summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@gmail.com>2007-07-24 18:29:29 +0200
committerAnselm R. Garbe <garbeam@gmail.com>2007-07-24 18:29:29 +0200
commite0cfe076485e7df266b53eaffaa093d9c94a61a7 (patch)
tree17a2b3e02e120c7ea426aa3ea16e4e2b5db46682
parentapplied dwm-windowscrolling patch (diff)
downloaddwm-e0cfe076485e7df266b53eaffaa093d9c94a61a7.tar.gz
dwm-e0cfe076485e7df266b53eaffaa093d9c94a61a7.zip
applied Jeroen Schot's shiftview patch
-rw-r--r--dwm.h1
-rw-r--r--event.c4
-rw-r--r--tag.c18
3 files changed, 23 insertions, 0 deletions
diff --git a/dwm.h b/dwm.h
index 999f027..d54fdc0 100644
--- a/dwm.h
+++ b/dwm.h
@@ -144,6 +144,7 @@ void tag(const char *arg); /* tags sel with arg's index */
144void toggletag(const char *arg); /* toggles sel tags with arg's index */ 144void toggletag(const char *arg); /* toggles sel tags with arg's index */
145void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */ 145void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */
146void view(const char *arg); /* views the tag with arg's index */ 146void view(const char *arg); /* views the tag with arg's index */
147void shiftview(const char *arg); /* views next(1)/previous(-1) tag */
147 148
148/* util.c */ 149/* util.c */
149void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */ 150void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */
diff --git a/event.c b/event.c
index 3f06ea7..ac96df1 100644
--- a/event.c
+++ b/event.c
@@ -135,6 +135,10 @@ buttonpress(XEvent *e) {
135 else 135 else
136 toggleview(buf); 136 toggleview(buf);
137 } 137 }
138 else if(ev->button == Button4)
139 shiftview("-1");
140 else if(ev->button == Button5)
141 shiftview("1");
138 return; 142 return;
139 } 143 }
140 } 144 }
diff --git a/tag.c b/tag.c
index c44954b..19c63b1 100644
--- a/tag.c
+++ b/tag.c
@@ -99,6 +99,24 @@ settags(Client *c, Client *trans) {
99 c->tags[i] = seltag[i]; 99 c->tags[i] = seltag[i];
100} 100}
101 101
102void
103shiftview(const char *arg) {
104 int i, j;
105
106 for(i = 0; !seltag[i]; i++);
107 for(j = i + 1; j < ntags && !seltag[j]; j++);
108 if(j < ntags)
109 return; /* more then one tag selected */
110 seltag[i] = False;
111 i += arg ? atoi(arg) : 0;
112 if(i < 0)
113 i = ntags - 1;
114 else if(i >= ntags)
115 i = 0;
116 seltag[i] = True;
117 lt->arrange();
118}
119
102void 120void
103tag(const char *arg) { 121tag(const char *arg) {
104 int i; 122 int i;