small window cycling bugs

This commit is contained in:
Sean Pringle
2014-09-14 17:11:14 +10:00
parent 1778b9d413
commit 6a70a405e6
3 changed files with 24 additions and 6 deletions

View File

@@ -57,13 +57,15 @@ void action_close(void *data, int num, client *cli)
void action_cycle(void *data, int num, client *cli) void action_cycle(void *data, int num, client *cli)
{ {
if (!cli) return; if (!cli) return;
STACK_INIT(lower); STACK_INIT(order);
if (spot_count_windows(cli->spot, cli->monitor) > 1) if (spot_stack_clients(cli->spot, cli->monitor, &order) > 1)
{ {
spot_focus_top_window(cli->spot, cli->monitor, cli->window); int i; client *c = NULL;
client_stack_family(cli, &lower); for_stack(&order, i, c) if (c->manage && c->transient == None && c->window != cli->window)
XLowerWindow(display, lower.windows[0]); {
XRestackWindows(display, lower.windows, lower.depth); client_activate(c);
break;
}
} }
} }

8
spot.c
View File

@@ -137,4 +137,12 @@ int spot_count_windows(int spot, int mon)
int i, n = 0; client *c; int i, n = 0; client *c;
for_windows(i, c) if (c->manage && c->spot == spot && c->monitor == mon) n++; for_windows(i, c) if (c->manage && c->spot == spot && c->monitor == mon) n++;
return 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;
} }

8
xoat.c
View File

@@ -127,6 +127,14 @@ void action_maximize(void*, int, client*);
#define STACK_INIT(n) stack (n); memset(&(n), 0, sizeof(stack)) #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 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)\ #define for_windows(i,c)\
for (query_windows(), (i) = 0; (i) < windows.depth; (i)++)\ for (query_windows(), (i) = 0; (i) < windows.depth; (i)++)\
if (((c) = windows.clients[(i)])) if (((c) = windows.clients[(i)]))