[Xfce4-commits] [apps/xfce4-screenshooter] 24/38: Replace pointer/keyboard related deprecated functions
noreply at xfce.org
noreply at xfce.org
Fri Apr 28 03:07:20 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 9bf14080dcd577ccafd6c73b37b622cf099fd9d4
Author: Andre Miranda <andre42m at gmail.com>
Date: Tue Apr 4 21:48:31 2017 -0300
Replace pointer/keyboard related deprecated functions
---
lib/screenshooter-capture.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/lib/screenshooter-capture.c b/lib/screenshooter-capture.c
index c7b5dbf..5d396a4 100644
--- a/lib/screenshooter-capture.c
+++ b/lib/screenshooter-capture.c
@@ -187,6 +187,8 @@ static GdkPixbuf *get_cursor_pixbuf (GdkDisplay *display,
{
GdkCursor *cursor = NULL;
GdkPixbuf *cursor_pixbuf = NULL;
+ GdkDevice *pointer = NULL;
+ GdkSeat *seat = NULL;
#ifdef HAVE_XFIXES
XFixesCursorImage *cursor_image = NULL;
@@ -255,7 +257,10 @@ fallback:
return NULL;
TRACE ("Get the coordinates of the cursor");
- gdk_window_get_pointer (root, cursorx, cursory, NULL);
+
+ seat = gdk_display_get_default_seat (gdk_display_get_default ());
+ pointer = gdk_seat_get_pointer (seat);
+ gdk_window_get_device_position (root, pointer, cursorx, cursory, NULL);
TRACE ("Get the cursor hotspot");
sscanf (gdk_pixbuf_get_option (cursor_pixbuf, "x_hot"), "%d", xhot);
@@ -687,6 +692,8 @@ static GdkPixbuf
gboolean cancelled = FALSE;
GdkPixbuf *screenshot;
GdkWindow *root;
+ GdkDevice *pointer, *keyboard;
+ GdkSeat *seat;
GdkCursor *xhair_cursor = gdk_cursor_new_for_display (gdk_display_get_default (),
GDK_CROSSHAIR);
@@ -737,9 +744,22 @@ static GdkPixbuf
/* Grab the mouse and the keyboard to prevent any interaction with other
* applications */
- gdk_keyboard_grab (gtk_widget_get_window (window), FALSE, GDK_CURRENT_TIME);
- gdk_pointer_grab (gtk_widget_get_window (window), TRUE, 0, NULL,
- NULL, GDK_CURRENT_TIME);
+ seat = gdk_display_get_default_seat (gdk_display_get_default ());
+ pointer = gdk_seat_get_pointer (seat);
+ keyboard = gdk_seat_get_keyboard (seat);
+
+ gdk_device_grab (keyboard, gtk_widget_get_window (window),
+ GDK_OWNERSHIP_NONE, FALSE,
+ GDK_KEY_PRESS_MASK |
+ GDK_KEY_RELEASE_MASK,
+ NULL, GDK_CURRENT_TIME);
+
+ gdk_device_grab (pointer, gtk_widget_get_window (window),
+ GDK_OWNERSHIP_NONE, FALSE,
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK,
+ NULL, GDK_CURRENT_TIME);
gtk_dialog_run (GTK_DIALOG (window));
gtk_widget_destroy (window);
@@ -767,8 +787,8 @@ static GdkPixbuf
rbdata.rectangle.height);
/* Ungrab the mouse and the keyboard */
- 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);
gdk_flush ();
return screenshot;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list