convert xmax/ymax uses to view geometry.

This commit is contained in:
okan 2012-07-13 15:21:35 +00:00
parent 3f2059e461
commit 6ee7c6534f
8 changed files with 32 additions and 37 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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 */

View File

@ -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);

View File

@ -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;

View File

@ -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,