diff options
| author | Anselm R Garbe <garbeam@gmail.com> | 2008-06-20 16:52:07 +0100 |
|---|---|---|
| committer | Anselm R Garbe <garbeam@gmail.com> | 2008-06-20 16:52:07 +0100 |
| commit | b86c818599f8fecd42bcde564686b2489196d7ab (patch) | |
| tree | 507dcf29cd248e548c645addeb41e9454a3c4b23 /dwm.c | |
| parent | made arrange again like it was once (diff) | |
| download | dwm-b86c818599f8fecd42bcde564686b2489196d7ab.tar.gz dwm-b86c818599f8fecd42bcde564686b2489196d7ab.zip | |
applied Gottox' ClkTagBar patch
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 20 |
1 files changed, 11 insertions, 9 deletions
| @@ -60,7 +60,7 @@ 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 */ |
| @@ -304,17 +304,18 @@ attachstack(Client *c) { | |||
| 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)) |
| @@ -330,7 +331,7 @@ buttonpress(XEvent *e) { | |||
| 330 | for(i = 0; i < LENGTH(buttons); i++) | 331 | for(i = 0; i < LENGTH(buttons); i++) |
| 331 | if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button | 332 | if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button |
| 332 | && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) | 333 | && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) |
| 333 | buttons[i].func(&buttons[i].arg); | 334 | buttons[i].func(click == ClkTagBar ? &arg : &buttons[i].arg); |
| 334 | } | 335 | } |
| 335 | 336 | ||
| 336 | void | 337 | void |
| @@ -1295,8 +1296,9 @@ setclientstate(Client *c, long state) { | |||
| 1295 | 1296 | ||
| 1296 | void | 1297 | void |
| 1297 | setlayout(const Arg *arg) { | 1298 | setlayout(const Arg *arg) { |
| 1298 | sellt ^= 1; | 1299 | if(!arg || !arg->v || arg->v != lt[sellt]) |
| 1299 | if(arg && arg->v && arg->v != lt[sellt]) | 1300 | sellt ^= 1; |
| 1301 | if(arg && arg->v) | ||
| 1300 | lt[sellt] = (Layout *)arg->v; | 1302 | lt[sellt] = (Layout *)arg->v; |
| 1301 | if(sel) | 1303 | if(sel) |
| 1302 | arrange(); | 1304 | arrange(); |
