wayland: Check stylus serials on meta_wayland_seat_can_popup()

This allows xdg_popup.grab() to work with styli. Without this check
we would bail out and emit xdg_popup.popup_done, leaving stylus users
unable to interact with popup menus, comboboxes, etc...

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/886
This commit is contained in:
Carlos Garnacho 2019-10-28 18:07:31 +01:00 committed by Carlos Garnacho
parent 942883577e
commit f2b3dd318f
5 changed files with 37 additions and 1 deletions

View File

@ -504,9 +504,17 @@ gboolean
meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
uint32_t serial)
{
MetaWaylandCompositor *compositor;
MetaWaylandTabletSeat *tablet_seat;
compositor = meta_wayland_compositor_get_default ();
tablet_seat =
meta_wayland_tablet_manager_ensure_seat (compositor->tablet_manager, seat);
return (meta_wayland_pointer_can_popup (seat->pointer, serial) ||
meta_wayland_keyboard_can_popup (seat->keyboard, serial) ||
meta_wayland_touch_can_popup (seat->touch, serial));
meta_wayland_touch_can_popup (seat->touch, serial) ||
meta_wayland_tablet_seat_can_popup (tablet_seat, serial));
}
gboolean

View File

@ -552,3 +552,20 @@ meta_wayland_tablet_seat_set_pad_focus (MetaWaylandTabletSeat *tablet_seat,
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &pad))
meta_wayland_tablet_pad_set_focus (pad, surface);
}
gboolean
meta_wayland_tablet_seat_can_popup (MetaWaylandTabletSeat *tablet_seat,
uint32_t serial)
{
MetaWaylandTabletTool *tool;
GHashTableIter iter;
g_hash_table_iter_init (&iter, tablet_seat->tools);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &tool))
{
if (meta_wayland_tablet_tool_can_popup (tool, serial))
return TRUE;
}
return FALSE;
}

View File

@ -75,5 +75,7 @@ MetaWaylandTablet *meta_wayland_tablet_seat_lookup_paired_tablet (MetaWaylan
MetaWaylandTabletPad *pad);
GList *meta_wayland_tablet_seat_lookup_paired_pads (MetaWaylandTabletSeat *tablet_seat,
MetaWaylandTablet *tablet);
gboolean meta_wayland_tablet_seat_can_popup (MetaWaylandTabletSeat *tablet_seat,
uint32_t serial);
#endif /* META_WAYLAND_TABLET_SEAT_H */

View File

@ -1018,3 +1018,10 @@ meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool,
return ((tool->down_serial == serial || tool->button_serial == serial) &&
tablet_tool_can_grab_surface (tool, surface));
}
gboolean
meta_wayland_tablet_tool_can_popup (MetaWaylandTabletTool *tool,
uint32_t serial)
{
return tool->down_serial == serial || tool->button_serial == serial;
}

View File

@ -85,5 +85,7 @@ void meta_wayland_tablet_tool_set_cursor_position (MetaWaylandTabletTool *t
gboolean meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool,
MetaWaylandSurface *surface,
uint32_t serial);
gboolean meta_wayland_tablet_tool_can_popup (MetaWaylandTabletTool *tool,
uint32_t serial);
#endif /* META_WAYLAND_TABLET_TOOL_H */