From a98f1b2764db2505dc374fbfca64d337871be7e6 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 14 Nov 2023 23:25:35 +0100 Subject: [PATCH] wayland: Add getter for the implicitly grabbed surface of a touch sequence This will be used to implement the default MetaWaylandEventInterface at MetaWaylandSeat. Part-of: --- src/wayland/meta-wayland-touch.c | 16 ++++++++++++++++ src/wayland/meta-wayland-touch.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/wayland/meta-wayland-touch.c b/src/wayland/meta-wayland-touch.c index d75ced4cf..401abca85 100644 --- a/src/wayland/meta-wayland-touch.c +++ b/src/wayland/meta-wayland-touch.c @@ -637,6 +637,22 @@ meta_wayland_touch_get_press_coords (MetaWaylandTouch *touch, return TRUE; } +MetaWaylandSurface * +meta_wayland_touch_get_surface (MetaWaylandTouch *touch, + ClutterEventSequence *sequence) +{ + MetaWaylandTouchInfo *touch_info; + + if (!touch->touches) + return NULL; + + touch_info = touch_get_info (touch, sequence, FALSE); + if (!touch_info || !touch_info->touch_surface) + return NULL; + + return touch_info->touch_surface->surface; +} + static void meta_wayland_touch_init (MetaWaylandTouch *touch) { diff --git a/src/wayland/meta-wayland-touch.h b/src/wayland/meta-wayland-touch.h index ab2138adb..259cec7c5 100644 --- a/src/wayland/meta-wayland-touch.h +++ b/src/wayland/meta-wayland-touch.h @@ -73,3 +73,6 @@ gboolean meta_wayland_touch_get_press_coords (MetaWaylandTouch *touch, gboolean meta_wayland_touch_can_popup (MetaWaylandTouch *touch, uint32_t serial); + +MetaWaylandSurface * meta_wayland_touch_get_surface (MetaWaylandTouch *touch, + ClutterEventSequence *sequence);