summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2012-09-09 19:47:48 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2012-09-09 19:47:48 +0000
commita514e69ee8bb6f7915d6bd8437b003bae29c1d85 (patch)
treed85debd3251b04ea361382b1ea6f23a9908b65ad
parentc89e19c7bf4c18a149b4ad1e1872a7f426dee283 (diff)
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.
-rw-r--r--app/cwm/calmwm.h4
-rw-r--r--app/cwm/client.c15
-rw-r--r--app/cwm/kbfunc.c4
-rw-r--r--app/cwm/mousefunc.c6
4 files changed, 17 insertions, 12 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index dbcb5099d..9c392e289 100644
--- a/app/cwm/calmwm.h
+++ b/app/cwm/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: calmwm.h,v 1.152 2012/07/13 17:01:04 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.153 2012/09/09 19:47:47 okan Exp $
*/
#ifndef _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/app/cwm/client.c b/app/cwm/client.c
index 3339f55c5..2276520d5 100644
--- a/app/cwm/client.c
+++ b/app/cwm/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.100 2012/07/16 01:53:14 okan Exp $
+ * $OpenBSD: client.c,v 1.101 2012/09/09 19:47:47 okan Exp $
*/
#include <sys/param.h>
@@ -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/app/cwm/kbfunc.c b/app/cwm/kbfunc.c
index 056dbe9ef..77544927b 100644
--- a/app/cwm/kbfunc.c
+++ b/app/cwm/kbfunc.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: kbfunc.c,v 1.62 2012/07/13 17:01:04 okan Exp $
+ * $OpenBSD: kbfunc.c,v 1.63 2012/09/09 19:47:47 okan Exp $
*/
#include <sys/param.h>
@@ -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/app/cwm/mousefunc.c b/app/cwm/mousefunc.c
index 4f6ec66da..5af879829 100644
--- a/app/cwm/mousefunc.c
+++ b/app/cwm/mousefunc.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: mousefunc.c,v 1.37 2012/07/13 17:01:04 okan Exp $
+ * $OpenBSD: mousefunc.c,v 1.38 2012/09/09 19:47:47 okan Exp $
*/
#include <sys/param.h>
@@ -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();