[gimp/gimp-2.10] Issue #6778: Colorpicker (from Colors dockable) shows wrong color.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2.10] Issue #6778: Colorpicker (from Colors dockable) shows wrong color.
- Date: Thu, 18 Aug 2022 20:42:08 +0000 (UTC)
commit 7d026c96cb8a08417e21cd931321dde543259abf
Author: Jehan <jehan girinstud io>
Date: Thu Aug 18 21:25:46 2022 +0200
Issue #6778: Colorpicker (from Colors dockable) shows wrong color.
Actually our X11 implementation is right, and the implementation from
the Freedesktop portal is "as far as it can do", i.e. that we get the
returned RGB value, which is unfortunately in display space. And it
doesn't return any space information together (we don't even know which
display the color comes from, in multi-display setups).
Therefore let's check if we are running GIMP on X11 and if so, let's
call this implementation first.
See this report on xdg-desktop-portal to get proper space info:
https://github.com/flatpak/xdg-desktop-portal/issues/862
(cherry picked from commit 9b216885019d11de18cae74a6852e6dda2f9e80c)
Cherry-pick note: GIMP 2.10 on Linux will just run on X11 even inside
Wayland (XWayland) so there is no need to check anymore if we are
actually running on X11 with GDK_IS_X11_DISPLAY() (to be more accurate:
you can't on GDK 2!). So now if X11 is compiled in, we simply use the
default color-picking implementation and drop portal calls. As simple as
that.
libgimpwidgets/gimppickbutton.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/libgimpwidgets/gimppickbutton.c b/libgimpwidgets/gimppickbutton.c
index 175e54d956..34aa0f2db8 100644
--- a/libgimpwidgets/gimppickbutton.c
+++ b/libgimpwidgets/gimppickbutton.c
@@ -22,6 +22,10 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
+
#include "libgimpcolor/gimpcolor.h"
#include "gimpwidgetstypes.h"
@@ -140,6 +144,18 @@ gimp_pick_button_clicked (GtkButton *button)
{
#ifdef GDK_WINDOWING_QUARTZ
_gimp_pick_button_quartz_pick (GIMP_PICK_BUTTON (button));
+#elif defined GDK_WINDOWING_X11
+ /* It's a bit weird as we use the default pick code both in first and
+ * last cases. It's because when running GIMP on X11 in particular,
+ * the portals don't return color space information. So the returned
+ * color is in the display space, not in the current image space and
+ * we have no way to convert the data back (well if running on X11, we
+ * could still get a profile from the display, but if there are
+ * several displays, we can't know for sure where the color was picked
+ * from.).
+ * See: https://github.com/flatpak/xdg-desktop-portal/issues/862
+ */
+ _gimp_pick_button_default_pick (GIMP_PICK_BUTTON (button));
#else
if (_gimp_pick_button_xdg_available ())
_gimp_pick_button_xdg_pick (GIMP_PICK_BUTTON (button));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]