aboutsummaryrefslogtreecommitdiff
path: root/dminiwm.c
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2011-12-08 12:32:45 +0200
committerIvan Kanakarakis <ivan.kanak@gmail.com>2011-12-08 20:34:20 +0200
commit5a314d02667acf28d83d7c8af60cea278b85e157 (patch)
tree49931f8fd621b7cfc365a70c9a79b74f09bc003e /dminiwm.c
parent0087dc78537b3dc846fced53640067b426030646 (diff)
work on {prev,next}_win() and fix comments on change_desktop()
Diffstat (limited to 'dminiwm.c')
-rw-r--r--dminiwm.c61
1 files changed, 21 insertions, 40 deletions
diff --git a/dminiwm.c b/dminiwm.c
index f48a516..265c977 100644
--- a/dminiwm.c
+++ b/dminiwm.c
@@ -249,35 +249,22 @@ void killclient(const Arg arg) {
}
void next_win(const Arg arg) {
- client *c;
-
- if(current != NULL && head != NULL) {
- if(current->next == NULL)
- c = head;
- else
- c = current->next;
-
- current = c;
- if(mode == MONOCYCLE)
- tile();
- update_current();
- }
+ if(current == NULL || head == NULL) return;
+ current = (current->next == NULL) ? head : current->next;
+ if(mode == MONOCYCLE)
+ tile();
+ update_current();
}
void prev_win(const Arg arg) {
- client *c;
-
- if(current != NULL && head != NULL) {
- if(current->prev == NULL)
- for(c=head;c->next;c=c->next);
- else
- c = current->prev;
-
- current = c;
- if(mode == MONOCYCLE)
- tile();
- update_current();
- }
+ if(current == NULL || head == NULL) return;
+ if(current->prev == NULL) /* if(current == head) */
+ for(current=head; current->next; current=current->next);
+ else
+ current = current->prev;
+ if(mode == MONOCYCLE)
+ tile();
+ update_current();
}
void move_down(const Arg arg) {
@@ -330,25 +317,19 @@ void swap_master(const Arg arg) {
void change_desktop(const Arg arg) {
client *c;
- if(arg.i == current_desktop)
- return;
+ if(arg.i == current_desktop) return;
- // Save current "properties"
+ /* save current desktop settings and unmap windows */
save_desktop(current_desktop);
- previous_desktop = current_desktop;
-
- // Unmap all window
if(head != NULL)
- for(c=head;c;c=c->next)
- XUnmapWindow(dis,c->win);
-
- // Take "properties" from the new desktop
+ for(c=head; c; c=c->next)
+ XUnmapWindow(dis, c->win);
+ previous_desktop = current_desktop;
+ /* read new desktop properties and map new windows */
select_desktop(arg.i);
-
- // Map all windows
if(head != NULL)
- for(c=head;c;c=c->next)
- XMapWindow(dis,c->win);
+ for(c=head; c; c=c->next)
+ XMapWindow(dis, c->win);
tile();
update_current();