Ksnapshot captures its window if "Snapshot delay" is "No delay" and window hide effect is enabled

Bug #1252235 reported by kolen
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KDE Graphics
Fix Released
Medium
ksnapshot (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

* Set capture mode to "Freehand region"
* Set Snapshot delay to "No delay"
* Press "Take a New Snapshot"
* Ksnapshot window appears semi-transparent (and left on captured image)

Occurs when window hide animation is enabled (I have "Fade" effect enabled).

ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: ksnapshot 4:4.11.2-0ubuntu1
ProcVersionSignature: Ubuntu 3.11.0-14.21-generic 3.11.7
Uname: Linux 3.11.0-14-generic x86_64
ApportVersion: 2.12.5-0ubuntu2.1
Architecture: amd64
Date: Mon Nov 18 15:21:21 2013
ExecutablePath: /usr/bin/ksnapshot
InstallationDate: Installed on 2013-10-23 (26 days ago)
InstallationMedia: Ubuntu 13.10 "Saucy Salamander" - Release amd64 (20131016.1)
MarkForUpload: True
SourcePackage: ksnapshot
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
In , Thorsten Hirsch (t-hirsch) wrote :

Version: 4.7 (using KDE 4.7.0)
OS: Linux

Since KDE 4.7 ksnapshot captures itself.

Reproducible: Always

Steps to Reproduce:
1. run ksnapshot
2. select "rectangular region"
3. take a new snapshot
4. select a region that overlaps with the ksnapshot windows
5. return

Actual Results:
ksnapshot window is part of the screenshot

Expected Results:
ksnapshot window is not part of the screenshot

OpenGL effects might be needed to reproduce this bug.

Revision history for this message
In , Dario Andres (andresbajotierra) wrote :

[Comment from a bug report cleaner]
- Is this the same as bug 260725 ? Regards

Revision history for this message
In , Christoph-maxiom (christoph-maxiom) wrote :

The bugs are similar. Bug 260725 says the window hides, but because the screen isn't refreshed fast enough on a non-composited desktop, you are seeing gray holes.

This bug actually says the window doesn't hide (on a composited desktop), which means either the snapshot window really isn't hidden, or the compositor is faster generating the snapshot, than hiding the window. In the latter case, it would be a KWin bug.

Revision history for this message
In , Thorsten Hirsch (t-hirsch) wrote :

Hi,

the window turns 50% translucient. And also in the screenshot it is
captured 50% translucient. But it's not a matter of time, the window
doesn't hide completely when I wait longer.

Thorsten

Revision history for this message
In , JC (nothingness) wrote :

Created attachment 69316
It captures itself doing the Glide effect

Opensuse 12.1 64bit

Revision history for this message
In , JC (nothingness) wrote :
Revision history for this message
In , Rmatov101 (rmatov101) wrote :

Created attachment 79062
Image of Advanced tab in Desktop Efects settings.

Here it shows fadeout (translucent) at some level if desktop effect Fade is active. After disabling effect it works as expected.

It seems that is some timing issue.
When timeout is set to 1s it works every time with or without Fade effect.

This comment is prompted by:
http://lists.opensuse.org/opensuse-kde/2013-04/msg00045.html

Revision history for this message
In , Rmatov101 (rmatov101) wrote :

This is About section of Help:
KSnapshot
Version 0.8.2
Using KDE Development Platform 4.10.2 "release 556"

Revision history for this message
In , Rmatov101 (rmatov101) wrote :

To test is it issue as suggested in comment #2 I enabled Glide effect and ...
KSnapshot window was stuck on the screen halfway faded out and deformed.

In other words screenshot that is used to select part of the screen that should be copied to image is created before KSnapshot windows is moved out of the screen.

Revision history for this message
In , Christoph-maxiom (christoph-maxiom) wrote :

If hiding the KSnapshot window involves some animated effects, please increase the "Snapshot delay" value.

Revision history for this message
In , Mgraesslin (mgraesslin) wrote :

*** Bug 283006 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Mgraesslin (mgraesslin) wrote :

*** Bug 319961 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Christoph-maxiom (christoph-maxiom) wrote :

*** Bug 325693 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Mgraesslin (mgraesslin) wrote :

Suggestion: add an X11 property to the KSnapshot window which KWin uses to exclude the window from any close window animations.

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

Since we only repaint 60x a second this could still fail if the snapshot (just blits the framebuffer) is triggered before the next repaint (by the window unmapping)

After i figured that the screenshot effect just blits the framebuffer i first thought about rendering the scene to an offscreen target, omitting ksnapshot windows or window IDs, or disabling ksnapshot for painting, cause a full repaint, blit the framebuffer and then re-enable ksnapshot and cause a final paint.

But then i wondered what if somebody actually wanted to snap the disappearing ksnapshot (which is part of the scene when the snapshot is taken)

-> Maybe ksnapshot rather needs "No Delay"/"When KSnapshot window is hidden"/"1 sec"/2 sec"/...?
Where the "When KSnapshot window is hidden" entry requires the screenshot effect to be running.

The screenshot effect would then emit a dbus signal whenever the ksnapshot window is ::windowDeleted() and ksnapshot can take that to safely trigger a screenshot.

Revision history for this message
In , Christoph-maxiom (christoph-maxiom) wrote :

*** Bug 326204 has been marked as a duplicate of this bug. ***

Revision history for this message
kolen (incredible-angst) wrote :
Revision history for this message
In , kolen (incredible-angst) wrote :

Occurs for me always in 4.11.2 when using "Freehand region":

* Set capture mode to "Freehand region"
* Set Snapshot delay to "No delay"
* Press "Take a New Snapshot"
* Ksnapshot window appears semi-transparent (and left on captured image)

I have "Fade" window hiding effect enabled.

Changed in kdegraphics:
importance: Unknown → Medium
status: Unknown → New
Revision history for this message
In , Ezio Vergine (virgolus) wrote :

Same issue here, kde 4.11.3.
With fade effect active, ksnapshot window remain translucent and is grabbed in screen snapshot. If I disable fade effect or set to 1 second the snapshot timeout, it work fine.

Revision history for this message
In , ValdikSS (valdikss) wrote :

Please vote for this bug.

Revision history for this message
Harald Sitter (apachelogger) wrote :

Closing in favor of upstream report.

Changed in ksnapshot (Ubuntu):
status: New → Invalid
Revision history for this message
In , Mehran Kholdi (semekh) wrote :

Created attachment 83765
A workaround patch

A workaround that increases the waiting amount, just so that normal users aren't affected.

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

the fade effect runs 600ms at normal speed (non-linear, we're cheating because of another issue)

Revision history for this message
In , Kdebug8 (kdebug8) wrote :

Is this different to setting 1s delay?

Revision history for this message
In , ValdikSS (valdikss) wrote :

Dan Duris, well, yes, it's 0.5s delay.

Revision history for this message
In , Mehran Kholdi (semekh) wrote :

Ofcourse an extra 0.5s delay is better than a broken screenshot. A normal user won't do much of screenshots, but when he does, he wants it right, not fast!

Let's not think of this as the "fix", but the "workaround". Of course the appropriate way is to have callbacks, or basically avoid effects somehow.

Revision history for this message
In , Kdebug8 (kdebug8) wrote :

Mehran: makes sense. But still for the future, please think about the actual fix, not just the workaround.

I have resolved to use the 1s delay as a workaround myself, but as you said, it does not fix the actual problem and further slows me down working with the screenshots.

I disagree your statement about user not minding the delays. Think developers, graphics designers etc., people that are doing tons of screenshots, this would for sure slow them down a lot.

Revision history for this message
In , Mehran Kholdi (semekh) wrote :

Created attachment 83776
Fix the issue through setting blocking compositing

I'm not familiar with the KWin and related stuff, but this seems to be working fine.

Revision history for this message
In , Mgraesslin (mgraesslin) wrote :

> Fix the issue through setting blocking compositing
no! that's a very bad idea! I'm using ksnapshot quite a lot to capture desktop
effects.

for general information: I'm going to work on ksnapshot starting tomorrow. It
wants an XCB and Qt 5 port. Let's see whether I can also add a proper solution
to this longstanding issue.

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

hotfix:
https://git.reviewboard.kde.org/r/114146/

Random note, "KWindowSystem::compositingActive()" only tests whether *some* compositor (xcompmgr, mutter, e17 ...) is running - not that kwin is running.

With the hotfix there's no need to wait a lot for kwin (test for the screenshot effect dbus interface), but for other compositors you want to wait for a second anyway (eg. explosion or burn effects take quite some time)

@Mehran
You'll completely loose the ability to shoot occluded/translucent/shadowed windows by that approach and it's equal to simply pressing "Shift+Alt+F12" to take the screenshot.
Also one could add a window rule for that purpose.

Revision history for this message
In , Mgraesslin (mgraesslin) wrote :

@Thomas: I have a new idea. When we destroy the Deleted we send a client message to the window. In KSnapshot we add an x11 event filter and delay the snapshot till we got the client message.

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

(In reply to comment #28)
> When we destroy the Deleted we send a client
> message to the window.
Which is not generally supposed to be there or still the drawable that it was when it was unmaped (re-used. i think mozilla apps do that)

> In KSnapshot we add an x11 event filter and delay the
> snapshot till we got the client message.

Some close effects can take a fairly long time (explode and stuff like that), ie. we'd considerably slow down screenshot taking, basically forcing a delay while it seems (see comment #24) that the appreciated feature was to have the unwanted ksnapshot dialog vanish as fast as possible.

IMO this either needs async or a 2 step processing.
for the latter ksnapshot would send a sync dbus command to the effect to prepare it for taking control over the window and when that's done, close the window - which the effect now forces down immediately - and call the effect for the snapshot, what will also cause the effect to release control over the dialog.

Revision history for this message
In , Christoph-maxiom (christoph-maxiom) wrote :

*** Bug 329167 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Christoph-maxiom (christoph-maxiom) wrote :

*** Bug 320400 has been marked as a duplicate of this bug. ***

Revision history for this message
In , bastii (me-l-dot) wrote :

This behaviour is irritating me as well. I would like to have the pleasant fade-out animation, but the default 'normal' animation speed is too slow in most cases.

As Thomas Lübking pointed out, disappearing ksnapshot might be the object of interest.
However, in most cases it is not.

How about making this optional?
+ By default ksnapshot avoids capturing itself, such that people don't get annoyed by repeatedly moving the window out of the way to take a snap (because it does return to the center of the screen after taking a snapshot).

+ An option in the window allows to disable this exceptional behavior.

Let me propose a simple (?) way of not capturing ksnapshot window:
Temporarily move the window outside the capture region/screen/desktop,
then restore the position after the capture.

Revision history for this message
In , Mgraesslin (mgraesslin) wrote :

I started to work on tackling this problem. KWin part is prepared: https://git.reviewboard.kde.org/r/115288/

At the moment I'm targeting the KWin 5 only. Depending on when we get the support into KSnapshot I will be tempted to backport to 4.11. It's not largely invasive and only conflicts in atoms.(h|cpp) (I expect).

Revision history for this message
In , Plooges (plooges) wrote :

May be this is not good solution, but works fine on my system.

It is necessary to make a few changes in ksnapashot.cpp.
Add header unistd.h:
ksnapashot.cpp:29
#include <unistd.h>
And set delay to give time for 3d effects to finish the job:
ksnapashot.cpp:405
void KSnapshot::startUndelayedGrab()
{
    if (mode() == Region) {
        usleep(140000); // 0.14 sec delay for fix bug 279615.
        grabRegion();
    }
    else if ( mode() == FreeRegion ) {
        usleep(140000); // 0.14 sec delay for fix bug 279615.
        grabFreeRegion();
    }
    else {
        grabber->show();
        grabber->grabMouse(Qt::CrossCursor);
    }
}
If 3d effects enabled 0.14 seconds not visible for users.
But, theoretically, this delay may irritate users which disabled 3d effects and for which capture start delay is critical. (For example, when capturing the movie)
I tried to capture film with disabled 3d effects with delay 0.14 sec and without delay and didn't see the difference.

I don't know how it works in different systems with different 3D effect settings but in my system work fine, with this changes.
Debian GNU/Linux jessie/sid
KDE 4.11.5
X.Org X Server 1.14.5

Revision history for this message
In , Richard Moore (rich-kde) wrote :

@Aleksei I'm afraid messing around with timers is not a valid approach (the timings vary too much with differing setups). Martin is working on a new feature for kwin that will allow this to be solved properly (and I believe plans to backport it to KDE 4).

Revision history for this message
In , Mgraesslin (mgraesslin) wrote :

Git commit 41c77675e6bb0bbb4b50c121f8c81799fa2e411b by Martin Gräßlin.
Committed on 24/01/2014 at 11:34.
Pushed by graesslin into branch 'KDE/4.11'.

Allow windows to specify that they should not get animated on window close

By setting the X property _KDE_NET_WM_SKIP_CLOSE_ANIMATION to 1 a window
can request to be excluded from any close animation. This property is
read in Toplevel, so that it is available to both Client and Unmanaged.

If the window has this property set the Scene suppresses the paintWindow
loop of the Deleted. Thus no effect needs to be adjusted. But an effect
using drawWindow directly would still be able to render the Deleted as
there is no suppression.

Furthermore the property is passed to the EffectWindow so that an
Effect can make use of this functionality and not start the animation
in the first place.

REVIEW: 115288

Backported from 9497b4ddb681ac50dbe9c015e05a3f12fd496da8

M +3 -0 kwin/atoms.cpp
M +1 -0 kwin/atoms.h
M +2 -0 kwin/events.cpp
M +1 -0 kwin/libkwineffects/kwineffects.cpp
M +12 -0 kwin/libkwineffects/kwineffects.h
M +1 -0 kwin/manage.cpp
M +4 -0 kwin/scene.cpp
M +30 -0 kwin/toplevel.cpp
M +12 -0 kwin/toplevel.h
M +1 -0 kwin/unmanaged.cpp

http://commits.kde.org/kde-workspace/41c77675e6bb0bbb4b50c121f8c81799fa2e411b

Revision history for this message
In , Mgraesslin (mgraesslin) wrote :

Change for KSnapshot prepared: https://git.reviewboard.kde.org/r/115350/

If timing works fine we will have this fixed in the combined release of 4.11.6 and 4.12.2 on February 4.

Revision history for this message
In , Mgraesslin (mgraesslin) wrote :

Git commit 2d7d4545b4c7961970a28aabfc0d61cdb6af6c5f by Martin Gräßlin.
Committed on 28/01/2014 at 08:04.
Pushed by graesslin into branch 'KDE/4.12'.

Set window property to not animate KSnapshot's window on close

Starting with KWin 4.11.6 [1] there is a hint to exclude a window from
the closing animation. KSnapshot can use this to ensure that it doesn't
capture itself. With other compositors (e.g. Compiz) KSnapshot is most
likely still capturing itself. There is nothing KSnapshot can do about
it. Of course affected users are invited to point the developers of
other compositors to this commit and suggest to implement the KWin
specific hint.
FIXED-IN: 4.12.2
REVIEW: 115350

[1] http://commits.kde.org/kde-workspace/41c77675e6bb0bbb4b50c121f8c81799fa2e411b

M +11 -0 ksnapshot.cpp

http://commits.kde.org/ksnapshot/2d7d4545b4c7961970a28aabfc0d61cdb6af6c5f

Changed in kdegraphics:
status: New → Fix Released
Revision history for this message
In , Graham P Davis (hacker-scarlet-jade) wrote :

Created attachment 85303
snapshot of Claws display showing greyed-out area where ksnapshot area had been.

I'm using version 0.8.2 of ksnapshot on KDE 4.12.2, openSUSE 13.1. I'm getting grey ghosts of the ksnapshot dialogue window unless I select a 1 second delay. Desktop effects are disabled. This morning, I've noticed that this seems to occur when taking snapshots of Claws but not of Dolphin and Firefox. Existence of the ghost switches on and off with each snapshot so that 1,3,5, are clear but 2,4,6, have the ghost.

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

You're very much likely not using a compositor (if you do, you can skip reading here), thus claws has to repaint the area that is exposed by the ksnapshot withdrawal and it apparently needs "some time" for this (more that the few ms that ksnapshot afair delays anyway)

-> try with another GTK+ style (they do largely differ in their repaint speed), but it could also just be claws itself.

Revision history for this message
In , Christian González (droetker) wrote :

*** Bug 260725 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Sb (sb56637) wrote :

Please re-open this bug, which is present in 0.8.2 in KDE 4.14.1 in openSUSE 13.2.

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

That would imply that ksnapshot issues the shot before having (successfully) closed the window.
That would hoever be very weird, since you'd need to click to trigger the shot unless there's a minimum of 1s delay.

KSnapshot still disappears immediately and w/o delay or animation when triggering a screenshot here.

Revision history for this message
In , Sb (sb56637) wrote :

Created attachment 89230
ksnapshot (0.8.2, KDE 4.14.1) captures itself, including the save dialog

Revision history for this message
In , Mgraesslin (mgraesslin) wrote :

(In reply to S from comment #44)
> Created attachment 89230 [details]
> ksnapshot (0.8.2, KDE 4.14.1) captures itself, including the save dialog

but that's a different instance, isn't it?

Revision history for this message
In , Sb (sb56637) wrote :

Nope, when I(In reply to Martin Gräßlin from comment #45)
> (In reply to S from comment #44)
> > Created attachment 89230 [details]
> > ksnapshot (0.8.2, KDE 4.14.1) captures itself, including the save dialog
>
> but that's a different instance, isn't it?

Nope, when I first save the fullscreen with no delay, ksnapshot's window is included. Then, to make matters worse, when I go to save it, it captures the save window too, as if it was taking another screen capture when hitting the save button. Really weird.

Revision history for this message
In , Sb (sb56637) wrote :

> ...when I first save the fullscreen with no delay...

Sorry, I should have said "when I first CAPTURE the fullscreen with no delay"

Revision history for this message
In , Volkan Gezer (volkangezer) wrote :

Can you reproduce this using Oxygen theme? It seems you are using Plastic.

Revision history for this message
In , Sb (sb56637) wrote :

Created attachment 89236
ksnapshot (0.8.2, KDE 4.14.1) captures itself, including the save dialog, Oxygen style

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

Can you please explain how you take a snapshot of the ksnapshot save dialog if the ksnapshot that shoots the save dialog of ksnapshot is not another ksnapshot than the ksnapshot with the save dialog that you shot?

IOW, your illustrative shots contain a ksnapshot window w/ a modal dialog.
The ksnapshot window seen there (that w/ the modal dialog) is CERTAINLY not what made the snapshot (it cannot be used to take the snapshot since that's currently prevented by the modal dialog)

The first screenshot also contains a ksnapshot window w/ "snapshot5.png" being the titlebar, while the one with the modal dialog is entitled "snapshot2.png" what makes me assume that there're actually three ksnapshot windows invoked (snapshot2 shooting snapshot5 and a third variant shooting snapshot2)

-> Can you please describe *precisely* what you're trying to do and what you expect?

Revision history for this message
In , Sb (sb56637) wrote :

I know that this behavior doesn't make any sense. However, I assure you that I am not confused. :)

1. Open Ksnapshot (via menu or PrintScreen key)
2. When Ksnapshot appears, its preview of the full screen capture includes its own Ksnapshot window.
     2.1 Ksnapshot should capture the whole screen, but automatically hide itself first before capturing.
3. Click "Save As" in Ksnapshot, save as ~/Desktop/snapshot1.png
4. Open ~/Desktop/snapshot1.png in an image viewer. The saved image not only shows the Ksnapshot window, but now on top it even shows the save dialog that I used to save snapshot1.png.
    4.1 Ksnapshot should save whatever it captured and showed me in the preview before I saved it. It definitely should not be re-capturing the screen upon clicking "Save As".

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

[I cannot reproduce this, however]
Actually, ksnapshot should take the screenshot before mapping any window.
Together with the "shoots on save", this however sonds a bit like ksnapshot would trigger continuous shots.

"kcmshell4 kwincompositing" - is the "screenshot" effect enabled?

Revision history for this message
In , Sb (sb56637) wrote :

(In reply to Thomas Lübking from comment #52)
> "kcmshell4 kwincompositing" - is the "screenshot" effect enabled?

Yes it is. Should it be?
This is a new installation of openSUSE 13.2 RC1, I didn't mess with any settings except the QT theme.

Revision history for this message
In , Sb (sb56637) wrote :

Created attachment 89239
ksnapshot (0.8.2, KDE 4.14.1) Screenshots

Here are some "old fashioned" screen shots of the process. And snapshot1.jpg is the final product.

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

(In reply to S from comment #53)
> Yes it is. Should it be?
Yes, but please try turning it off - we need to figure whether ksnapshot keeps requesting shots or the kwin effect keeps saving them.

Revision history for this message
In , Sb (sb56637) wrote :

(In reply to Thomas Lübking from comment #55)
> (In reply to S from comment #53)
> > Yes it is. Should it be?
> Yes, but please try turning it off - we need to figure whether ksnapshot
> keeps requesting shots or the kwin effect keeps saving them.

Done. It still behaves the same, though.

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

KWin's off the hook then and that very particular copy of ksnapshot (0.8.2 on 4.14.2 here) seems to take screenshots continuously.
That's not related to this very bug but a fresh and new one.
(This bug played on the animations when showing/hiding ksnapshot what cause ghosts of it to remain on the screenshot)

Revision history for this message
In , Sb (sb56637) wrote :

Thanks Thomas for looking into it. Do I create a new bug then?

Revision history for this message
In , Thomas-luebking (thomas-luebking) wrote :

Yes.
Please notice that I only _assume_ that ksnapshot shoots continuously (4 times would be sufficient for the behavior as well)

Revision history for this message
In , Sb (sb56637) wrote :

I created bug #340202

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.