diff --git a/meson.build b/meson.build index 5c1587c3..81ed954c 100644 --- a/meson.build +++ b/meson.build @@ -156,8 +156,9 @@ if not cc.has_header_symbol('sys/ptrace.h', 'PTRACE_ATTACH', prefix : prefix) config_h.set('PTRACE_CONT', 'PT_CONTINUE') config_h.set('PTRACE_DETACH', 'PT_DETACH') endif - -config_h.set10('HAVE_INSTALLED_TESTS', get_option('install-tests')) +if get_option('install-tests') + config_h.set('HAVE_INSTALLED_TESTS', 1) +endif # Dependencies pkgconfig = import('pkgconfig') @@ -174,8 +175,8 @@ includes_src = include_directories('src') ############ mtdev configuration ############ have_mtdev = get_option('mtdev') -config_h.set10('HAVE_MTDEV', have_mtdev) if have_mtdev + config_h.set('HAVE_MTDEV', 1) dep_mtdev = dependency('mtdev', version : '>= 1.1.0') else dep_mtdev = declare_dependency() @@ -184,8 +185,8 @@ endif ############ libwacom configuration ############ have_libwacom = get_option('libwacom') -config_h.set10('HAVE_LIBWACOM', have_libwacom) if have_libwacom + config_h.set('HAVE_LIBWACOM', 1) dep_libwacom = dependency('libwacom', version : '>= 0.27') if cc.has_header_symbol('libwacom/libwacom.h', 'WACOM_BUTTON_DIAL_MODESWITCH', dependencies : dep_libwacom) @@ -612,13 +613,16 @@ executable('libinput-record', install : true, ) -config_h.set10('HAVE_DEBUG_GUI', get_option('debug-gui')) if get_option('debug-gui') + config_h.set('HAVE_DEBUG_GUI', 1) dep_gtk = dependency('gtk4', version : '>= 4.0', required : false) - config_h.set10('HAVE_GTK4', dep_gtk.found()) - if not dep_gtk.found() + if dep_gtk.found() + config_h.set('HAVE_GTK4', 1) + else dep_gtk = dependency('gtk+-3.0', version : '>= 3.20') - config_h.set10('HAVE_GTK3', dep_gtk.found()) + if dep_gtk.found() + config_h.set('HAVE_GTK3', 1) + endif endif if meson.version().version_compare('>= 0.58') @@ -636,8 +640,9 @@ if get_option('debug-gui') dep_wayland_client = dependency('wayland-client', required : false) dep_wayland_protocols = dependency('wayland-protocols', required : false) - config_h.set10('HAVE_GTK_X11', have_gtk_x11 and dep_x11.found()) - config_h.set10('HAVE_GTK_WAYLAND', false) + if have_gtk_x11 and dep_x11.found() + config_h.set('HAVE_GTK_X11', 1) + endif debug_gui_sources = [ 'tools/libinput-debug-gui.c' ] @@ -665,7 +670,7 @@ if get_option('debug-gui') ) debug_gui_sources += [ wayland_headers, wayland_sources ] - config_h.set10('HAVE_GTK_WAYLAND', true) + config_h.set('HAVE_GTK_WAYLAND', 1) endif deps_debug_gui = [ @@ -791,11 +796,15 @@ if get_option('tests') dep_check = dependency('check', version : '>= 0.9.10', required: false) gstack = find_program('gstack', required : false) - config_h.set10('HAVE_GSTACK', gstack.found()) + if gstack.found() + config_h.set('HAVE_GSTACK', 1) + endif # for inhibit support during test run dep_libsystemd = dependency('libsystemd', version : '>= 221', required : false) - config_h.set10('HAVE_LIBSYSTEMD', dep_libsystemd.found()) + if dep_libsystemd.found() + config_h.set('HAVE_LIBSYSTEMD', 1) + endif litest_sources = [ 'src/libinput-private-config.c', diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index f819a2ad..d161ab6a 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -28,7 +28,7 @@ #include #include -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM #include #endif @@ -3742,7 +3742,7 @@ static bool tp_requires_rotation(struct tp_dispatch *tp, struct evdev_device *device) { bool rotate = false; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct libinput *li = tp_libinput_context(tp); WacomDeviceDatabase *db = NULL; WacomDevice **devices = NULL, **d; diff --git a/src/evdev-tablet-pad-leds.c b/src/evdev-tablet-pad-leds.c index aa411202..7aca1e1d 100644 --- a/src/evdev-tablet-pad-leds.c +++ b/src/evdev-tablet-pad-leds.c @@ -28,7 +28,7 @@ #include "evdev-tablet-pad.h" -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM #include #endif @@ -114,7 +114,7 @@ pad_led_destroy(struct libinput *libinput, struct pad_mode_led *led) free(led); } -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM static inline struct pad_mode_led * pad_led_new(struct libinput *libinput, const char *prefix, int group, int mode) { @@ -198,7 +198,7 @@ pad_get_mode_group(struct pad_dispatch *pad, unsigned int index) return NULL; } -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM static inline bool is_litest_device(struct evdev_device *device) { @@ -618,7 +618,7 @@ pad_init_leds(struct pad_dispatch *pad, struct evdev_device *device, WacomDevice } /* If libwacom fails, we init one fallback group anyway */ -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM rc = pad_init_leds_from_libwacom(pad, device, wacom); #endif if (rc != 0) diff --git a/src/evdev-tablet-pad.c b/src/evdev-tablet-pad.c index c1e387c5..5bd58db0 100644 --- a/src/evdev-tablet-pad.c +++ b/src/evdev-tablet-pad.c @@ -31,7 +31,7 @@ #include "evdev-tablet-pad.h" -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM #include #endif @@ -667,7 +667,7 @@ pad_init_buttons_from_libwacom(struct pad_dispatch *pad, WacomDevice *tablet) { bool rc = false; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM if (tablet) { int num_buttons = libwacom_get_num_buttons(tablet); @@ -759,7 +759,7 @@ pad_init_left_handed(struct evdev_device *device, WacomDevice *wacom) { bool has_left_handed = true; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM has_left_handed = !wacom || libwacom_is_reversible(wacom); #endif if (has_left_handed) @@ -772,7 +772,7 @@ pad_init(struct pad_dispatch *pad, struct evdev_device *device) int rc = 1; struct libinput *li = evdev_libinput_context(device); WacomDevice *wacom = NULL; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM WacomDeviceDatabase *db = libinput_libwacom_ref(li); if (db) { char event_path[64]; @@ -825,7 +825,7 @@ pad_init(struct pad_dispatch *pad, struct evdev_device *device) /* at most 5 "Multiple EV_ABS events" log messages per hour */ ratelimit_init(&pad->duplicate_abs_limit, s2us(60 * 60), 5); -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM if (wacom) libwacom_destroy(wacom); if (db) diff --git a/src/evdev-tablet-pad.h b/src/evdev-tablet-pad.h index 8e07d519..76014c8d 100644 --- a/src/evdev-tablet-pad.h +++ b/src/evdev-tablet-pad.h @@ -26,7 +26,7 @@ #include "evdev.h" -#if !HAVE_LIBWACOM +#ifndef HAVE_LIBWACOM typedef void *WacomDevice; #endif diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 77fae45f..f77ba967 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -31,7 +31,7 @@ #include "evdev-tablet.h" -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM #include #else typedef void *WacomStylus; @@ -1004,7 +1004,7 @@ tool_set_bits_from_libwacom(const struct tablet_dispatch *tablet, const WacomStylus *s) { bool rc = false; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM int code; WacomStylusType type; WacomAxisTypeFlags axes; @@ -1369,7 +1369,7 @@ tool_init_eraser_button(struct tablet_dispatch *tablet, if (libinput_tablet_tool_get_type(tool) != LIBINPUT_TABLET_TOOL_TYPE_PEN) return; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM /* libwacom's API is a bit terrible here: * - has_eraser is true on styli that have a separate eraser, all * those are INVERT so we can exclude them @@ -1400,7 +1400,7 @@ tablet_new_tool(struct tablet_dispatch *tablet, { struct libinput_tablet_tool *tool = zalloc(sizeof *tool); const WacomStylus *s = NULL; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM WacomDeviceDatabase *db; db = tablet_libinput_context(tablet)->libwacom.db; @@ -2788,7 +2788,7 @@ tablet_init_left_handed(struct evdev_device *device, WacomDevice *wacom) { bool has_left_handed = true; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM has_left_handed = !wacom || libwacom_is_reversible(wacom); #endif if (has_left_handed) @@ -2798,7 +2798,7 @@ tablet_init_left_handed(struct evdev_device *device, WacomDevice *wacom) static inline bool tablet_is_display_tablet(WacomDevice *wacom) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM return !wacom || (libwacom_get_integration_flags(wacom) & (WACOM_DEVICE_INTEGRATED_SYSTEM | WACOM_DEVICE_INTEGRATED_DISPLAY)); @@ -2810,7 +2810,7 @@ tablet_is_display_tablet(WacomDevice *wacom) static inline bool tablet_is_aes(struct evdev_device *device, WacomDevice *wacom) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM int vid = evdev_device_get_id_vendor(device); /* Wacom-specific check for whether smoothing is required: * libwacom keeps all the AES pens in a single group, so any device @@ -2943,7 +2943,7 @@ tablet_init(struct tablet_dispatch *tablet, struct evdev_device *device) enum libinput_tablet_tool_axis axis; int rc = -1; WacomDevice *wacom = NULL; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM WacomDeviceDatabase *db = libinput_libwacom_ref(li); if (db) { char event_path[64]; @@ -3018,7 +3018,7 @@ tablet_init(struct tablet_dispatch *tablet, struct evdev_device *device) rc = 0; out: -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM if (wacom) libwacom_destroy(wacom); if (db) diff --git a/src/evdev-tablet.h b/src/evdev-tablet.h index 88e8faf5..091a9de4 100644 --- a/src/evdev-tablet.h +++ b/src/evdev-tablet.h @@ -27,7 +27,7 @@ #include "evdev.h" -#if !HAVE_LIBWACOM +#ifndef HAVE_LIBWACOM typedef void *WacomDevice; #endif diff --git a/src/evdev.c b/src/evdev.c index d0ef1c25..b5f860c9 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -48,7 +48,7 @@ #include "linux/input.h" #include "quirks.h" -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM #include #endif diff --git a/src/libinput-plugin.c b/src/libinput-plugin.c index 7e6aee94..0b43c76c 100644 --- a/src/libinput-plugin.c +++ b/src/libinput-plugin.c @@ -373,7 +373,7 @@ libinput_plugin_system_load_internal_plugins(struct libinput *libinput, system->loaded = true; -#if HAVE_MTDEV +#ifdef HAVE_MTDEV libinput_mtdev_plugin(libinput); #endif libinput_tablet_plugin_forced_tool(libinput); diff --git a/src/libinput-private.h b/src/libinput-private.h index 4d6511dc..30ee5650 100644 --- a/src/libinput-private.h +++ b/src/libinput-private.h @@ -31,7 +31,7 @@ #include #include -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM #include #endif @@ -228,7 +228,7 @@ struct libinput { struct libinput_plugin_system plugin_system; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct { WacomDeviceDatabase *db; size_t refcount; @@ -1107,7 +1107,7 @@ point_in_rect(const struct device_coords *point, const struct device_coord_rect point->y >= rect->y && point->y < rect->y + rect->h); } -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM WacomDeviceDatabase * libinput_libwacom_ref(struct libinput *li); void diff --git a/src/libinput.c b/src/libinput.c index 0602fff5..949780e8 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -5146,7 +5146,7 @@ libinput_tablet_tool_config_eraser_button_get_default_button( return tool->config.eraser_button.get_button(tool); } -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM WacomDeviceDatabase * libinput_libwacom_ref(struct libinput *li) { diff --git a/src/util-backtrace.h b/src/util-backtrace.h index 7d1f0ff5..82462f02 100644 --- a/src/util-backtrace.h +++ b/src/util-backtrace.h @@ -54,7 +54,7 @@ backtrace_print(FILE *fp, const char *highlight_before, const char *highlight_extra) { -#if HAVE_GSTACK +#ifdef HAVE_GSTACK pid_t parent, child; int pipefd[2]; diff --git a/test/litest-main.c b/test/litest-main.c index 8c059859..6fc31dac 100644 --- a/test/litest-main.c +++ b/test/litest-main.c @@ -47,7 +47,7 @@ #include #include "linux/input.h" -#if HAVE_LIBSYSTEMD +#ifdef HAVE_LIBSYSTEMD #include #endif #ifdef __FreeBSD__ diff --git a/test/litest.c b/test/litest.c index b419f440..2e0c16c3 100644 --- a/test/litest.c +++ b/test/litest.c @@ -47,7 +47,7 @@ #include #include "linux/input.h" -#if HAVE_LIBSYSTEMD +#ifdef HAVE_LIBSYSTEMD #include #endif #ifdef __FreeBSD__ @@ -1615,7 +1615,7 @@ static inline int inhibit(void) { int lock_fd = -1; -#if HAVE_LIBSYSTEMD +#ifdef HAVE_LIBSYSTEMD _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; _unref_(sd_bus_message) *m = NULL; _unref_(sd_bus) *bus = NULL; diff --git a/test/test-pad.c b/test/test-pad.c index de4d1854..6c3560d6 100644 --- a/test/test-pad.c +++ b/test/test-pad.c @@ -29,7 +29,7 @@ #include #include -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM #include #endif @@ -121,7 +121,7 @@ END_TEST START_TEST(pad_num_buttons_libwacom) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput_device *device = dev->libinput_device; WacomDeviceDatabase *db = NULL; @@ -172,7 +172,7 @@ END_TEST START_TEST(pad_button_intuos) { -#if !HAVE_LIBWACOM +#ifndef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; unsigned int code; @@ -231,7 +231,7 @@ END_TEST START_TEST(pad_button_bamboo) { -#if !HAVE_LIBWACOM +#ifndef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; unsigned int code; @@ -281,7 +281,7 @@ END_TEST START_TEST(pad_button_libwacom) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; WacomDeviceDatabase *db = NULL; @@ -325,7 +325,7 @@ START_TEST(pad_button_mode_groups) struct libinput_event_tablet_pad *pev; unsigned int expected_mode = 0; int evdev_codes[KEY_OK - BTN_0] = { 0 }; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM WacomDeviceDatabase *db = NULL; WacomDevice *wacom = NULL; @@ -703,7 +703,7 @@ END_TEST START_TEST(pad_left_handed_default) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput_device *device = dev->libinput_device; enum libinput_config_status status; @@ -735,7 +735,7 @@ START_TEST(pad_no_left_handed) struct libinput_device *device = dev->libinput_device; /* Without libwacom we default to left-handed being available */ -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM litest_assert(!libinput_device_config_left_handed_is_available(device)); #else litest_assert(libinput_device_config_left_handed_is_available(device)); @@ -744,7 +744,7 @@ START_TEST(pad_no_left_handed) litest_assert_int_eq(libinput_device_config_left_handed_get_default(device), 0); litest_assert_int_eq(libinput_device_config_left_handed_get(device), 0); -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM enum libinput_config_status status; status = libinput_device_config_left_handed_set(dev->libinput_device, 1); litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); @@ -763,7 +763,7 @@ END_TEST START_TEST(pad_left_handed_ring) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; struct libinput_event *ev; @@ -811,7 +811,7 @@ static bool pad_has_groups(struct litest_device *dev) { bool rc = false; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM WacomDeviceDatabase *db = NULL; WacomDevice *wacom = NULL; @@ -1020,7 +1020,7 @@ END_TEST START_TEST(pad_mode_group_has_no_toggle) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput_device *device = dev->libinput_device; struct libinput_tablet_pad_mode_group *group; diff --git a/test/test-tablet.c b/test/test-tablet.c index c99d4648..edca1e0f 100644 --- a/test/test-tablet.c +++ b/test/test-tablet.c @@ -31,7 +31,7 @@ #include #include -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM #include #endif @@ -1763,7 +1763,7 @@ END_TEST START_TEST(left_handed) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; struct libinput_event *event; @@ -1892,7 +1892,7 @@ START_TEST(no_left_handed) struct litest_device *dev = litest_current_device(); /* Without libwacom we default to left-handed being available */ -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM litest_assert( !libinput_device_config_left_handed_is_available(dev->libinput_device)); #else @@ -1904,7 +1904,7 @@ END_TEST START_TEST(left_handed_tilt) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; struct libinput_event *event; @@ -1977,7 +1977,7 @@ rotate_event(struct litest_device *dev, int angle_degrees) START_TEST(left_handed_mouse_rotation) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; enum libinput_config_status status; @@ -2023,7 +2023,7 @@ END_TEST START_TEST(left_handed_artpen_rotation) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; struct libinput_event *event; @@ -3542,7 +3542,7 @@ device_has_calibration(struct litest_device *dev) libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_PEN) || libevdev_has_event_code(dev->evdev, EV_KEY, BTN_STYLUS); -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM WacomDeviceDatabase *db = libwacom_database_new(); if (db) { WacomDevice *d = @@ -6379,7 +6379,7 @@ START_TEST(touch_arbitration_swap_device) } END_TEST -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM static void verify_left_handed_tablet_motion(struct litest_device *tablet, struct libinput *li, @@ -6502,7 +6502,7 @@ verify_left_handed_touch_sequence(struct litest_device *finger, START_TEST(tablet_rotation_left_handed) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *tablet = litest_current_device(); enum litest_device_type other; struct litest_device *finger; @@ -6545,7 +6545,7 @@ END_TEST START_TEST(tablet_rotation_left_handed_configuration) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *tablet = litest_current_device(); enum litest_device_type other; struct litest_device *finger; @@ -6597,7 +6597,7 @@ END_TEST START_TEST(tablet_rotation_left_handed_while_in_prox) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *tablet = litest_current_device(); enum litest_device_type other; struct litest_device *finger; @@ -6691,7 +6691,7 @@ END_TEST START_TEST(tablet_rotation_left_handed_while_touch_down) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *tablet = litest_current_device(); enum litest_device_type other; struct litest_device *finger; @@ -6752,7 +6752,7 @@ END_TEST START_TEST(tablet_rotation_left_handed_add_touchpad) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *tablet = litest_current_device(); enum litest_device_type other; struct litest_device *finger; @@ -6800,7 +6800,7 @@ END_TEST START_TEST(tablet_rotation_left_handed_add_tablet) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *finger = litest_current_device(); enum litest_device_type other; struct litest_device *tablet; @@ -7028,7 +7028,7 @@ END_TEST START_TEST(tablet_smoothing) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; double x, y; diff --git a/test/test-touch.c b/test/test-touch.c index 331ec93e..a5071370 100644 --- a/test/test-touch.c +++ b/test/test-touch.c @@ -1353,7 +1353,7 @@ TEST_COLLECTION(touch) litest_add(fake_mt_exists, LITEST_FAKE_MT, LITEST_ANY); litest_add(fake_mt_no_touch_events, LITEST_FAKE_MT, LITEST_ANY); -#if HAVE_MTDEV +#ifdef HAVE_MTDEV litest_add(touch_protocol_a_init, LITEST_PROTOCOL_A, LITEST_ANY); litest_add(touch_protocol_a_touch, LITEST_PROTOCOL_A, LITEST_ANY); litest_add(touch_protocol_a_2fg_touch, LITEST_PROTOCOL_A, LITEST_ANY); @@ -1375,7 +1375,7 @@ TEST_COLLECTION(touch) litest_add(touch_count_st, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD); litest_add(touch_count_mt, LITEST_TOUCH, LITEST_SINGLE_TOUCH|LITEST_PROTOCOL_A); -#if HAVE_MTDEV +#ifdef HAVE_MTDEV litest_add(touch_count_mtdev, LITEST_PROTOCOL_A, LITEST_ANY); litest_add(touch_count_invalid, LITEST_ANY, LITEST_TOUCH|LITEST_SINGLE_TOUCH|LITEST_PROTOCOL_A); #endif diff --git a/test/test-touchpad.c b/test/test-touchpad.c index 8370bf34..eb9eae79 100644 --- a/test/test-touchpad.c +++ b/test/test-touchpad.c @@ -2573,7 +2573,7 @@ START_TEST(touchpad_left_handed_clickpad_delayed) } END_TEST -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM static inline bool touchpad_has_rotation(struct libevdev *evdev) { @@ -2583,7 +2583,7 @@ touchpad_has_rotation(struct libevdev *evdev) START_TEST(touchpad_left_handed_rotation) { -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM struct litest_device *dev = litest_current_device(); struct libinput_device *d = dev->libinput_device; struct libinput *li = dev->libinput; diff --git a/tools/libinput-debug-gui.c b/tools/libinput-debug-gui.c index 2814edd0..0c2fcfc5 100644 --- a/tools/libinput-debug-gui.c +++ b/tools/libinput-debug-gui.c @@ -46,21 +46,21 @@ #include "shared.h" -#if HAVE_GTK_WAYLAND +#ifdef HAVE_GTK_WAYLAND #include #include "pointer-constraints-unstable-v1-client-protocol.h" -#if HAVE_GTK4 +#ifdef HAVE_GTK4 #include #else #include #endif #endif -#if HAVE_GTK_X11 +#ifdef HAVE_GTK_X11 #include #include -#if HAVE_GTK4 +#ifdef HAVE_GTK4 #include #else #include @@ -119,7 +119,7 @@ struct window { struct { bool locked; -#if HAVE_GTK_WAYLAND +#ifdef HAVE_GTK_WAYLAND struct zwp_pointer_constraints_v1 *wayland_pointer_constraints; struct zwp_locked_pointer_v1 *wayland_locked_pointer; #endif @@ -210,7 +210,7 @@ struct window { struct libinput_device *devices[50]; }; -#if HAVE_GTK_WAYLAND +#ifdef HAVE_GTK_WAYLAND static void wayland_registry_global(void *data, struct wl_registry *registry, @@ -268,7 +268,7 @@ wayland_lock_pointer(struct window *w) if (!w->lock_pointer.wayland_pointer_constraints) return false; -#if HAVE_GTK4 +#ifdef HAVE_GTK4 GtkNative *window = gtk_widget_get_native(w->win); GdkSurface *gdk_surface = gtk_native_get_surface(window); surface = gdk_wayland_surface_get_wl_surface(gdk_surface); @@ -302,7 +302,7 @@ backend_is_wayland(void) } #endif /* HAVE_GTK_WAYLAND */ -#if HAVE_GTK_X11 +#ifdef HAVE_GTK_X11 static bool x_lock_pointer(struct window *w) { @@ -319,7 +319,7 @@ x_lock_pointer(struct window *w) x_display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()); #pragma GCC diagnostic pop -#if HAVE_GTK4 +#ifdef HAVE_GTK4 GtkNative *window = gtk_widget_get_native(w->win); GdkSurface *surface = gtk_native_get_surface(window); #pragma GCC diagnostic push @@ -369,12 +369,12 @@ window_lock_pointer(struct window *w) if (w->lock_pointer.locked) return true; -#if HAVE_GTK_WAYLAND +#ifdef HAVE_GTK_WAYLAND if (backend_is_wayland()) w->lock_pointer.locked = wayland_lock_pointer(w); #endif -#if HAVE_GTK_X11 +#ifdef HAVE_GTK_X11 if (backend_is_x11()) w->lock_pointer.locked = x_lock_pointer(w); #endif @@ -390,12 +390,12 @@ window_unlock_pointer(struct window *w) w->lock_pointer.locked = false; -#if HAVE_GTK_WAYLAND +#ifdef HAVE_GTK_WAYLAND if (backend_is_wayland()) wayland_unlock_pointer(w); #endif -#if HAVE_GTK_X11 +#ifdef HAVE_GTK_X11 if (backend_is_x11()) x_unlock_pointer(w); #endif @@ -1047,7 +1047,7 @@ draw(GtkWidget *widget, cairo_t *cr, gpointer data) return TRUE; } -#if HAVE_GTK4 +#ifdef HAVE_GTK4 static void draw_gtk4(GtkDrawingArea *widget, cairo_t *cr, int width, int height, gpointer data) { @@ -1058,7 +1058,7 @@ draw_gtk4(GtkDrawingArea *widget, cairo_t *cr, int width, int height, gpointer d static void window_place_ui_elements(GtkWidget *widget, struct window *w) { -#if HAVE_GTK4 +#ifdef HAVE_GTK4 w->width = gtk_widget_get_width(w->area); w->height = gtk_widget_get_height(w->area); #else @@ -1089,7 +1089,7 @@ window_place_ui_elements(GtkWidget *widget, struct window *w) w->pinch.y = w->height / 2; } -#if HAVE_GTK4 +#ifdef HAVE_GTK4 static void map_event_cb(GtkDrawingArea *widget, int width, int height, gpointer data) { @@ -1131,7 +1131,7 @@ window_quit(struct window *w) g_main_loop_quit(w->event_loop); } -#if HAVE_GTK4 +#ifdef HAVE_GTK4 static gboolean window_delete_event_cb(GtkWindow *window, gpointer data) { @@ -1156,14 +1156,14 @@ window_init(struct window *w) { list_init(&w->evdev_devices); -#if HAVE_GTK4 +#ifdef HAVE_GTK4 w->win = gtk_window_new(); #else w->win = gtk_window_new(GTK_WINDOW_TOPLEVEL); #endif if (getenv("LIBINPUT_RUNNING_TEST_SUITE")) { -#if HAVE_GTK4 +#ifdef HAVE_GTK4 gtk_window_minimize(GTK_WINDOW(w->win)); #else gtk_window_iconify(GTK_WINDOW(w->win)); @@ -1178,7 +1178,7 @@ window_init(struct window *w) w->area = gtk_drawing_area_new(); -#if HAVE_GTK4 +#ifdef HAVE_GTK4 g_signal_connect(G_OBJECT(w->area), "resize", G_CALLBACK(map_event_cb), w); g_signal_connect(G_OBJECT(w->win), "close-request", @@ -1929,7 +1929,7 @@ main(int argc, char **argv) bool verbose = false; bool gtk_init = false; -#if HAVE_GTK4 +#ifdef HAVE_GTK4 gtk_init = gtk_init_check(); #else gtk_init = gtk_init_check(&argc, &argv); diff --git a/tools/libinput-test.c b/tools/libinput-test.c index 26aa73f6..27252734 100644 --- a/tools/libinput-test.c +++ b/tools/libinput-test.c @@ -31,7 +31,7 @@ static inline void usage(void) { -#if HAVE_INSTALLED_TESTS +#ifdef HAVE_INSTALLED_TESTS printf("Usage: libinput test [--help] \n"); #else fprintf(stderr, "libinput test was disabled in the build configuration\n"); diff --git a/tools/libinput-tool.c b/tools/libinput-tool.c index 04316f34..f0937ff3 100644 --- a/tools/libinput-tool.c +++ b/tools/libinput-tool.c @@ -45,7 +45,7 @@ usage(void) " debug-events\n" " Print events to stdout\n" "\n" -#if HAVE_DEBUG_GUI +#ifdef HAVE_DEBUG_GUI " debug-gui\n" " Display a simple GUI to visualize libinput's events.\n" "\n" diff --git a/udev/libinput-device-group.c b/udev/libinput-device-group.c index 91e8a35b..cdb38c0b 100644 --- a/udev/libinput-device-group.c +++ b/udev/libinput-device-group.c @@ -30,7 +30,7 @@ #include "libinput-util.h" -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM #include static void @@ -205,7 +205,7 @@ main(int argc, char **argv) } else { char *physmatch = NULL; -#if HAVE_LIBWACOM +#ifdef HAVE_LIBWACOM if (vendor_id == VENDOR_ID_WACOM) { if (product_id == PRODUCT_ID_WACOM_EKR) wacom_handle_ekr(device,