diff --git a/src/wayland/meta-wayland-tablet-seat.c b/src/wayland/meta-wayland-tablet-seat.c index 861252cbe..5a8cf62c3 100644 --- a/src/wayland/meta-wayland-tablet-seat.c +++ b/src/wayland/meta-wayland-tablet-seat.c @@ -603,3 +603,25 @@ meta_wayland_tablet_seat_get_grab_info (MetaWaylandTabletSeat *tablet_seat, return FALSE; } + +MetaWaylandSurface * +meta_wayland_tablet_seat_get_current_surface (MetaWaylandTabletSeat *tablet_seat, + ClutterInputDevice *device) +{ + MetaWaylandTablet *tablet; + g_autoptr (GList) tools = NULL; + GList *l; + + tools = g_hash_table_get_values (tablet_seat->tools); + tablet = meta_wayland_tablet_seat_lookup_tablet (tablet_seat, device); + + for (l = tools; l; l = l->next) + { + MetaWaylandTabletTool *tool = l->data; + + if (meta_wayland_tablet_tool_has_current_tablet (tool, tablet)) + return meta_wayland_tablet_tool_get_current_surface (tool); + } + + return NULL; +} diff --git a/src/wayland/meta-wayland-tablet-seat.h b/src/wayland/meta-wayland-tablet-seat.h index beee347af..834e6a65a 100644 --- a/src/wayland/meta-wayland-tablet-seat.h +++ b/src/wayland/meta-wayland-tablet-seat.h @@ -84,3 +84,6 @@ gboolean meta_wayland_tablet_seat_get_grab_info (MetaWaylandTabletSeat *tablet_s ClutterInputDevice **device_out, float *x, float *y); + +MetaWaylandSurface * meta_wayland_tablet_seat_get_current_surface (MetaWaylandTabletSeat *tablet_seat, + ClutterInputDevice *device); diff --git a/src/wayland/meta-wayland-tablet-tool.c b/src/wayland/meta-wayland-tablet-tool.c index 288f58a1e..8f8be2c17 100644 --- a/src/wayland/meta-wayland-tablet-tool.c +++ b/src/wayland/meta-wayland-tablet-tool.c @@ -937,3 +937,16 @@ meta_wayland_tablet_tool_can_popup (MetaWaylandTabletTool *tool, { return tool->down_serial == serial || tool->button_serial == serial; } + +gboolean +meta_wayland_tablet_tool_has_current_tablet (MetaWaylandTabletTool *tool, + MetaWaylandTablet *tablet) +{ + return tool->current_tablet == tablet; +} + +MetaWaylandSurface * +meta_wayland_tablet_tool_get_current_surface (MetaWaylandTabletTool *tool) +{ + return tool->current; +} diff --git a/src/wayland/meta-wayland-tablet-tool.h b/src/wayland/meta-wayland-tablet-tool.h index a86ac0470..9afd13e75 100644 --- a/src/wayland/meta-wayland-tablet-tool.h +++ b/src/wayland/meta-wayland-tablet-tool.h @@ -81,3 +81,8 @@ gboolean meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool, uint32_t serial); gboolean meta_wayland_tablet_tool_can_popup (MetaWaylandTabletTool *tool, uint32_t serial); + +gboolean meta_wayland_tablet_tool_has_current_tablet (MetaWaylandTabletTool *tool, + MetaWaylandTablet *tablet); + +MetaWaylandSurface * meta_wayland_tablet_tool_get_current_surface (MetaWaylandTabletTool *tool);