wayland: Make it possible to trigger popups through pointer/keyboard/touch
Right now we just check the pointer serial, so the popup will be immediately dismissed if the client passes a serial corresponding to another input device. Abstract this a bit further and add a meta_wayland_seat_can_popup() call that will check the serial all input devices. This makes it possible to trigger menus through touch or keyboard devices. https://bugzilla.gnome.org/show_bug.cgi?id=756296
This commit is contained in:
parent
dd5a4ecdf9
commit
a5d2555196
@ -673,3 +673,10 @@ meta_wayland_keyboard_create_new_resource (MetaWaylandKeyboard *keyboard,
|
||||
wl_list_insert (&keyboard->resource_list, wl_resource_get_link (cr));
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_keyboard_can_popup (MetaWaylandKeyboard *keyboard,
|
||||
uint32_t serial)
|
||||
{
|
||||
return keyboard->key_serial == serial;
|
||||
}
|
||||
|
@ -101,4 +101,7 @@ void meta_wayland_keyboard_create_new_resource (MetaWaylandKeyboard *keyboard,
|
||||
struct wl_resource *seat_resource,
|
||||
uint32_t id);
|
||||
|
||||
gboolean meta_wayland_keyboard_can_popup (MetaWaylandKeyboard *keyboard,
|
||||
uint32_t serial);
|
||||
|
||||
#endif /* META_WAYLAND_KEYBOARD_H */
|
||||
|
@ -405,3 +405,12 @@ meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
|
||||
|
||||
return sequence || can_grab_surface;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
|
||||
uint32_t serial)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
@ -64,5 +64,7 @@ gboolean meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
|
||||
uint32_t serial,
|
||||
gfloat *x,
|
||||
gfloat *y);
|
||||
gboolean meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
|
||||
uint32_t serial);
|
||||
|
||||
#endif /* META_WAYLAND_SEAT_H */
|
||||
|
@ -1518,7 +1518,7 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
|
||||
surface->xdg_popup = popup_resource;
|
||||
surface->xdg_shell_resource = resource;
|
||||
|
||||
if (!meta_wayland_pointer_can_popup (&seat->pointer, serial))
|
||||
if (!meta_wayland_seat_can_popup (seat, serial))
|
||||
{
|
||||
xdg_popup_send_popup_done (popup_resource);
|
||||
return;
|
||||
@ -1739,7 +1739,7 @@ wl_shell_surface_set_popup (struct wl_client *client,
|
||||
|
||||
wl_shell_surface_set_state (surface, SURFACE_STATE_TOPLEVEL);
|
||||
|
||||
if (!meta_wayland_pointer_can_popup (&seat->pointer, serial))
|
||||
if (!meta_wayland_seat_can_popup (seat, serial))
|
||||
{
|
||||
wl_shell_surface_send_popup_done (resource);
|
||||
return;
|
||||
|
@ -575,6 +575,26 @@ meta_wayland_touch_create_new_resource (MetaWaylandTouch *touch,
|
||||
wl_list_insert (&touch->resource_list, wl_resource_get_link (cr));
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_touch_can_popup (MetaWaylandTouch *touch,
|
||||
uint32_t serial)
|
||||
{
|
||||
MetaWaylandTouchInfo *touch_info;
|
||||
GHashTableIter iter;
|
||||
|
||||
if (!touch->touches)
|
||||
return FALSE;
|
||||
|
||||
g_hash_table_iter_init (&iter, touch->touches);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &touch_info))
|
||||
{
|
||||
if (touch_info->slot_serial == serial)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ClutterEventSequence *
|
||||
meta_wayland_touch_find_grab_sequence (MetaWaylandTouch *touch,
|
||||
MetaWaylandSurface *surface,
|
||||
|
@ -70,4 +70,7 @@ gboolean meta_wayland_touch_get_press_coords (MetaWaylandTouch *touch,
|
||||
gfloat *x,
|
||||
gfloat *y);
|
||||
|
||||
gboolean meta_wayland_touch_can_popup (MetaWaylandTouch *touch,
|
||||
uint32_t serial);
|
||||
|
||||
#endif /* META_WAYLAND_TOUCH_H */
|
||||
|
Loading…
Reference in New Issue
Block a user