comparison event.c @ 3:faa4cb9d7bd6

add TASKBAR and CLICK_TO_FOCUS
author paulo@localhost
date Thu, 23 Apr 2009 02:43:13 -0700
parents de6bb7885c97
children a54de16f8277
comparison
equal deleted inserted replaced
1:33c75a93ee2b 2:94fa084f0eb6
156 incnmaster(&a); 156 incnmaster(&a);
157 break; 157 break;
158 } 158 }
159 if(ev->x > x + blw) 159 if(ev->x > x + blw)
160 switch(ev->button) { 160 switch(ev->button) {
161 case Button1: zoom(NULL); break; 161 case Button1: zoom(NULL); break;
162 case Button2: toggleversatile(NULL); break; 162 case Button2: toggleversatile(NULL); break;
163 case Button3: killclient(NULL); break; 163 case Button3: killclient(NULL); break;
164 case Button4: focusprev(NULL); break; 164 case Button4: pushup(NULL); break;
165 case Button5: focusnext(NULL); break; 165 case Button5: pushdown(NULL); break;
166 } 166 }
167 } 167 }
168 else if(tbarwin == ev->window) {
169 int i, w;
170 switch(ev->button) {
171 case Button4: focusprev(NULL); return; break;
172 case Button5: focusnext(NULL); return; break;
173 }
174 for(i=0, c = clients; c; c = c->next) {
175 if(isvisible(c))
176 i++;
177 }
178 if(!i && i >= MAX_TASKS)
179 return;
180 else
181 w = sw/i;
182 for(i=1, c = clients; c && i*w<=sw; c = c->next, i++) {
183 for(; c && !isvisible(c); c = c->next);
184 if(i*w > ev->x) {
185 switch(ev->button) {
186 case Button1: focus(c); restack(); break;
187 case Button3: focus(c); zoom(NULL); break;
188 }
189 break;
190 }
191 }
192 }
168 else if((c = getclient(ev->window))) { 193 else if((c = getclient(ev->window))) {
169 focus(c); 194 focus(c);
170 if(CLEANMASK(ev->state) != MODKEY) 195 if(CLEANMASK(ev->state) != MODKEY)
171 return; 196 return;
172 if(ev->button == Button1 && (lt->arrange == versatile || c->isversatile)) { 197 if(ev->button == Button1 && (lt->arrange == versatile || c->isversatile)) {
240 Client *c; 265 Client *c;
241 XCrossingEvent *ev = &e->xcrossing; 266 XCrossingEvent *ev = &e->xcrossing;
242 267
243 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) 268 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
244 return; 269 return;
245 if((c = getclient(ev->window)) && isvisible(c)) 270 if(!CLICK_TO_FOCUS && (c = getclient(ev->window)) && isvisible(c))
246 focus(c); 271 focus(c);
247 else if(ev->window == root) { 272 else if(ev->window == root) {
248 selscreen = True; 273 selscreen = True;
249 for(c = stack; c && !isvisible(c); c = c->snext); 274 for(c = stack; c && !isvisible(c); c = c->snext);
250 focus(c); 275 focus(c);
254 static void 279 static void
255 expose(XEvent *e) { 280 expose(XEvent *e) {
256 XExposeEvent *ev = &e->xexpose; 281 XExposeEvent *ev = &e->xexpose;
257 282
258 if(ev->count == 0) { 283 if(ev->count == 0) {
259 if(barwin == ev->window) 284 if(barwin == ev->window || tbarwin == ev->window)
260 drawstatus(); 285 drawstatus();
261 } 286 }
262 } 287 }
263 288
264 static void 289 static void