mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
clutter/backend/x11: Make filter add/remove take a clutter backend
This avoids some global fetching, which is problematic if it happens during init. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2002>
This commit is contained in:
parent
6ae9bc9045
commit
92b95b0b4b
@ -160,7 +160,9 @@ meta_clutter_backend_x11_finish_init (ClutterBackend *clutter_backend,
|
||||
g_debug ("Getting the X screen");
|
||||
|
||||
/* add event filter for Cogl events */
|
||||
meta_clutter_x11_add_filter (cogl_xlib_filter, clutter_backend);
|
||||
meta_clutter_backend_x11_add_filter (clutter_backend_x11,
|
||||
cogl_xlib_filter,
|
||||
clutter_backend);
|
||||
|
||||
xscreen = DefaultScreenOfDisplay (clutter_backend_x11->xdisplay);
|
||||
clutter_backend_x11->xscreen_num = XScreenNumberOfScreen (xscreen);
|
||||
@ -201,7 +203,9 @@ meta_clutter_backend_x11_finalize (GObject *gobject)
|
||||
{
|
||||
MetaClutterBackendX11 *clutter_backend_x11 = META_CLUTTER_BACKEND_X11 (gobject);
|
||||
|
||||
meta_clutter_x11_remove_filter (cogl_xlib_filter, gobject);
|
||||
meta_clutter_backend_x11_remove_filter (clutter_backend_x11,
|
||||
cogl_xlib_filter,
|
||||
clutter_backend_x11);
|
||||
|
||||
XCloseDisplay (clutter_backend_x11->xdisplay);
|
||||
|
||||
@ -593,29 +597,14 @@ meta_clutter_x11_get_root_window (void)
|
||||
}
|
||||
|
||||
void
|
||||
meta_clutter_x11_add_filter (MetaX11FilterFunc func,
|
||||
gpointer data)
|
||||
meta_clutter_backend_x11_add_filter (MetaClutterBackendX11 *clutter_backend_x11,
|
||||
MetaX11FilterFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
MetaX11EventFilter *filter;
|
||||
ClutterBackend *clutter_backend = clutter_get_default_backend ();
|
||||
MetaClutterBackendX11 *clutter_backend_x11;
|
||||
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
if (clutter_backend == NULL)
|
||||
{
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!META_IS_CLUTTER_BACKEND_X11 (clutter_backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return;
|
||||
}
|
||||
|
||||
clutter_backend_x11 = META_CLUTTER_BACKEND_X11 (clutter_backend);
|
||||
|
||||
filter = g_new0 (MetaX11EventFilter, 1);
|
||||
filter->func = func;
|
||||
filter->data = data;
|
||||
@ -627,30 +616,15 @@ meta_clutter_x11_add_filter (MetaX11FilterFunc func,
|
||||
}
|
||||
|
||||
void
|
||||
meta_clutter_x11_remove_filter (MetaX11FilterFunc func,
|
||||
gpointer data)
|
||||
meta_clutter_backend_x11_remove_filter (MetaClutterBackendX11 *clutter_backend_x11,
|
||||
MetaX11FilterFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
GSList *tmp_list, *this;
|
||||
MetaX11EventFilter *filter;
|
||||
ClutterBackend *clutter_backend = clutter_get_default_backend ();
|
||||
MetaClutterBackendX11 *clutter_backend_x11;
|
||||
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
if (clutter_backend == NULL)
|
||||
{
|
||||
g_critical ("The Clutter backend has not been initialised");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!META_IS_CLUTTER_BACKEND_X11 (clutter_backend))
|
||||
{
|
||||
g_critical ("The Clutter backend is not a X11 backend");
|
||||
return;
|
||||
}
|
||||
|
||||
clutter_backend_x11 = META_CLUTTER_BACKEND_X11 (clutter_backend);
|
||||
|
||||
tmp_list = clutter_backend_x11->event_filters;
|
||||
|
||||
while (tmp_list)
|
||||
|
@ -84,10 +84,13 @@ int meta_clutter_x11_get_default_screen (void);
|
||||
Window meta_clutter_x11_get_root_window (void);
|
||||
void meta_clutter_x11_set_display (Display * xdpy);
|
||||
|
||||
void meta_clutter_x11_add_filter (MetaX11FilterFunc func,
|
||||
gpointer data);
|
||||
void meta_clutter_x11_remove_filter (MetaX11FilterFunc func,
|
||||
gpointer data);
|
||||
void meta_clutter_backend_x11_add_filter (MetaClutterBackendX11 *clutter_backend_x11,
|
||||
MetaX11FilterFunc func,
|
||||
gpointer data);
|
||||
|
||||
void meta_clutter_backend_x11_remove_filter (MetaClutterBackendX11 *clutter_backend_x11,
|
||||
MetaX11FilterFunc func,
|
||||
gpointer data);
|
||||
|
||||
void meta_clutter_x11_set_use_stereo_stage (gboolean use_stereo);
|
||||
gboolean meta_clutter_x11_get_use_stereo_stage (void);
|
||||
|
@ -323,6 +323,10 @@ meta_seat_x11_apply_kbd_a11y_settings (ClutterSeat *seat,
|
||||
gboolean
|
||||
meta_seat_x11_a11y_init (ClutterSeat *seat)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
MetaClutterBackendX11 *clutter_backend_x11 =
|
||||
META_CLUTTER_BACKEND_X11 (clutter_backend);
|
||||
Display *xdisplay = meta_clutter_x11_get_default_display ();
|
||||
guint event_mask;
|
||||
|
||||
@ -333,7 +337,9 @@ meta_seat_x11_a11y_init (ClutterSeat *seat)
|
||||
|
||||
XkbSelectEvents (xdisplay, XkbUseCoreKbd, event_mask, event_mask);
|
||||
|
||||
meta_clutter_x11_add_filter (xkb_a11y_event_filter, seat);
|
||||
meta_clutter_backend_x11_add_filter (clutter_backend_x11,
|
||||
xkb_a11y_event_filter,
|
||||
seat);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user