Mercurial > hg > index.fcgi > dwm > dwm-3.6.1-12pba
diff 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 |
line diff
1.1 --- a/event.c Tue Mar 24 12:52:45 2009 -0700 1.2 +++ b/event.c Thu Apr 23 02:43:13 2009 -0700 1.3 @@ -158,13 +158,38 @@ 1.4 } 1.5 if(ev->x > x + blw) 1.6 switch(ev->button) { 1.7 - case Button1: zoom(NULL); break; 1.8 - case Button2: toggleversatile(NULL); break; 1.9 - case Button3: killclient(NULL); break; 1.10 - case Button4: focusprev(NULL); break; 1.11 - case Button5: focusnext(NULL); break; 1.12 + case Button1: zoom(NULL); break; 1.13 + case Button2: toggleversatile(NULL); break; 1.14 + case Button3: killclient(NULL); break; 1.15 + case Button4: pushup(NULL); break; 1.16 + case Button5: pushdown(NULL); break; 1.17 + } 1.18 + } 1.19 + else if(tbarwin == ev->window) { 1.20 + int i, w; 1.21 + switch(ev->button) { 1.22 + case Button4: focusprev(NULL); return; break; 1.23 + case Button5: focusnext(NULL); return; break; 1.24 } 1.25 - } 1.26 + for(i=0, c = clients; c; c = c->next) { 1.27 + if(isvisible(c)) 1.28 + i++; 1.29 + } 1.30 + if(!i && i >= MAX_TASKS) 1.31 + return; 1.32 + else 1.33 + w = sw/i; 1.34 + for(i=1, c = clients; c && i*w<=sw; c = c->next, i++) { 1.35 + for(; c && !isvisible(c); c = c->next); 1.36 + if(i*w > ev->x) { 1.37 + switch(ev->button) { 1.38 + case Button1: focus(c); restack(); break; 1.39 + case Button3: focus(c); zoom(NULL); break; 1.40 + } 1.41 + break; 1.42 + } 1.43 + } 1.44 + } 1.45 else if((c = getclient(ev->window))) { 1.46 focus(c); 1.47 if(CLEANMASK(ev->state) != MODKEY) 1.48 @@ -242,7 +267,7 @@ 1.49 1.50 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) 1.51 return; 1.52 - if((c = getclient(ev->window)) && isvisible(c)) 1.53 + if(!CLICK_TO_FOCUS && (c = getclient(ev->window)) && isvisible(c)) 1.54 focus(c); 1.55 else if(ev->window == root) { 1.56 selscreen = True; 1.57 @@ -256,7 +281,7 @@ 1.58 XExposeEvent *ev = &e->xexpose; 1.59 1.60 if(ev->count == 0) { 1.61 - if(barwin == ev->window) 1.62 + if(barwin == ev->window || tbarwin == ev->window) 1.63 drawstatus(); 1.64 } 1.65 }