From 6a70a405e695b5e21ec6ac869be7120a8b640ee1 Mon Sep 17 00:00:00 2001 From: Sean Pringle Date: Sun, 14 Sep 2014 17:11:14 +1000 Subject: [PATCH] small window cycling bugs --- action.c | 14 ++++++++------ spot.c | 8 ++++++++ xoat.c | 8 ++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/action.c b/action.c index 4dd308a..5d72ee0 100644 --- a/action.c +++ b/action.c @@ -57,13 +57,15 @@ void action_close(void *data, int num, client *cli) void action_cycle(void *data, int num, client *cli) { if (!cli) return; - STACK_INIT(lower); - if (spot_count_windows(cli->spot, cli->monitor) > 1) + STACK_INIT(order); + if (spot_stack_clients(cli->spot, cli->monitor, &order) > 1) { - spot_focus_top_window(cli->spot, cli->monitor, cli->window); - client_stack_family(cli, &lower); - XLowerWindow(display, lower.windows[0]); - XRestackWindows(display, lower.windows, lower.depth); + int i; client *c = NULL; + for_stack(&order, i, c) if (c->manage && c->transient == None && c->window != cli->window) + { + client_activate(c); + break; + } } } diff --git a/spot.c b/spot.c index c2216d2..b037380 100644 --- a/spot.c +++ b/spot.c @@ -137,4 +137,12 @@ int spot_count_windows(int spot, int mon) int i, n = 0; client *c; for_windows(i, c) if (c->manage && c->spot == spot && c->monitor == mon) n++; return n; +} + +int spot_stack_clients(int spot, int mon, stack *stk) +{ + int i; client *c; + for_windows(i, c) if (c->manage && c->spot == spot && c->monitor == mon) + client_stack_family(c, stk); + return stk->depth; } \ No newline at end of file diff --git a/xoat.c b/xoat.c index 7cd51d9..0bd0c81 100644 --- a/xoat.c +++ b/xoat.c @@ -127,6 +127,14 @@ void action_maximize(void*, int, client*); #define STACK_INIT(n) stack (n); memset(&(n), 0, sizeof(stack)) #define STACK_FREE(s) while ((s)->depth) client_free((s)->clients[--(s)->depth]) +#define for_stack(s,i,c)\ + for ((i) = 0; (i) < (s)->depth; (i)++)\ + if (((c) = (s)->clients[(i)])) + +#define for_stack_rev(s,i,c)\ + for ((i) = (s)->depth-1; (i) > -1; (i)--)\ + if (((c) = (s)->clients[(i)])) + #define for_windows(i,c)\ for (query_windows(), (i) = 0; (i) < windows.depth; (i)++)\ if (((c) = windows.clients[(i)]))