mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
convert xmax/ymax uses to view geometry.
This commit is contained in:
parent
cc08aef0df
commit
186a78ff1e
2
calmwm.h
2
calmwm.h
@ -211,8 +211,6 @@ struct screen_ctx {
|
|||||||
struct color color[CWM_COLOR_MAX];
|
struct color color[CWM_COLOR_MAX];
|
||||||
GC gc;
|
GC gc;
|
||||||
int cycling;
|
int cycling;
|
||||||
int xmax;
|
|
||||||
int ymax;
|
|
||||||
struct geom view; /* viewable area */
|
struct geom view; /* viewable area */
|
||||||
struct geom work; /* workable area, gap-applied */
|
struct geom work; /* workable area, gap-applied */
|
||||||
struct gap gap;
|
struct gap gap;
|
||||||
|
14
client.c
14
client.c
@ -256,7 +256,7 @@ 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 xmax = sc->xmax, ymax = sc->ymax;
|
int xmax = sc->view.w, ymax = sc->view.h;
|
||||||
int x_org = 0, y_org = 0;
|
int x_org = 0, y_org = 0;
|
||||||
|
|
||||||
if (cc->flags & CLIENT_FREEZE)
|
if (cc->flags & CLIENT_FREEZE)
|
||||||
@ -312,7 +312,7 @@ 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 = 0, ymax = sc->ymax;
|
int y_org = 0, ymax = sc->view.h;
|
||||||
|
|
||||||
if (cc->flags & CLIENT_FREEZE)
|
if (cc->flags & CLIENT_FREEZE)
|
||||||
return;
|
return;
|
||||||
@ -360,7 +360,7 @@ 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 = 0, xmax = sc->xmax;
|
int x_org = 0, xmax = sc->view.w;
|
||||||
|
|
||||||
if (cc->flags & CLIENT_FREEZE)
|
if (cc->flags & CLIENT_FREEZE)
|
||||||
return;
|
return;
|
||||||
@ -670,8 +670,8 @@ client_placecalc(struct client_ctx *cc)
|
|||||||
* XRandR bits mean that {x,y}max shouldn't be outside what's
|
* XRandR bits mean that {x,y}max shouldn't be outside what's
|
||||||
* currently there.
|
* currently there.
|
||||||
*/
|
*/
|
||||||
xslack = sc->xmax - cc->geom.width - cc->bwidth * 2;
|
xslack = sc->view.w - cc->geom.width - cc->bwidth * 2;
|
||||||
yslack = sc->ymax - cc->geom.height - cc->bwidth * 2;
|
yslack = sc->view.h - cc->geom.height - cc->bwidth * 2;
|
||||||
if (cc->size->x > 0)
|
if (cc->size->x > 0)
|
||||||
cc->geom.x = MIN(cc->size->x, xslack);
|
cc->geom.x = MIN(cc->size->x, xslack);
|
||||||
if (cc->size->y > 0)
|
if (cc->size->y > 0)
|
||||||
@ -693,8 +693,8 @@ client_placecalc(struct client_ctx *cc)
|
|||||||
} else {
|
} else {
|
||||||
noxine:
|
noxine:
|
||||||
xorig = yorig = 0;
|
xorig = yorig = 0;
|
||||||
xmax = sc->xmax;
|
xmax = sc->view.w;
|
||||||
ymax = sc->ymax;
|
ymax = sc->view.h;
|
||||||
}
|
}
|
||||||
xmouse = MAX(xmouse, xorig) - cc->geom.width / 2;
|
xmouse = MAX(xmouse, xorig) - cc->geom.width / 2;
|
||||||
ymouse = MAX(ymouse, yorig) - cc->geom.height / 2;
|
ymouse = MAX(ymouse, yorig) - cc->geom.height / 2;
|
||||||
|
12
kbfunc.c
12
kbfunc.c
@ -90,20 +90,20 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
|
|||||||
cc->geom.y += my;
|
cc->geom.y += my;
|
||||||
if (cc->geom.y + cc->geom.height < 0)
|
if (cc->geom.y + cc->geom.height < 0)
|
||||||
cc->geom.y = -cc->geom.height;
|
cc->geom.y = -cc->geom.height;
|
||||||
if (cc->geom.y > sc->ymax - 1)
|
if (cc->geom.y > sc->view.h - 1)
|
||||||
cc->geom.y = sc->ymax - 1;
|
cc->geom.y = sc->view.h - 1;
|
||||||
|
|
||||||
cc->geom.x += mx;
|
cc->geom.x += mx;
|
||||||
if (cc->geom.x + cc->geom.width < 0)
|
if (cc->geom.x + cc->geom.width < 0)
|
||||||
cc->geom.x = -cc->geom.width;
|
cc->geom.x = -cc->geom.width;
|
||||||
if (cc->geom.x > sc->xmax - 1)
|
if (cc->geom.x > sc->view.w - 1)
|
||||||
cc->geom.x = sc->xmax - 1;
|
cc->geom.x = sc->view.w - 1;
|
||||||
|
|
||||||
cc->geom.x += client_snapcalc(cc->geom.x,
|
cc->geom.x += client_snapcalc(cc->geom.x,
|
||||||
cc->geom.width, sc->xmax,
|
cc->geom.width, sc->view.w,
|
||||||
cc->bwidth, Conf.snapdist);
|
cc->bwidth, Conf.snapdist);
|
||||||
cc->geom.y += client_snapcalc(cc->geom.y,
|
cc->geom.y += client_snapcalc(cc->geom.y,
|
||||||
cc->geom.height, sc->ymax,
|
cc->geom.height, sc->view.h,
|
||||||
cc->bwidth, Conf.snapdist);
|
cc->bwidth, Conf.snapdist);
|
||||||
|
|
||||||
client_move(cc);
|
client_move(cc);
|
||||||
|
4
menu.c
4
menu.c
@ -349,8 +349,8 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
|
|||||||
ymax = xine->y_org + xine->height;
|
ymax = xine->y_org + xine->height;
|
||||||
} else {
|
} else {
|
||||||
xmin = ymin = 0;
|
xmin = ymin = 0;
|
||||||
xmax = sc->xmax;
|
xmax = sc->view.w;
|
||||||
ymax = sc->ymax;
|
ymax = sc->view.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
xsave = mc->x;
|
xsave = mc->x;
|
||||||
|
@ -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.y = ev.xmotion.y_root - py - cc->bwidth;
|
||||||
|
|
||||||
cc->geom.x += client_snapcalc(cc->geom.x,
|
cc->geom.x += client_snapcalc(cc->geom.x,
|
||||||
cc->geom.width, sc->xmax,
|
cc->geom.width, sc->view.w,
|
||||||
cc->bwidth, Conf.snapdist);
|
cc->bwidth, Conf.snapdist);
|
||||||
cc->geom.y += client_snapcalc(cc->geom.y,
|
cc->geom.y += client_snapcalc(cc->geom.y,
|
||||||
cc->geom.height, sc->ymax,
|
cc->geom.height, sc->view.h,
|
||||||
cc->bwidth, Conf.snapdist);
|
cc->bwidth, Conf.snapdist);
|
||||||
|
|
||||||
/* don't move more than 60 times / second */
|
/* don't move more than 60 times / second */
|
||||||
|
3
screen.c
3
screen.c
@ -117,9 +117,6 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y)
|
|||||||
void
|
void
|
||||||
screen_update_geometry(struct screen_ctx *sc)
|
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.x = 0;
|
||||||
sc->view.y = 0;
|
sc->view.y = 0;
|
||||||
sc->view.w = DisplayWidth(X_Dpy, sc->which);
|
sc->view.w = DisplayWidth(X_Dpy, sc->which);
|
||||||
|
@ -151,10 +151,10 @@ xev_handle_configurerequest(XEvent *ee)
|
|||||||
if (e->value_mask & CWBorderWidth)
|
if (e->value_mask & CWBorderWidth)
|
||||||
wc.border_width = e->border_width;
|
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;
|
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;
|
cc->geom.y -= cc->bwidth;
|
||||||
|
|
||||||
wc.x = cc->geom.x;
|
wc.x = cc->geom.x;
|
||||||
|
10
xutil.c
10
xutil.c
@ -298,7 +298,7 @@ xu_ewmh_net_supported_wm_check(struct screen_ctx *sc)
|
|||||||
void
|
void
|
||||||
xu_ewmh_net_desktop_geometry(struct screen_ctx *sc)
|
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,
|
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_DESKTOP_GEOMETRY].atom,
|
||||||
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)geom , 2);
|
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)geom , 2);
|
||||||
@ -311,10 +311,10 @@ xu_ewmh_net_workarea(struct screen_ctx *sc)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||||
workareas[i][0] = sc->gap.left;
|
workareas[i][0] = sc->work.x;
|
||||||
workareas[i][1] = sc->gap.top;
|
workareas[i][1] = sc->work.y;
|
||||||
workareas[i][2] = sc->xmax - (sc->gap.left + sc->gap.right);
|
workareas[i][2] = sc->work.w;
|
||||||
workareas[i][3] = sc->ymax - (sc->gap.top + sc->gap.bottom);
|
workareas[i][3] = sc->work.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_WORKAREA].atom,
|
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_WORKAREA].atom,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user