xwd utility does not capture screen properly on unity2d

Bug #1081674 reported by p!F
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
unity-2d
Invalid
Undecided
Unassigned

Bug Description

xwd -root

This command fails to capture normal screenshot of the screen.

More information and example pictures here:
http://stackoverflow.com/questions/13493765/xwd-java-awt-robot-captures-black-windows-everything-except-unity2d-shell-is-bl

Same mechanism is used by java Robot for screenshots, so it doesn't work as well.

Revision history for this message
Gerry Boland (gerboland) wrote :

This is a consequence of how unity-2d draws itself on screen. Effectively it creates a window that covers your entire desktop & all open applications windows on your screen, then specifies to X the bits it wants to be transparent (using XShaping). The compositor (metacity in this case) then takes this info to draw your desktop.

The tool you're using to grab screenshots unfortunately is not aware of XShaping. I would encourage is the use of another screenshotting tool. gnome-screenshot is capable, and should be scriptable in a similar way to xwd.

Alternatively you could try turning off metacity's compositor, logging out & in again. Unity-2d will fall back to a different XShaping routine that may work better with xwd. Try this with:
gconftool --set --type bool /apps/metacity/general/compositing_manager false

Revision history for this message
p!F (pifostap) wrote :

Thanks a lot, Gerry!
That's a great answer. It shed a lot of light on the issue.

I tried disabling metacity's compoziting manager using gconftool and it worked flawlessly. Whole screen was captured.

Unfortunately, I can't use anything, but xwd like utilities. The cause of the issue was inside java's screen capturing abilities (java.awt.Robot), which use sources from xwd for screen capturing.

But I wonder, why does it work in Ubuntu 11.04.
Probably, it uses another XShaping routing there?

Do you know any good resources about compoziting/XShaping? Or, at least, where can I find XShaping routine's sources?

Revision history for this message
Gerry Boland (gerboland) wrote :

In 12.04 we changed unity-2d quite a bit. Before the launcher & dash were separate applications, and each had their own window. There was no XShaping being used before 12.04, so this problem would not have happened before that release.

We wanted the ability to draw anything anywhere on screen, hence this work. It made the HUD much easier, and the keyboard shortcuts popup was thus easy to do too (just didn't land before feature freeze).

A handy reference on compositing in my bookmarks is this:
http://web.archive.org/web/20100105155103/http://ktown.kde.org/~fredrik/composite_howto.html
And the XShape API is here
http://linux.die.net/man/3/xshapecombinemask

You'll need to dig into X.org's sources to find the implementation. Good luck!

Changed in unity-2d:
status: New → Invalid
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.