Bug 374864 - Using "Capture the current pop-up only" option causes Spectacle to disappear with compositing enabled
Summary: Using "Capture the current pop-up only" option causes Spectacle to disappear ...
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR major
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords:
: 381046 401891 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-01-10 12:14 UTC by Elias Probst
Modified: 2019-05-31 21:10 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.15.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elias Probst 2017-01-10 12:14:50 UTC
When using the "Capture the current pop-up only" option, Spectacle will simply disappear when using the "Take a New Screenshot" button and never show up again.

It doesn't matter whether there's a pop-up to capture shown or not.

Spectacle doesn't crash - the process is still there - it just won't do anything and its window stays hidden.

Spectacle from git/master 249505a804c
Qt 5.7.1
Comment 1 null 2018-01-31 14:29:33 UTC
I noticed this too with Spectacle 17.12.1 and Qt 5.10.1.

However, turning compositing off will capture something instead of getting stuck. Unfortunately it's not the area of the screen I was interested in.

See also Bug 371768.
Comment 2 Jack 2018-02-01 19:05:11 UTC
I'm seeing this with 17.08.3.  Haven't yet tried turning off compositing.
Comment 3 null 2018-02-13 23:00:10 UTC
*** Bug 381046 has been marked as a duplicate of this bug. ***
Comment 4 Patrick Silva 2018-02-20 15:13:01 UTC
Confirmed on Arch Linux, spectacle 17.12.2.
When compositing is off, spectacle takes an empty "screenshot" if cursor is on an pop-up (dolphin context menu, for example).
Comment 5 null 2018-02-20 15:23:57 UTC
> When compositing is off, spectacle takes an empty "screenshot"
That's tracked in Bug 390787.
Comment 6 Nate Graham 2018-03-09 17:41:42 UTC

*** This bug has been marked as a duplicate of bug 389694 ***
Comment 7 null 2018-03-09 17:50:17 UTC
> *** This bug has been marked as a duplicate of bug 389694 ***
Are you sure this is a duplicate?
- It works fine with the compositing/KWin code path.
- The other bug is about closing, here we don't even get a screenshot.
- The other bug is all about notifications, nothing we have here.
Comment 8 null 2018-03-09 17:51:17 UTC
> - It works fine with the compositing/KWin code path.
The other way round, of course.
Comment 9 Nate Graham 2018-03-09 18:05:46 UTC
I was thinking that the root cause is likely the same.
Comment 10 null 2018-03-09 18:10:41 UTC
Hmh, I think that's very unlikely. The issue in the other bug is that closing is delegated in a lambda to Plasma (!), and if Plasma fails to call back, Spectacle stays open forever. He we have a problem in getting an image from KWin, i.e. we are not even in the code path triggering the notification ("GUI mode").
Comment 11 Nate Graham 2019-02-07 14:54:42 UTC
*** Bug 401891 has been marked as a duplicate of this bug. ***
Comment 12 David Redondo 2019-03-04 17:16:01 UTC
I think the cause is that Spectacle calls org.kde.kwin.Screenshot.screenshotWindowUnderCursor and waits for the screenshotCreated signal which is never send by KWin. I manually called the method and also didn't see the signal in dbus-monitor. A quick fix is using screenshotForWindow as we already grab the Id of the window under the cursor. I don't know how reliable this is compared to the old approach but I was able to get a picture of only a right click menu.

diff --git a/src/PlatformBackends/X11ImageGrabber.cpp b/src/PlatformBackends/X11ImageGrabber.cpp
index 4fbb89f..dc5412d 100644
--- a/src/PlatformBackends/X11ImageGrabber.cpp
+++ b/src/PlatformBackends/X11ImageGrabber.cpp
@@ -585,7 +585,7 @@ void X11ImageGrabber::grabWindowUnderCursor()
             mask |= 1 << 1;
         }
 
-        interface.call(QStringLiteral("screenshotWindowUnderCursor"), mask);
+        interface.call(QStringLiteral("screenshotForWindow"), (quint64)windowUnderCursor, mask);
         return;
     }
Comment 13 Nate Graham 2019-03-05 19:33:24 UTC
That works very reliably for me. Very nice find. Would you like to submit the patch, David? :)
Comment 14 Kai Uwe Broulik 2019-03-05 22:00:59 UTC
Git commit 2ea6fc2abefd810915c38daee95fe31205ca741b by Kai Uwe Broulik.
Committed on 05/03/2019 at 21:59.
Pushed by broulik into branch 'Plasma/5.15'.

[effects/screenshot] Set m_windowMode in screenshotWindowUnderCursor
FIXED-IN: 5.15.3

Differential Revision: https://phabricator.kde.org/D19552

M  +1    -0    effects/screenshot/screenshot.cpp

https://commits.kde.org/kwin/2ea6fc2abefd810915c38daee95fe31205ca741b
Comment 15 Ben Klopfenstein 2019-05-31 20:46:58 UTC
The fix that was comitted only works for X11 - for wayland, this problem still exists.
Comment 16 Nate Graham 2019-05-31 21:10:27 UTC
Thanks. Can you file a new bug for that?