diff options
| -rw-r--r-- | client.c | 30 | ||||
| -rw-r--r-- | config.mk | 2 | ||||
| -rw-r--r-- | dwm.h | 1 | ||||
| -rw-r--r-- | event.c | 1 |
4 files changed, 18 insertions, 16 deletions
| @@ -54,19 +54,6 @@ grabbuttons(Client *c, Bool focused) { | |||
| 54 | GrabModeAsync, GrabModeSync, None, None); | 54 | GrabModeAsync, GrabModeSync, None, None); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static void | ||
| 58 | resizetitle(Client *c) { | ||
| 59 | c->tw = textw(c->name); | ||
| 60 | if(c->tw > c->w) | ||
| 61 | c->tw = c->w + 2; | ||
| 62 | c->tx = c->x + c->w - c->tw + 2; | ||
| 63 | c->ty = c->y; | ||
| 64 | if(isvisible(c)) | ||
| 65 | XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); | ||
| 66 | else | ||
| 67 | XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th); | ||
| 68 | } | ||
| 69 | |||
| 70 | static int | 57 | static int |
| 71 | xerrordummy(Display *dsply, XErrorEvent *ee) { | 58 | xerrordummy(Display *dsply, XErrorEvent *ee) { |
| 72 | return 0; | 59 | return 0; |
| @@ -250,11 +237,13 @@ manage(Window w, XWindowAttributes *wa) { | |||
| 250 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); | 237 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); |
| 251 | 238 | ||
| 252 | grabbuttons(c, False); | 239 | grabbuttons(c, False); |
| 240 | updatetitle(c); | ||
| 253 | settags(c, getclient(trans)); | 241 | settags(c, getclient(trans)); |
| 254 | if(!c->isfloat) | 242 | if(!c->isfloat) |
| 255 | c->isfloat = trans | 243 | c->isfloat = trans |
| 256 | || (c->maxw && c->minw && | 244 | || (c->maxw && c->minw && |
| 257 | c->maxw == c->minw && c->maxh == c->minh); | 245 | c->maxw == c->minw && c->maxh == c->minh); |
| 246 | resizetitle(c); | ||
| 258 | 247 | ||
| 259 | if(clients) | 248 | if(clients) |
| 260 | clients->prev = c; | 249 | clients->prev = c; |
| @@ -262,7 +251,6 @@ manage(Window w, XWindowAttributes *wa) { | |||
| 262 | c->snext = stack; | 251 | c->snext = stack; |
| 263 | stack = clients = c; | 252 | stack = clients = c; |
| 264 | 253 | ||
| 265 | updatetitle(c); | ||
| 266 | ban(c); | 254 | ban(c); |
| 267 | XMapWindow(dpy, c->win); | 255 | XMapWindow(dpy, c->win); |
| 268 | XMapWindow(dpy, c->twin); | 256 | XMapWindow(dpy, c->twin); |
| @@ -321,6 +309,19 @@ resize(Client *c, Bool sizehints, Corner sticky) { | |||
| 321 | } | 309 | } |
| 322 | 310 | ||
| 323 | void | 311 | void |
| 312 | resizetitle(Client *c) { | ||
| 313 | c->tw = textw(c->name); | ||
| 314 | if(c->tw > c->w) | ||
| 315 | c->tw = c->w + 2; | ||
| 316 | c->tx = c->x + c->w - c->tw + 2; | ||
| 317 | c->ty = c->y; | ||
| 318 | if(isvisible(c)) | ||
| 319 | XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); | ||
| 320 | else | ||
| 321 | XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th); | ||
| 322 | } | ||
| 323 | |||
| 324 | void | ||
| 324 | updatesize(Client *c) { | 325 | updatesize(Client *c) { |
| 325 | long msize; | 326 | long msize; |
| 326 | XSizeHints size; | 327 | XSizeHints size; |
| @@ -382,7 +383,6 @@ updatetitle(Client *c) { | |||
| 382 | } | 383 | } |
| 383 | } | 384 | } |
| 384 | XFree(name.value); | 385 | XFree(name.value); |
| 385 | resizetitle(c); | ||
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | void | 388 | void |
| @@ -1,5 +1,5 @@ | |||
| 1 | # dwm version | 1 | # dwm version |
| 2 | VERSION = 1.7 | 2 | VERSION = 1.7.1 |
| 3 | 3 | ||
| 4 | # Customize below to fit your system | 4 | # Customize below to fit your system |
| 5 | 5 | ||
| @@ -117,6 +117,7 @@ extern void gravitate(Client *c, Bool invert); /* gravitate c */ | |||
| 117 | extern void killclient(Arg *arg); /* kill c nicely */ | 117 | extern void killclient(Arg *arg); /* kill c nicely */ |
| 118 | extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ | 118 | extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ |
| 119 | extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/ | 119 | extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/ |
| 120 | extern void resizetitle(Client *c); /* resizes c->twin correctly */ | ||
| 120 | extern void updatesize(Client *c); /* update the size structs of c */ | 121 | extern void updatesize(Client *c); /* update the size structs of c */ |
| 121 | extern void updatetitle(Client *c); /* update the name of c */ | 122 | extern void updatetitle(Client *c); /* update the name of c */ |
| 122 | extern void unmanage(Client *c); /* destroy c */ | 123 | extern void unmanage(Client *c); /* destroy c */ |
| @@ -316,6 +316,7 @@ propertynotify(XEvent *e) { | |||
| 316 | } | 316 | } |
| 317 | if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { | 317 | if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { |
| 318 | updatetitle(c); | 318 | updatetitle(c); |
| 319 | resizetitle(c); | ||
| 319 | drawtitle(c); | 320 | drawtitle(c); |
| 320 | } | 321 | } |
| 321 | } | 322 | } |
