[gimp] Bug 780375 - Color picker won't pick on Wayland
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 780375 - Color picker won't pick on Wayland
- Date: Tue, 31 Oct 2017 15:26:46 +0000 (UTC)
commit 0323541d869620836b8cbf034e728989416fbdff
Author: Ell <ell_se yahoo com>
Date: Tue Oct 31 11:13:44 2017 -0400
Bug 780375 - Color picker won't pick on Wayland
In GimpPickButton, try to pick from the local window under the
cursor, before falling back to picking from the root window, so
that we can at least pick from local windows on Wayland.
libgimpwidgets/gimppickbutton-default.c | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/libgimpwidgets/gimppickbutton-default.c b/libgimpwidgets/gimppickbutton-default.c
index 683b65e..28c7713 100644
--- a/libgimpwidgets/gimppickbutton-default.c
+++ b/libgimpwidgets/gimppickbutton-default.c
@@ -234,17 +234,35 @@ gimp_pick_button_pick (GdkScreen *screen,
#else
- GdkWindow *root_window = gdk_screen_get_root_window (screen);
+ GdkWindow *window;
+ gint x_window;
+ gint y_window;
cairo_surface_t *image;
cairo_t *cr;
guchar *data;
guchar color[3];
+ /* we try to pick from the local window under the cursor, and fall back to
+ * picking from the root window if this fails (i.e., if the cursor is not
+ * under a local window). on wayland, picking from the root window is not
+ * supported, so this at least allows us to pick from local windows. see
+ * bug #780375.
+ */
+ window = gdk_display_get_window_at_pointer (gdk_screen_get_display (screen),
+ &x_window, &y_window);
+
+ if (! window)
+ {
+ window = gdk_screen_get_root_window (screen);
+ x_window = x_root;
+ y_window = y_root;
+ }
+
image = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1);
cr = cairo_create (image);
- gdk_cairo_set_source_window (cr, root_window, -x_root, -y_root);
+ gdk_cairo_set_source_window (cr, window, -x_window, -y_window);
cairo_paint (cr);
cairo_destroy (cr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]