Bug 432260 - Spectacle fails to create rectangular and active window screenshots on Wayland with multiple screens
Summary: Spectacle fails to create rectangular and active window screenshots on Waylan...
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: VHI normal
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords: wayland
: 432751 433213 433289 433547 434127 435556 436196 437137 437312 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-01-28 19:06 UTC by Claudius Ellsel
Modified: 2022-06-23 08:54 UTC (History)
19 users (show)

See Also:
Latest Commit:
Version Fixed In: Plasma 5.22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Claudius Ellsel 2021-01-28 19:06:50 UTC
SUMMARY
When I want to create a rectangular screenshot I get an error message.

STEPS TO REPRODUCE
1. Launch Spectacle
2. Select the "rectangular area" mode from the dropdown
3. Click the button to create a new screenshot

OBSERVED RESULT
An error message is displayed

EXPECTED RESULT
The mode for rectangular screenshots is launched


Happens on Wayland, will also test on X11. This might be a regression.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20210127
KDE Plasma Version: 5.20.90
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
Kernel Version: 5.10.9-1-default
OS Type: 64-bit
Processors: 4 × Intel® Xeon® CPU E3-1225 v3 @ 3.20GHz
Memory: 11.6 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics P4600/P4700
Comment 1 Claudius Ellsel 2021-01-28 19:10:05 UTC
Wayland only, X11 is fine. Setting keyword.
Comment 2 Andrey 2021-01-28 20:46:44 UTC
What's in the error message?
Also you could try to run in from terminal to see more prompt output.
Comment 3 Méven Car 2021-01-30 09:00:54 UTC
Where you using multiple screens ?
What is the version of spectacle used ?
Comment 4 Claudius Ellsel 2021-01-30 16:50:31 UTC
(In reply to Andrey from comment #2)
> What's in the error message?
> Also you could try to run in from terminal to see more prompt output.

Basically it just says that it cannot take a screenshot. I did not find an easy way to screenshot that window, as it is Spectacle and usually not wanted on Screenshots.

Running from terminal was a good idea. It gives the following error message when trying to create a rectangular screenshot:
`Error calling KWin DBus interface: "org.kde.kwin.Screenshot.Error.ScreenMissing" "Screen not found"`

(In reply to Méven Car from comment #3)
> Where you using multiple screens ?
> What is the version of spectacle used ?

Yes, I am using multiple screens.

Version of Spectacle used is 20.12.1
Comment 5 Claudius Ellsel 2021-01-30 16:54:11 UTC
This seems to be unrelated to multiple screens (at least I got the same error in the terminal after deactivating my second monitor in KScreen).
Comment 6 Méven Car 2021-01-31 07:02:33 UTC
Relates to https://bugs.kde.org/show_bug.cgi?id=430869

Could you run `kscreen-doctor -o`

The issue is somehow KWin screens names are different from QApplication::screens()

As KWin responded `Error calling KWin DBus interface: "org.kde.kwin.Screenshot.Error.ScreenMissing" "Screen not found"`

I haven't been able to reproduce so far making any investigation limited.
Comment 7 Claudius Ellsel 2021-01-31 13:40:41 UTC
(In reply to Méven Car from comment #6)
> Could you run `kscreen-doctor -o`

This gives:
Output: 33 XWAYLAND0 enabled connected  Unknown Modes: 36:2560x1440@60*! Geometry: 1080,240 2560x1440 Scale: 1 Rotation: 1 
Output: 35 XWAYLAND1 enabled connected  Unknown Modes: 37:1920x1080@60*! Geometry: 0,0 1080x1920 Scale: 1 Rotation: 8

> The issue is somehow KWin screens names are different from
> QApplication::screens()

Hm. That might have been caused by me running multiple screens. I also switch between X11 and Wayland sessions which might introduce further problems (for example when switching from Wayland to X11 I have to correct the screen orientation of my vertical screen due to a different issue and also X11 currently always makes that one primary). Might not be related at all, though.
Comment 8 Andrey 2021-02-10 20:07:34 UTC
*** Bug 432751 has been marked as a duplicate of this bug. ***
Comment 9 Nate Graham 2021-02-10 20:41:58 UTC
I'm seeing this with only a single screen. Trying to do a rectangular region screenshot fails and produces the following console output:

t.qpa.wayland: Wayland does not support QWindow::requestActivate()
Error calling KWin DBus interface: "org.kde.kwin.Screenshot.Error.ScreenMissing" "Screen not found"
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
Comment 10 Nate Graham 2021-02-21 23:34:17 UTC
*** Bug 433213 has been marked as a duplicate of this bug. ***
Comment 11 Nate Graham 2021-02-22 00:16:28 UTC
Méven or David, could I ask one of you to take a look? thanks!
Comment 12 David Redondo 2021-02-22 07:38:16 UTC
I think Meven has more knowledge here
Comment 13 Nate Graham 2021-02-22 23:49:08 UTC
*** Bug 433289 has been marked as a duplicate of this bug. ***
Comment 14 Alois Wohlschlager 2021-02-24 20:26:21 UTC
*** Bug 433547 has been marked as a duplicate of this bug. ***
Comment 15 Luiz Angelo De Luca 2021-02-24 21:17:02 UTC
If it helps, here is my screen info:

$ kscreen-doctor -o
Output: 33 XWAYLAND0 enabled connected  Unknown Modes: 34:1920x1080@60*! Geometry: 0,0 1920x1080 Scale: 1 Rotation: 1 

I get the same error msg when I launch from a terminal.
Comment 16 Alex 2021-02-26 05:35:30 UTC
I'm unable to reproduce this at all, rectangular region and active window screenshots work fine for me. Running spectacle in the terminal, the only message I get when initiating any screenshot, including rectangular region, is:

qt.qpa.wayland: Wayland does not support QWindow::requestActivate()

I am on Plasma 5.21.1, Spectacle 20.12.2, Frameworks 5.79.0, Qt 5.12.2, Fedora 34.
Comment 17 Luiz Angelo De Luca 2021-02-26 19:04:08 UTC
Is it possible that it happens only with opensuse tumbleweed?
Comment 18 Dan Dascalescu 2021-03-01 08:14:55 UTC
I can't repro this in KDE neon 5.21.1 (single-screen).
Comment 19 Méven Car 2021-03-01 09:22:14 UTC
This bug only concerns multiple screens setups.
Comment 20 Méven Car 2021-03-01 09:24:41 UTC
(In reply to Méven Car from comment #19)
> This bug only concerns multiple screens setups.

I should say mostly, Nate do you still reproduce this ?

This patch could help this:
https://invent.kde.org/plasma/kwin/-/merge_requests/692/diffs
Comment 21 Dan Dascalescu 2021-03-01 10:56:08 UTC
I've connected my laptop to an external monitor and still can't reproduce this. I can take rectangular region screenshots. (There are other usability issues there, like the screenshot not being copied to the clipboard after I press Enter, but those seem like different bugs).
Comment 22 Nate Graham 2021-03-04 18:51:52 UTC
Yes, I can still reproduce this issue with a single screen with current git master, including the merged MR https://invent.kde.org/plasma/kwin/-/merge_requests/692
Comment 23 2wxsy58236r3 2021-03-08 06:38:32 UTC
*** Bug 434127 has been marked as a duplicate of this bug. ***
Comment 24 Vlad Zahorodnii 2021-03-09 11:16:46 UTC
Can you check if https://invent.kde.org/plasma/kwin/-/merge_requests/742 has fixed this issue?
Comment 25 Nate Graham 2021-03-09 17:50:58 UTC
I can confirm that it's fixed, hooray! I don't suppose that merge request is backportable? It looks pretty huge. But on the other hand it would be a shame to have this functionality broken for all of Plasma 5.21. Are there any targeted fixes we could apply?
Comment 26 Andrés B.S. 2021-03-13 18:46:25 UTC
Not sure what the connection between this and the issue is, but I found out that the bug can be worked-around by launching spectacle as:
QT_QPA_PLATFORM=wayland spectacle

On Wayland, it seems to prefer xcb. Rectangular selection was working on the XOrg session.

What I found out too, is that Spectacle itself would be part of the screenshot when doing rectangular selection, it would be sometimes caught in the middle of the animation (IIRC the effect is called "Scale").

Also, just a reminder that we currently have two Wayland sessions for openSUSE:
"Full Wayland" forces QT_QPA_PLATFORM=GDK_BACKEND=wayland, while the "Wayland" session doesn't touch QT_QPA_PLATFORM. This issue does not happen on the Full Wayland for the reason mentioned above.
Comment 27 Nate Graham 2021-04-09 19:44:56 UTC
*** Bug 435556 has been marked as a duplicate of this bug. ***
Comment 28 Nate Graham 2021-04-27 19:21:25 UTC
*** Bug 436218 has been marked as a duplicate of this bug. ***
Comment 29 Nate Graham 2021-04-28 16:23:38 UTC
*** Bug 436196 has been marked as a duplicate of this bug. ***
Comment 30 Luiz Angelo De Luca 2021-04-28 17:30:14 UTC
(In reply to Andrés B.S. from comment #26)
> Not sure what the connection between this and the issue is, but I found out
> that the bug can be worked-around by launching spectacle as:
> QT_QPA_PLATFORM=wayland spectacle
> 
> On Wayland, it seems to prefer xcb. Rectangular selection was working on the
> XOrg session.
> 
> What I found out too, is that Spectacle itself would be part of the
> screenshot when doing rectangular selection, it would be sometimes caught in
> the middle of the animation (IIRC the effect is called "Scale").
> 
> Also, just a reminder that we currently have two Wayland sessions for
> openSUSE:
> "Full Wayland" forces QT_QPA_PLATFORM=GDK_BACKEND=wayland, while the
> "Wayland" session doesn't touch QT_QPA_PLATFORM. This issue does not happen
> on the Full Wayland for the reason mentioned above.

If someone wants to use the workaround but keep it working in X11 as well, I suggest:

  QT_QPA_PLATFORM="wayland;xcb" spectacle

Or as an argument:

 spectacle -platform 'wayland;xcb'

The argument should be suitable for .desktop files. However, changing org.kde.spectacle.desktop gets kwin angry:

 spectacle[16738]: Error calling KWin DBus interface: "org.kde.kwin.Screenshot.Error.NoAuthorized" "The process is not authorized to take a screenshot"
Comment 31 Nate Graham 2021-05-18 20:55:29 UTC
*** Bug 437137 has been marked as a duplicate of this bug. ***
Comment 32 Nate Graham 2021-05-19 02:05:09 UTC
*** Bug 437312 has been marked as a duplicate of this bug. ***
Comment 33 Murdo Maclachlan 2022-06-23 08:54:24 UTC
I noticed this bug is marked resolved, however I still get this issue on Wayland with Plasma 5.25 (Slackware Current).

The workaround "QT_QPA_PLATFORM=wayland spectacle" does work for me (interestingly, "spectacle -platform 'wayland;xcb'" did not work), but a workaround isn't a fix.

Additionally, when running with the workaround in console, the output gives the following complaint: "qt.qpa.wayland: Wayland does not support QWindow::requestActivate()". I don't know enough about Wayland or Qt to know if that's related, though.