From 28ad0e568b51653d20413d83d1a8b9236b26874f Mon Sep 17 00:00:00 2001 From: Wolfgang Ulbrich Date: Mon, 18 Jan 2016 15:32:45 +0100 Subject: GTK3 desktop-icon-view: don't use deprecated GDK grab API taken from: https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-2&id=70df8fa --- src/file-manager/fm-desktop-icon-view.c | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src') diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index 7f02efb5..3022fcf2 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -322,6 +322,45 @@ fm_desktop_icon_view_handle_middle_click (CajaIconContainer *icon_container, FMDesktopIconView *desktop_icon_view) { XButtonEvent x_event; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDevice *keyboard = NULL, *pointer = NULL, *cur; + GdkDeviceManager *manager; + GList *list, *l; + + manager = gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET (icon_container))); + list = gdk_device_manager_list_devices (manager, GDK_DEVICE_TYPE_MASTER); + + for (l = list; l != NULL; l = l->next) { + cur = l->data; + + if (pointer == NULL && (gdk_device_get_source (cur) == GDK_SOURCE_MOUSE)) { + pointer = cur; + } + + if (keyboard == NULL && (gdk_device_get_source (cur) == GDK_SOURCE_KEYBOARD)) { + keyboard = cur; + } + + if (pointer != NULL && keyboard != NULL) { + break; + } + } + + g_list_free (list); + + /* During a mouse click we have the pointer and keyboard grab. + * We will send a fake event to the root window which will cause it + * to try to get the grab so we need to let go ourselves. + */ + + if (pointer != NULL) { + gdk_device_ungrab (pointer, GDK_CURRENT_TIME); + } + + if (keyboard != NULL) { + gdk_device_ungrab (keyboard, GDK_CURRENT_TIME); + } +#else /* During a mouse click we have the pointer and keyboard grab. * We will send a fake event to the root window which will cause it @@ -329,6 +368,7 @@ fm_desktop_icon_view_handle_middle_click (CajaIconContainer *icon_container, */ gdk_pointer_ungrab (GDK_CURRENT_TIME); gdk_keyboard_ungrab (GDK_CURRENT_TIME); +#endif /* Stop the event because we don't want anyone else dealing with it. */ gdk_flush (); -- cgit v1.2.1