wayland: Avoid getting the ClutterStage through ClutterEvents

Fetch the ClutterStage through other means, as that field will go
away from events.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
This commit is contained in:
Carlos Garnacho
2023-08-02 20:10:52 +02:00
parent af9d406610
commit 77510ca72d
4 changed files with 40 additions and 4 deletions

View File

@ -96,6 +96,16 @@ G_DECLARE_FINAL_TYPE (MetaWaylandTextInputFocus, meta_wayland_text_input_focus,
G_DEFINE_TYPE (MetaWaylandTextInputFocus, meta_wayland_text_input_focus,
CLUTTER_TYPE_INPUT_FOCUS)
static MetaBackend *
backend_from_text_input (MetaWaylandTextInput *text_input)
{
MetaWaylandSeat *seat = text_input->seat;
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
MetaContext *context = meta_wayland_compositor_get_context (compositor);
return meta_context_get_backend (context);
}
static void
meta_wayland_text_input_focus_request_surrounding (ClutterInputFocus *focus)
{
@ -836,9 +846,14 @@ meta_wayland_text_input_handle_event (MetaWaylandTextInput *text_input,
event->type == CLUTTER_TOUCH_BEGIN)
{
MetaWaylandSurface *surface = NULL;
MetaBackend *backend;
ClutterStage *stage;
ClutterActor *actor;
actor = clutter_stage_get_device_actor (clutter_event_get_stage (event),
backend = backend_from_text_input (text_input);
stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
actor = clutter_stage_get_device_actor (stage,
clutter_event_get_device (event),
clutter_event_get_event_sequence (event));