commit 41e62e6603465f7e7787cd557fef9ffbf93651db
parent 2ecf687056a6f7d4c9c341cabe5f7604ae2076fb
Author: garbeam <garbeam@mmv.wmii.de>
Date: Sun, 18 Dec 2005 15:56:22 +0200
fixed select page and select floating frame as well to allow round trips
Diffstat:
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/cmd/wm/layout_float.c b/cmd/wm/layout_float.c
@@ -210,10 +210,18 @@ static void select_frame(void *obj, char *arg)
if (!f || !arg)
return;
- if (!strncmp(arg, "prev", 5))
- f = f->prev;
- else if (!strncmp(arg, "next", 5))
- f = f->next;
+ if (!strncmp(arg, "prev", 5)) {
+ if (f->prev)
+ f = f->prev;
+ else
+ for (f = fl->frames; f && f->next; f = f->next);
+ }
+ else if (!strncmp(arg, "next", 5)) {
+ if (f->next)
+ f = f->next;
+ else
+ f = fl->frames;
+ }
else {
unsigned int i = 0, idx = blitz_strtonum(arg, 0, fl->nframes - 1);
for (f = fl->frames; f && i != idx; f = f->next) i++;
diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c
@@ -405,10 +405,18 @@ static void _select_page(void *obj, char *arg)
Page *p = selpage;
if (!p || !arg)
return;
- if (!strncmp(arg, "prev", 5))
- p = p->prev;
- else if (!strncmp(arg, "next", 5))
- p = p->next;
+ if (!strncmp(arg, "prev", 5)) {
+ if (p->prev)
+ p = p->prev;
+ else
+ for (p = pages; p && p->next; p = p->next);
+ }
+ else if (!strncmp(arg, "next", 5)) {
+ if (p->next)
+ p = p->next;
+ else
+ p = pages;
+ }
else
p = pageat(blitz_strtonum(arg, 0, npages - 1));
if (p)