Created attachment 96318 [details] spectacle Fails where xfce-screenshooter Succeeds in capturing active window with drop-down menu Neither `spectacle` nor `xfce4-screenshooter` will launch while a drop-down menu is displayed, but `xfce4-screenshooter` will capture a window displaying a drop-down menu anyway if "Delay before capturing" is set to allow time to activate the drop-down menu to be captured. Unfortunately, `spectacle` fails to capture the drop-down menu even when a "Delay" is specified. The attached screenshot shows `spectacle` failing where `xfce4-screenshooter` succeeds. I first tried the capture with `spectacle`, then tried again with `xfce4-screenshooter`, and finally used `xfce4-screenshooter` to capture the whole screen including the window with the drop-down menu displayed. Also, this bug reporting form would not allow me to enter a version. I am using `spectacle 15.12.0`
You'll want to use Window Under Cursor for this, not Active Window.
(In reply to Boudhayan Gupta from comment #1) > You'll want to use Window Under Cursor for this, not Active Window. I just tried that, and got the same failed result.
This is strange, because I can't reproduce the issue. Are you trying to take a shot of a Qt4 application? The other thing I could ask you to try is to take a shot with the mouse cursor over some element in the menu rather than the menu button. If that works, I know how to update the algorithm to fix this.
I'm taking a shot of whatever it is that runs when you try to change wallpaper. Right-click desktop->Desktop Settings (Alt+D,Alt+S) I just tried moving the mouse pointer to one of the entries and it only showed the popup window without the active window that made the popup. For some strange reason, it also showed the entire Plasma panel, so the small popup window wasn't easy to even notice. Then, I switched from "under mouse" to "active window" and it failed the same as always, except that it didn't even show the mouse pointer.
I don't know why this would make a difference, but I am running the "Active Window Control" widget on the Plasma panel. Just a hunch, maybe try running that and see if you can reproduce this issue when trying to change Wallpaper. Also, I'm running plasma 5.5.2 on Arch Linux and was previously running Xfce4 4.12.3 so have all that installed along with Plasma. I installed a fairly minimal plasma 5.5.2 desktop.
I can reproduce this. The KCM is written in QtQuick; it seems like QtQuick pop-ups don't correctly set WM_TRANSIENT_FOR to point to the parent window, leading to the parent window being the Plasma Shell panel. I'm not sure how to fix this, so it won't be an immediate fix. Expect a fix by 16.04
Target 16.04 for fix.
I'm not sure that the Wallpaper plugin is the same as KCM. I just tried to capture the drop down menu on System Settings :: Application Style :: Widget Style, and it succeeded in capturing the popup menu without the entire plasma panel. However, it did not capture the active window either. I would consider it a bug anyway if the only way to ever capture the popup drop-down menu was to capture the window under the mouse. It should show up on full screen and active window captures as well. If there is a delay, then anything on the screen when the delay is up should be captured.
It won't show up on Active Window because Active Window is a very specific mode (in Linux, pop-up menus are separate (undecorated) windows in their own right). It does appear on Full Screen mode and the rest. I tested.
OK, you are right that it does show up on fullscreen. There is obviously a way to get around the way linux defines the drop down menu because xfce4-screenshooter is able to do it. I thought maybe taking a shot of a rectangular region would work, but it doesn't because it ignores the delay setting. Just now, i tried capturing the "Customize and Control your Google Chrome" drop down menu (3 horizontal lines menu) and it works the same as Widget Style did. I can capture the menu alone by capturing the window under the mouse, but there's no way to just capture the whole Google Chrome window including the drop down menu. This is definitely a shortcoming of spectacle when compared to other screenshot applications, and is not really related to a QtQuick bug.
Why not just use the window geometry to define the area to be captured and then capture everything in that area? Surely that's what's expected, not that it will capture the active window without stuff in front of it.
I had hacked together some bash scripts to record parts of the screen with ffmpeg and needed to get the (x,y) coordinates and also the w x h of the active window. Here is that bash code from genffcom in my https://github.com/colinkeenan/silentcast package: ``` aw=$(xdotool getactivewindow) eval $(xwininfo -id "$aw" | sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \ -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \ -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \ -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" ) if [ "$entire" = true ] then extents=$(xprop _NET_FRAME_EXTENTS -id "$aw" | grep "NET_FRAME_EXTENTS" | cut -d '=' -f 2 | tr -d ' ') bl=$(echo $extents | cut -d ',' -f 1) # width of left border br=$(echo $extents | cut -d ',' -f 2) # width of right border t=$(echo $extents | cut -d ',' -f 3) # height of title bar bb=$(echo $extents | cut -d ',' -f 4) # height of bottom border let x=$x-$bl let y=$y-$t let w=$w+$bl+$br let h=$h+$t+$bb fi ```
Getting the extents of the window and doing a manual crop would work if the cursor was over the menu widget button (since technically that's part of the parent window) but not if the cursor was over a menu item. The ideal solution needs to work for both cases; this is why I'd like to wait and think over this instead of rushing a fix. I'll also go over xfce4-screenshot's source.
The reason why the menu is hidden in the Qt4 app is because this menu has the WM_TRANSIENT_FOR property set (i.e. it is a transient "window"). The current code does not correctly handle the case where a window has transient windows. An attempt at fixing this: https://github.com/Lekensteyn/spectacle/commit/cb4648021298c3eb1c775a111d680c111183caa2 A possibly future patch could re-add the grabWindowUnderCursor fallback when it can be sure that there are no child transient windows. That could however cause some delay in obtaining the picture.
Git commit aab52c83ba70e9867632e83bd81715fc4405ffcf by Peter Wu. Committed on 13/10/2016 at 00:12. Pushed by peterwu into branch 'master'. Capture all windows for "Window under cursor" Capture the correct area, not just the top-left one (bug 369330). Capture all possible related windows, not just the top-level (or the non-transient background window), this will correctly capture whole applications including the open menus (bug 357223). The last change also affects how windows with other overlapping ones are captured, previously the hidden area is shown as if there was no popup. For example, Kate would be captured and not its Open dialog. Tested with Kate (Qt 5): Open File -> Add Places Entry -> Select Icon. Verify that clicking all of these menus show the same screenshot and that the non-overlapping parts are shown. Right-click to open a context menu, this is also captured on the delayed screenshot. Tested with heimdall-frontend and Hedgewars (Qt 4): open a menu, keep the cursor on it. Verify that the menu and window are captured. Do the same, but with the cursor outside the menu. REVIEW: 129163 Related: bug 369330 FIXED-IN: 16.12 M +37 -54 src/PlatformBackends/X11ImageGrabber.cpp M +1 -2 src/PlatformBackends/X11ImageGrabber.h http://commits.kde.org/spectacle/aab52c83ba70e9867632e83bd81715fc4405ffcf