diff options
author | okan | 2012-07-13 15:21:35 +0000 |
---|---|---|
committer | okan | 2012-07-13 15:21:35 +0000 |
commit | a4c958a3f89733566a15f47d5ddc0167fe5e85d4 (patch) | |
tree | c389a5df0d1eac207d889d53e01760717fb24f45 | |
parent | 5e6e2b31dc906e221316757e7b05b680209148b1 (diff) | |
download | cwm-a4c958a3f89733566a15f47d5ddc0167fe5e85d4.tar.gz |
convert xmax/ymax uses to view geometry.
-rw-r--r-- | calmwm.h | 4 | ||||
-rw-r--r-- | client.c | 16 | ||||
-rw-r--r-- | kbfunc.c | 14 | ||||
-rw-r--r-- | menu.c | 6 | ||||
-rw-r--r-- | mousefunc.c | 6 | ||||
-rw-r--r-- | screen.c | 5 | ||||
-rw-r--r-- | xevents.c | 6 | ||||
-rw-r--r-- | xutil.c | 12 |
8 files changed, 32 insertions, 37 deletions
@@ -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; @@ -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 <sys/param.h> @@ -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; @@ -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 <sys/param.h> @@ -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); @@ -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 <sys/param.h> @@ -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 <sys/param.h> @@ -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 */ @@ -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 <sys/param.h> @@ -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); @@ -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; @@ -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 <sys/param.h> @@ -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, |