Commit 66231a29 authored by Alexander Larsson's avatar Alexander Larsson

[broadway] Ungrab if grabbed window is destroyed

parent 22c250e3
......@@ -234,6 +234,41 @@ gdk_broadway_device_query_state (GdkDevice *device,
return TRUE;
}
void
_gdk_broadway_window_grab_check_destroy (GdkWindow *window)
{
GdkDisplay *display = gdk_window_get_display (window);
GdkBroadwayDisplay *broadway_display;
GdkDeviceManager *device_manager;
GdkDeviceGrabInfo *grab;
GList *devices, *d;
broadway_display = GDK_BROADWAY_DISPLAY (display);
device_manager = gdk_display_get_device_manager (display);
/* Get all devices */
devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
for (d = devices; d; d = d->next)
{
/* Make sure there is no lasting grab in this native window */
grab = _gdk_display_get_last_device_grab (display, d->data);
if (grab && grab->native_window == window)
{
grab->serial_end = grab->serial_start;
grab->implicit_ungrab = TRUE;
broadway_display->pointer_grab_window = NULL;
}
}
g_list_free (devices);
}
static GdkGrabStatus
gdk_broadway_device_grab (GdkDevice *device,
GdkWindow *window,
......
......@@ -87,7 +87,9 @@ void _gdk_broadway_window_change_property (GdkWindow *window,
void _gdk_broadway_window_delete_property (GdkWindow *window,
GdkAtom property);
void _gdk_broadway_selection_window_destroyed (GdkWindow *window);
void _gdk_broadway_selection_window_destroyed (GdkWindow *window);
void _gdk_broadway_window_grab_check_destroy (GdkWindow *window);
void _gdk_keymap_keys_changed (GdkDisplay *display);
gint _gdk_broadway_get_group_for_state (GdkDisplay *display,
......
......@@ -273,6 +273,8 @@ gdk_window_impl_broadway_finalize (GObject *object)
wrapper = impl->wrapper;
_gdk_broadway_window_grab_check_destroy (wrapper);
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (impl->wrapper));
if (broadway_display->mouse_in_toplevel == GDK_WINDOW (wrapper))
......@@ -472,6 +474,7 @@ _gdk_broadway_window_destroy (GdkWindow *window,
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
_gdk_broadway_selection_window_destroyed (window);
_gdk_broadway_window_grab_check_destroy (window);
if (impl->ref_surface)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment