mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
move the HasXinerama check into screen_find_xinerama and simplify logic;
moves closer to logic in menu code.
This commit is contained in:
parent
0e8815dfb0
commit
e42d1c7f01
59
client.c
59
client.c
@ -258,6 +258,7 @@ client_maximize(struct client_ctx *cc)
|
|||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
int xmax = sc->view.w, ymax = sc->view.h;
|
int xmax = sc->view.w, ymax = sc->view.h;
|
||||||
int x_org = 0, y_org = 0;
|
int x_org = 0, y_org = 0;
|
||||||
|
XineramaScreenInfo *xine;
|
||||||
|
|
||||||
if (cc->flags & CLIENT_FREEZE)
|
if (cc->flags & CLIENT_FREEZE)
|
||||||
return;
|
return;
|
||||||
@ -279,24 +280,21 @@ client_maximize(struct client_ctx *cc)
|
|||||||
cc->savegeom.x = cc->geom.x;
|
cc->savegeom.x = cc->geom.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasXinerama) {
|
/*
|
||||||
XineramaScreenInfo *xine;
|
* pick screen that the middle of the window is on.
|
||||||
/*
|
* that's probably more fair than if just the origin of
|
||||||
* pick screen that the middle of the window is on.
|
* a window is poking over a boundary
|
||||||
* that's probably more fair than if just the origin of
|
*/
|
||||||
* a window is poking over a boundary
|
xine = screen_find_xinerama(sc,
|
||||||
*/
|
cc->geom.x + cc->geom.w / 2,
|
||||||
xine = screen_find_xinerama(sc,
|
cc->geom.y + cc->geom.h / 2);
|
||||||
cc->geom.x + cc->geom.w / 2,
|
if (xine) {
|
||||||
cc->geom.y + cc->geom.h / 2);
|
|
||||||
if (xine == NULL)
|
|
||||||
goto calc;
|
|
||||||
x_org = xine->x_org;
|
x_org = xine->x_org;
|
||||||
y_org = xine->y_org;
|
y_org = xine->y_org;
|
||||||
xmax = xine->width;
|
xmax = xine->width;
|
||||||
ymax = xine->height;
|
ymax = xine->height;
|
||||||
}
|
}
|
||||||
calc:
|
|
||||||
cc->geom.x = x_org + sc->gap.left;
|
cc->geom.x = x_org + sc->gap.left;
|
||||||
cc->geom.y = y_org + sc->gap.top;
|
cc->geom.y = y_org + sc->gap.top;
|
||||||
cc->geom.h = ymax - (sc->gap.top + sc->gap.bottom);
|
cc->geom.h = ymax - (sc->gap.top + sc->gap.bottom);
|
||||||
@ -313,6 +311,7 @@ client_vertmaximize(struct client_ctx *cc)
|
|||||||
{
|
{
|
||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
int y_org = 0, ymax = sc->view.h;
|
int y_org = 0, ymax = sc->view.h;
|
||||||
|
XineramaScreenInfo *xine;
|
||||||
|
|
||||||
if (cc->flags & CLIENT_FREEZE)
|
if (cc->flags & CLIENT_FREEZE)
|
||||||
return;
|
return;
|
||||||
@ -336,17 +335,14 @@ client_vertmaximize(struct client_ctx *cc)
|
|||||||
cc->bwidth = 0;
|
cc->bwidth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasXinerama) {
|
xine = screen_find_xinerama(sc,
|
||||||
XineramaScreenInfo *xine;
|
cc->geom.x + cc->geom.w / 2,
|
||||||
xine = screen_find_xinerama(sc,
|
cc->geom.y + cc->geom.h / 2);
|
||||||
cc->geom.x + cc->geom.w / 2,
|
if (xine) {
|
||||||
cc->geom.y + cc->geom.h / 2);
|
|
||||||
if (xine == NULL)
|
|
||||||
goto calc;
|
|
||||||
y_org = xine->y_org;
|
y_org = xine->y_org;
|
||||||
ymax = xine->height;
|
ymax = xine->height;
|
||||||
}
|
}
|
||||||
calc:
|
|
||||||
cc->geom.y = y_org + sc->gap.top;
|
cc->geom.y = y_org + sc->gap.top;
|
||||||
cc->geom.h = ymax - (cc->bwidth * 2) - (sc->gap.top +
|
cc->geom.h = ymax - (cc->bwidth * 2) - (sc->gap.top +
|
||||||
sc->gap.bottom);
|
sc->gap.bottom);
|
||||||
@ -361,6 +357,7 @@ client_horizmaximize(struct client_ctx *cc)
|
|||||||
{
|
{
|
||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
int x_org = 0, xmax = sc->view.w;
|
int x_org = 0, xmax = sc->view.w;
|
||||||
|
XineramaScreenInfo *xine;
|
||||||
|
|
||||||
if (cc->flags & CLIENT_FREEZE)
|
if (cc->flags & CLIENT_FREEZE)
|
||||||
return;
|
return;
|
||||||
@ -384,17 +381,14 @@ client_horizmaximize(struct client_ctx *cc)
|
|||||||
cc->bwidth = 0;
|
cc->bwidth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasXinerama) {
|
xine = screen_find_xinerama(sc,
|
||||||
XineramaScreenInfo *xine;
|
cc->geom.x + cc->geom.w / 2,
|
||||||
xine = screen_find_xinerama(sc,
|
cc->geom.y + cc->geom.h / 2);
|
||||||
cc->geom.x + cc->geom.w / 2,
|
if (xine) {
|
||||||
cc->geom.y + cc->geom.h / 2);
|
|
||||||
if (xine == NULL)
|
|
||||||
goto calc;
|
|
||||||
x_org = xine->x_org;
|
x_org = xine->x_org;
|
||||||
xmax = xine->width;
|
xmax = xine->width;
|
||||||
}
|
}
|
||||||
calc:
|
|
||||||
cc->geom.x = x_org + sc->gap.left;
|
cc->geom.x = x_org + sc->gap.left;
|
||||||
cc->geom.w = xmax - (cc->bwidth * 2) - (sc->gap.left +
|
cc->geom.w = xmax - (cc->bwidth * 2) - (sc->gap.left +
|
||||||
sc->gap.right);
|
sc->gap.right);
|
||||||
@ -682,16 +676,13 @@ client_placecalc(struct client_ctx *cc)
|
|||||||
int xmax, ymax;
|
int xmax, ymax;
|
||||||
|
|
||||||
xu_ptr_getpos(sc->rootwin, &xmouse, &ymouse);
|
xu_ptr_getpos(sc->rootwin, &xmouse, &ymouse);
|
||||||
if (HasXinerama) {
|
info = screen_find_xinerama(sc, xmouse, ymouse);
|
||||||
info = screen_find_xinerama(sc, xmouse, ymouse);
|
if (info) {
|
||||||
if (info == NULL)
|
|
||||||
goto noxine;
|
|
||||||
xorig = info->x_org;
|
xorig = info->x_org;
|
||||||
yorig = info->y_org;
|
yorig = info->y_org;
|
||||||
xmax = xorig + info->width;
|
xmax = xorig + info->width;
|
||||||
ymax = yorig + info->height;
|
ymax = yorig + info->height;
|
||||||
} else {
|
} else {
|
||||||
noxine:
|
|
||||||
xorig = yorig = 0;
|
xorig = yorig = 0;
|
||||||
xmax = sc->view.w;
|
xmax = sc->view.w;
|
||||||
ymax = sc->view.h;
|
ymax = sc->view.h;
|
||||||
|
3
screen.c
3
screen.c
@ -105,6 +105,9 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y)
|
|||||||
XineramaScreenInfo *info;
|
XineramaScreenInfo *info;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (HasXinerama = 0)
|
||||||
|
return (NULL);
|
||||||
|
|
||||||
for (i = 0; i < sc->xinerama_no; i++) {
|
for (i = 0; i < sc->xinerama_no; i++) {
|
||||||
info = &sc->xinerama[i];
|
info = &sc->xinerama[i];
|
||||||
if (x >= info->x_org && x < info->x_org + info->width &&
|
if (x >= info->x_org && x < info->x_org + info->width &&
|
||||||
|
Loading…
Reference in New Issue
Block a user