[broadway] Ungrab if grabbed window is destroyed

This commit is contained in:
Alexander Larsson 2011-04-15 16:17:27 +02:00
parent 22c250e324
commit 66231a29b8
3 changed files with 41 additions and 1 deletions

View File

@ -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,

View File

@ -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_window_grab_check_destroy (GdkWindow *window);
void _gdk_keymap_keys_changed (GdkDisplay *display);
gint _gdk_broadway_get_group_for_state (GdkDisplay *display,

View File

@ -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)
{