git://git.iain.cx/iain
/
pager.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
14aa6af
)
Fall back to XQueryTree if necessary
author
Iain Patterson
<me@iain.cx>
Sun, 8 Mar 2009 15:18:57 +0000
(15:18 +0000)
committer
Iain Patterson
<me@iain.cx>
Sun, 8 Mar 2009 15:19:32 +0000
(15:19 +0000)
pager.c
patch
|
blob
|
history
diff --git
a/pager.c
b/pager.c
index
10c1703
..
c351049
100644
(file)
--- a/
pager.c
+++ b/
pager.c
@@
-22,6
+22,7
@@
static double aspect, scale;
static int desktop_geometry_supported;
static int current_desktop_supported;
static int desktop_geometry_supported;
static int current_desktop_supported;
+static int client_list_supported;
static int active_window_supported;
static int moveresize_supported;
static int active_window_supported;
static int moveresize_supported;
@@
-84,6
+85,7
@@
void check_support() {
for (i = 0; i < num_items; i++) {
if (data[i] == desktop_geometry_atom) desktop_geometry_supported = 1;
if (data[i] == current_desktop_atom) current_desktop_supported = 1;
for (i = 0; i < num_items; i++) {
if (data[i] == desktop_geometry_atom) desktop_geometry_supported = 1;
if (data[i] == current_desktop_atom) current_desktop_supported = 1;
+ if (data[i] == client_list_atom) client_list_supported = 1;
if (data[i] == active_window_atom) active_window_supported = 1;
if (data[i] == moveresize_window_atom) moveresize_supported = 1;
}
if (data[i] == active_window_atom) active_window_supported = 1;
if (data[i] == moveresize_window_atom) moveresize_supported = 1;
}
@@
-92,7
+94,7
@@
void check_support() {
}
void enumerate_clients(client_t ***clients, unsigned long *num_clients, unsigned long *active_desktop, unsigned long *active_window) {
}
void enumerate_clients(client_t ***clients, unsigned long *num_clients, unsigned long *active_desktop, unsigned long *active_window) {
- Window root,
dockapp_root, child
;
+ Window root,
qroot, qparent, dockapp_root, child, *wins, client
;
int x, y;
unsigned int width, height, border, depth;
unsigned int root_width, root_height;
int x, y;
unsigned int width, height, border, depth;
unsigned int root_width, root_height;
@@
-120,7
+122,12
@@
void enumerate_clients(client_t ***clients, unsigned long *num_clients, unsigned
*active_window = get_atom_long(active_window_atom, XA_WINDOW, dockapp_root);
*active_desktop = get_atom_long(current_desktop_atom, XA_CARDINAL, DefaultRootWindow(DADisplay));
*active_window = get_atom_long(active_window_atom, XA_WINDOW, dockapp_root);
*active_desktop = get_atom_long(current_desktop_atom, XA_CARDINAL, DefaultRootWindow(DADisplay));
- get_atom_longs(client_list_atom, XA_WINDOW, dockapp_root, &data, num_clients);
+ if (client_list_supported) {
+ get_atom_longs(client_list_atom, XA_WINDOW, dockapp_root, &data, num_clients);
+ }
+ else {
+ XQueryTree(DADisplay, dockapp_root, &qroot, &qparent, &wins, (unsigned int *) num_clients);
+ }
*clients = (client_t **) malloc(sizeof(client_t *) * *num_clients);
if (! *clients) {
*clients = (client_t **) malloc(sizeof(client_t *) * *num_clients);
if (! *clients) {
@@
-136,11
+143,14
@@
void enumerate_clients(client_t ***clients, unsigned long *num_clients, unsigned
}
(*clients)[i]->window = 0;
}
(*clients)[i]->window = 0;
+ if (client_list_supported) client = data[i];
+ else client = XmuClientWindow(DADisplay, wins[i]);
+
/* Don't page the pager. */
/* Don't page the pager. */
- if (
data[i]
== DAWindow) continue;
+ if (
client
== DAWindow) continue;
/* Check the window is on our desktop (or all desktops). */
/* Check the window is on our desktop (or all desktops). */
- client_desktop = get_atom_long(client_desktop_atom, XA_CARDINAL,
data[i]
);
+ client_desktop = get_atom_long(client_desktop_atom, XA_CARDINAL,
client
);
if (desktop > -1) {
if (client_desktop != desktop && client_desktop != -1) continue;
}
if (desktop > -1) {
if (client_desktop != desktop && client_desktop != -1) continue;
}
@@
-149,20
+159,20
@@
void enumerate_clients(client_t ***clients, unsigned long *num_clients, unsigned
}
/* Try to get its dimensions. */
}
/* Try to get its dimensions. */
- if (! XGetGeometry(DADisplay,
data[i]
, &root, &x, &y, &width, &height, &border, &depth)) continue;
- if (! XTranslateCoordinates(DADisplay,
data[i]
, root, x, y, &x, &y, &child)) continue;
+ if (! XGetGeometry(DADisplay,
client
, &root, &x, &y, &width, &height, &border, &depth)) continue;
+ if (! XTranslateCoordinates(DADisplay,
client
, root, x, y, &x, &y, &child)) continue;
/* Make sure it isn't hidden or shaded. */
draw = 1;
/* Make sure it isn't hidden or shaded. */
draw = 1;
- get_atom_longs(client_state_atom, XA_ATOM,
data[i]
, &states, &num_states);
+ get_atom_longs(client_state_atom, XA_ATOM,
client
, &states, &num_states);
for (j = 0; j < num_states; j++) {
for (j = 0; j < num_states; j++) {
- if (states[j] == shaded_state)
draw = 0
;
+ if (states[j] == shaded_state)
height = 3.0 * scale
;
if (states[j] == skip_pager_state) draw = 0;
if (states[j] == hidden_state) draw = 0;
}
if (! draw) continue;
if (states[j] == skip_pager_state) draw = 0;
if (states[j] == hidden_state) draw = 0;
}
if (! draw) continue;
- (*clients)[i]->window =
data[i]
;
+ (*clients)[i]->window =
client
;
/* Scale it. */
(*clients)[i]->rect.x = (double) x / scale;
/* Scale it. */
(*clients)[i]->rect.x = (double) x / scale;
@@
-171,7
+181,8
@@
void enumerate_clients(client_t ***clients, unsigned long *num_clients, unsigned
(*clients)[i]->rect.height = (double) height / aspect;
}
(*clients)[i]->rect.height = (double) height / aspect;
}
- XFree(data);
+ if (client_list_supported) XFree(data);
+ else XFree(wins);
}
void destroy_clients(client_t ***clients, unsigned long num_clients) {
}
void destroy_clients(client_t ***clients, unsigned long num_clients) {