From 92be442b0aa0ced485dd77ba1fe778d2bf9e0376 Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Sat, 4 Oct 2008 12:41:35 +0200 Subject: [PATCH] [wmfs] Improve moving system : can pass on the bar --- config.c | 36 ++++++++++++++++++------------------ wmfs.c | 31 +++++++++---------------------- 2 files changed, 27 insertions(+), 40 deletions(-) diff --git a/config.c b/config.c index 9de3058..90d046a 100644 --- a/config.c +++ b/config.c @@ -55,32 +55,32 @@ func_name_list_t func_list[] = func_name_list_t layout_list[] = { - {"tile", tile}, - {"max", maxlayout}, - {"free", freelayout} + {"tile", tile }, + {"max", maxlayout }, + {"free", freelayout } }; key_name_list_t key_list[] = { - {"Control", ControlMask}, - {"Shift", ShiftMask}, - {"Lock", LockMask}, - {"Control", ControlMask}, - {"Alt", Mod1Mask}, - {"Mod2", Mod2Mask}, - {"Mod3", Mod3Mask}, - {"Mod4", Mod4Mask}, - {"Mod5", Mod5Mask}, - {NULL, NoSymbol} + {"Control", ControlMask }, + {"Shift", ShiftMask }, + {"Lock", LockMask }, + {"Control", ControlMask }, + {"Alt", Mod1Mask }, + {"Mod2", Mod2Mask }, + {"Mod3", Mod3Mask }, + {"Mod4", Mod4Mask }, + {"Mod5", Mod5Mask }, + {NULL, NoSymbol } }; name_to_uint_t mouse_button_list[] = { - {"Button1", Button1}, - {"Button2", Button2}, - {"Button3", Button3}, - {"Button4", Button4}, - {"Button5", Button5} + {"Button1", Button1 }, + {"Button2", Button2 }, + {"Button3", Button3 }, + {"Button4", Button4 }, + {"Button5", Button5 } }; void* diff --git a/wmfs.c b/wmfs.c index deb30e4..c47ce1c 100644 --- a/wmfs.c +++ b/wmfs.c @@ -177,8 +177,10 @@ focus(Client *c) } if(c) grabbuttons(c, True); + sel = c; selbytag[seltag] = sel; + if(c) { setborder(c->win, conf.colors.borderfocus); @@ -571,6 +573,7 @@ manage(Window w, XWindowAttributes *wa) XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); mapclient(c); setwinstate(c->win, NormalState); + focus(c); arrange(); return; @@ -603,6 +606,7 @@ mouseaction(Client *c, int x, int y, int type) if(type) XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h); XUngrabPointer(dpy, CurrentTime); + updatebar(); return; } else if(ev.type == MotionNotify) @@ -619,20 +623,6 @@ mouseaction(Client *c, int x, int y, int type) (ocx + (ev.xmotion.x - x)), (ocy + (ev.xmotion.y - y)), c->w, c->h, True); - - /* for don't pass on the bar */ - if(conf.bartop && c->y < barheight + conf.ttbarheight - 5) - { - moveresize(c, c->x, barheight + conf.ttbarheight, c->w, c->h, True); - XUngrabPointer(dpy, CurrentTime); - return; - } - else if(!conf.bartop && c->y + c->h > bary + 3) - { - moveresize(c, c->x, bary - c->h, c->w, c->h, True); - XUngrabPointer(dpy, CurrentTime); - return; - } } } @@ -693,14 +683,11 @@ moveresize(Client *c, int x, int y, int w, int h, bool r) c->x = x; c->y = y; c->w = w; c->h = h; - if(conf.bartop) - { - if((y - conf.ttbarheight) <= barheight) - y = barheight+conf.ttbarheight; - } - else - if(y - h >= bary) - y = bary - h; + /* can't pass on the bar */ + if(conf.bartop && (y - conf.ttbarheight) <= barheight) + y = barheight + conf.ttbarheight; + else if(!conf.bartop && (y + h) >= bary - conf.borderheight*2) + y = bary - c->h - conf.borderheight*2; XMoveResizeWindow(dpy, c->win, x, y, w ,h);