fixed tag click handling, however ClkRootWin doesn't work for me

This commit is contained in:
Anselm R Garbe 2008-06-12 23:04:55 +01:00
parent 512541bfbd
commit 1f1a132784
1 changed files with 7 additions and 6 deletions

13
dwm.c
View File

@ -59,8 +59,8 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */
enum { ClkLtSymbol = -1, ClkStatusText = -2, ClkWinTitle = -3, enum { ClkLtSymbol = 64, ClkStatusText, ClkWinTitle,
ClkClientWin = -4, ClkRootWin = -5, ClkLast = -6};/* clicks */ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
/* typedefs */ /* typedefs */
typedef unsigned int uint; typedef unsigned int uint;
@ -314,11 +314,12 @@ buttonpress(XEvent *e) {
click = ClkRootWin; click = ClkRootWin;
if(ev->window == barwin) { if(ev->window == barwin) {
x = 0; i = x = 0;
for(i = 0; i < LENGTH(tags) && ev->x >= x; i++) do
x += TEXTW(tags[i]); x += TEXTW(tags[i]);
if(i < LENGTH(tags) || ev->x <= x) while(ev->x >= x && ++i < LENGTH(tags));
click = i - 1; if(i < LENGTH(tags))
click = i;
else if(ev->x < x + blw) else if(ev->x < x + blw)
click = ClkLtSymbol; click = ClkLtSymbol;
else if(ev->x > wx + ww - TEXTW(stext)) else if(ev->x > wx + ww - TEXTW(stext))