mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Fix a couple of issues with the maximization code.
If a window is vertically maximized, then resized, before the MAXIMIZED flag wasn't removed, now it is. so doing a resize then does the right thing. Also, separate flags are needed for vertical and normal maximziation, else when you do vertical-maximize, followed by maximize, the window returns to it's original size. ok simon@, okan@
This commit is contained in:
parent
e704b57d33
commit
34c0a0635f
20
calmwm.h
20
calmwm.h
@ -95,18 +95,20 @@ struct screen_ctx {
|
||||
|
||||
TAILQ_HEAD(screen_ctx_q, screen_ctx);
|
||||
|
||||
#define CLIENT_PROTO_DELETE 0x01
|
||||
#define CLIENT_PROTO_TAKEFOCUS 0x02
|
||||
#define CLIENT_PROTO_DELETE 0x01
|
||||
#define CLIENT_PROTO_TAKEFOCUS 0x02
|
||||
|
||||
#define CLIENT_MAXNAMEQLEN 5
|
||||
#define CLIENT_MAXNAMEQLEN 5
|
||||
|
||||
#define CLIENT_HIDDEN 0x01
|
||||
#define CLIENT_IGNORE 0x02
|
||||
#define CLIENT_INQUEUE 0x04 /* tmp used by search code */
|
||||
#define CLIENT_MAXIMIZED 0x08
|
||||
#define CLIENT_HIDDEN 0x01
|
||||
#define CLIENT_IGNORE 0x02
|
||||
#define CLIENT_DOMAXIMIZE 0x04
|
||||
#define CLIENT_MAXIMIZED 0x08
|
||||
#define CLIENT_DOVMAXIMIZE 0x10
|
||||
#define CLIENT_VMAXIMIZED 0x20
|
||||
|
||||
#define CLIENT_HIGHLIGHT_BLUE 1
|
||||
#define CLIENT_HIGHLIGHT_RED 2
|
||||
#define CLIENT_HIGHLIGHT_BLUE 1
|
||||
#define CLIENT_HIGHLIGHT_RED 2
|
||||
|
||||
|
||||
struct winname {
|
||||
|
25
client.c
25
client.c
@ -331,19 +331,19 @@ void
|
||||
client_maximize(struct client_ctx *cc)
|
||||
{
|
||||
if (cc->flags & CLIENT_MAXIMIZED) {
|
||||
cc->flags &= ~CLIENT_MAXIMIZED;
|
||||
cc->geom = cc->savegeom;
|
||||
} else {
|
||||
XWindowAttributes rootwin_geom;
|
||||
struct screen_ctx *sc = CCTOSC(cc);
|
||||
|
||||
XGetWindowAttributes(X_Dpy, sc->rootwin, &rootwin_geom);
|
||||
cc->savegeom = cc->geom;
|
||||
if (!(cc->flags & CLIENT_VMAXIMIZED))
|
||||
cc->savegeom = cc->geom;
|
||||
cc->geom.x = 0;
|
||||
cc->geom.y = 0;
|
||||
cc->geom.height = rootwin_geom.height;
|
||||
cc->geom.width = rootwin_geom.width;
|
||||
cc->flags |= CLIENT_MAXIMIZED;
|
||||
cc->flags |= CLIENT_DOMAXIMIZE;
|
||||
}
|
||||
|
||||
client_resize(cc);
|
||||
@ -352,6 +352,17 @@ client_maximize(struct client_ctx *cc)
|
||||
void
|
||||
client_resize(struct client_ctx *cc)
|
||||
{
|
||||
if (cc->flags & (CLIENT_MAXIMIZED | CLIENT_VMAXIMIZED))
|
||||
cc->flags &= ~(CLIENT_MAXIMIZED | CLIENT_VMAXIMIZED);
|
||||
|
||||
if (cc->flags & CLIENT_DOMAXIMIZE) {
|
||||
cc->flags &= ~CLIENT_DOMAXIMIZE;
|
||||
cc->flags |= CLIENT_MAXIMIZED;
|
||||
} else if (cc->flags & CLIENT_DOVMAXIMIZE) {
|
||||
cc->flags &= ~CLIENT_DOVMAXIMIZE;
|
||||
cc->flags |= CLIENT_VMAXIMIZED;
|
||||
}
|
||||
|
||||
XMoveResizeWindow(X_Dpy, cc->pwin, cc->geom.x - cc->bwidth,
|
||||
cc->geom.y - cc->bwidth, cc->geom.width + cc->bwidth*2,
|
||||
cc->geom.height + cc->bwidth*2);
|
||||
@ -830,22 +841,22 @@ client_placecalc(struct client_ctx *cc)
|
||||
void
|
||||
client_vertmaximize(struct client_ctx *cc)
|
||||
{
|
||||
if (cc->flags & CLIENT_MAXIMIZED) {
|
||||
cc->flags &= ~CLIENT_MAXIMIZED;
|
||||
if (cc->flags & CLIENT_VMAXIMIZED) {
|
||||
cc->geom = cc->savegeom;
|
||||
} else {
|
||||
struct screen_ctx *sc = CCTOSC(cc);
|
||||
int display_height = DisplayHeight(X_Dpy, sc->which) -
|
||||
cc->bwidth*2;
|
||||
|
||||
cc->savegeom = cc->geom;
|
||||
if (!(cc->flags & CLIENT_MAXIMIZED))
|
||||
cc->savegeom = cc->geom;
|
||||
cc->geom.y = cc->bwidth;
|
||||
if (cc->geom.min_dx == 0)
|
||||
cc->geom.height = display_height;
|
||||
else
|
||||
cc->geom.height = display_height -
|
||||
(display_height % cc->geom.min_dx);
|
||||
cc->flags |= CLIENT_MAXIMIZED;
|
||||
cc->flags |= CLIENT_DOVMAXIMIZE;
|
||||
}
|
||||
|
||||
client_resize(cc);
|
||||
|
Loading…
Reference in New Issue
Block a user