X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=client.c;h=f4ed1a067f860bc95c215919cc82a35a7d2cdbf2;hb=dc5c070c44d9af434405c8d6538abd06299d3298;hp=f90a182e0cca4b1534ff5b4cba75475be1dfd7d6;hpb=52021851d1fd78970dfe63380d51b87f57d1ee1b;p=dwm.git diff --git a/client.c b/client.c index f90a182..f4ed1a0 100644 --- a/client.c +++ b/client.c @@ -3,7 +3,6 @@ * See LICENSE file for license details. */ #include "dwm.h" - #include #include #include @@ -19,7 +18,7 @@ resizetitle(Client *c) c->tw = 0; for(i = 0; i < TLast; i++) if(c->tags[i]) - c->tw += textw(c->tags[i]); + c->tw += textw(tags[i]); c->tw += textw(c->name); if(c->tw > c->w) c->tw = c->w + 2; @@ -219,26 +218,25 @@ manage(Window w, XWindowAttributes *wa) c->h = wa->height; c->th = bh; - if(c->y < bh) + c->border = 0; + setsize(c); + + if(c->h != sh && c->y < bh) c->y = c->ty = bh; - c->border = 1; c->proto = getproto(c->win); - setsize(c); XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | EnterWindowMask); XGetTransientForHint(dpy, c->win, &trans); twa.override_redirect = 1; twa.background_pixmap = ParentRelative; - twa.event_mask = ExposureMask; + twa.event_mask = ExposureMask | EnterWindowMask; c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); - settags(c); - if(clients) clients->prev = c; c->next = clients; @@ -251,11 +249,11 @@ manage(Window w, XWindowAttributes *wa) XGrabButton(dpy, Button3, MODKEY, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); + settags(c); if(!c->isfloat) - c->isfloat = trans || (c->maxw && c->minw && - (c->maxw == c->minw) && (c->maxh == c->minh)); - - + c->isfloat = trans + || (c->maxw && c->minw && + c->maxw == c->minw && c->maxh == c->minh); settitle(c); arrange(NULL); @@ -271,6 +269,7 @@ resize(Client *c, Bool sizehints, Corner sticky) { int bottom = c->y + c->h; int right = c->x + c->w; + /*XConfigureEvent e;*/ XWindowChanges wc; if(sizehints) { @@ -287,21 +286,24 @@ resize(Client *c, Bool sizehints, Corner sticky) if(c->maxh && c->h > c->maxh) c->h = c->maxh; } + if(c->x > right) /* might happen on restart */ + c->x = right - c->w; + if(c->y > bottom) + c->y = bottom - c->h; if(sticky == TopRight || sticky == BotRight) c->x = right - c->w; if(sticky == BotLeft || sticky == BotRight) c->y = bottom - c->h; resizetitle(c); - - if(c->tags[tsel]) - wc.x = c->x; - else - wc.x = c->x + 2 * sw; + wc.x = c->x; wc.y = c->y; wc.width = c->w; wc.height = c->h; - wc.border_width = 1; + if(c->w == sw && c->h == sh) + wc.border_width = 0; + else + wc.border_width = 1; XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); XSync(dpy, False); } @@ -389,8 +391,8 @@ togglemax(Arg *arg) oh = sel->h; sel->x = sx; sel->y = sy + bh; - sel->w = sw - 2 * sel->border; - sel->h = sh - 2 * sel->border - bh; + sel->w = sw - 2; + sel->h = sh - 2 - bh; higher(sel); resize(sel, False, TopLeft);