wayland: Add API to change a tool focus surface

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
This commit is contained in:
Carlos Garnacho 2023-11-15 14:49:29 +01:00
parent 9c2514b75c
commit 77ec0d1e41
4 changed files with 35 additions and 0 deletions

View File

@ -625,3 +625,24 @@ meta_wayland_tablet_seat_get_current_surface (MetaWaylandTabletSeat *tablet_seat
return NULL; return NULL;
} }
void
meta_wayland_tablet_seat_focus_surface (MetaWaylandTabletSeat *tablet_seat,
ClutterInputDevice *device,
MetaWaylandSurface *surface)
{
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))
meta_wayland_tablet_tool_focus_surface (tool, surface);
}
}

View File

@ -87,3 +87,7 @@ gboolean meta_wayland_tablet_seat_get_grab_info (MetaWaylandTabletSeat *tablet_s
MetaWaylandSurface * meta_wayland_tablet_seat_get_current_surface (MetaWaylandTabletSeat *tablet_seat, MetaWaylandSurface * meta_wayland_tablet_seat_get_current_surface (MetaWaylandTabletSeat *tablet_seat,
ClutterInputDevice *device); ClutterInputDevice *device);
void meta_wayland_tablet_seat_focus_surface (MetaWaylandTabletSeat *tablet_seat,
ClutterInputDevice *device,
MetaWaylandSurface *surface);

View File

@ -950,3 +950,10 @@ meta_wayland_tablet_tool_get_current_surface (MetaWaylandTabletTool *tool)
{ {
return tool->current; return tool->current;
} }
void
meta_wayland_tablet_tool_focus_surface (MetaWaylandTabletTool *tool,
MetaWaylandSurface *surface)
{
meta_wayland_tablet_tool_set_focus (tool, surface, NULL);
}

View File

@ -86,3 +86,6 @@ gboolean meta_wayland_tablet_tool_has_current_tablet (MetaWaylandTabletTool *too
MetaWaylandTablet *tablet); MetaWaylandTablet *tablet);
MetaWaylandSurface * meta_wayland_tablet_tool_get_current_surface (MetaWaylandTabletTool *tool); MetaWaylandSurface * meta_wayland_tablet_tool_get_current_surface (MetaWaylandTabletTool *tool);
void meta_wayland_tablet_tool_focus_surface (MetaWaylandTabletTool *tool,
MetaWaylandSurface *surface);