From bc2bda8c7e60627677c701aa20ef5998e32ce42c Mon Sep 17 00:00:00 2001 From: raveit65 Date: Sun, 7 Aug 2016 12:46:14 +0200 Subject: 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 --- mate-screenshot/src/screenshot-utils.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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); -- cgit v1.2.1