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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
This commit is contained in:
Carlos Garnacho 2023-08-02 12:36:59 +02:00
parent 830a5c0caa
commit 990a50539e
4 changed files with 14 additions and 24 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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);