Bug 454068

Summary: [wayland] Black box appears under cursor when taking a screenshot of the window under the cursor
Product: [Plasma] kwin Reporter: indecisiveautomator
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: bugseforuns, kde, nate, p.r.worrall
Priority: NOR Keywords: regression
Version First Reported In: 5.24.90   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description indecisiveautomator 2022-05-20 02:47:03 UTC
SUMMARY
When taking a screenshot of the current window a black box will appear under the cursor the next time the cursor state changes. This behaviour is new in the Plasma 5.24.90 beta.

For example, taking a screenshot with the cursor inside a textbox where it is an IBeam, and then moving it outside of the textbox where it becomes a regular pointer again, will make a black box appear under the cursor. The inverse is true as well, taking a screenshot of the current window and then moving the mouse into a textbox where it will turn into an IBeam will put a black box under it. Moving the cursor back into this box or in general changing the cursor state will not remove the black box, it only goes away when a certain handful of actions are performed. For example, dragging a window's titlebar or holding the Alt and dragging a window will make it disappear, but it only disappears AFTER the left mouse button has been lifted. Activating an effect such as changing desktops, or toggling the Overview effect, will also remove the black box, but in the case of the Overview effect it is still present until either an element of the Overview effect is interacted with (such as a window, or the Virtual Desktop list, etc), or when the effect is cancelled. There are other various weird circumstances too where the box will disappear, such as opening an application from the Dashboard applications view, where the black box will disappear once the newly opened window is moused over.

Unfortunately I can't get a screenshot of this, as when trying to take a rectangle region screenshot the black box moves as I move the mouse cursor, and when taking a regular screenshot the black box is not visible I tried Active Window, Current Monitor, Entire Desktop, and Window Under Cursor. The black box does not show up in any of them.

This happens seemingly regardless of any settings. I tried toggling copying the screenshot to the clipboard and toggling capturing mouse cursor for example.

STEPS TO REPRODUCE
1. Take a screenshot of the current window
2. Move the mouse cursor around, for example in and out of a textbox
3. A black box will appear under the mouse cursor, drag a window using its titlebar or with the window dragging shortcut (for example holding Alt and left click)
4. Once the left mouse button is released, the black box should disappear


OBSERVED RESULT
Black box appears under mouse cursor when a single window screenshot is taken.


EXPECTED RESULT
No black box should appear under mouse cursor, consistent with behaviour in Plasma 5.24 and below.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.17.9-zen1-1
KDE Plasma Version: 5.24.90
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4

ADDITIONAL INFORMATION
Have not tried X11
Comment 1 Patrick Silva 2022-05-20 13:07:31 UTC
Noticed this bug yesterday on Wayland session of Plasma 5.25 beta, Arch Linux.
Comment 2 Nate Graham 2022-05-23 16:14:27 UTC
Can reproduce with "Window Under Cursor" mode
Comment 3 Vlad Zahorodnii 2022-05-24 08:01:36 UTC
Can't reproduce
Comment 4 Nate Graham 2022-05-24 14:36:35 UTC
So the way I can reproduce is as follows:
1. Open Spectacle
2. Change the dropdown to say "Window under cursor"
3. Click "Take New Screenshot"
3. Click on a window when prompted

The cursor shows a black square around it, and this black square remains visible until I move the cursor over Spectacle's main window.,
Comment 5 Vlad Zahorodnii 2022-05-25 09:03:30 UTC
(In reply to Nate Graham from comment #4)
> So the way I can reproduce is as follows:
> 1. Open Spectacle
> 2. Change the dropdown to say "Window under cursor"
> 3. Click "Take New Screenshot"
> 3. Click on a window when prompted
> 
> The cursor shows a black square around it, and this black square remains
> visible until I move the cursor over Spectacle's main window.,

Ack, can reproduce now
Comment 6 Bug Janitor Service 2022-05-25 09:04:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2466
Comment 7 Vlad Zahorodnii 2022-05-25 10:37:31 UTC
Git commit 960ad64eec852e8855bfb465a245bfbbf174fc9e by Vlad Zahorodnii.
Committed on 25/05/2022 at 10:37.
Pushed by vladz into branch 'Plasma/5.25'.

backends/drm: Specify clear color for cursor plane

Otherwise the results are undefined.
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2466>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2466>


(cherry picked from commit e57be93108fcb1f29b2b374613c2d08a174ef32c)

M  +2    -0    src/backends/drm/drm_output.cpp

https://invent.kde.org/plasma/kwin/commit/960ad64eec852e8855bfb465a245bfbbf174fc9e