config_h.set10('HAVE_GTK3', dep_gtk.found())
endif
+ gtk_targets = dep_gtk.get_pkgconfig_variable('targets')
+ have_gtk_wayland = gtk_targets.contains('wayland')
+ have_gtk_x11 = gtk_targets.contains('x11')
+
dep_cairo = dependency('cairo')
dep_glib = dependency('glib-2.0')
- dep_wayland_client = dependency('wayland-client', required : false)
- dep_wayland_protocols = dependency('wayland-protocols', required : false)
dep_x11 = dependency('x11', required : false)
+ config_h.set10('HAVE_GTK_X11', have_gtk_x11 and dep_x11.found())
debug_gui_sources = [ 'tools/libinput-debug-gui.c' ]
- if dep_wayland_client.found() and dep_wayland_protocols.found()
- wayland_scanner = find_program('wayland-scanner')
- wlproto_dir = dep_wayland_protocols.get_pkgconfig_variable('pkgdatadir')
-
- proto_name = 'pointer-constraints-unstable-v1'
- input = files(wlproto_dir / 'unstable' / 'pointer-constraints' / '@0@.xml'.format(proto_name))
-
- wayland_headers = custom_target('@0@ client header'.format(proto_name),
- input: input,
- output: '@0@-client-protocol.h'.format(proto_name),
- command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
- )
-
- wayland_sources = custom_target('@0@ source'.format(proto_name),
- input: input,
- output: '@0@-protocol.c'.format(proto_name),
- command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
- )
-
- debug_gui_sources += [ wayland_headers, wayland_sources ]
+ if have_gtk_wayland
+ dep_wayland_client = dependency('wayland-client', required : false)
+ dep_wayland_protocols = dependency('wayland-protocols', required : false)
+ if dep_wayland_client.found() and dep_wayland_protocols.found()
+ wayland_scanner = find_program('wayland-scanner')
+ wlproto_dir = dep_wayland_protocols.get_pkgconfig_variable('pkgdatadir')
+
+ proto_name = 'pointer-constraints-unstable-v1'
+ input = files(wlproto_dir / 'unstable' / 'pointer-constraints' / '@0@.xml'.format(proto_name))
+
+ wayland_headers = custom_target('@0@ client header'.format(proto_name),
+ input: input,
+ output: '@0@-client-protocol.h'.format(proto_name),
+ command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
+ )
+
+ wayland_sources = custom_target('@0@ source'.format(proto_name),
+ input: input,
+ output: '@0@-protocol.c'.format(proto_name),
+ command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
+ )
+
+ debug_gui_sources += [ wayland_headers, wayland_sources ]
+ config_h.set10('HAVE_GTK_WAYLAND', true)
+ endif
endif
deps_debug_gui = [
#include "shared.h"
-#ifdef GDK_WINDOWING_WAYLAND
+#if HAVE_GTK_WAYLAND
#include <wayland-client.h>
#include "pointer-constraints-unstable-v1-client-protocol.h"
#if HAVE_GTK4
#endif
#endif
-#ifdef GDK_WINDOWING_X11
+#if HAVE_GTK_X11
#include <X11/X.h>
#include <X11/Xlib.h>
#if HAVE_GTK4
struct {
bool locked;
-#ifdef GDK_WINDOWING_WAYLAND
+#if HAVE_GTK_WAYLAND
struct zwp_pointer_constraints_v1 *wayland_pointer_constraints;
struct zwp_locked_pointer_v1 *wayland_locked_pointer;
#endif
struct libinput_device *devices[50];
};
-#ifdef GDK_WINDOWING_WAYLAND
+#if HAVE_GTK_WAYLAND
static void
wayland_registry_global(void *data,
struct wl_registry *registry,
{
return GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default());
}
-#endif /* GDK_WINDOWING_WAYLAND */
+#endif /* HAVE_GTK_WAYLAND */
-#ifdef GDK_WINDOWING_X11
+#if HAVE_GTK_X11
static bool
x_lock_pointer(struct window *w)
{
{
return GDK_IS_X11_DISPLAY(gdk_display_get_default());
}
-#endif /* GDK_WINDOWING_X11 */
+#endif /* HAVE_GTK_X11 */
static bool
window_lock_pointer(struct window *w)
{
w->lock_pointer.locked = false;
-#ifdef GDK_WINDOWING_WAYLAND
+#if HAVE_GTK_WAYLAND
if (backend_is_wayland())
w->lock_pointer.locked = wayland_lock_pointer(w);
#endif
-#ifdef GDK_WINDOWING_X11
+#if HAVE_GTK_X11
if (backend_is_x11())
w->lock_pointer.locked = x_lock_pointer(w);
#endif
w->lock_pointer.locked = false;
-#ifdef GDK_WINDOWING_WAYLAND
+#if HAVE_GTK_WAYLAND
if (backend_is_wayland())
wayland_unlock_pointer(w);
#endif
-#ifdef GDK_WINDOWING_X11
+#if HAVE_GTK_X11
if (backend_is_x11())
x_unlock_pointer(w);
#endif