Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am trying to write a program that will take a screenshot of each workspace and then display them together to create an expo type effect.

I am currently using gtk and I can only take a screenshot of the active workspace (using gdk_get_default_root_window and gdk_pixbuf_get_from_drawable). The only method I have currently found of taking a screenshot of an inactive workspace is to switch to it, take the screenshot and then switch back, but this will make the screen flash. So my question is, is there way of capturing the workspaces without flashing the screen?

share|improve this question

closed as off topic by MichaelT, Martijn Pieters, Glenn Nelson, Walter, thorsten müller Mar 7 '13 at 12:53

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

This question should be migrated somewhere else. –  Blrfl Jul 26 '12 at 14:34
add comment

1 Answer

up vote 1 down vote accepted

No, there isn't.

Workspaces are implemented by un-mapping the windows in inactive ones and re-mapping windows in the newly-active one. The pixels that make up the unmapped windows don't actually exist anywhere until they're re-mapped.

You should also be aware that that while most servers these days have backing store enabled, X doesn't guarantee that behavior and individual clients can opt not to use it. When there isn't a backing store, changing workspaces and immediately snapping a screenshot may not produce the results you're expecting.

share|improve this answer
I don't suppose there is an easy way to remap them to a virtual screen. With the changing workspaces before and after the screenshot I have noticed that random parts of windows can show up (like parts of the title bar), I presume this is due to the lack of a backing store. –  Ian G Jul 26 '12 at 15:27
The relationship between X clients and servers doesn't make mapping onto another display possible without the application's cooperation. Decorations (title bars, etc.) are drawn by the window manager, which is just another client. It may be using the backing store or it gets around to exposing its elements earlier. The only way to capture what would have been on the screen is for the WM to grab and store a bitmap of the root window before it starts un-mapping windows. The Sawfish WM included in older versions of GNOME had hooks that might have made this kind of customization easy. –  Blrfl Jul 26 '12 at 16:42
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.