From 990a50539ece9e35e38344910555c478f088d175 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 2 Aug 2023 12:36:59 +0200 Subject: [PATCH] backends/x11: Handle stage events from the main XEvent handler This does not do any event translation, so does not need to be handled through the translate_event() ClutterBackend vfunc. Part-of: --- src/backends/x11/meta-clutter-backend-x11.c | 6 ------ src/backends/x11/meta-event-x11.c | 6 ++++++ src/backends/x11/meta-stage-x11.c | 21 ++++++--------------- src/backends/x11/meta-stage-x11.h | 5 ++--- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/backends/x11/meta-clutter-backend-x11.c b/src/backends/x11/meta-clutter-backend-x11.c index 3d9291931..3474cab86 100644 --- a/src/backends/x11/meta-clutter-backend-x11.c +++ b/src/backends/x11/meta-clutter-backend-x11.c @@ -221,14 +221,8 @@ meta_clutter_backend_x11_translate_event (ClutterBackend *clutter_backend, META_CLUTTER_BACKEND_X11 (clutter_backend); MetaClutterBackendX11Private *priv = meta_clutter_backend_x11_get_instance_private (clutter_backend_x11); - MetaStageX11 *stage_x11; ClutterSeat *seat; - stage_x11 = - META_STAGE_X11 (clutter_backend_get_stage_window (clutter_backend)); - if (meta_stage_x11_translate_event (stage_x11, native, event)) - return TRUE; - seat = meta_backend_get_default_seat (priv->backend); if (meta_seat_x11_translate_event (META_SEAT_X11 (seat), native, event)) return TRUE; diff --git a/src/backends/x11/meta-event-x11.c b/src/backends/x11/meta-event-x11.c index f0b04edd7..8f8880989 100644 --- a/src/backends/x11/meta-event-x11.c +++ b/src/backends/x11/meta-event-x11.c @@ -28,6 +28,7 @@ #include "backends/x11/meta-backend-x11.h" #include "backends/x11/meta-event-x11.h" +#include "backends/x11/meta-stage-x11.h" #include "clutter/clutter-mutter.h" #include "cogl/cogl-xlib.h" @@ -55,6 +56,7 @@ meta_x11_handle_event (MetaBackend *backend, MetaX11FilterReturn result; ClutterBackend *clutter_backend; ClutterEvent *event; + MetaStageX11 *stage_x11; gint spin = 1; Display *xdisplay; gboolean allocated_event; @@ -85,6 +87,10 @@ meta_x11_handle_event (MetaBackend *backend, goto out; } + stage_x11 = + META_STAGE_X11 (clutter_backend_get_stage_window (clutter_backend)); + meta_stage_x11_handle_event (stage_x11, xevent); + if (_clutter_backend_translate_event (clutter_backend, xevent, event)) { _clutter_event_push (event, FALSE); diff --git a/src/backends/x11/meta-stage-x11.c b/src/backends/x11/meta-stage-x11.c index ddfecfc62..60375201f 100644 --- a/src/backends/x11/meta-stage-x11.c +++ b/src/backends/x11/meta-stage-x11.c @@ -628,21 +628,19 @@ clipped_redraws_cool_off_cb (void *data) return G_SOURCE_REMOVE; } -gboolean -meta_stage_x11_translate_event (MetaStageX11 *stage_x11, - XEvent *xevent, - ClutterEvent *event) +void +meta_stage_x11_handle_event (MetaStageX11 *stage_x11, + XEvent *xevent) { MetaClutterBackendX11 *clutter_backend_x11 = clutter_backend_x11_from_stage (stage_x11); MetaBackend *backend; MetaStageImpl *stage_impl; - gboolean res = FALSE; ClutterStage *stage; stage_impl = meta_x11_get_stage_window_from_window (xevent->xany.window); if (stage_impl == NULL) - return FALSE; + return; backend = meta_stage_impl_get_backend (stage_impl); stage = stage_impl->wrapper; @@ -789,10 +787,8 @@ meta_stage_x11_translate_event (MetaStageX11 *stage_x11, g_debug ("Destroy notification received for stage, win:0x%x", (unsigned int) xevent->xany.window); - g_return_val_if_fail (META_IS_STAGE_X11_NESTED (stage_x11), - FALSE); + g_return_if_fail (META_IS_STAGE_X11_NESTED (stage_x11)); meta_context_terminate (meta_backend_get_context (backend)); - res = FALSE; break; case ClientMessage: @@ -803,21 +799,16 @@ meta_stage_x11_translate_event (MetaStageX11 *stage_x11, { if (handle_wm_protocols_event (stage_x11, xevent)) { - g_return_val_if_fail (META_IS_STAGE_X11_NESTED (stage_x11), - FALSE); + g_return_if_fail (META_IS_STAGE_X11_NESTED (stage_x11)); meta_context_terminate (meta_backend_get_context (backend)); - res = FALSE; } } break; default: - res = FALSE; break; } - - return res; } Window diff --git a/src/backends/x11/meta-stage-x11.h b/src/backends/x11/meta-stage-x11.h index df4e091d8..f76c16e94 100644 --- a/src/backends/x11/meta-stage-x11.h +++ b/src/backends/x11/meta-stage-x11.h @@ -79,9 +79,8 @@ GType meta_stage_x11_get_type (void) G_GNUC_CONST; void meta_stage_x11_set_user_time (MetaStageX11 *stage_x11, guint32 user_time); -gboolean meta_stage_x11_translate_event (MetaStageX11 *stage_x11, - XEvent *xevent, - ClutterEvent *event); +void meta_stage_x11_handle_event (MetaStageX11 *stage_x11, + XEvent *xevent); ClutterStage *meta_x11_get_stage_from_window (Window win);