From a4c958a3f89733566a15f47d5ddc0167fe5e85d4 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 13 Jul 2012 15:21:35 +0000 Subject: convert xmax/ymax uses to view geometry. --- calmwm.h | 4 +--- client.c | 16 ++++++++-------- kbfunc.c | 14 +++++++------- menu.c | 6 +++--- mousefunc.c | 6 +++--- screen.c | 5 +---- xevents.c | 6 +++--- xutil.c | 12 ++++++------ 8 files changed, 32 insertions(+), 37 deletions(-) diff --git a/calmwm.h b/calmwm.h index 1bc20d2..efbbf3b 100644 --- a/calmwm.h +++ b/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.h,v 1.150 2012/07/13 14:18:04 okan Exp $ + * $OpenBSD: calmwm.h,v 1.151 2012/07/13 15:21:35 okan Exp $ */ #ifndef _CALMWM_H_ @@ -211,8 +211,6 @@ struct screen_ctx { struct color color[CWM_COLOR_MAX]; GC gc; int cycling; - int xmax; - int ymax; struct geom view; /* viewable area */ struct geom work; /* workable area, gap-applied */ struct gap gap; diff --git a/client.c b/client.c index 1aa46fe..fbc1ee4 100644 --- a/client.c +++ b/client.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: client.c,v 1.96 2012/07/04 18:00:13 okan Exp $ + * $OpenBSD: client.c,v 1.97 2012/07/13 15:21:35 okan Exp $ */ #include @@ -256,7 +256,7 @@ void client_maximize(struct client_ctx *cc) { struct screen_ctx *sc = cc->sc; - int xmax = sc->xmax, ymax = sc->ymax; + int xmax = sc->view.w, ymax = sc->view.h; int x_org = 0, y_org = 0; if (cc->flags & CLIENT_FREEZE) @@ -312,7 +312,7 @@ void client_vertmaximize(struct client_ctx *cc) { struct screen_ctx *sc = cc->sc; - int y_org = 0, ymax = sc->ymax; + int y_org = 0, ymax = sc->view.h; if (cc->flags & CLIENT_FREEZE) return; @@ -360,7 +360,7 @@ void client_horizmaximize(struct client_ctx *cc) { struct screen_ctx *sc = cc->sc; - int x_org = 0, xmax = sc->xmax; + int x_org = 0, xmax = sc->view.w; if (cc->flags & CLIENT_FREEZE) return; @@ -670,8 +670,8 @@ client_placecalc(struct client_ctx *cc) * XRandR bits mean that {x,y}max shouldn't be outside what's * currently there. */ - xslack = sc->xmax - cc->geom.width - cc->bwidth * 2; - yslack = sc->ymax - cc->geom.height - cc->bwidth * 2; + xslack = sc->view.w - cc->geom.width - cc->bwidth * 2; + yslack = sc->view.h - cc->geom.height - cc->bwidth * 2; if (cc->size->x > 0) cc->geom.x = MIN(cc->size->x, xslack); if (cc->size->y > 0) @@ -693,8 +693,8 @@ client_placecalc(struct client_ctx *cc) } else { noxine: xorig = yorig = 0; - xmax = sc->xmax; - ymax = sc->ymax; + xmax = sc->view.w; + ymax = sc->view.h; } xmouse = MAX(xmouse, xorig) - cc->geom.width / 2; ymouse = MAX(ymouse, yorig) - cc->geom.height / 2; diff --git a/kbfunc.c b/kbfunc.c index a201bc2..67179a4 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: kbfunc.c,v 1.60 2012/07/04 23:42:03 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.61 2012/07/13 15:21:35 okan Exp $ */ #include @@ -90,20 +90,20 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg) cc->geom.y += my; if (cc->geom.y + cc->geom.height < 0) cc->geom.y = -cc->geom.height; - if (cc->geom.y > sc->ymax - 1) - cc->geom.y = sc->ymax - 1; + if (cc->geom.y > sc->view.h - 1) + cc->geom.y = sc->view.h - 1; cc->geom.x += mx; if (cc->geom.x + cc->geom.width < 0) cc->geom.x = -cc->geom.width; - if (cc->geom.x > sc->xmax - 1) - cc->geom.x = sc->xmax - 1; + if (cc->geom.x > sc->view.w - 1) + cc->geom.x = sc->view.w - 1; cc->geom.x += client_snapcalc(cc->geom.x, - cc->geom.width, sc->xmax, + cc->geom.width, sc->view.w, cc->bwidth, Conf.snapdist); cc->geom.y += client_snapcalc(cc->geom.y, - cc->geom.height, sc->ymax, + cc->geom.height, sc->view.h, cc->bwidth, Conf.snapdist); client_move(cc); diff --git a/menu.c b/menu.c index 5fc2888..7452c42 100644 --- a/menu.c +++ b/menu.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: menu.c,v 1.34 2012/05/16 01:04:36 okan Exp $ + * $OpenBSD: menu.c,v 1.35 2012/07/13 15:21:35 okan Exp $ */ #include @@ -349,8 +349,8 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq, ymax = xine->y_org + xine->height; } else { xmin = ymin = 0; - xmax = sc->xmax; - ymax = sc->ymax; + xmax = sc->view.w; + ymax = sc->view.h; } xsave = mc->x; diff --git a/mousefunc.c b/mousefunc.c index b84e189..1361617 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: mousefunc.c,v 1.35 2012/07/04 23:42:03 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.36 2012/07/13 15:21:35 okan Exp $ */ #include @@ -162,10 +162,10 @@ mousefunc_window_move(struct client_ctx *cc, void *arg) cc->geom.y = ev.xmotion.y_root - py - cc->bwidth; cc->geom.x += client_snapcalc(cc->geom.x, - cc->geom.width, sc->xmax, + cc->geom.width, sc->view.w, cc->bwidth, Conf.snapdist); cc->geom.y += client_snapcalc(cc->geom.y, - cc->geom.height, sc->ymax, + cc->geom.height, sc->view.h, cc->bwidth, Conf.snapdist); /* don't move more than 60 times / second */ diff --git a/screen.c b/screen.c index 28778b1..6a078b2 100644 --- a/screen.c +++ b/screen.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: screen.c,v 1.32 2012/07/13 14:18:04 okan Exp $ + * $OpenBSD: screen.c,v 1.33 2012/07/13 15:21:35 okan Exp $ */ #include @@ -117,9 +117,6 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y) void screen_update_geometry(struct screen_ctx *sc) { - sc->xmax = DisplayWidth(X_Dpy, sc->which); - sc->ymax = DisplayHeight(X_Dpy, sc->which); - sc->view.x = 0; sc->view.y = 0; sc->view.w = DisplayWidth(X_Dpy, sc->which); diff --git a/xevents.c b/xevents.c index 9480c7d..2a7c5e1 100644 --- a/xevents.c +++ b/xevents.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: xevents.c,v 1.63 2012/07/06 14:18:00 okan Exp $ + * $OpenBSD: xevents.c,v 1.64 2012/07/13 15:21:35 okan Exp $ */ /* @@ -151,10 +151,10 @@ xev_handle_configurerequest(XEvent *ee) if (e->value_mask & CWBorderWidth) wc.border_width = e->border_width; - if (cc->geom.x == 0 && cc->geom.width >= sc->xmax) + if (cc->geom.x == 0 && cc->geom.width >= sc->view.w) cc->geom.x -= cc->bwidth; - if (cc->geom.y == 0 && cc->geom.height >= sc->ymax) + if (cc->geom.y == 0 && cc->geom.height >= sc->view.h) cc->geom.y -= cc->bwidth; wc.x = cc->geom.x; diff --git a/xutil.c b/xutil.c index c89b215..15e648a 100644 --- a/xutil.c +++ b/xutil.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: xutil.c,v 1.43 2012/07/08 02:55:01 okan Exp $ + * $OpenBSD: xutil.c,v 1.44 2012/07/13 15:21:35 okan Exp $ */ #include @@ -298,7 +298,7 @@ xu_ewmh_net_supported_wm_check(struct screen_ctx *sc) void xu_ewmh_net_desktop_geometry(struct screen_ctx *sc) { - long geom[2] = { sc->xmax, sc->ymax }; + long geom[2] = { sc->view.w, sc->view.h }; XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_DESKTOP_GEOMETRY].atom, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)geom , 2); @@ -311,10 +311,10 @@ xu_ewmh_net_workarea(struct screen_ctx *sc) int i; for (i = 0; i < CALMWM_NGROUPS; i++) { - workareas[i][0] = sc->gap.left; - workareas[i][1] = sc->gap.top; - workareas[i][2] = sc->xmax - (sc->gap.left + sc->gap.right); - workareas[i][3] = sc->ymax - (sc->gap.top + sc->gap.bottom); + workareas[i][0] = sc->work.x; + workareas[i][1] = sc->work.y; + workareas[i][2] = sc->work.w; + workareas[i][3] = sc->work.h; } XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_WORKAREA].atom, -- cgit v1.2.3-2-gb3c3