This diff fixes some bugs in cwm that occur when a window changes from
one maximized state (horizontal, vertical or full) to another.
For instance:
1. Focus a non-maximized window.
2. Press CM-= to vertically maximize it.
3. Press CM-f to fully maximize it.
4. Press CM-= to vertically maximize it again. The window is
horizontally maximized instead.
Another:
1. Focus a non-maximized window.
2. Press CM-= to vertically maximize it.
3. Press CM-f to fully maximize it.
4. Press CM-f to unmaximize it.
5. Press CM-= to vertically maximize it again. The size of the window
doesn't change.
6. Press CM-= to try again. Now the window is vertically maximized.
With this diff, cwm maximizes windows in a way I think is most useful
and least surprising.
Regards,
Tim
Index: client.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.86
diff -p -u -r1.86 client.c
--- client.c 14 Jul 2011 11:39:53 -0000 1.86
+++ client.c 18 Aug 2011 20:20:45 -0000
@@ -312,6 +312,7 @@ calc:
cc->geom.width = xmax - (sc->gap.left + sc->gap.right);
cc->bwidth = 0;
cc->flags |= CLIENT_MAXIMIZED;
+ cc->flags &= ~(CLIENT_VMAXIMIZED | CLIENT_HMAXIMIZED);
}
client_resize(cc);
@@ -329,11 +330,16 @@ client_vertmaximize(struct client_ctx *c
if (cc->flags & CLIENT_VMAXIMIZED) {
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;
+ else {
+ cc->geom.x = cc->savegeom.x;
+ cc->geom.width = cc->savegeom.width;
+ cc->bwidth = Conf.bwidth;
+ cc->flags &= ~(CLIENT_MAXIMIZED | CLIENT_HMAXIMIZED);
+ }
if (HasXinerama) {
XineramaScreenInfo *xine;
xine = screen_find_xinerama(sc,
@@ -366,11 +372,16 @@ client_horizmaximize(struct client_ctx *
if (cc->flags & CLIENT_HMAXIMIZED) {
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;
+ else {
+ cc->geom.y = cc->savegeom.y;
+ cc->geom.height = cc->savegeom.height;
+ cc->bwidth = Conf.bwidth;
+ cc->flags &= ~(CLIENT_MAXIMIZED | CLIENT_VMAXIMIZED);
+ }
if (HasXinerama) {
XineramaScreenInfo *xine;
xine = screen_find_xinerama(sc,