Desktop-operations in Metacity and Compiz?



Hello,

I'm developing a fancy screenshot application for the GNOME-desktop
using the 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 work correctly or similarly in Compiz compared to
Metacity.

Operations of interest are; find number of desktops, find current
desktop, move to a spesific desktop #, find desktop for this window id.
[Desktops = Virtual workspaces that the graphical UI maintains].
---

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
libraries? I already know how to do this in GNOME's GTK/GDK/Metacity.
---

Question(s) 2:
I've done a serie of tests to find out algorithms that work both in flat
Metacity and Compiz WMs. Please study and test-run the code and give
your best answers.

The tests are:
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 gdk-2.0` -lX11 -Wall desk-test.c -o
desk-test

Run it in both Metacity (or an equivalent flat wm) and Compiz.
./desk-test
------------------------------

This is output of my run in Compiz.

TEST1: Get number of desktops.
Number of desktops is: 6
I kind of made it work both in Metacity and Compiz. Solution is not
perfect. Study the code.

------------------------------------------
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 kind of made it work both in Metacity and Compiz. Solution is not
perfect. Study the code.

------------------------------------------
TEST3: Get the current desktop number.
Current desktop is: 0
I kind of made it work both in Metacity and Compiz. Solution is not
perfect. Study the code.

------------------------------------------
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 wm.

------------------------------------------
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 wm.
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)?

Can you pour some light to this dark matter? ;-)

[I've also sent also this question to Compiz-forums on
http://forum.compiz-fusion.org/showthread.php?t=10193 and
http://lists.freedesktop.org/mailman/listinfo/compiz  ]

Many TIA for all answers,
  Moma Antero
  Norway, Oslo, Grønland/Tøyen.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]