Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
spectrwm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e6727e0
)
next/prev window swap logic that sucks less.
author
Ryan McBride
<mcbride@countersiege.com>
Thu, 15 Jan 2009 08:27:56 +0000
(08:27 +0000)
committer
Ryan McBride
<mcbride@countersiege.com>
Thu, 15 Jan 2009 08:27:56 +0000
(08:27 +0000)
scrotwm.c
patch
|
blob
|
history
diff --git
a/scrotwm.c
b/scrotwm.c
index
66fb627
..
f1c498d
100644
(file)
--- a/
scrotwm.c
+++ b/
scrotwm.c
@@
-458,36
+458,26
@@
swapwin(union arg *args)
switch (args->id) {
case SWM_ARG_ID_SWAPPREV:
target = TAILQ_PREV(ws[current_ws].focus, ws_win_list, entry);
switch (args->id) {
case SWM_ARG_ID_SWAPPREV:
target = TAILQ_PREV(ws[current_ws].focus, ws_win_list, entry);
- if (target == NULL)
- target = TAILQ_LAST(&ws[current_ws].winlist,
- ws_win_list);
- if (target == ws[current_ws].focus)
- return;
TAILQ_REMOVE(&ws[current_ws].winlist,
ws[current_ws].focus, entry);
TAILQ_REMOVE(&ws[current_ws].winlist,
ws[current_ws].focus, entry);
- TAILQ_INSERT_BEFORE(target, ws[current_ws].focus, entry);
+ if (target == NULL)
+ TAILQ_INSERT_TAIL(&ws[current_ws].winlist,
+ ws[current_ws].focus, entry);
+ else
+ TAILQ_INSERT_BEFORE(target, ws[current_ws].focus,
+ entry);
break;
break;
- case SWM_ARG_ID_SWAPNEXT: {
- int loop = 0;
-
+ case SWM_ARG_ID_SWAPNEXT:
target = TAILQ_NEXT(ws[current_ws].focus, entry);
target = TAILQ_NEXT(ws[current_ws].focus, entry);
- if (target == NULL) {
- loop = 1;
- target = TAILQ_FIRST(&ws[current_ws].winlist);
- }
- if (target == ws[current_ws].focus)
- return;
TAILQ_REMOVE(&ws[current_ws].winlist,
ws[current_ws].focus, entry);
TAILQ_REMOVE(&ws[current_ws].winlist,
ws[current_ws].focus, entry);
- TAILQ_INSERT_AFTER(&ws[current_ws].winlist, target,
- ws[current_ws].focus, entry);
- if (loop) {
- TAILQ_REMOVE(&ws[current_ws].winlist, target, entry);
- TAILQ_INSERT_TAIL(&ws[current_ws].winlist,
- target, entry);
- }
+ if (target == NULL)
+ TAILQ_INSERT_HEAD(&ws[current_ws].winlist,
+ ws[current_ws].focus, entry);
+ else
+ TAILQ_INSERT_AFTER(&ws[current_ws].winlist, target,
+ ws[current_ws].focus, entry);
break;
break;
- }
case SWM_ARG_ID_SWAPMAIN:
target = TAILQ_FIRST(&ws[current_ws].winlist);
if (target == ws[current_ws].focus)
case SWM_ARG_ID_SWAPMAIN:
target = TAILQ_FIRST(&ws[current_ws].winlist);
if (target == ws[current_ws].focus)