From: Iain Patterson Date: Sun, 8 Mar 2009 12:57:03 +0000 (+0000) Subject: Handle dynamic desktops by default X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=10c1af5f13dd8eb4d7f41337cd45763397d129e5;p=pager.git Handle dynamic desktops by default Unless a desktop is specified the pager will now always handle the active desktop. --- diff --git a/pager.c b/pager.c index 6c60e09..f629f76 100644 --- a/pager.c +++ b/pager.c @@ -12,7 +12,7 @@ static GC dockapp_border1GC, dockapp_border2GC, window_border1GC, window_border2GC, active_desktopGC, inactive_desktopGC, active_windowGC, inactive_windowGC; static Atom supported_atom, num_desktops_atom, desktop_geometry_atom, current_desktop_atom, client_list_atom, client_desktop_atom, client_state_atom, active_window_atom, moveresize_window_atom; static Atom above_state, below_state, shaded_state, skip_pager_state, hidden_state; -static long desktop = -1; +static int desktop = -1; static Window drag_window; static int drag_x, drag_y; static int drag_button; @@ -137,7 +137,12 @@ void enumerate_clients(client_t ***clients, unsigned long *num_clients, unsigned /* Check the window is on our desktop (or all desktops). */ client_desktop = get_atom_long(client_desktop_atom, XA_CARDINAL, data[i]); - if (client_desktop != desktop && client_desktop != -1) continue; + if (desktop > -1) { + if (client_desktop != desktop && client_desktop != -1) continue; + } + else { + if (client_desktop != *active_desktop && client_desktop != -1) continue; + } /* Try to get its dimensions. */ if (! XGetGeometry(DADisplay, data[i], &root, &x, &y, &width, &height, &border, &depth)) continue; @@ -288,7 +293,7 @@ void page() { enumerate_clients(&clients, &num_clients, &active_desktop, &active_window); pixmap = XCreatePixmap(DADisplay, DAWindow, dockapp_width, dockapp_height, dockapp_depth); - if (active_desktop == desktop) gc = active_desktopGC; + if (active_desktop == desktop || desktop < 0) gc = active_desktopGC; else gc = inactive_desktopGC; draw_relief(pixmap, dockapp_width, dockapp_height, gc); @@ -396,9 +401,10 @@ int main(int argc, char **argv) { check_support(); num_desktops = get_atom_long(num_desktops_atom, XA_CARDINAL, DefaultRootWindow(DADisplay)); - if (desktop < 1) { + if (desktop == 0) { desktop = get_atom_long(current_desktop_atom, XA_CARDINAL, DefaultRootWindow(DADisplay)); } + else if (desktop < 0) desktop = -1; else if (desktop-- > num_desktops) { fprintf(stderr, "There are only %ld desktops!\n", num_desktops); exit(111);