backends: Assign stage to events in MetaBackend

Don't do this in the MetaSeatNative, this should be detached from
the stage.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
This commit is contained in:
Carlos Garnacho 2020-07-31 20:17:31 +02:00
parent 0f0848191e
commit 2e07c55241
2 changed files with 15 additions and 11 deletions

View File

@ -175,6 +175,14 @@ struct _MetaBackendPrivate
}; };
typedef struct _MetaBackendPrivate MetaBackendPrivate; typedef struct _MetaBackendPrivate MetaBackendPrivate;
typedef struct _MetaBackendSource MetaBackendSource;
struct _MetaBackendSource
{
GSource parent;
MetaBackend *backend;
};
static void static void
initable_iface_init (GInitableIface *initable_iface); initable_iface_init (GInitableIface *initable_iface);
@ -933,10 +941,13 @@ clutter_source_dispatch (GSource *source,
GSourceFunc callback, GSourceFunc callback,
gpointer user_data) gpointer user_data)
{ {
MetaBackendSource *backend_source = (MetaBackendSource *) source;
ClutterEvent *event = clutter_event_get (); ClutterEvent *event = clutter_event_get ();
if (event) if (event)
{ {
event->any.stage =
CLUTTER_STAGE (meta_backend_get_stage (backend_source->backend));
clutter_do_event (event); clutter_do_event (event);
clutter_event_free (event); clutter_event_free (event);
} }
@ -962,6 +973,7 @@ static gboolean
init_clutter (MetaBackend *backend, init_clutter (MetaBackend *backend,
GError **error) GError **error)
{ {
MetaBackendSource *backend_source;
GSource *source; GSource *source;
clutter_set_custom_backend_func (meta_get_clutter_backend); clutter_set_custom_backend_func (meta_get_clutter_backend);
@ -973,7 +985,9 @@ init_clutter (MetaBackend *backend,
return FALSE; return FALSE;
} }
source = g_source_new (&clutter_source_funcs, sizeof (GSource)); source = g_source_new (&clutter_source_funcs, sizeof (MetaBackendSource));
backend_source = (MetaBackendSource *) source;
backend_source->backend = backend;
g_source_attach (source, NULL); g_source_attach (source, NULL);
g_source_unref (source); g_source_unref (source);

View File

@ -246,15 +246,6 @@ static void
queue_event (MetaSeatNative *seat, queue_event (MetaSeatNative *seat,
ClutterEvent *event) ClutterEvent *event)
{ {
ClutterStage *stage = meta_seat_native_get_stage (seat);
if (!stage)
{
/* No stage yet, drop this event on the floor */
return;
}
event->any.stage = stage;
_clutter_event_push (event, FALSE); _clutter_event_push (event, FALSE);
} }
@ -1339,7 +1330,6 @@ meta_event_dispatch (GSource *g_source,
{ {
MetaEventSource *source = (MetaEventSource *) g_source; MetaEventSource *source = (MetaEventSource *) g_source;
MetaSeatNative *seat; MetaSeatNative *seat;
ClutterEvent *event;
seat = source->seat; seat = source->seat;