summaryrefslogtreecommitdiff
path: root/mate-screenshot
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-08-07 12:46:14 +0200
committerraveit65 <[email protected]>2016-09-01 08:21:55 +0200
commitbc2bda8c7e60627677c701aa20ef5998e32ce42c (patch)
tree5237e39618f0981d608140144d71c4db5ebd7f86 /mate-screenshot
parent206323736d82a707230e02eab1f891fdfd652e7f (diff)
downloadmate-utils-bc2bda8c7e60627677c701aa20ef5998e32ce42c.tar.bz2
mate-utils-bc2bda8c7e60627677c701aa20ef5998e32ce42c.tar.xz
GTK+-3 screenshot-utils: don't use deprecated GDK api
Use GdkDevice and GdkDeviceManager instead of the deprecated pointer GDK API. taken from: https://git.gnome.org/browse/gnome-screenshot/commit/?h=gnome-3-4&id=29e5f8c
Diffstat (limited to 'mate-screenshot')
-rw-r--r--mate-screenshot/src/screenshot-utils.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/mate-screenshot/src/screenshot-utils.c b/mate-screenshot/src/screenshot-utils.c
index 3ea49b57..92b371dd 100644
--- a/mate-screenshot/src/screenshot-utils.c
+++ b/mate-screenshot/src/screenshot-utils.c
@@ -240,14 +240,26 @@ GdkWindow *
screenshot_find_current_window ()
{
GdkWindow *current_window;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkDeviceManager *manager;
+ GdkDevice *device;
+#endif
current_window = screenshot_find_active_window ();
+#if GTK_CHECK_VERSION (3, 0, 0)
+ manager = gdk_display_get_device_manager (gdk_display_get_default ());
+ device = gdk_device_manager_get_client_pointer (manager);
+#endif
/* If there's no active window, we fall back to returning the
* window that the cursor is in.
*/
if (!current_window)
+#if GTK_CHECK_VERSION (3, 0, 0)
+ current_window = gdk_device_get_window_at_position (device, NULL, NULL);
+#else
current_window = gdk_window_at_pointer (NULL, NULL);
+#endif
if (current_window)
{
@@ -1007,10 +1019,20 @@ screenshot_get_pixbuf (GdkWindow *window,
if (cursor_pixbuf != NULL)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkDeviceManager *manager;
+ GdkDevice *device;
+#endif
GdkRectangle r1, r2;
gint cx, cy, xhot, yhot;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ manager = gdk_display_get_device_manager (gdk_display_get_default ());
+ device = gdk_device_manager_get_client_pointer (manager);
+ gdk_window_get_device_position (window, device, &cx, &cy, NULL);
+#else
gdk_window_get_pointer (window, &cx, &cy, NULL);
+#endif
sscanf (gdk_pixbuf_get_option (cursor_pixbuf, "x_hot"), "%d", &xhot);
sscanf (gdk_pixbuf_get_option (cursor_pixbuf, "y_hot"), "%d", &yhot);