wayland: Check the serial when creating popups
Send popup_done immediately if the serial is incorrect so the client can destroy its resources. https://bugzilla.gnome.org/show_bug.cgi?id=744452
This commit is contained in:
parent
f328890ed1
commit
f5c65d9ea1
@ -844,3 +844,9 @@ meta_wayland_pointer_can_grab_surface (MetaWaylandPointer *pointer,
|
|||||||
pointer->grab_serial == serial &&
|
pointer->grab_serial == serial &&
|
||||||
pointer->focus_surface == surface);
|
pointer->focus_surface == surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_wayland_pointer_can_popup (MetaWaylandPointer *pointer, uint32_t serial)
|
||||||
|
{
|
||||||
|
return pointer->grab_serial == serial;
|
||||||
|
}
|
||||||
|
@ -114,4 +114,7 @@ gboolean meta_wayland_pointer_can_grab_surface (MetaWaylandPointer *pointer,
|
|||||||
MetaWaylandSurface *surface,
|
MetaWaylandSurface *surface,
|
||||||
uint32_t serial);
|
uint32_t serial);
|
||||||
|
|
||||||
|
gboolean meta_wayland_pointer_can_popup (MetaWaylandPointer *pointer,
|
||||||
|
uint32_t serial);
|
||||||
|
|
||||||
#endif /* META_WAYLAND_POINTER_H */
|
#endif /* META_WAYLAND_POINTER_H */
|
||||||
|
@ -1046,6 +1046,7 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
|
|||||||
int32_t x,
|
int32_t x,
|
||||||
int32_t y)
|
int32_t y)
|
||||||
{
|
{
|
||||||
|
struct wl_resource *popup_resource;
|
||||||
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
|
||||||
MetaWaylandSurface *parent_surf = wl_resource_get_user_data (parent_resource);
|
MetaWaylandSurface *parent_surf = wl_resource_get_user_data (parent_resource);
|
||||||
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
||||||
@ -1077,9 +1078,20 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->xdg_popup = wl_resource_create (client, &xdg_popup_interface, wl_resource_get_version (resource), id);
|
popup_resource = wl_resource_create (client, &xdg_popup_interface,
|
||||||
wl_resource_set_implementation (surface->xdg_popup, &meta_wayland_xdg_popup_interface, surface, xdg_popup_destructor);
|
wl_resource_get_version (resource), id);
|
||||||
|
wl_resource_set_implementation (popup_resource,
|
||||||
|
&meta_wayland_xdg_popup_interface,
|
||||||
|
surface,
|
||||||
|
xdg_popup_destructor);
|
||||||
|
|
||||||
|
if (!meta_wayland_pointer_can_popup (&seat->pointer, serial))
|
||||||
|
{
|
||||||
|
xdg_popup_send_popup_done (popup_resource);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
surface->xdg_popup = popup_resource;
|
||||||
surface->xdg_shell_resource = resource;
|
surface->xdg_shell_resource = resource;
|
||||||
|
|
||||||
window = meta_window_wayland_new (display, surface);
|
window = meta_window_wayland_new (display, surface);
|
||||||
@ -1275,6 +1287,12 @@ wl_shell_surface_set_popup (struct wl_client *client,
|
|||||||
|
|
||||||
wl_shell_surface_set_state (surface, SURFACE_STATE_TOPLEVEL);
|
wl_shell_surface_set_state (surface, SURFACE_STATE_TOPLEVEL);
|
||||||
|
|
||||||
|
if (!meta_wayland_pointer_can_popup (&seat->pointer, serial))
|
||||||
|
{
|
||||||
|
wl_shell_surface_send_popup_done (resource);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
meta_window_set_transient_for (surface->window, parent_surf->window);
|
meta_window_set_transient_for (surface->window, parent_surf->window);
|
||||||
meta_window_move_frame (surface->window, FALSE,
|
meta_window_move_frame (surface->window, FALSE,
|
||||||
parent_surf->window->rect.x + x,
|
parent_surf->window->rect.x + x,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user