Bug 454974

Summary: DBus method ColorPicker.pick fails to retrieve color (returns black)
Product: [Plasma] kwin Reporter: Christopher Bräuer <christopher.m.braeuer>
Component: effects-variousAssignee: ratijas <me>
Status: RESOLVED FIXED    
Severity: normal CC: christopher.m.braeuer, davestechshop, doncbugs, gerald.drissner, isma.af, kde, me, mmarreroleyva, nate, notfood.dev, pablo, postix, vmorenomarin
Priority: VHI Keywords: regression
Version: 5.24.90   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 5.24.7
Attachments: Color pick does not works when pick a color.
ColorPicker.pick not picking a color
Support Information
another kwin support info

Description Christopher Bräuer 2022-06-07 13:12:31 UTC
SUMMARY
If I use the color picker, it does not pick the color I pointed to. No color at all is picked.

STEPS TO REPRODUCE
1. Click on the applet.
2. Click somewhere on the screen.
3. Nothing happens.

OBSERVED RESULT
Nothing happens, no color is picked.

EXPECTED RESULT
Pick the color under mouse cursor.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
openSuSE Leap 15.3
KDE Plasma Version: 5.24.90
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
-
Comment 1 Víctor 2022-06-08 18:13:22 UTC
(In reply to Christopher Bräuer from comment #0)
> SUMMARY
> If I use the color picker, it does not pick the color I pointed to. No color
> at all is picked.
> 
> STEPS TO REPRODUCE
> 1. Click on the applet.
> 2. Click somewhere on the screen.
> 3. Nothing happens.
> 
> OBSERVED RESULT
> Nothing happens, no color is picked.
> 
> EXPECTED RESULT
> Pick the color under mouse cursor.
> 
> SOFTWARE/OS VERSIONS
> Linux/KDE Plasma: 
> openSuSE Leap 15.3
> KDE Plasma Version: 5.24.90
> KDE Frameworks Version: 5.94.0
> Qt Version: 5.15.2
> 
> ADDITIONAL INFORMATION
> -

Same here last week.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Testing Edition
KDE Plasma Version: 5.24.90
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.4
Kernel Version: 5.13.0-44-generic (64-bit)
Graphics Platform: X11
Comment 2 notfood.dev 2022-06-22 18:32:44 UTC
I experience the same. Downgrading fixes it even if it doesn't match Plasma version. I tried moving the old one to ~/.local/share/plasma/plasmoids without success.
Bug report in Arch: https://bugs.archlinux.org/task/75131

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
ArchLinux latest
KDE Plasma Version: 5.25.1
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.5
Comment 3 Antonio Rojas 2022-06-22 18:50:02 UTC
The only relevant change in 5.25 is https://invent.kde.org/plasma/kdeplasma-addons/-/commit/e03b5939c17454cded7df90b6bc2d50e2005e2b6

I can't reproduce this in any of my systems, but there are 3 reports from 3 different distros now.
Comment 4 Víctor 2022-06-22 20:03:19 UTC
Created attachment 150064 [details]
Color pick does not works when pick a color.
Comment 5 Ismael Asensio 2022-06-22 20:08:51 UTC
 (In reply to Antonio Rojas from comment #3)
> The only relevant change in 5.25 is
> https://invent.kde.org/plasma/kdeplasma-addons/-/commit/
> e03b5939c17454cded7df90b6bc2d50e2005e2b6
> 
> I can't reproduce this in any of my systems, but there are 3 reports from 3
> different distros now.

Yeah, that commit removed the specific deprecated code for X and ported it to the common dbus-based method.

User reports that `qdbus --literal org.kde.KWin /ColorPicker org.kde.kwin.ColorPicker.pick` does not launch the color-picking part (where the user should point to a pixel with the crosshair cursor), but it seems to timeout and return `[Argument: (u) 4278190080]`, translated to  `#ff000000`, that is black.

Moving this to kwin, as it will be easier to track down the root cause there. Information about monitor, graphics driver, etc, might be relevant here to know why this happens on some cases, as we cannot reproduce it.
Comment 6 Ismael Asensio 2022-06-22 20:10:49 UTC
Created attachment 150066 [details]
ColorPicker.pick not picking a color

Also attaching the relevant video from the Ark bug tracker here
Comment 7 notfood.dev 2022-06-23 04:53:58 UTC
(In reply to Ismael Asensio from comment #6)
> Created attachment 150066 [details]
> ColorPicker.pick not picking a color
> 
> Also attaching the relevant video from the Ark bug tracker here

It doesn't timeout. The video doesn't capture the cursor change but it switches to picker, the message `[Argument: (u) 4278190080]` appears after clicking.

Relevant information:
Monitor1: Samsung S22B300 1920x1080 60Hz 
Monitor2: CRT-0 1024x768
Video driver: Nvidia 515.48.07
Xorg Server: 1.21.1.3
Comment 8 Ismael Asensio 2022-06-23 05:45:23 UTC
(In reply to notfood.dev from comment #7)
> (In reply to Ismael Asensio from comment #6)
> > Created attachment 150066 [details]
> > ColorPicker.pick not picking a color
> > 
> > Also attaching the relevant video from the Ark bug tracker here
> 
> It doesn't timeout. The video doesn't capture the cursor change but it
> switches to picker, the message `[Argument: (u) 4278190080]` appears after
> clicking.
> 

Thanks for the clarification. Yeah, the video tricked me. 
This is useful information as we know then that the failing bit is the color retrieving from the screen.
Comment 9 Vlad Zahorodnii 2022-06-23 07:27:08 UTC
(In reply to Ismael Asensio from comment #5)
>  (In reply to Antonio Rojas from comment #3)
> > The only relevant change in 5.25 is
> > https://invent.kde.org/plasma/kdeplasma-addons/-/commit/
> > e03b5939c17454cded7df90b6bc2d50e2005e2b6
> > 
> > I can't reproduce this in any of my systems, but there are 3 reports from 3
> > different distros now.
> 
> Yeah, that commit removed the specific deprecated code for X and ported it
> to the common dbus-based method.
> 
> User reports that `qdbus --literal org.kde.KWin /ColorPicker
> org.kde.kwin.ColorPicker.pick` does not launch the color-picking part (where
> the user should point to a pixel with the crosshair cursor), but it seems to
> timeout and return `[Argument: (u) 4278190080]`, translated to  `#ff000000`,
> that is black.

The qdbus works for me both on Wayland and X11.

> Moving this to kwin, as it will be easier to track down the root cause
> there. Information about monitor, graphics driver, etc, might be relevant
> here to know why this happens on some cases, as we cannot reproduce it.
Comment 10 Vlad Zahorodnii 2022-06-23 07:27:23 UTC
The qdbus command*
Comment 11 Vlad Zahorodnii 2022-06-24 07:36:08 UTC
Can anybody who is able to reproduce this issue post the output `qdbus org.kde.KWin /KWin supportInformation`?
Comment 12 notfood.dev 2022-06-25 04:15:03 UTC
Created attachment 150134 [details]
Support Information

(In reply to Vlad Zahorodnii from comment #11)
> Can anybody who is able to reproduce this issue post the output `qdbus
> org.kde.KWin /KWin supportInformation`?

Attached
Comment 13 Antonio Rojas 2022-06-29 16:36:00 UTC
*** Bug 456114 has been marked as a duplicate of this bug. ***
Comment 14 Antonio Rojas 2022-07-15 18:45:50 UTC
*** Bug 456418 has been marked as a duplicate of this bug. ***
Comment 15 ratijas 2022-07-20 19:41:05 UTC
Created attachment 150776 [details]
another kwin support info

> Can anybody who is able to reproduce this issue post the output `qdbus org.kde.KWin /KWin supportInformation`?

For me the D-Bus method always returns the last color I successfully selected some time in past: #ff7f0000.
Comment 16 ratijas 2022-07-20 19:47:47 UTC
Meanwhile, Qt/KDE color dialog still works. It can be invoked by right clicking on the applet -> «Open Color Dialog». Picking screen color from a dialog works alright, and clicking OK button adds chosen color to the applet. However, subsequent D-Bus invocations still return the same #ff7f0000 color in console. And in the applet, trying to pick a color does nothing: when the history is empty no color is added as a result of picking at all.

    printf "#%x\n" $(qdbus --literal org.kde.KWin /ColorPicker org.kde.kwin.ColorPicker.pick | awk '{print $3+0}')
Comment 17 ratijas 2022-07-20 19:49:58 UTC
Forgot to add my system information.  Sorry for the spam.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE: git master
Qt Version: 5.15.5
Kernel Version: 5.18.12-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 970M/PCIe/SSE2
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: G752VT
System Version: 1.0
Comment 18 Bug Janitor Service 2022-07-22 16:08:00 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2702
Comment 19 Nate Graham 2022-07-22 20:03:15 UTC
Git commit df6331b60aa03e65f146e93d0229cdc6dc956bbd by Nate Graham, on behalf of ivan tkachenko.
Committed on 22/07/2022 at 19:51.
Pushed by ngraham into branch 'master'.

effects/colorpicker: Fix picking colors

Due to the wrong buffer format, the function failed with
GL_INVALID_OPERATION error, which was silently ignored by the effect.
It resulted in the constant phantom color being returned over and over
again.

Co-Authored-By: David Edmundson <kde@davidedmundson.co.uk>
FIXED-IN: 5.24.7, 5.25.4, 5.26

M  +2    -2    src/effects/colorpicker/colorpicker.cpp

https://invent.kde.org/plasma/kwin/commit/df6331b60aa03e65f146e93d0229cdc6dc956bbd
Comment 20 Nate Graham 2022-07-22 22:40:03 UTC
Git commit 420636a2a1300423212bda751097d267bd214d7d by Nate Graham, on behalf of ivan tkachenko.
Committed on 22/07/2022 at 22:39.
Pushed by ngraham into branch 'Plasma/5.25'.

effects/colorpicker: Fix picking colors

Due to the wrong buffer format, the function failed with
GL_INVALID_OPERATION error, which was silently ignored by the effect.
It resulted in the constant phantom color being returned over and over
again.

Co-Authored-By: David Edmundson <kde@davidedmundson.co.uk>
FIXED-IN: 5.24.7, 5.25.4, 5.26


(cherry picked from commit df6331b60aa03e65f146e93d0229cdc6dc956bbd)

M  +2    -2    src/effects/colorpicker/colorpicker.cpp

https://invent.kde.org/plasma/kwin/commit/420636a2a1300423212bda751097d267bd214d7d
Comment 21 Nate Graham 2022-07-22 23:15:04 UTC
Git commit aa5fc42349052d040f45aca40749edce80ff8f1f by Nate Graham, on behalf of ivan tkachenko.
Committed on 22/07/2022 at 22:41.
Pushed by ngraham into branch 'Plasma/5.24'.

effects/colorpicker: Fix picking colors

Due to the wrong buffer format, the function failed with
GL_INVALID_OPERATION error, which was silently ignored by the effect.
It resulted in the constant phantom color being returned over and over
again.

Co-Authored-By: David Edmundson <kde@davidedmundson.co.uk>
FIXED-IN: 5.24.7, 5.25.4, 5.26
(cherry picked from commit df6331b60aa03e65f146e93d0229cdc6dc956bbd)

M  +2    -2    src/effects/colorpicker/colorpicker.cpp

https://invent.kde.org/plasma/kwin/commit/aa5fc42349052d040f45aca40749edce80ff8f1f
Comment 22 Antonio Rojas 2022-07-30 21:04:32 UTC
*** Bug 457311 has been marked as a duplicate of this bug. ***
Comment 23 MountainX 2022-09-21 21:49:43 UTC
(In reply to Antonio Rojas from comment #22)
> *** Bug 457311 has been marked as a duplicate of this bug. ***

That bug says the result is "returns black". This bug appears to be different and not a duplicate. Furthermore, this bug is not resolved as of plasmashell 5.25.4 while that bug was marked as fixed in 5.24.7.
Comment 24 MountainX 2022-09-21 21:52:09 UTC
(In reply to MountainX from comment #23)
> (In reply to Antonio Rojas from comment #22)
> > *** Bug 457311 has been marked as a duplicate of this bug. ***
> 
> That bug says the result is "returns black". This bug appears to be
> different and not a duplicate. Furthermore, this bug is not resolved as of
> plasmashell 5.25.4 while that bug was marked as fixed in 5.24.7.

I apologize. I added this comment to the wrong bug. Will add it to 456418 where it belongs.