mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Mechanical change from xinerama to region backed areas.
This commit is contained in:
114
client.c
114
client.c
@ -265,7 +265,7 @@ void
|
||||
client_toggle_fullscreen(struct client_ctx *cc)
|
||||
{
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct geom xine;
|
||||
struct geom area;
|
||||
|
||||
if ((cc->flags & CLIENT_FREEZE) &&
|
||||
!(cc->flags & CLIENT_FULLSCREEN))
|
||||
@ -280,12 +280,12 @@ client_toggle_fullscreen(struct client_ctx *cc)
|
||||
|
||||
cc->fullgeom = cc->geom;
|
||||
|
||||
xine = screen_find_xinerama(sc,
|
||||
area = screen_area(sc,
|
||||
cc->geom.x + cc->geom.w / 2,
|
||||
cc->geom.y + cc->geom.h / 2, CWM_NOGAP);
|
||||
|
||||
cc->bwidth = 0;
|
||||
cc->geom = xine;
|
||||
cc->geom = area;
|
||||
cc->flags |= (CLIENT_FULLSCREEN | CLIENT_FREEZE);
|
||||
|
||||
resize:
|
||||
@ -297,7 +297,7 @@ void
|
||||
client_toggle_maximize(struct client_ctx *cc)
|
||||
{
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct geom xine;
|
||||
struct geom area;
|
||||
|
||||
if (cc->flags & (CLIENT_FREEZE|CLIENT_STICKY))
|
||||
return;
|
||||
@ -323,14 +323,14 @@ client_toggle_maximize(struct client_ctx *cc)
|
||||
* that's probably more fair than if just the origin of
|
||||
* a window is poking over a boundary
|
||||
*/
|
||||
xine = screen_find_xinerama(sc,
|
||||
area = screen_area(sc,
|
||||
cc->geom.x + cc->geom.w / 2,
|
||||
cc->geom.y + cc->geom.h / 2, CWM_GAP);
|
||||
|
||||
cc->geom.x = xine.x;
|
||||
cc->geom.y = xine.y;
|
||||
cc->geom.w = xine.w - (cc->bwidth * 2);
|
||||
cc->geom.h = xine.h - (cc->bwidth * 2);
|
||||
cc->geom.x = area.x;
|
||||
cc->geom.y = area.y;
|
||||
cc->geom.w = area.w - (cc->bwidth * 2);
|
||||
cc->geom.h = area.h - (cc->bwidth * 2);
|
||||
cc->flags |= CLIENT_MAXIMIZED;
|
||||
|
||||
resize:
|
||||
@ -342,7 +342,7 @@ void
|
||||
client_toggle_vmaximize(struct client_ctx *cc)
|
||||
{
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct geom xine;
|
||||
struct geom area;
|
||||
|
||||
if (cc->flags & (CLIENT_FREEZE|CLIENT_STICKY))
|
||||
return;
|
||||
@ -357,12 +357,12 @@ client_toggle_vmaximize(struct client_ctx *cc)
|
||||
cc->savegeom.y = cc->geom.y;
|
||||
cc->savegeom.h = cc->geom.h;
|
||||
|
||||
xine = screen_find_xinerama(sc,
|
||||
area = screen_area(sc,
|
||||
cc->geom.x + cc->geom.w / 2,
|
||||
cc->geom.y + cc->geom.h / 2, CWM_GAP);
|
||||
|
||||
cc->geom.y = xine.y;
|
||||
cc->geom.h = xine.h - (cc->bwidth * 2);
|
||||
cc->geom.y = area.y;
|
||||
cc->geom.h = area.h - (cc->bwidth * 2);
|
||||
cc->flags |= CLIENT_VMAXIMIZED;
|
||||
|
||||
resize:
|
||||
@ -374,7 +374,7 @@ void
|
||||
client_toggle_hmaximize(struct client_ctx *cc)
|
||||
{
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct geom xine;
|
||||
struct geom area;
|
||||
|
||||
if (cc->flags & (CLIENT_FREEZE|CLIENT_STICKY))
|
||||
return;
|
||||
@ -389,12 +389,12 @@ client_toggle_hmaximize(struct client_ctx *cc)
|
||||
cc->savegeom.x = cc->geom.x;
|
||||
cc->savegeom.w = cc->geom.w;
|
||||
|
||||
xine = screen_find_xinerama(sc,
|
||||
area = screen_area(sc,
|
||||
cc->geom.x + cc->geom.w / 2,
|
||||
cc->geom.y + cc->geom.h / 2, CWM_GAP);
|
||||
|
||||
cc->geom.x = xine.x;
|
||||
cc->geom.w = xine.w - (cc->bwidth * 2);
|
||||
cc->geom.x = area.x;
|
||||
cc->geom.w = area.w - (cc->bwidth * 2);
|
||||
cc->flags |= CLIENT_HMAXIMIZED;
|
||||
|
||||
resize:
|
||||
@ -740,33 +740,33 @@ client_placecalc(struct client_ctx *cc)
|
||||
cc->geom.x = MIN(cc->geom.x, xslack);
|
||||
cc->geom.y = MIN(cc->geom.y, yslack);
|
||||
} else {
|
||||
struct geom xine;
|
||||
struct geom area;
|
||||
int xmouse, ymouse;
|
||||
|
||||
xu_ptr_getpos(sc->rootwin, &xmouse, &ymouse);
|
||||
xine = screen_find_xinerama(sc, xmouse, ymouse, CWM_GAP);
|
||||
xine.w += xine.x;
|
||||
xine.h += xine.y;
|
||||
xmouse = MAX(xmouse, xine.x) - cc->geom.w / 2;
|
||||
ymouse = MAX(ymouse, xine.y) - cc->geom.h / 2;
|
||||
area = screen_area(sc, xmouse, ymouse, CWM_GAP);
|
||||
area.w += area.x;
|
||||
area.h += area.y;
|
||||
xmouse = MAX(xmouse, area.x) - cc->geom.w / 2;
|
||||
ymouse = MAX(ymouse, area.y) - cc->geom.h / 2;
|
||||
|
||||
xmouse = MAX(xmouse, xine.x);
|
||||
ymouse = MAX(ymouse, xine.y);
|
||||
xmouse = MAX(xmouse, area.x);
|
||||
ymouse = MAX(ymouse, area.y);
|
||||
|
||||
xslack = xine.w - cc->geom.w - cc->bwidth * 2;
|
||||
yslack = xine.h - cc->geom.h - cc->bwidth * 2;
|
||||
xslack = area.w - cc->geom.w - cc->bwidth * 2;
|
||||
yslack = area.h - cc->geom.h - cc->bwidth * 2;
|
||||
|
||||
if (xslack >= xine.x) {
|
||||
cc->geom.x = MAX(MIN(xmouse, xslack), xine.x);
|
||||
if (xslack >= area.x) {
|
||||
cc->geom.x = MAX(MIN(xmouse, xslack), area.x);
|
||||
} else {
|
||||
cc->geom.x = xine.x;
|
||||
cc->geom.w = xine.w;
|
||||
cc->geom.x = area.x;
|
||||
cc->geom.w = area.w;
|
||||
}
|
||||
if (yslack >= xine.y) {
|
||||
cc->geom.y = MAX(MIN(ymouse, yslack), xine.y);
|
||||
if (yslack >= area.y) {
|
||||
cc->geom.y = MAX(MIN(ymouse, yslack), area.y);
|
||||
} else {
|
||||
cc->geom.y = xine.y;
|
||||
cc->geom.h = xine.h;
|
||||
cc->geom.y = area.y;
|
||||
cc->geom.h = area.h;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -949,7 +949,7 @@ client_htile(struct client_ctx *cc)
|
||||
struct client_ctx *ci;
|
||||
struct group_ctx *gc = cc->group;
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct geom xine;
|
||||
struct geom area;
|
||||
int i, n, mh, x, h, w;
|
||||
|
||||
if (!gc)
|
||||
@ -965,36 +965,36 @@ client_htile(struct client_ctx *cc)
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
xine = screen_find_xinerama(sc,
|
||||
area = screen_area(sc,
|
||||
cc->geom.x + cc->geom.w / 2,
|
||||
cc->geom.y + cc->geom.h / 2, CWM_GAP);
|
||||
|
||||
if (cc->flags & CLIENT_VMAXIMIZED ||
|
||||
cc->geom.h + (cc->bwidth * 2) >= xine.h)
|
||||
cc->geom.h + (cc->bwidth * 2) >= area.h)
|
||||
return;
|
||||
|
||||
cc->flags &= ~CLIENT_HMAXIMIZED;
|
||||
cc->geom.x = xine.x;
|
||||
cc->geom.y = xine.y;
|
||||
cc->geom.w = xine.w - (cc->bwidth * 2);
|
||||
cc->geom.x = area.x;
|
||||
cc->geom.y = area.y;
|
||||
cc->geom.w = area.w - (cc->bwidth * 2);
|
||||
client_resize(cc, 1);
|
||||
client_ptrwarp(cc);
|
||||
|
||||
mh = cc->geom.h + (cc->bwidth * 2);
|
||||
x = xine.x;
|
||||
w = xine.w / n;
|
||||
h = xine.h - mh;
|
||||
x = area.x;
|
||||
w = area.w / n;
|
||||
h = area.h - mh;
|
||||
TAILQ_FOREACH(ci, &gc->clientq, group_entry) {
|
||||
if (ci->flags & CLIENT_HIDDEN ||
|
||||
ci->flags & CLIENT_IGNORE || (ci == cc))
|
||||
continue;
|
||||
ci->bwidth = Conf.bwidth;
|
||||
ci->geom.y = xine.y + mh;
|
||||
ci->geom.y = area.y + mh;
|
||||
ci->geom.x = x;
|
||||
ci->geom.h = h - (ci->bwidth * 2);
|
||||
ci->geom.w = w - (ci->bwidth * 2);
|
||||
if (i + 1 == n)
|
||||
ci->geom.w = xine.x + xine.w -
|
||||
ci->geom.w = area.x + area.w -
|
||||
ci->geom.x - (ci->bwidth * 2);
|
||||
x += w;
|
||||
client_resize(ci, 1);
|
||||
@ -1008,7 +1008,7 @@ client_vtile(struct client_ctx *cc)
|
||||
struct client_ctx *ci;
|
||||
struct group_ctx *gc = cc->group;
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct geom xine;
|
||||
struct geom area;
|
||||
int i, n, mw, y, h, w;
|
||||
|
||||
if (!gc)
|
||||
@ -1024,36 +1024,36 @@ client_vtile(struct client_ctx *cc)
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
xine = screen_find_xinerama(sc,
|
||||
area = screen_area(sc,
|
||||
cc->geom.x + cc->geom.w / 2,
|
||||
cc->geom.y + cc->geom.h / 2, CWM_GAP);
|
||||
|
||||
if (cc->flags & CLIENT_HMAXIMIZED ||
|
||||
cc->geom.w + (cc->bwidth * 2) >= xine.w)
|
||||
cc->geom.w + (cc->bwidth * 2) >= area.w)
|
||||
return;
|
||||
|
||||
cc->flags &= ~CLIENT_VMAXIMIZED;
|
||||
cc->geom.x = xine.x;
|
||||
cc->geom.y = xine.y;
|
||||
cc->geom.h = xine.h - (cc->bwidth * 2);
|
||||
cc->geom.x = area.x;
|
||||
cc->geom.y = area.y;
|
||||
cc->geom.h = area.h - (cc->bwidth * 2);
|
||||
client_resize(cc, 1);
|
||||
client_ptrwarp(cc);
|
||||
|
||||
mw = cc->geom.w + (cc->bwidth * 2);
|
||||
y = xine.y;
|
||||
h = xine.h / n;
|
||||
w = xine.w - mw;
|
||||
y = area.y;
|
||||
h = area.h / n;
|
||||
w = area.w - mw;
|
||||
TAILQ_FOREACH(ci, &gc->clientq, group_entry) {
|
||||
if (ci->flags & CLIENT_HIDDEN ||
|
||||
ci->flags & CLIENT_IGNORE || (ci == cc))
|
||||
continue;
|
||||
ci->bwidth = Conf.bwidth;
|
||||
ci->geom.y = y;
|
||||
ci->geom.x = xine.x + mw;
|
||||
ci->geom.x = area.x + mw;
|
||||
ci->geom.h = h - (ci->bwidth * 2);
|
||||
ci->geom.w = w - (ci->bwidth * 2);
|
||||
if (i + 1 == n)
|
||||
ci->geom.h = xine.y + xine.h -
|
||||
ci->geom.h = area.y + area.h -
|
||||
ci->geom.y - (ci->bwidth * 2);
|
||||
y += h;
|
||||
client_resize(ci, 1);
|
||||
|
Reference in New Issue
Block a user