X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=dwm.c;h=8ae4c0e8fc7c0573a661140ced2463d751b01aae;hb=cf98ea2a9ce0b8ccbb3bbb510421c48279a1b280;hp=dd55ee22bed4af8802a698cee1821bce4528fc58;hpb=9ff5143acba0c6b457bfb92370c8397b7f124f3a;p=dwm.git diff --git a/dwm.c b/dwm.c index dd55ee2..8ae4c0e 100644 --- a/dwm.c +++ b/dwm.c @@ -60,7 +60,7 @@ enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ enum { ClkLtSymbol = 64, ClkStatusText, ClkWinTitle, - ClkClientWin, ClkLast }; /* clicks */ + ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ /* typedefs */ typedef unsigned int uint; @@ -84,12 +84,12 @@ typedef struct { typedef struct Client Client; struct Client { char name[256]; + float mina, maxa; int x, y, w, h; int basew, baseh, incw, inch, maxw, maxh, minw, minh; - float mina, maxa; int bw, oldbw; - Bool isbanned, isfixed, isfloating, ismoved, isurgent; uint tags; + Bool isbanned, isfixed, isfloating, ismoved, isurgent; Client *next; Client *snext; Window win; @@ -312,7 +312,7 @@ buttonpress(XEvent *e) { Client *c; XButtonPressedEvent *ev = &e->xbutton; - click = ClkLast; + click = ClkRootWin; if(ev->window == barwin) { i = x = 0; do @@ -327,8 +327,10 @@ buttonpress(XEvent *e) { else click = ClkWinTitle; } - else if((c = getclient(ev->window))) + else if((c = getclient(ev->window))) { + focus(c); click = ClkClientWin; + } for(i = 0; i < LENGTH(buttons); i++) if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button @@ -911,7 +913,8 @@ manage(Window w, XWindowAttributes *wa) { if(c->y + c->h + 2 * c->bw > sy + sh) c->y = sy + sh - c->h - 2 * c->bw; c->x = MAX(c->x, sx); - c->y = MAX(c->y, by == 0 ? bh : sy); + /* only fix client y-offset, if the client center might cover the bar */ + c->y = MAX(c->y, ((by == 0) && (c->x + (c->w / 2) >= wx) && (c->x + (c->w / 2) < wx + ww)) ? bh : sy); c->bw = borderpx; } @@ -980,11 +983,6 @@ movemouse(const Arg *arg) { None, cursor[CurMove], CurrentTime) != GrabSuccess) return; XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); - if(x1 < c->x || x1 > c->x + c->w || y1 < c->y || y1 > c->y + c->h) { - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, 0, 0); - x1 = c->x + 1; - y1 = c->y + 1; - } for(;;) { XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); switch (ev.type) { @@ -1096,11 +1094,11 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) { w = MAX(w, c->minw); h = MAX(h, c->minh); - - if (c->maxw) + + if(c->maxw) w = MIN(w, c->maxw); - if (c->maxh) + if(c->maxh) h = MIN(h, c->maxh); } if(w <= 0 || h <= 0)