summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2016-01-18 15:32:45 +0100
committerWolfgang Ulbrich <[email protected]>2016-01-18 15:32:45 +0100
commit28ad0e568b51653d20413d83d1a8b9236b26874f (patch)
tree47bb62042dff2aa0c67e180a8ece9722e8178573 /src
parentacadd35e4cab5beb155496558597ae5c755f1225 (diff)
downloadcaja-28ad0e568b51653d20413d83d1a8b9236b26874f.tar.bz2
caja-28ad0e568b51653d20413d83d1a8b9236b26874f.tar.xz
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
Diffstat (limited to 'src')
-rw-r--r--src/file-manager/fm-desktop-icon-view.c40
1 files changed, 40 insertions, 0 deletions
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 ();