aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2011-06-24 06:01:47 +0000
committerokan2011-06-24 06:01:47 +0000
commitc94e1a5dfb1df6ef5292efe8116084f95220d1a1 (patch)
tree71f97575176f2deb147da427962f828adae8e917
parent8ea15c6377219fe726620108371d90809ac06233 (diff)
downloadcwm-c94e1a5dfb1df6ef5292efe8116084f95220d1a1.tar.gz
re-do various bits of {,h,v}max for simplicity and less flag handling.
as a bonus, flipping between various combinations of vmax+hmax provides a more predictable behavior. commitski oga@
Diffstat (limited to '')
-rw-r--r--calmwm.h13
-rw-r--r--client.c43
2 files changed, 20 insertions, 36 deletions
diff --git a/calmwm.h b/calmwm.h
index a7abad3..8e37e3b 100644
--- a/calmwm.h
+++ b/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.129 2011/06/24 05:45:57 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.130 2011/06/24 06:01:47 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -140,13 +140,10 @@ struct client_ctx {
int xproto;
#define CLIENT_HIDDEN 0x0001
#define CLIENT_IGNORE 0x0002
-#define CLIENT_DOMAXIMIZE 0x0004
-#define CLIENT_MAXIMIZED 0x0008
-#define CLIENT_DOVMAXIMIZE 0x0010
-#define CLIENT_VMAXIMIZED 0x0020
-#define CLIENT_DOHMAXIMIZE 0x0040
-#define CLIENT_HMAXIMIZED 0x0080
-#define CLIENT_FREEZE 0x0100
+#define CLIENT_MAXIMIZED 0x0004
+#define CLIENT_VMAXIMIZED 0x0008
+#define CLIENT_HMAXIMIZED 0x0010
+#define CLIENT_FREEZE 0x0020
int flags;
int state;
int active;
diff --git a/client.c b/client.c
index e7307cd..d366f30 100644
--- a/client.c
+++ b/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.83 2011/06/24 05:40:09 okan Exp $
+ * $OpenBSD: client.c,v 1.84 2011/06/24 06:01:47 okan Exp $
*/
#include <sys/param.h>
@@ -283,6 +283,8 @@ client_maximize(struct client_ctx *cc)
if (cc->flags & CLIENT_MAXIMIZED) {
cc->geom = cc->savegeom;
+ cc->bwidth = Conf.bwidth;
+ cc->flags &= ~CLIENT_MAXIMIZED;
} else {
if (!(cc->flags & (CLIENT_VMAXIMIZED | CLIENT_HMAXIMIZED)))
cc->savegeom = cc->geom;
@@ -308,7 +310,8 @@ calc:
cc->geom.y = y_org + sc->gap.top;
cc->geom.height = ymax - (sc->gap.top + sc->gap.bottom);
cc->geom.width = xmax - (sc->gap.left + sc->gap.right);
- cc->flags |= CLIENT_DOMAXIMIZE;
+ cc->bwidth = 0;
+ cc->flags |= CLIENT_MAXIMIZED;
}
client_resize(cc);
@@ -324,7 +327,10 @@ client_vertmaximize(struct client_ctx *cc)
return;
if (cc->flags & CLIENT_VMAXIMIZED) {
- cc->geom = cc->savegeom;
+ cc->geom.y = cc->savegeom.y;
+ cc->geom.height = cc->savegeom.height;
+ cc->bwidth = Conf.bwidth;
+ cc->flags &= ~CLIENT_VMAXIMIZED;
} else {
if (!(cc->flags & (CLIENT_MAXIMIZED | CLIENT_HMAXIMIZED)))
cc->savegeom = cc->geom;
@@ -342,7 +348,7 @@ calc:
cc->geom.y = y_org + sc->gap.top;
cc->geom.height = ymax - (cc->bwidth * 2) - (sc->gap.top +
sc->gap.bottom);
- cc->flags |= CLIENT_DOVMAXIMIZE;
+ cc->flags |= CLIENT_VMAXIMIZED;
}
client_resize(cc);
@@ -358,7 +364,10 @@ client_horizmaximize(struct client_ctx *cc)
return;
if (cc->flags & CLIENT_HMAXIMIZED) {
- cc->geom = cc->savegeom;
+ cc->geom.x = cc->savegeom.x;
+ cc->geom.width = cc->savegeom.width;
+ cc->bwidth = Conf.bwidth;
+ cc->flags &= ~CLIENT_HMAXIMIZED;
} else {
if (!(cc->flags & (CLIENT_MAXIMIZED | CLIENT_VMAXIMIZED)))
cc->savegeom = cc->geom;
@@ -376,7 +385,7 @@ calc:
cc->geom.x = x_org + sc->gap.left;
cc->geom.width = xmax - (cc->bwidth * 2) - (sc->gap.left +
sc->gap.right);
- cc->flags |= CLIENT_DOHMAXIMIZE;
+ cc->flags |= CLIENT_HMAXIMIZED;
}
client_resize(cc);
@@ -385,23 +394,6 @@ calc:
void
client_resize(struct client_ctx *cc)
{
- cc->flags &= ~(CLIENT_MAXIMIZED | CLIENT_VMAXIMIZED |
- CLIENT_HMAXIMIZED);
-
- if (cc->flags & CLIENT_DOMAXIMIZE) {
- cc->bwidth = 0;
- cc->flags &= ~CLIENT_DOMAXIMIZE;
- cc->flags |= CLIENT_MAXIMIZED;
- } else if (cc->flags & CLIENT_DOVMAXIMIZE) {
- cc->flags &= ~CLIENT_DOVMAXIMIZE;
- cc->flags |= CLIENT_VMAXIMIZED;
- } else if (cc->flags & CLIENT_DOHMAXIMIZE) {
- cc->flags &= ~CLIENT_DOHMAXIMIZE;
- cc->flags |= CLIENT_HMAXIMIZED;
- } else {
- cc->bwidth = Conf.bwidth;
- }
-
client_draw_border(cc);
XMoveResizeWindow(X_Dpy, cc->win, cc->geom.x,
@@ -412,11 +404,6 @@ client_resize(struct client_ctx *cc)
void
client_move(struct client_ctx *cc)
{
- if (cc->flags & CLIENT_VMAXIMIZED)
- cc->savegeom.x = cc->geom.x;
- if (cc->flags & CLIENT_HMAXIMIZED)
- cc->savegeom.y = cc->geom.y;
-
XMoveWindow(X_Dpy, cc->win, cc->geom.x, cc->geom.y);
xu_configure(cc);
}