core/events: Guard X11 types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
This commit is contained in:
Bilal Elmoussaoui 2022-06-01 10:06:55 +02:00
parent 3e95609073
commit 0f88f0931c

View File

@ -27,14 +27,17 @@
#include "backends/meta-cursor-tracker-private.h" #include "backends/meta-cursor-tracker-private.h"
#include "backends/meta-dnd-private.h" #include "backends/meta-dnd-private.h"
#include "backends/meta-idle-manager.h" #include "backends/meta-idle-manager.h"
#include "backends/x11/meta-backend-x11.h"
#include "backends/x11/meta-input-device-x11.h"
#include "compositor/compositor-private.h" #include "compositor/compositor-private.h"
#include "compositor/meta-window-actor-private.h" #include "compositor/meta-window-actor-private.h"
#include "core/display-private.h" #include "core/display-private.h"
#include "core/window-private.h" #include "core/window-private.h"
#include "meta/meta-backend.h" #include "meta/meta-backend.h"
#ifdef HAVE_X11_CLIENT
#include "backends/x11/meta-backend-x11.h"
#include "backends/x11/meta-input-device-x11.h"
#endif
#ifdef HAVE_NATIVE_BACKEND #ifdef HAVE_NATIVE_BACKEND
#include "backends/native/meta-backend-native.h" #include "backends/native/meta-backend-native.h"
#endif #endif
@ -165,6 +168,7 @@ sequence_is_pointer_emulated (MetaDisplay *display,
return FALSE; return FALSE;
} }
#ifdef HAVE_X11_CLIENT
static void static void
maybe_unfreeze_pointer_events (MetaBackend *backend, maybe_unfreeze_pointer_events (MetaBackend *backend,
const ClutterEvent *event, const ClutterEvent *event,
@ -203,6 +207,7 @@ maybe_unfreeze_pointer_events (MetaBackend *backend,
xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XIAllowEvents (xdisplay, device_id, event_mode, event->button.time); XIAllowEvents (xdisplay, device_id, event_mode, event->button.time);
} }
#endif
static gboolean static gboolean
meta_display_handle_event (MetaDisplay *display, meta_display_handle_event (MetaDisplay *display,
@ -465,8 +470,9 @@ meta_display_handle_event (MetaDisplay *display,
{ {
/* Only replay button press events, since that's where we /* Only replay button press events, since that's where we
* have the synchronous grab. */ * have the synchronous grab. */
#ifdef HAVE_X11_CLIENT
maybe_unfreeze_pointer_events (backend, event, EVENTS_UNFREEZE_REPLAY); maybe_unfreeze_pointer_events (backend, event, EVENTS_UNFREEZE_REPLAY);
#endif
/* If the focus window has an active close dialog let clutter /* If the focus window has an active close dialog let clutter
* events go through, so fancy clutter dialogs can get to handle * events go through, so fancy clutter dialogs can get to handle
* all events. * all events.
@ -486,7 +492,9 @@ meta_display_handle_event (MetaDisplay *display,
/* We could not match the event with a window, make sure we sync /* We could not match the event with a window, make sure we sync
* the pointer to discard the sequence and don't keep events frozen. * the pointer to discard the sequence and don't keep events frozen.
*/ */
maybe_unfreeze_pointer_events (backend, event, EVENTS_UNFREEZE_SYNC); #ifdef HAVE_X11_CLIENT
maybe_unfreeze_pointer_events (backend, event, EVENTS_UNFREEZE_SYNC);
#endif
} }
out: out: