[compiz] Desktop-operations in Metacity and Compiz.
Osmo Maatta
osmoma at online.no
Fri Oct 31 10:43:47 PDT 2008
Hello,
I'm developing a fancy screenshot application for the GNOME-desktop
using GTK and GDK libraries (and some Xlib stuff too).
When taking a screenshot of a window, my code first finds out in which
desktop the window lies (resides) and then moves to that desktop and
takes a screenshot. This is quite easy to do under the Metacity window
manager, but I cannot make this work right in Compiz because not all
desktop-operations (find current desktop, number of desktops, move to a
spesific desktop #, find desktop for this window id) do work correctly
or similarly in Compiz.
Question 1: How to take a screenshot of an arbitrary window in in
Compiz? Should I implement it via OpenGL instead of Xlib and GNOME's GDK
og GDKPixbuf?
Question(s) 2:
I've done a serie of tests to find out algorithms that work both in flat
Metacity and Compiz VMs. Please study and test-run the code and give
your best opinions.
The tests area:
TEST1: Get number of desktops.
TEST2: Get desktop names.
TEST3: Get the current desktop number.
TEST4: Move to the last desktop, sleep(2) and come back.
TEST5: Get the desktop number for a spesific Window ID.
(Requires you to modify the code (in TEST5) and change the window_id= to
a correct value. Use xwininfo command to find out window-id for any
window you like), then recompile and run.
The test code (desk-test.c) is available from
http://www.futuredesktop.org/tmp/desk-test.c
Compile it:
gcc `pkg-config --cflags --libs gtk+-2.0` -lX11 -Wall desk-test.c -o
desk-test
Run it in Metacity, Compiz.
./desk-test
------------------------------
This is output of my run:
TEST1: Get number of desktops.
Number of desktops is: 6
I've kind of made it work both in Metacity and Compiz,
------------------------------------------
TEST2: Get desktop names.
Length of the name list is: 6
Desk 1
Compiz desktop 2
Compiz desktop 3
Compiz desktop 4
Compiz desktop 5
Compiz desktop 6
I've kind of made it work both in Metacity and Compiz,
------------------------------------------
TEST3: Get the current desktop number.
Current desktop is: 0
I've kind of made it work both in Metacity and Compiz,
------------------------------------------
TEST4: Move to the last desktop, sleep(2) and come back.
You should see the desktop move if this is right.
My test shows that this works in Metacity but not in Compiz vm.
------------------------------------------
TEST5: Get the desktop number for a spesific Window ID.
Run xwininfo command to find out a window-id (for any window you like)
then change the variable window_id= in the code (in TEST5).
My test shows that this works in Metacity but not in Compiz vm.
Desktop number for X-window 0x2a029d5 is: 0
------------------------------------------
How can I make the desktop-operations to work right in Metacity and
Compiz? (and maybe even in KDE)?
I need urgent enlightenment ;-)
Many TIA,
Moma Antero
Norway, Oslo, Grønland/Tøyen.
More information about the compiz
mailing list