diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c index 7cc485360..9620705fe 100644 --- a/src/wayland/meta-wayland-keyboard.c +++ b/src/wayland/meta-wayland-keyboard.c @@ -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; +} diff --git a/src/wayland/meta-wayland-keyboard.h b/src/wayland/meta-wayland-keyboard.h index aaf431f91..7127c0da9 100644 --- a/src/wayland/meta-wayland-keyboard.h +++ b/src/wayland/meta-wayland-keyboard.h @@ -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 */ diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c index e92ee35fc..9ac2cd137 100644 --- a/src/wayland/meta-wayland-seat.c +++ b/src/wayland/meta-wayland-seat.c @@ -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)); +} diff --git a/src/wayland/meta-wayland-seat.h b/src/wayland/meta-wayland-seat.h index c0768ec35..42d23046f 100644 --- a/src/wayland/meta-wayland-seat.h +++ b/src/wayland/meta-wayland-seat.h @@ -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 */ diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index ba21d77a0..9d15401c6 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -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; diff --git a/src/wayland/meta-wayland-touch.c b/src/wayland/meta-wayland-touch.c index 7400d66a4..2892510a3 100644 --- a/src/wayland/meta-wayland-touch.c +++ b/src/wayland/meta-wayland-touch.c @@ -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, diff --git a/src/wayland/meta-wayland-touch.h b/src/wayland/meta-wayland-touch.h index beaf6caa5..e5abc12d7 100644 --- a/src/wayland/meta-wayland-touch.h +++ b/src/wayland/meta-wayland-touch.h @@ -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 */