58 /* enums */ |
58 /* enums */ |
59 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ |
59 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ |
60 enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ |
60 enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ |
61 enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ |
61 enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ |
62 enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ |
62 enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ |
63 enum { ClkLtSymbol = 64, ClkStatusText, ClkWinTitle, |
63 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, |
64 ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ |
64 ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ |
65 |
65 |
66 /* typedefs */ |
66 /* typedefs */ |
67 typedef unsigned int uint; |
67 typedef unsigned int uint; |
68 typedef unsigned long ulong; |
68 typedef unsigned long ulong; |
302 } |
302 } |
303 |
303 |
304 void |
304 void |
305 buttonpress(XEvent *e) { |
305 buttonpress(XEvent *e) { |
306 uint i, x, click; |
306 uint i, x, click; |
|
307 Arg arg = {0}; |
307 Client *c; |
308 Client *c; |
308 XButtonPressedEvent *ev = &e->xbutton; |
309 XButtonPressedEvent *ev = &e->xbutton; |
309 |
310 |
310 click = ClkRootWin; |
311 click = ClkRootWin; |
311 if(ev->window == barwin) { |
312 if(ev->window == barwin) { |
312 i = x = 0; |
313 for(i = x = 0; ev->x >= x && ++i < LENGTH(tags); i++) |
313 do |
|
314 x += TEXTW(tags[i]); |
314 x += TEXTW(tags[i]); |
315 while(ev->x >= x && ++i < LENGTH(tags)); |
315 if(i < LENGTH(tags)) { |
316 if(i < LENGTH(tags)) |
316 click = ClkTagBar; |
317 click = i; |
317 arg.ui = 1 << i; |
|
318 } |
318 else if(ev->x < x + blw) |
319 else if(ev->x < x + blw) |
319 click = ClkLtSymbol; |
320 click = ClkLtSymbol; |
320 else if(ev->x > wx + ww - TEXTW(stext)) |
321 else if(ev->x > wx + ww - TEXTW(stext)) |
321 click = ClkStatusText; |
322 click = ClkStatusText; |
322 else |
323 else |