annotate src/rootvis/getroot.c @ 2964:629d5494c8f1

Ok, really fix the EOF stuff.
author William Pitcock <nenolod@atheme.org>
date Thu, 16 Oct 2008 14:53:09 -0500
parents f1b6f1b2cdb3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
1 /* I've modified the following file and renamed it. My modifications were just
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
2 * about getting rid of some toon.h dependants. If you're interested in the
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
3 * original version of the file, you can find it either in the sources of
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
4 * xpenguins or of xsnow.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
5 * http://xpenguins.seul.org/ is my actual source.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
6 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
7 * Johannes Jordan
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
8 */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
9
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
10 /* toon_root.c - finding the correct background window / virtual root
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
11 * Copyright (C) 1999-2001 Robin Hogan
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
12 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
13 * This program is free software; you can redistribute it and/or modify
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
14 * it under the terms of the GNU General Public License as published by
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
15 * the Free Software Foundation; either version 2 of the License, or
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
16 * (at your option) any later version.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
17 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
18 * This program is distributed in the hope that it will be useful,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
21 * GNU General Public License for more details.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
22 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
23 * You should have received a copy of the GNU General Public License
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
24 * along with this program; if not, write to the Free Software
2835
f1b6f1b2cdb3 fixed FSF address
Andrew O. Shadoura <bugzilla@tut.by>
parents: 900
diff changeset
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
26 */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
27
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
28 /* Since xpenguins version 2.1, the ToonGetRootWindow() function
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
29 * attempts to find the window IDs of
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
30 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
31 * 1) The background window that is behind the toplevel client
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
32 * windows; this is the window that we draw the toons on.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
33 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
34 * 2) The parent window of the toplevel client windows; this is used
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
35 * by ToonLocateWindows() to build up a map of the space that the
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
36 * toons can occupy.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
37 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
38 * In simple (sensible?) window managers (e.g. blackbox, sawfish, fvwm
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
39 * and countless others), both of these are the root window. The other
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
40 * more complex scenarios that ToonGetRootWindow() attempts to cope
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
41 * with are:
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
42 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
43 * Some `virtual' window managers (e.g. amiwm, swm and tvtwm) that
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
44 * reparent all client windows to a desktop window that sits on top of
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
45 * the root window. This desktop window is easy to find - we just look
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
46 * for a property __SWM_VROOT in the immediate children of the root
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
47 * window that contains the window ID of this desktop window. The
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
48 * desktop plays both roles (1 and 2 above). This functionality was
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
49 * detected in xpenguins 1.x with the vroot.h header file.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
50 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
51 * Enlightenment (0.16) can have a number of desktops with different
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
52 * backgrounds; client windows on these are reparented, except for
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
53 * Desktop 0 which is the root window. Therefore versions less than
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
54 * 2.1 of xpenguins worked on Desktop 0 but not on any others. To fix
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
55 * this we look for a root-window property _WIN_WORKSPACE which
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
56 * contains the numerical index of the currently active desktop. The
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
57 * active desktop is then simply the immediate child of the root
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
58 * window that has a property ENLIGHTENMENT_DESKTOP set to this value.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
59 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
60 * KDE 2.0: Oh dear. The kdesktop is a program separate from the
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
61 * window manager that launches a window which sits behind all the
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
62 * other client windows and has all the icons on it. Thus the other
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
63 * client windows are still children of the root window, but we want
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
64 * to draw to the uppermost window of the kdesktop. This is difficult
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
65 * to find - it is the great-great-grandchild of the root window and
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
66 * in KDE 2.0 has nothing to identify it from its siblings other than
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
67 * its size. KDE 2.1+ usefully implements the __SWM_VROOT property in
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
68 * a child of the root window, but the client windows are still
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
69 * children of the root window. A problem is that the penguins erase
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
70 * the desktop icons when they walk which is a bit messy. The icons
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
71 * are not lost - they reappear when the desktop window gets an expose
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
72 * event (i.e. move some windows over where they were and back again).
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
73 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
74 * Nautilus (GNOME 1.4+): Creates a background window to draw icons
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
75 * on, but does not reparent the client windows. The toplevel window
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
76 * of the desktop is indicated by the root window property
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
77 * NAUTILUS_DESKTOP_WINDOW_ID, but then we must descend down the tree
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
78 * from this toplevel window looking for subwindows that are the same
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
79 * size as the screen. The bottom one is the one to draw to. Hopefully
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
80 * one day Nautilus will implement __SWM_VROOT in exactly the same way
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
81 * as KDE 2.1+.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
82 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
83 * Other cases: CDE, the common desktop environment. This is a
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
84 * commercial product that has been packaged with Sun (and other)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
85 * workstations. It typically implements four virtual desktops but
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
86 * provides NO properties at all for apps such as xpenguins to use to
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
87 * work out where to draw to. Seeing as Sun are moving over to GNOME,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
88 * CDE use is on the decline so I don't have any current plans to try
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
89 * and get xpenguins to work with it.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
90 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
91 * As a note to developers of window managers and big screen hoggers
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
92 * like kdesktop, please visit www.freedesktop.org and implement their
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
93 * Extended Window Manager Hints spec that help pagers and apps like
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
94 * xpenguins and xearth to find their way around. In particular,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
95 * please use the _NET_CURRENT_DESKTOP and _NET_VIRTUAL_ROOTS
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
96 * properties if you reparent any windows (e.g. Enlightenment). Since
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
97 * no window managers that I know yet use these particular hints, I
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
98 * haven't yet added any code to parse them. */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
99
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
100 #include <X11/Xlib.h>
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
101 #include <X11/Xatom.h>
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
102 #include <X11/Xproto.h>
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
103 #include <string.h>
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
104
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
105 /* Time to throw up. Here is a kludgey function that recursively calls
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
106 * itself (up to a limit) to find the window ID of the KDE desktop to
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
107 * draw on. It works with KDE 2.0, but since KDE 2.0 is less stable
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
108 * than Windows 95, I don't expect many people to remain using it now
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
109 * that 2.1 is available, which implements __SWM_VROOT and makes this
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
110 * function redundant. This is the hierarchy we're trying to traverse:
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
111 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
112 * -> The root window
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
113 * 0 -> window with name="KDE Desktop"
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
114 * 1 -> window with no name
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
115 * 2 -> window with name="KDE Desktop" & _NET_WM_WINDOW_TYPE_DESKTOP
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
116 * 3 -> window with no name and width >= width of screen
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
117 *
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
118 * The last window in the hierarchy is the one to draw to. The
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
119 * numbers show the value of the `depth' argument. */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
120 static
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
121 Window
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
122 __ToonGetKDEDesktop(Display *display, int screen, Window window,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
123 Atom atom, char *atomname, int depth)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
124 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
125 char *name = NULL;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
126 unsigned char *wintype = NULL;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
127 Window winreturn = 0;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
128 unsigned long nitems, bytesafter;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
129 Atom actual_type;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
130 int actual_format;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
131 Window rootReturn, parentReturn, *children;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
132 unsigned int nChildren;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
133 char go_deeper = 0;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
134
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
135 if (XFetchName(display, window, &name)) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
136 if (strcasecmp(name, "KDE Desktop") == 0) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
137 /* Presumably either at depth 0 or 2 */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
138 if (XGetWindowProperty(display, window, atom, 0, 1,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
139 False, XA_ATOM,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
140 &actual_type, &actual_format,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
141 &nitems, &bytesafter,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
142 &wintype) == Success
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
143 && wintype) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
144 char *tmpatomname = XGetAtomName(display, *(Atom*)wintype);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
145 if (tmpatomname) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
146 if (strcmp(atomname, tmpatomname) == 0 && depth == 2) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
147 /* OK, at depth 2 */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
148 go_deeper = 1;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
149 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
150 XFree((char *) tmpatomname);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
151 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
152 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
153 else if (depth < 2) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
154 go_deeper = 1;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
155 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
156 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
157 else if (depth == 1) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
158 go_deeper = 1;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
159 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
160 XFree((char *) name);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
161 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
162 else if (depth == 1) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
163 go_deeper = 1;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
164 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
165
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
166 /* If go_deeper is 1 then there is a possibility that the background
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
167 * window is a descendant of the current window; otherwise we're
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
168 * barking up the wrong tree. */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
169 if (go_deeper && XQueryTree(display, window, &rootReturn,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
170 &parentReturn, &children,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
171 &nChildren)) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
172 int i;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
173 for (i = 0; i < nChildren; ++i) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
174 /* children[i] is now at depth 3 */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
175 if (depth == 2) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
176 XWindowAttributes attributes;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
177 if (XGetWindowAttributes(display, children[i], &attributes)) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
178 if (attributes.width >= DisplayWidth(display, screen)/2
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
179 && attributes.height > 0) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
180 /* Found it! */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
181 winreturn = children[i];
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
182 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
183 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
184 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
185 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
186 else if ((winreturn = __ToonGetKDEDesktop(display, screen,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
187 children[i],
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
188 atom, atomname,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
189 depth+1))) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
190 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
191 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
192 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
193 XFree((char *) children);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
194 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
195
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
196 return winreturn;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
197 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
198
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
199 /* Look for the Nautilus desktop window to draw to, given the toplevel
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
200 * window of the Nautilus desktop. Basically recursively calls itself
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
201 * looking for subwindows the same size as the root window. */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
202 static
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
203 Window
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
204 __ToonGetNautilusDesktop(Display *display, int screen, Window window,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
205 int depth)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
206 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
207 Window rootReturn, parentReturn, *children;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
208 Window winreturn = window;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
209 unsigned int nChildren;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
210
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
211 if (depth > 5) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
212 return ((Window) 0);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
213 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
214 else if (XQueryTree(display, window, &rootReturn, &parentReturn,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
215 &children, &nChildren)) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
216 int i;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
217 for (i = 0; i < nChildren; ++i) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
218 XWindowAttributes attributes;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
219 if (XGetWindowAttributes(display, children[i], &attributes)) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
220 if (attributes.width == DisplayWidth(display, screen)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
221 && attributes.height == DisplayHeight(display, screen)) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
222 /* Found a possible desktop window */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
223 winreturn = __ToonGetNautilusDesktop(display, screen,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
224 children[i], depth+1);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
225 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
226 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
227 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
228 XFree((char *) children);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
229 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
230 return winreturn;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
231 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
232
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
233
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
234 /*
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
235 * Returns the window ID of the `background' window on to which the
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
236 * toons should be drawn. Also returned (in clientparent) is the ID of
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
237 * the parent of all the client windows, since this may not be the
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
238 * same as the background window. If no recognised virtual window
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
239 * manager or desktop environment is found then the root window is
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
240 * returned in both cases. The string toon_message contains
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
241 * information about the window manager that was found.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
242 */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
243 Window
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
244 ToonGetRootWindow(Display *display, int screen, Window *clientparent)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
245 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
246 Window background = 0; /* The return value */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
247 Window root = RootWindow(display, screen);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
248 Window rootReturn, parentReturn, *children;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
249 unsigned char *toplevel = NULL;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
250 unsigned int nChildren;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
251 unsigned long nitems, bytesafter;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
252 Atom actual_type;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
253 int actual_format;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
254 unsigned char *workspace = NULL;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
255 unsigned char *desktop = NULL;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
256 Atom NAUTILUS_DESKTOP_WINDOW_ID = XInternAtom(display,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
257 "NAUTILUS_DESKTOP_WINDOW_ID",
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
258 False);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
259
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
260 *clientparent = root;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
261
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
262 if (XGetWindowProperty(display, root,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
263 NAUTILUS_DESKTOP_WINDOW_ID,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
264 0, 1, False, XA_WINDOW,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
265 &actual_type, &actual_format,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
266 &nitems, &bytesafter,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
267 &toplevel) == Success
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
268 && toplevel) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
269 /* Nautilus is running */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
270 background = __ToonGetNautilusDesktop(display, screen,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
271 *(Window*)toplevel, 0);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
272 XFree(toplevel);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
273 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
274
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
275 /* Next look for a virtual root or a KDE Desktop */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
276 if (!background
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
277 && XQueryTree(display, root, &rootReturn, &parentReturn,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
278 &children, &nChildren)) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
279 int i;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
280 Atom _NET_WM_WINDOW_TYPE = XInternAtom(display,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
281 "_NET_WM_WINDOW_TYPE",
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
282 False);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
283 Atom __SWM_VROOT = XInternAtom(display, "__SWM_VROOT", False);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
284
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
285 for (i = 0; i < nChildren && !background; ++i) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
286 unsigned char *newroot = NULL;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
287 if (XGetWindowProperty(display, children[i],
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
288 __SWM_VROOT, 0, 1, False, XA_WINDOW,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
289 &actual_type, &actual_format,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
290 &nitems, &bytesafter,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
291 &newroot) == Success
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
292 && newroot) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
293 /* Found a window with a __SWM_VROOT property that contains
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
294 * the window ID of the virtual root. Now we must check
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
295 * whether it is KDE (2.1+) or not. If it is KDE then it does
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
296 * not reparent the clients. If the root window has the
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
297 * _NET_SUPPORTED property but not the _NET_VIRTUAL_ROOTS
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
298 * property then we assume it is KDE. */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
299 Atom _NET_SUPPORTED = XInternAtom(display,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
300 "_NET_SUPPORTED",
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
301 False);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
302 unsigned char *tmpatom;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
303 if (XGetWindowProperty(display, root,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
304 _NET_SUPPORTED, 0, 1, False,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
305 XA_ATOM, &actual_type, &actual_format,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
306 &nitems, &bytesafter,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
307 &tmpatom) == Success
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
308 && tmpatom) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
309 unsigned char *tmpwindow = NULL;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
310 Atom _NET_VIRTUAL_ROOTS = XInternAtom(display,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
311 "_NET_VIRTUAL_ROOTS",
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
312 False);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
313 XFree(tmpatom);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
314 if (XGetWindowProperty(display, root,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
315 _NET_VIRTUAL_ROOTS, 0, 1, False,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
316 XA_WINDOW, &actual_type, &actual_format,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
317 &nitems, &bytesafter,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
318 &tmpwindow) != Success
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
319 || !tmpwindow) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
320 /* Must be KDE 2.1+ */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
321 background = *(Window*)newroot;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
322 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
323 else if (tmpwindow) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
324 XFree(tmpwindow);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
325 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
326 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
327
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
328 if (!background) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
329 /* Not KDE: assume windows are reparented */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
330 background = *clientparent = *newroot;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
331 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
332 XFree((char *) newroot);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
333 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
334 else background = __ToonGetKDEDesktop(display, screen, children[i],
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
335 _NET_WM_WINDOW_TYPE,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
336 "_NET_WM_WINDOW_TYPE_DESKTOP",
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
337 0);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
338 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
339 XFree((char *) children);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
340 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
341
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
342 if (!background) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
343 /* Look for a _WIN_WORKSPACE property, used by Enlightenment */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
344 Atom _WIN_WORKSPACE = XInternAtom(display, "_WIN_WORKSPACE", False);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
345 if (XGetWindowProperty(display, root, _WIN_WORKSPACE,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
346 0, 1, False, XA_CARDINAL,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
347 &actual_type, &actual_format,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
348 &nitems, &bytesafter,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
349 &workspace) == Success
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
350 && workspace) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
351 /* Found a _WIN_WORKSPACE property - this is the desktop to look for.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
352 * For now assume that this is Enlightenment.
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
353 * We're looking for a child of the root window that has an
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
354 * ENLIGHTENMENT_DESKTOP atom with a value equal to the root window's
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
355 * _WIN_WORKSPACE atom. */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
356 Atom ENLIGHTENMENT_DESKTOP = XInternAtom(display,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
357 "ENLIGHTENMENT_DESKTOP",
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
358 False);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
359 /* First check to see if the root window is the current desktop... */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
360 if (XGetWindowProperty(display, root,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
361 ENLIGHTENMENT_DESKTOP, 0, 1,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
362 False, XA_CARDINAL,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
363 &actual_type, &actual_format,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
364 &nitems, &bytesafter,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
365 &desktop) == Success
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
366 && desktop && *desktop == *workspace) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
367 /* The root window is the current Enlightenment desktop */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
368 background = root;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
369 XFree(desktop);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
370 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
371 /* Now look at each immediate child window of root to see if it is
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
372 * the current desktop */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
373 else if (XQueryTree(display, root, &rootReturn, &parentReturn,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
374 &children, &nChildren)) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
375 int i;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
376 for (i = 0; i < nChildren; ++i) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
377 if (XGetWindowProperty(display, children[i],
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
378 ENLIGHTENMENT_DESKTOP, 0, 1,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
379 False, XA_CARDINAL,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
380 &actual_type, &actual_format,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
381 &nitems, &bytesafter,
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
382 &desktop) == Success
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
383 && desktop && *desktop == *workspace) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
384 /* Found current Enlightenment desktop */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
385 background = *clientparent = children[i];
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
386 XFree(desktop);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
387 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
388 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
389 XFree((char *) children);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
390 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
391 XFree(workspace);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
392 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
393 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
394 if (background) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
395 return background;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
396 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
397 else {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
398 return root;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
399 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
400 }