[Xfce4-commits] [apps/xfce4-screenshooter] 28/38: Replace gdk_pointer/keyboard_grab by gdk_device_grab

noreply at xfce.org noreply at xfce.org
Fri Apr 28 03:07:24 CEST 2017


This is an automated email from the git hooks/post-receive script.

andre pushed a commit to branch master
in repository apps/xfce4-screenshooter.

commit a38908680db6412611b2e9028ce835db35bf9b64
Author: Andre Miranda <andre42m at gmail.com>
Date:   Tue Apr 4 22:05:18 2017 -0300

    Replace gdk_pointer/keyboard_grab by gdk_device_grab
---
 lib/screenshooter-capture.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/lib/screenshooter-capture.c b/lib/screenshooter-capture.c
index b589a4d..0ba9097 100644
--- a/lib/screenshooter-capture.c
+++ b/lib/screenshooter-capture.c
@@ -955,8 +955,9 @@ static GdkPixbuf
   Display *display;
   gint screen;
   RbData rbdata;
-  GdkEventMask mask;
   GdkCursor *xhair_cursor;
+  GdkDevice *pointer, *keyboard;
+  GdkSeat   *seat;
   long value_mask;
 
   /* Get root window */
@@ -989,17 +990,25 @@ static GdkPixbuf
 
   /* Change cursor to cross-hair */
   TRACE ("Set the cursor");
-
   xhair_cursor = gdk_cursor_new_for_display (gdk_display_get_default (),
                                              GDK_CROSSHAIR);
 
-  mask = GDK_POINTER_MOTION_MASK |
-         GDK_BUTTON_PRESS_MASK |
-         GDK_BUTTON_RELEASE_MASK;
+  seat = gdk_display_get_default_seat (gdk_display_get_default ());
+  pointer = gdk_seat_get_pointer (seat);
+  keyboard = gdk_seat_get_keyboard (seat);
 
-  gdk_pointer_grab (root_window, FALSE, mask, NULL,
-                    xhair_cursor, GDK_CURRENT_TIME);
-  gdk_keyboard_grab (root_window, FALSE, GDK_CURRENT_TIME);
+  gdk_device_grab (keyboard, root_window,
+                  GDK_OWNERSHIP_NONE, FALSE,
+                  GDK_KEY_PRESS_MASK |
+                  GDK_KEY_RELEASE_MASK,
+                  NULL, GDK_CURRENT_TIME);
+
+  gdk_device_grab (pointer, root_window,
+                   GDK_OWNERSHIP_NONE, FALSE,
+                   GDK_POINTER_MOTION_MASK |
+                   GDK_BUTTON_PRESS_MASK | 
+                   GDK_BUTTON_RELEASE_MASK,
+                   xhair_cursor, GDK_CURRENT_TIME);
 
   /* Initialize the rubber band data */
   TRACE ("Initialize the rubber band data");
@@ -1020,8 +1029,8 @@ static GdkPixbuf
                             (GdkFilterFunc) region_filter_func,
                             &rbdata);
 
-  gdk_pointer_ungrab (GDK_CURRENT_TIME);
-  gdk_keyboard_ungrab (GDK_CURRENT_TIME);
+  gdk_device_ungrab (pointer, GDK_CURRENT_TIME);
+  gdk_device_ungrab (keyboard, GDK_CURRENT_TIME);
 
   /* Get the screenshot's pixbuf */
   if (G_LIKELY (!rbdata.cancelled))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list