From d28c8c2278220273f6381bb346fa3c4acc577215 Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Tue, 12 Aug 2008 15:40:24 +0200 Subject: [PATCH 1/3] [wmfs.c] Can't move client if its Tile --- wmfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/wmfs.c b/wmfs.c index 68c42bd..bf39179 100644 --- a/wmfs.c +++ b/wmfs.c @@ -201,6 +201,7 @@ getevent(void) { XConfigureWindow(dpy, event.xconfigurerequest.window, event.xconfigurerequest.value_mask, &wc); + XMoveResizeWindow(dpy, c->tbar, c->x, c->y-conf.ttbarheight, c->w, conf.ttbarheight); break; case UnmapNotify: @@ -417,7 +418,7 @@ ishide(Client *c) { void keymovex(char *cmd) { - if(sel && cmd && !ishide(sel) && !sel->max) { + if(sel && cmd && !ishide(sel) && !sel->max && sel->layout != Tile) { int tmp; tmp = sel->x + atoi(cmd); moveresize(sel,tmp, sel->y, sel->w, sel->h); @@ -427,7 +428,7 @@ keymovex(char *cmd) { void keymovey(char *cmd) { - if(sel && cmd && !ishide(sel) && !sel->max) { + if(sel && cmd && !ishide(sel) && !sel->max && sel->layout != Tile) { int tmp; tmp = sel->y + atoi(cmd); moveresize(sel, sel->x, tmp, sel->w, sel->h); @@ -456,7 +457,7 @@ keypress(XEvent *e) { void keyresize(char *cmd) { - if(sel && !ishide(sel) && !sel->max) { + if(sel && !ishide(sel) && !sel->max && sel->layout != Tile) { int temph=0, tempw=0, modh=0, modw=0, tmp=0; @@ -578,7 +579,7 @@ mouseaction(Client *c, int x, int y, int type) { int ocx, ocy; XEvent ev; - if(c->max) + if(c->max || c->layout == Tile) return; ocx = c->x; @@ -609,7 +610,6 @@ mouseaction(Client *c, int x, int y, int type) { (ocx + (ev.xmotion.x - x)), (ocy + (ev.xmotion.y - y)), c->w, c->h); - if(conf.clientbarblock) { if(c->y < barheight + conf.ttbarheight - 5) { moveresize(c, c->x, barheight+conf.ttbarheight, c->w, c->h); @@ -617,6 +617,7 @@ mouseaction(Client *c, int x, int y, int type) { return; } } + } } return; From dd72177ddbb268f5c4fdd973b25c96363ff762f3 Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Tue, 12 Aug 2008 15:42:06 +0200 Subject: [PATCH 2/3] [wmfs.c] Remove XMove test --- wmfs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/wmfs.c b/wmfs.c index bf39179..0c32f34 100644 --- a/wmfs.c +++ b/wmfs.c @@ -198,10 +198,8 @@ getevent(void) { wc.border_width = event.xconfigurerequest.border_width; wc.sibling = event.xconfigurerequest.above; wc.stack_mode = event.xconfigurerequest.detail; - XConfigureWindow(dpy, event.xconfigurerequest.window, event.xconfigurerequest.value_mask, &wc); - XMoveResizeWindow(dpy, c->tbar, c->x, c->y-conf.ttbarheight, c->w, conf.ttbarheight); break; case UnmapNotify: From 74f8c65bbc8f4ef37eb2e7ba77eced512ac18ff5 Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Wed, 13 Aug 2008 13:22:36 +0200 Subject: [PATCH 3/3] [ALL] Fix ttbar resize with configure request, new tile function (soon mwfact option) --- local.h | 3 +- wmfs.c | 95 ++++++++++++++++++++++++++++++--------------------------- 2 files changed, 52 insertions(+), 46 deletions(-) diff --git a/local.h b/local.h index 8acbd84..03c9109 100644 --- a/local.h +++ b/local.h @@ -125,7 +125,7 @@ void layoutswitch(char *cmd); void mapclient(Client *c); void manage(Window w, XWindowAttributes *wa); void mouseaction(Client *c, int x, int y, int type); -void moveresize(Client *c, int x, int y, int w, int h); +void moveresize(Client *c, int x, int y, int w, int h, bool r); void raiseclient(Client *c); void scan(void); void setborder(Window win, int color); @@ -169,4 +169,5 @@ Client *clients; /* Fisrt Client */ Client *sel; /* selected client */ int seltag; char status[16]; +float mwfact[MAXTAG]; #endif /* LOCAL_H */ diff --git a/wmfs.c b/wmfs.c index 0c32f34..7b1b198 100644 --- a/wmfs.c +++ b/wmfs.c @@ -191,6 +191,7 @@ getevent(void) { break; case ConfigureRequest: /* configure size and window position */ + wc.x = event.xconfigurerequest.x; wc.y = event.xconfigurerequest.y; wc.width = event.xconfigurerequest.width; @@ -200,6 +201,15 @@ getevent(void) { wc.stack_mode = event.xconfigurerequest.detail; XConfigureWindow(dpy, event.xconfigurerequest.window, event.xconfigurerequest.value_mask, &wc); + if((c = getclient(event.xconfigurerequest.window))) { + XResizeWindow(dpy, c->tbar, wc.width, conf.ttbarheight); + XMoveWindow(dpy, c->button, wc.x + wc.width - 10, BUTY(wc.y)); + updatetitle(c); + c->y = wc.y; + c->x = wc.x; + c->w = wc.width; + c->h = wc.height; + } break; case UnmapNotify: @@ -345,6 +355,8 @@ init(void) { mh = DisplayHeight (dpy, screen); seltag = 1; init_conf(); + for(i=0;imax && sel->layout != Tile) { int tmp; tmp = sel->x + atoi(cmd); - moveresize(sel,tmp, sel->y, sel->w, sel->h); + moveresize(sel,tmp, sel->y, sel->w, sel->h, 1); } return; } @@ -429,7 +441,7 @@ keymovey(char *cmd) { if(sel && cmd && !ishide(sel) && !sel->max && sel->layout != Tile) { int tmp; tmp = sel->y + atoi(cmd); - moveresize(sel, sel->x, tmp, sel->w, sel->h); + moveresize(sel, sel->x, tmp, sel->w, sel->h, 1); } return; } @@ -468,7 +480,7 @@ keyresize(char *cmd) { tempw = sel->w + modw; temph = (temph < 10) ? 10 : temph; tempw = (tempw < 10) ? 10 : tempw; - moveresize(sel, sel->x, sel->y, tempw, temph); + moveresize(sel, sel->x, sel->y, tempw, temph, 1); } return; } @@ -560,7 +572,7 @@ manage(Window w, XWindowAttributes *wa) { grabbuttons(c, False); setsizehints(c); attach(c); - moveresize(c, c->x, c->y, c->w, c->h); + moveresize(c, c->x, c->y, c->w, c->h, 0); XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); mapclient(c); updatetitle(c); @@ -602,15 +614,15 @@ mouseaction(Client *c, int x, int y, int type) { if(type) /* Resize */ moveresize(c, c->x, c->y, ((ev.xmotion.x - ocx <= 0) ? 1 : ev.xmotion.x - ocx), - ((ev.xmotion.y - ocy <= 0) ? 1 : ev.xmotion.y - ocy)); + ((ev.xmotion.y - ocy <= 0) ? 1 : ev.xmotion.y - ocy),0); else /* Move */ moveresize(c, (ocx + (ev.xmotion.x - x)), (ocy + (ev.xmotion.y - y)), - c->w, c->h); + c->w, c->h,0); if(conf.clientbarblock) { if(c->y < barheight + conf.ttbarheight - 5) { - moveresize(c, c->x, barheight+conf.ttbarheight, c->w, c->h); + moveresize(c, c->x, barheight+conf.ttbarheight, c->w, c->h, 0); XUngrabPointer(dpy, CurrentTime); return; } @@ -622,16 +634,16 @@ mouseaction(Client *c, int x, int y, int type) { } void -moveresize(Client *c, int x, int y, int w, int h) { +moveresize(Client *c, int x, int y, int w, int h, bool r) { if(c) { /* Resize hints {{{ */ - - if(c->minw > 0 && w < c->minw) w = c->minw; - if(c->minh > 0 && h < c->minh) h = c->minh; - if(c->maxw > 0 && w > c->maxw) w = c->maxw; - if(c->maxh > 0 && h > c->maxh) h = c->maxh; - if(w <= 0 || h <= 0) return; - + if(r) { + if(c->minw > 0 && w < c->minw) w = c->minw; + if(c->minh > 0 && h < c->minh) h = c->minh; + if(c->maxw > 0 && w > c->maxw) w = c->maxw; + if(c->maxh > 0 && h > c->maxh) h = c->maxh; + if(w <= 0 || h <= 0) return; + } /* }}} */ c->layout = Free; @@ -797,45 +809,37 @@ tile(char *cmd) { if(sel) { Client *c; int i; - unsigned int x, y, w, h, bord; + unsigned int n, h, w, bord; unsigned int barto; + float mwf; barto = conf.ttbarheight + barheight; bord = conf.borderheight * 2; - x = mw / 2 + conf.borderheight; - y = barto; - w = ((mw - bord ) / 2 - bord); - if(clientpertag(seltag)-1) - h = ((mh-bord) - conf.ttbarheight - barheight) / (clientpertag(seltag) - 1) ; + mwf = mw*mwfact[seltag]; - sel->ox = sel->x; - sel->oy = sel->y; - sel->ow = sel->w; - sel->oh = sel->h; + n = clientpertag(seltag); + w = mw - mwf - bord; + if(n > 1) + h = (mh- barheight) / (n - 1); + else + h = mh - barheight; - /* Master client in first (always the sel window) */ - moveresize(sel, 0, barto, - ((clientpertag(seltag) > 1) ? (mw-bord) / 2 : (mw-bord)), - ((mh-bord) - conf.ttbarheight - barheight)); - sel->layout = Tile; - - /* tiling */ for(i=0, c = clients; c; c = c->next, ++i) { - if(c != sel && !ishide(c)) { - c->ox = c->x; - c->oy = c->y; - c->ow = c->w; - c->oh = c->h; - moveresize(c, x, y, w, h); - if(i < i + 1) - y = c->y + c->h + bord + conf.ttbarheight; - c->layout = Tile; + if(!ishide(c)) { + if(n == 1) + moveresize(c, 0, barto, mw-bord, mh-(bord+barto), 0); + else if(i == 0) + moveresize(c, 0, barto, mwf-bord, mh-(bord+barto), 0); + else + moveresize(c, mwf, (i-1)* h + barto, w, h - (conf.ttbarheight + bord), 0); + c->layout = Tile; } } } return; } + void togglemax(char *cmd) { if(sel && !ishide(sel)) { @@ -847,15 +851,16 @@ togglemax(char *cmd) { moveresize(sel, 0, conf.ttbarheight + barheight, (mw-(conf.borderheight * 2)), - (mh-(conf.borderheight * 2)- conf.ttbarheight - barheight)); + (mh-(conf.borderheight * 2)- conf.ttbarheight - barheight),1); sel->max = True; sel->layout = Max; } else if(sel->max) { - raiseclient(sel); - moveresize(sel, sel->ox, sel->oy, sel->ow, sel->oh); + moveresize(sel, sel->ox, sel->oy, sel->ow, sel->oh,0); sel->max = False; sel->layout = Free; + raiseclient(c); } + raiseclient(c); } return; } @@ -871,7 +876,7 @@ unhide(Client *c) { (c->y - 9)); if(conf.clientbarblock) if(c->y+conf.ttbarheight <= barheight) - moveresize(c, c->x, barheight + conf.ttbarheight, c->w, c->h); + moveresize(c, c->x, barheight + conf.ttbarheight, c->w, c->h,1); } }