summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-11-22 15:12:11 +0100
committerinfirit <[email protected]>2014-11-22 15:13:50 +0100
commit33290996c5c09725f902f23d362450cc58543a23 (patch)
treebb84ee8beaa7609e39dcfa8c883cec372e3c291f
parent54bb9d708c43ae6fbeb25888fe39d0b7f14a7631 (diff)
downloadmate-panel-33290996c5c09725f902f23d362450cc58543a23.tar.bz2
mate-panel-33290996c5c09725f902f23d362450cc58543a23.tar.xz
Gtk3: Fix use of pending deprecated gdk_pointer_grab()/_ungrab()
eplaced gdk_pointer_grab() and gdk_pointer_ungrab() by gdk_device_grab() and gdk_device_ungrab(), respectively. Based on gnome-panel commit: eff5d569c162d508f996678f0d1ea8647c1b810d From: Germán Póo-Caamaño <[email protected]>
-rw-r--r--mate-panel/menu.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/mate-panel/menu.c b/mate-panel/menu.c
index 3e4b16d2..f92dbeaa 100644
--- a/mate-panel/menu.c
+++ b/mate-panel/menu.c
@@ -686,14 +686,39 @@ drag_end_menu_cb (GtkWidget *widget, GdkDragContext *context)
if (xgrab_shell && !gtk_menu_get_tearoff_state (GTK_MENU(xgrab_shell)))
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gboolean status;
+ GdkDisplay *display;
+ GdkDevice *pointer;
+ GdkDeviceManager *device_manager;
+#endif
GdkWindow *window = gtk_widget_get_window (xgrab_shell);
GdkCursor *cursor = gdk_cursor_new (GDK_ARROW);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ display = gdk_window_get_display (window);
+ device_manager = gdk_display_get_device_manager (display);
+ pointer = gdk_device_manager_get_client_pointer (device_manager);
+
+ /* FIXMEgpoo: Not sure if report to GDK_OWNERSHIP_WINDOW
+ or GDK_OWNERSHIP_APPLICATION */
+ status = gdk_device_grab (pointer, window,
+ GDK_OWNERSHIP_WINDOW, TRUE,
+ GDK_BUTTON_PRESS_MASK
+ | GDK_BUTTON_RELEASE_MASK
+ | GDK_ENTER_NOTIFY_MASK
+ | GDK_LEAVE_NOTIFY_MASK
+ | GDK_POINTER_MOTION_MASK,
+ cursor, GDK_CURRENT_TIME);
+
+ if (!status)
+#else
if ((gdk_pointer_grab (window, TRUE,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK,
NULL, cursor, GDK_CURRENT_TIME) == 0))
+#endif
{
if (gdk_keyboard_grab (window, TRUE,
GDK_CURRENT_TIME) == 0)
@@ -705,13 +730,17 @@ drag_end_menu_cb (GtkWidget *widget, GdkDragContext *context)
}
else
{
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_device_ungrab (pointer, GDK_CURRENT_TIME);
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (cursor);
#else
+ gdk_pointer_ungrab (GDK_CURRENT_TIME);
+ }
+ }
+
gdk_cursor_unref (cursor);
#endif
}