From 86524e21dd53bad45f4586a7cc856062b67f8033 Mon Sep 17 00:00:00 2001 From: okan Date: Sun, 9 Sep 2012 19:47:47 +0000 Subject: [PATCH] extend client_resize so that it can know when to reset max flags and bwidth; this allows a client to be resized from a max state, which now gets treated like a non-max'd client. based on a diff that does part of this in a different way from Alexander Polakov. --- calmwm.h | 2 +- client.c | 13 +++++++++---- kbfunc.c | 2 +- mousefunc.c | 4 ++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/calmwm.h b/calmwm.h index 849a945..e193dd8 100644 --- a/calmwm.h +++ b/calmwm.h @@ -327,7 +327,7 @@ struct client_ctx *client_new(Window, struct screen_ctx *, int); void client_ptrsave(struct client_ctx *); void client_ptrwarp(struct client_ctx *); void client_raise(struct client_ctx *); -void client_resize(struct client_ctx *); +void client_resize(struct client_ctx *, int); void client_send_delete(struct client_ctx *); void client_setactive(struct client_ctx *, int); void client_setname(struct client_ctx *); diff --git a/client.c b/client.c index 15052eb..8cb119f 100644 --- a/client.c +++ b/client.c @@ -306,7 +306,7 @@ client_maximize(struct client_ctx *cc) cc->flags |= CLIENT_MAXIMIZED; resize: - client_resize(cc); + client_resize(cc, 0); } void @@ -355,7 +355,7 @@ client_vertmaximize(struct client_ctx *cc) cc->flags |= CLIENT_VMAXIMIZED; resize: - client_resize(cc); + client_resize(cc, 0); } void @@ -404,12 +404,17 @@ client_horizmaximize(struct client_ctx *cc) cc->flags |= CLIENT_HMAXIMIZED; resize: - client_resize(cc); + client_resize(cc, 0); } void -client_resize(struct client_ctx *cc) +client_resize(struct client_ctx *cc, int reset) { + if (reset) { + cc->flags &= ~CLIENT_MAXIMIZED; + cc->bwidth = Conf.bwidth; + } + client_draw_border(cc); XMoveResizeWindow(X_Dpy, cc->win, cc->geom.x, diff --git a/kbfunc.c b/kbfunc.c index 0f95df4..2b26416 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -117,7 +117,7 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg) cc->geom.h = 1; if ((cc->geom.w += mx) < 1) cc->geom.w = 1; - client_resize(cc); + client_resize(cc, 1); /* Make sure the pointer stays within the window. */ xu_ptr_getpos(cc->win, &cc->ptr.x, &cc->ptr.y); diff --git a/mousefunc.c b/mousefunc.c index b0bd40f..c615052 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -110,12 +110,12 @@ mousefunc_window_resize(struct client_ctx *cc, void *arg) /* don't resize more than 60 times / second */ if ((ev.xmotion.time - ltime) > (1000 / 60)) { ltime = ev.xmotion.time; - client_resize(cc); + client_resize(cc, 1); } break; case ButtonRelease: if (ltime) - client_resize(cc); + client_resize(cc, 1); XUnmapWindow(X_Dpy, sc->menuwin); XReparentWindow(X_Dpy, sc->menuwin, sc->rootwin, 0, 0); xu_ptr_ungrab();