Bug 9357 - Taking screenshots of the invidual window fails to capture window decorators
Summary: Taking screenshots of the invidual window fails to capture window decorators
Status: RESOLVED NOTOURBUG
Alias: None
Product: xorg
Classification: Unclassified
Component: App/compiz (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: David Reveman
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-15 22:56 UTC by Corey Burger
Modified: 2007-01-28 06:11 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Corey Burger 2006-12-15 22:56:17 UTC
stock feisty, stock compiz, stock xorg. Taking screenshots with alt-sctreenshot
with gnome-screenshot fails to capture the window decorators.

Filed at https://bugs.launchpad.net/distros/ubuntu/+source/compiz/+bug/74008
Comment 1 David Reveman 2006-12-19 06:58:24 UTC
That's because gnome-screenshot assumes that the window manager is reparenting
client windows into frame windows. Compiz doesn't do that.

This is not a compiz bug. gnome-screenshot and other screenshot utilities that
make the same assumption should be fixed.
Comment 2 Corey Burger 2006-12-19 23:19:30 UTC
Filed in bugzilla.g.o
Comment 3 Emmanuele Bassi 2006-12-29 11:29:28 UTC
from the bug on bugzilla.g.o:

gnome-screenshot does not assume anything: the window border are included only
if the "include-border" GConf key is set to TRUE, or command line argument is
given.

the problem is that the common path used by the include-border option doesn't
seem to work with compiz, so "include-border" is not honoured.

gnome-screenshot tries to find the current window using the _NET_ACTIVE_WINDOW
X property and then, if 'include-border' is set to TRUE, it walks back the
window chain until it finds the window frame.

I don't know why compiz doesn't do the reparenting, and neither understand why
it can't behave like every other window manager; if compiz authors wish to
share how gnome-screenshot should fix this misbehaviour, I'm all ears.
Comment 4 David Reveman 2006-12-29 14:05:24 UTC
(In reply to comment #3)
> from the bug on bugzilla.g.o:
> 
> gnome-screenshot does not assume anything: the window border are included only
> if the "include-border" GConf key is set to TRUE, or command line argument is
> given.
> 
> the problem is that the common path used by the include-border option doesn't
> seem to work with compiz, so "include-border" is not honoured.
> 
> gnome-screenshot tries to find the current window using the _NET_ACTIVE_WINDOW
> X property and then, if 'include-border' is set to TRUE, it walks back the
> window chain until it finds the window frame.
> 
> I don't know why compiz doesn't do the reparenting, and neither understand why
> it can't behave like every other window manager; if compiz authors wish to
> share how gnome-screenshot should fix this misbehaviour, I'm all ears.

The most important reason for why we don't do reparenting is that we don't
necessarily want to use the same visual for the decorations as the client
window. We want to always have an alpha channel present in our decorations but
most client windows use visuals without and alpha channel. If you reparent a
window using a non-ARGB visual into one using an ARGB visual when using the
composite extension to redirect top-level windows, an automatic redirect is
required on the server side to ensure that the alpha bits are correct. This
automatic redirect requires huge memory resources and adds a significant
performance impact. There's some other reasons too, like that it allows us to
compress decorations and save some additional video memory, reparenting also
make the WM code more complex, no reason to do it on a composited desktop so
it's nice to avoid it...

One way to grab a window including the decorations is to look at the
_NET_FRAME_EXTENTS property on the client window. Fetch the client window
geometry, add the frame extents from the _NET_FRAME_EXTENTS property and grab
the root window rectangle that you get from that.

This should work with any EWMH compliant window manager. It wont work with other
window managers that don't support the _NET_FRAME_EXTENTS property so keep the
old frame grabbing code for those cases.

Some additions to the EWMH spec is required if you want to be able to grab the
full contents of a partially covered window. I think it makes a lot of sense to
be able to do this so I could start by implementing a proposed mechanism in
compiz for this. Something like this would work:

- screenshot client sends a client message to wm, telling it that it likes to
acquire a pixmap containing the specific window.
- wm allocates a pixmap of appropriate size and render the window including it's
decorations to it.
- wm sends a client message back to the screenshot client, telling it about the
pixmap which now contains the window.

This mechanism would even be able to capture possible transformations and other
modifications done by the compositing manager to windows.

Comment 5 Emmanuele Bassi 2007-01-28 06:11:08 UTC
david, thanks for the explanation and the tips.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.