Bug 433530

Summary: Unable to take second screenshot under Wayland
Product: [Applications] Spectacle Reporter: phrxmd <philipp.reichmuth>
Component: GeneralAssignee: Boudhayan Gupta <me>
Status: RESOLVED WORKSFORME    
Severity: normal CC: flying-sheep, kde, openmail+kde
Priority: NOR    
Version First Reported In: 20.12.2   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description phrxmd 2021-02-24 11:45:01 UTC
SUMMARY
When trying to take a screenshot for the second time, even when Spectacle is closed, Spectacle reports "No screenshot can be taken. Please report this error here".

STEPS TO REPRODUCE
1. Use the Spectacle keyboard shortcut to take a (full screen) screenshot
2. Save the screen shot
3. Close Spectacle, or kill the Spectacle process
4. Use the Spectacle keyboard shortcut to take another (full screen) screenshot

OBSERVED RESULT
A notification box appears in the Spectacle window, telling me that no screenshot could be taken.
This happens regardless of whether I select full screen or rectangular area.

EXPECTED RESULT
A screenshot should be taken.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20210220
KDE Plasma Version: 5.21.0
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2
Kernel Version: 5.10.16-1-default
OS Type: 64-bit
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-8550U CPU @ 1.80GHz
Memory: 15.5 GiB of RAM
Graphics Processor: Mesa DRI Intel® UHD Graphics 620
Comment 1 Philipp A. 2021-03-06 16:53:00 UTC
Same problem. The console says:

    Error calling KWin DBus interface: "org.kde.kwin.Screenshot.Error.AlreadyTaking" "A screenshot is already been taken"


(the message) should probably be changed to “A screenshot is already *being* taken”
Comment 2 Philipp A. 2021-03-06 18:21:41 UTC
This happens when `bool KWin::ScreenShotEffect::isTakingScreenshot()` returns `true` when it shouldn’t:

https://invent.kde.org/plasma/kwin/-/blob/05811535d41203fde466a41fd2e05f4b9ce6c971/src/effects/screenshot/screenshot.cpp#L875-887

i.e. at least one of the following must be `true` when it shouldn’t:

• !m_scheduledGeometry.isNull()
• m_windowMode != WindowMode::NoCapture
• m_fd != -1
Comment 3 phrxmd 2021-11-09 08:30:05 UTC
Seems to be resolved now, as of 21.08.3 the problem no longer appears.