wayland: Set the WaylandCompositor as wl_clients user_data
This makes it easier to get references to components in wayland callbacks where the resource is inert and thus has a user_data of NULL. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3893>
This commit is contained in:
parent
63fa79c878
commit
7e2627f5d8
@ -88,6 +88,7 @@ struct _MetaWaylandCompositor
|
|||||||
struct wl_display *wayland_display;
|
struct wl_display *wayland_display;
|
||||||
char *display_name;
|
char *display_name;
|
||||||
GSource *source;
|
GSource *source;
|
||||||
|
struct wl_listener client_created_listener;
|
||||||
|
|
||||||
GHashTable *outputs;
|
GHashTable *outputs;
|
||||||
GList *frame_callback_surfaces;
|
GList *frame_callback_surfaces;
|
||||||
|
@ -660,6 +660,17 @@ meta_wayland_log_func (const char *fmt,
|
|||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_client_created (struct wl_listener *listener,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
struct wl_client *client = user_data;
|
||||||
|
MetaWaylandCompositor *compositor =
|
||||||
|
wl_container_of (listener, compositor, client_created_listener);
|
||||||
|
|
||||||
|
wl_client_set_user_data (client, compositor, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_compositor_prepare_shutdown (MetaWaylandCompositor *compositor)
|
meta_wayland_compositor_prepare_shutdown (MetaWaylandCompositor *compositor)
|
||||||
{
|
{
|
||||||
@ -718,6 +729,10 @@ meta_wayland_compositor_init (MetaWaylandCompositor *compositor)
|
|||||||
if (compositor->wayland_display == NULL)
|
if (compositor->wayland_display == NULL)
|
||||||
g_error ("Failed to create the global wl_display");
|
g_error ("Failed to create the global wl_display");
|
||||||
|
|
||||||
|
compositor->client_created_listener.notify = on_client_created;
|
||||||
|
wl_display_add_client_created_listener (compositor->wayland_display,
|
||||||
|
&compositor->client_created_listener);
|
||||||
|
|
||||||
priv->filter_manager = meta_wayland_filter_manager_new (compositor);
|
priv->filter_manager = meta_wayland_filter_manager_new (compositor);
|
||||||
priv->frame_callback_sources =
|
priv->frame_callback_sources =
|
||||||
g_hash_table_new_full (NULL, NULL, NULL,
|
g_hash_table_new_full (NULL, NULL, NULL,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user