From d3bc0c79ff14e303d777baab7eedea76ad3f515d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 29 Oct 2024 09:23:09 +1000 Subject: [PATCH] tablet: minor rework to remove one ifdef HAVE_LIBWACOM Change to a boolean for more obvious return values and move the ifdef into the function so we can skip the ifdef in the caller. Part-of: --- src/evdev-tablet.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 075ae57b..c90168bc 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -929,12 +929,12 @@ copy_button_cap(const struct tablet_dispatch *tablet, set_bit(tool->buttons, button); } -#if HAVE_LIBWACOM -static inline int +static inline bool tool_set_bits_from_libwacom(const struct tablet_dispatch *tablet, struct libinput_tablet_tool *tool) { - int rc = 1; + bool rc = false; +#if HAVE_LIBWACOM WacomDeviceDatabase *db; const WacomStylus *s = NULL; int code; @@ -992,11 +992,10 @@ tool_set_bits_from_libwacom(const struct tablet_dispatch *tablet, if (axes & WACOM_AXIS_TYPE_PRESSURE) copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE); - rc = 0; - + rc = true; +#endif return rc; } -#endif static void tool_set_bits(const struct tablet_dispatch *tablet, @@ -1007,10 +1006,9 @@ tool_set_bits(const struct tablet_dispatch *tablet, copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_X); copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_Y); -#if HAVE_LIBWACOM - if (tool_set_bits_from_libwacom(tablet, tool) == 0) + if (tool_set_bits_from_libwacom(tablet, tool)) return; -#endif + /* If we don't have libwacom, we simply copy any axis we have on the tablet onto the tool. Except we know that mice only have rotation anyway.