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-dnd-private.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/meta-window-actor-private.h"
#include "core/display-private.h"
#include "core/window-private.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
#include "backends/native/meta-backend-native.h"
#endif
@ -165,6 +168,7 @@ sequence_is_pointer_emulated (MetaDisplay *display,
return FALSE;
}
#ifdef HAVE_X11_CLIENT
static void
maybe_unfreeze_pointer_events (MetaBackend *backend,
const ClutterEvent *event,
@ -203,6 +207,7 @@ maybe_unfreeze_pointer_events (MetaBackend *backend,
xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XIAllowEvents (xdisplay, device_id, event_mode, event->button.time);
}
#endif
static gboolean
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
* have the synchronous grab. */
#ifdef HAVE_X11_CLIENT
maybe_unfreeze_pointer_events (backend, event, EVENTS_UNFREEZE_REPLAY);
#endif
/* If the focus window has an active close dialog let clutter
* events go through, so fancy clutter dialogs can get to handle
* 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
* 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: