more variable consistency

This commit is contained in:
okan 2013-01-02 02:19:20 +00:00
parent 2d28b71a1b
commit e492ed8e41
2 changed files with 30 additions and 30 deletions

View File

@ -255,8 +255,8 @@ void
client_maximize(struct client_ctx *cc) client_maximize(struct client_ctx *cc)
{ {
struct screen_ctx *sc = cc->sc; struct screen_ctx *sc = cc->sc;
int x_org, y_org, xmax, ymax;
XineramaScreenInfo *xine; XineramaScreenInfo *xine;
int x_org, y_org, xmax, ymax;
if (cc->flags & CLIENT_FREEZE) if (cc->flags & CLIENT_FREEZE)
return; return;
@ -312,8 +312,8 @@ void
client_vertmaximize(struct client_ctx *cc) client_vertmaximize(struct client_ctx *cc)
{ {
struct screen_ctx *sc = cc->sc; struct screen_ctx *sc = cc->sc;
int y_org, ymax;
XineramaScreenInfo *xine; XineramaScreenInfo *xine;
int y_org, ymax;
if (cc->flags & CLIENT_FREEZE) if (cc->flags & CLIENT_FREEZE)
return; return;
@ -361,8 +361,8 @@ void
client_horizmaximize(struct client_ctx *cc) client_horizmaximize(struct client_ctx *cc)
{ {
struct screen_ctx *sc = cc->sc; struct screen_ctx *sc = cc->sc;
int x_org, xmax;
XineramaScreenInfo *xine; XineramaScreenInfo *xine;
int x_org, xmax;
if (cc->flags & CLIENT_FREEZE) if (cc->flags & CLIENT_FREEZE)
return; return;
@ -683,46 +683,46 @@ client_placecalc(struct client_ctx *cc)
cc->geom.y = MIN(cc->size->y, yslack); cc->geom.y = MIN(cc->size->y, yslack);
} else { } else {
XineramaScreenInfo *xine; XineramaScreenInfo *xine;
int xmouse, ymouse, xorig, yorig; int x_org, y_org, xmax, ymax;
int xmax, ymax; int xmouse, ymouse;
xu_ptr_getpos(sc->rootwin, &xmouse, &ymouse); xu_ptr_getpos(sc->rootwin, &xmouse, &ymouse);
xine = screen_find_xinerama(sc, xmouse, ymouse); xine = screen_find_xinerama(sc, xmouse, ymouse);
if (xine) { if (xine) {
xorig = xine->x_org; x_org = xine->x_org;
yorig = xine->y_org; y_org = xine->y_org;
xmax = xorig + xine->width; xmax = xine->x_org + xine->width;
ymax = yorig + xine->height; ymax = xine->y_org + xine->height;
} else { } else {
xorig = yorig = 0; x_org = y_org = 0;
xmax = sc->view.w; xmax = sc->view.w;
ymax = sc->view.h; ymax = sc->view.h;
} }
xmouse = MAX(xmouse, xorig) - cc->geom.w / 2; xmouse = MAX(xmouse, x_org) - cc->geom.w / 2;
ymouse = MAX(ymouse, yorig) - cc->geom.h / 2; ymouse = MAX(ymouse, y_org) - cc->geom.h / 2;
xmouse = MAX(xmouse, xorig); xmouse = MAX(xmouse, x_org);
ymouse = MAX(ymouse, yorig); ymouse = MAX(ymouse, y_org);
xslack = xmax - cc->geom.w - cc->bwidth * 2; xslack = xmax - cc->geom.w - cc->bwidth * 2;
yslack = ymax - cc->geom.h - cc->bwidth * 2; yslack = ymax - cc->geom.h - cc->bwidth * 2;
if (xslack >= xorig) { if (xslack >= x_org) {
cc->geom.x = MAX(MIN(xmouse, xslack), cc->geom.x = MAX(MIN(xmouse, xslack),
xorig + sc->gap.left); x_org + sc->gap.left);
if (cc->geom.x > (xslack - sc->gap.right)) if (cc->geom.x > (xslack - sc->gap.right))
cc->geom.x -= sc->gap.right; cc->geom.x -= sc->gap.right;
} else { } else {
cc->geom.x = xorig + sc->gap.left; cc->geom.x = x_org + sc->gap.left;
cc->geom.w = xmax - sc->gap.left; cc->geom.w = xmax - sc->gap.left;
} }
if (yslack >= yorig) { if (yslack >= y_org) {
cc->geom.y = MAX(MIN(ymouse, yslack), cc->geom.y = MAX(MIN(ymouse, yslack),
yorig + sc->gap.top); y_org + sc->gap.top);
if (cc->geom.y > (yslack - sc->gap.bottom)) if (cc->geom.y > (yslack - sc->gap.bottom))
cc->geom.y -= sc->gap.bottom; cc->geom.y -= sc->gap.bottom;
} else { } else {
cc->geom.y = yorig + sc->gap.top; cc->geom.y = y_org + sc->gap.top;
cc->geom.h = ymax - sc->gap.top; cc->geom.h = ymax - sc->gap.top;
} }
} }

20
menu.c
View File

@ -351,7 +351,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
{ {
struct menu *mi; struct menu *mi;
XineramaScreenInfo *xine; XineramaScreenInfo *xine;
int xmin, xmax, ymin, ymax; int x_org, y_org, xmax, ymax;
int n, xsave, ysave; int n, xsave, ysave;
if (mc->list) { if (mc->list) {
@ -396,12 +396,12 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
xine = screen_find_xinerama(sc, mc->x, mc->y); xine = screen_find_xinerama(sc, mc->x, mc->y);
if (xine) { if (xine) {
xmin = xine->x_org; x_org = xine->x_org;
y_org = xine->y_org;
xmax = xine->x_org + xine->width; xmax = xine->x_org + xine->width;
ymin = xine->y_org;
ymax = xine->y_org + xine->height; ymax = xine->y_org + xine->height;
} else { } else {
xmin = ymin = 0; x_org = y_org = 0;
xmax = sc->view.w; xmax = sc->view.w;
ymax = sc->view.h; ymax = sc->view.h;
} }
@ -412,15 +412,15 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
/* Never hide the top, or left side, of the menu. */ /* Never hide the top, or left side, of the menu. */
if (mc->x + mc->width >= xmax) if (mc->x + mc->width >= xmax)
mc->x = xmax - mc->width; mc->x = xmax - mc->width;
if (mc->x < xmin) { if (mc->x < x_org) {
mc->x = xmin; mc->x = x_org;
mc->width = xmax - xmin; mc->width = xmax - x_org;
} }
if (mc->y + mc->height >= ymax) if (mc->y + mc->height >= ymax)
mc->y = ymax - mc->height; mc->y = ymax - mc->height;
if (mc->y < ymin) { if (mc->y < y_org) {
mc->y = ymin; mc->y = y_org;
mc->height = ymax - ymin; mc->height = ymax - y_org;
} }
if (mc->x != xsave || mc->y != ysave) if (mc->x != xsave || mc->y != ysave)