From cd058a475300123b100eaef075105bade386c2be Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Mon, 24 Oct 2011 19:37:36 +0200 Subject: [PATCH] Fix global fac resize when only one client is not resizable --- src/client.c | 19 ++++++++++++++----- src/event.c | 2 +- src/wmfs.h | 3 ++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/client.c b/src/client.c index 0f8742e..ea497ee 100644 --- a/src/client.c +++ b/src/client.c @@ -651,7 +651,7 @@ client_winsize(struct client *c, struct geo *g) void client_moveresize(struct client *c, struct geo *g) { - c->tgeo = c->rgeo = c->geo = *g; + c->ttgeo = c->tgeo = c->rgeo = c->geo = *g; if(!(c->flags & CLIENT_DID_WINSIZE)) if(client_winsize(c, g)) @@ -683,8 +683,9 @@ client_moveresize(struct client *c, struct geo *g) void client_maximize(struct client *c) { - c->geo = c->screen->ugeo; c->geo.x = c->geo.y = 0; + c->geo.w = c->screen->ugeo.w; + c->geo.h = c->screen->ugeo.h; client_moveresize(c, &c->geo); @@ -713,7 +714,7 @@ _fac_apply(struct client *c, enum position p, int fac) break; } - c->flags |= CLIENT_IGNORE_ENTER; + c->flags |= (CLIENT_IGNORE_ENTER | CLIENT_FAC_APPLIED); } static inline void @@ -737,6 +738,9 @@ _fac_resize(struct client *c, enum position p, int fac) if(!gc || gc->screen != c->screen) return; + SLIST_FOREACH(cc, &c->tag->clients, tnext) + cc->ttgeo = cc->tgeo; + if(GEO_CHECK2(c->geo, gc->geo, p)) { _fac_apply(c, p, fac); @@ -755,7 +759,8 @@ _fac_resize(struct client *c, enum position p, int fac) * clients in linked list. */ SLIST_FOREACH(gc, &c->tag->clients, tnext) - if(client_winsize(gc, &gc->tgeo)) + if(gc->flags & CLIENT_FAC_APPLIED + && client_winsize(gc, &gc->tgeo)) { /* * Reverse back the flag and the window geo @@ -763,12 +768,13 @@ _fac_resize(struct client *c, enum position p, int fac) */ SLIST_FOREACH(cc, &c->tag->clients, tnext) { - cc->tgeo = cc->geo; + cc->tgeo = cc->ttgeo; cc->flags &= ~CLIENT_DID_WINSIZE; } return; } + } #define _REV_BORDER() \ @@ -849,7 +855,10 @@ client_fac_resize(struct client *c, enum position p, int fac) if(b) { SLIST_FOREACH(gc, &c->tag->clients, tnext) + { client_moveresize(gc, &gc->tgeo); + gc->flags &= ~CLIENT_FAC_APPLIED; + } layout_save_set(c->tag); } diff --git a/src/event.c b/src/event.c index e8b691e..56a60af 100644 --- a/src/event.c +++ b/src/event.c @@ -48,7 +48,7 @@ event_enternotify(XEvent *e) if((c = client_gb_win(ev->window)) || (c = client_gb_frame(ev->window))) -{ + { if(c->flags & CLIENT_IGNORE_ENTER) c->flags ^= CLIENT_IGNORE_ENTER; else diff --git a/src/wmfs.h b/src/wmfs.h index 776ab2f..be912ca 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -143,7 +143,7 @@ struct client struct tag *tag; struct screen *screen; struct barwin *titlebar; - struct geo geo, wgeo, tgeo, rgeo; + struct geo geo, wgeo, tgeo, ttgeo, rgeo; struct colpair ncol, scol; int sizeh[SHLAST]; char *title; @@ -151,6 +151,7 @@ struct client #define CLIENT_HINT_FLAG 0x01 #define CLIENT_IGNORE_ENTER 0x02 #define CLIENT_DID_WINSIZE 0x04 +#define CLIENT_FAC_APPLIED 0x08 Flags flags; Window win, frame; SLIST_ENTRY(client) next; /* Global list */