Bug 479406 - The "Pick Screen Color" button is missing on Wayland session
Summary: The "Pick Screen Color" button is missing on Wayland session
Status: RESOLVED FIXED
Alias: None
Product: kcolorchooser
Classification: Applications
Component: general (show other bugs)
Version: 24.05.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL: https://bugreports.qt.io/browse/QTBUG...
Keywords: qt6, wayland
: 482810 487555 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-01-04 19:00 UTC by Petar Nedyalkov
Modified: 2024-05-26 11:56 UTC (History)
17 users (show)

See Also:
Latest Commit:
Version Fixed In: 24.05.1
Sentry Crash Report:


Attachments
Screenshot of KColorChooser with missing button. (263.91 KB, image/png)
2024-01-04 19:00 UTC, Petar Nedyalkov
Details
Screenshot of KColorChooser with missing button. (41.97 KB, image/png)
2024-03-19 03:04 UTC, sig
Details
KColorChooser vs Spectacle vs KColorSchemeEditor (350.01 KB, image/png)
2024-03-26 20:40 UTC, funny0facer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petar Nedyalkov 2024-01-04 19:00:54 UTC
Created attachment 164677 [details]
Screenshot of KColorChooser with missing button.

SUMMARY
The "Pick Screen Color" button is missing on Wayland session. It is displayed if we use 23.08.4 instead of 24.01.85

STEPS TO REPRODUCE
1. Launch KColorChooser on Wayland session
2. Observe the "Pick Screen Color" button 

OBSERVED RESULT
The "Pick Screen Color" button is missing on Wayland session

EXPECTED RESULT
The "Pick Screen Color" button is displayed on Wayland session

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20231228
KDE Plasma Version: 5.91.90
KDE Frameworks Version: 5.248.0
Qt Version: 6.6.1
Kernel Version: 6.6.7-1-default (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
The "Pick Screen Color" button is missing on KColorChooser 24.01.85 only.
Comment 1 Nicolas Fella 2024-01-13 22:34:08 UTC
This is https://bugreports.qt.io/browse/QTBUG-120957
Comment 2 Petar Nedyalkov 2024-01-16 13:47:08 UTC
Thank you for your update :)
Comment 3 Nate Graham 2024-01-30 20:51:03 UTC
The upstream bug report is now closed as "Cannot reproduce", and I see a "Pick Screen Color" button on my color picker dialog from KColorChooser and Kolourpaint. Did it get fixed along the way?
Comment 4 Petar Nedyalkov 2024-01-31 07:00:56 UTC
Hello Nate,
The button still missing in KColorChooser, but it appears on KolourPaint and KColorSchemeEditor. I'm using the following configuration:

Operating System: openSUSE Tumbleweed 20240128
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 5.249.0
Qt Version: 6.6.1

Here is a screenshot as evidence:
https://i.imgur.com/YQFdMOe.png
Comment 5 Eric Armbruster 2024-01-31 09:59:47 UTC
Can confirm. 

Operating System: Arch Linux 
KDE Plasma Version: 5.92.0
KDE Frameworks Version: 5.248.0
Qt Version: 6.7.0
Kernel Version: 6.7.1-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5700U with Radeon Graphics
Memory: 38.0 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: LENOVO
Product Name: 20Y7CTO1WW
System Version: ThinkPad E14 Gen 3
Comment 6 Aidan Harris 2024-01-31 11:13:02 UTC
For what it's worth this is still an issue in Gentoo too:
Operating System: Gentoo 2.14
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 5.249.0
Qt Version: 6.6.1 (dev-qt/qtbase-6.6.1-r4)
Graphics Platform: Wayland

I ended up patching out the check in qtbase to always return true:

/etc/portage/patches/dev-qt/qtbase-6.6.1/hack-enable-color-picking-everywhere.diff:

diff -Naur a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
--- a/src/widgets/dialogs/qcolordialog.cpp	2024-01-16 15:39:51.128220003 +0000
+++ b/src/widgets/dialogs/qcolordialog.cpp	2024-01-16 15:40:34.573643546 +0000
@@ -1901,9 +1901,7 @@
 
 bool QColorDialogPrivate::supportsColorPicking() const
 {
-    const auto integration = QGuiApplicationPrivate::platformIntegration();
-    return integration->hasCapability(QPlatformIntegration::ScreenWindowGrabbing)
-            || integration->services()->hasCapability(QPlatformServices::Capability::ColorPicking);
+    return true;
 }
 
 bool QColorDialogPrivate::canBeNativeDialog() const
Comment 7 Nicolas Fella 2024-03-08 08:46:23 UTC
*** Bug 482810 has been marked as a duplicate of this bug. ***
Comment 8 AlexDeLorenzo.dev 2024-03-17 07:33:45 UTC
Still an issue on:

Operating System: Arch 
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Graphics Platform: Wayland
Comment 9 sig 2024-03-19 03:04:30 UTC
Created attachment 167444 [details]
Screenshot of KColorChooser with missing button.
Comment 10 sig 2024-03-19 03:05:50 UTC
Comment on attachment 167444 [details]
Screenshot of KColorChooser with missing button.


Arch
extra/kcolorchooser 24.02.0-1
Plasma: 6.0.2
Comment 11 sig 2024-03-19 03:50:26 UTC
(In reply to Nicolas Fella from comment #1)
> This is https://bugreports.qt.io/browse/QTBUG-120957

This bug is still here, using the color chooser in Konversation which looks identical to kcolorchooser has the pick color dialog.
Comment 12 funny0facer 2024-03-26 20:40:28 UTC
Created attachment 167815 [details]
KColorChooser vs Spectacle vs KColorSchemeEditor

This still applies to 24.02.01 on my arch system.
where is the difference between the different color chooser applets? Why does KColorChooser behave different than e.g. KColorSchemeEditor?
The color chooser of Qt Designer works also perfectly fine and looks identical to me.
My qt6-wayland version is 6.6.2
Comment 13 Aidan Harris 2024-03-26 22:42:57 UTC
This is still an issue in 6.6.3

(In reply to funny0facer from comment #12)
> Created attachment 167815 [details]
> KColorChooser vs Spectacle vs KColorSchemeEditor
> 
> This still applies to 24.02.01 on my arch system.
> where is the difference between the different color chooser applets? Why
> does KColorChooser behave different than e.g. KColorSchemeEditor?

I think it's an issue with the Qt Platform theme or internal to Qt somewhere. When I patch Qt like I did here: https://bugs.kde.org/show_bug.cgi?id=479406#c6 it always works fine via the portal.

Something is returning false somewhere that should be returning true.
Comment 14 Gui Do 2024-04-04 17:02:00 UTC
Can confirm this - no way to choose color

Operating System: openSUSE Leap 15.5
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3
Kernel Version: 5.14.21-150500.55.52-default (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i3-7100U CPU @ 2.40GHz
Memory: 11.5 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 620
Comment 15 funny0facer 2024-04-13 08:00:16 UTC
Today,  I got the update to kcolorchooser 24.02.02.
The bug is still reproducible with Qt Version 6.7.0

Operating System: Arch Linux 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.7.0
Kernel Version: 6.8.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Comment 16 apache 2024-05-16 15:43:03 UTC
There is no such field as "pick color from screen"

Operating System: Manjaro Linux 
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 6.6.30-2-MANJARO (64-bit)
Graphics Platform: Wayland
Comment 17 Thomas Weißschuh 2024-05-18 10:16:00 UTC
This is a racecondition in QT. See https://bugreports.qt.io/browse/QTBUG-120957?focusedId=794902&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-794902


The following workaround in kcolorchooser works for me:
```
diff --git a/kcolorchooser.cpp b/kcolorchooser.cpp
index 97297071e07e..bd9c6ef6cf94 100644
--- a/kcolorchooser.cpp
+++ b/kcolorchooser.cpp
@@ -67,6 +67,9 @@ int main(int argc, char *argv[])
 
     QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kcolorchooser")));
 
+    /* Work around https://bugreports.qt.io/browse/QTBUG-120957 */
+    app.processEvents();
+
     QColorDialog dlg;
     dlg.setOption(QColorDialog::DontUseNativeDialog);
     QDialogButtonBox *box = dlg.findChild<QDialogButtonBox*>();
```
Comment 18 Thomas Weißschuh 2024-05-21 19:52:09 UTC
Git commit dace6c0d2b04b444b4e4a920450a7ed24b79cc30 by Thomas Weißschuh.
Committed on 21/05/2024 at 18:02.
Pushed by nicolasfella into branch 'master'.

Allow dbus processing in qt-base to enable color-picking via portal

qt-base uses dbus to query the desktop portal if color-picking is
supported, without explicitly waiting for the result.
kcolorchooser creates its QColorDialog before the response was processed
and therefore color picking via the portal is presumed to be
unavailable.

Give the eventloop the opportunity to process the event and only
afterwards create the QColorDialog.

See https://bugreports.qt.io/browse/QTBUG-120957

M  +3    -0    kcolorchooser.cpp

https://invent.kde.org/graphics/kcolorchooser/-/commit/dace6c0d2b04b444b4e4a920450a7ed24b79cc30
Comment 19 Nicolas Fella 2024-05-21 20:01:02 UTC
Git commit 7a03f1ccac935cb9c1a8e030a198d9267b0479f1 by Nicolas Fella, on behalf of Thomas Weißschuh.
Committed on 21/05/2024 at 20:00.
Pushed by nicolasfella into branch 'release/24.05'.

Allow dbus processing in qt-base to enable color-picking via portal

qt-base uses dbus to query the desktop portal if color-picking is
supported, without explicitly waiting for the result.
kcolorchooser creates its QColorDialog before the response was processed
and therefore color picking via the portal is presumed to be
unavailable.

Give the eventloop the opportunity to process the event and only
afterwards create the QColorDialog.

See https://bugreports.qt.io/browse/QTBUG-120957
(cherry picked from commit dace6c0d2b04b444b4e4a920450a7ed24b79cc30)

M  +3    -0    kcolorchooser.cpp

https://invent.kde.org/graphics/kcolorchooser/-/commit/7a03f1ccac935cb9c1a8e030a198d9267b0479f1
Comment 20 Antonio Rojas 2024-05-25 23:34:17 UTC
*** Bug 487555 has been marked as a duplicate of this bug. ***
Comment 21 funny0facer 2024-05-26 09:05:41 UTC
is there a state for "fixed, but not yet in a release"?