diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2013-12-13 22:39:14 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2013-12-13 22:39:14 +0000 |
commit | 0078550bb8d0157602e73a6961648013591d837d (patch) | |
tree | 0eb92b09485905f52e18405907e923d87e0f92ea | |
parent | 6704f56526350b6108d6418c5cc80e2df7e59fae (diff) |
Teach screen_find_xinerama() to apply gap only when told to do so;
adjust callers. Needed for an upcoming feature.
-rw-r--r-- | app/cwm/calmwm.h | 8 | ||||
-rw-r--r-- | app/cwm/client.c | 14 | ||||
-rw-r--r-- | app/cwm/kbfunc.c | 4 | ||||
-rw-r--r-- | app/cwm/menu.c | 4 | ||||
-rw-r--r-- | app/cwm/mousefunc.c | 4 | ||||
-rw-r--r-- | app/cwm/screen.c | 18 |
6 files changed, 31 insertions, 21 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index 780fa1a5e..e765537e2 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/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.235 2013/12/13 14:40:52 okan Exp $ + * $OpenBSD: calmwm.h,v 1.236 2013/12/13 22:39:13 okan Exp $ */ #ifndef _CALMWM_H_ @@ -80,6 +80,9 @@ #define CWM_TILE_HORIZ 0x0001 #define CWM_TILE_VERT 0x0002 +#define CWM_GAP 0x0001 +#define CWM_NOGAP 0x0002 + union arg { char *c; int i; @@ -430,7 +433,8 @@ void search_match_text(struct menu_q *, struct menu_q *, char *); void search_print_client(struct menu *, int); -struct geom screen_find_xinerama(struct screen_ctx *, int, int); +struct geom screen_find_xinerama(struct screen_ctx *, + int, int, int); struct screen_ctx *screen_fromroot(Window); void screen_init(int); void screen_update_geometry(struct screen_ctx *); diff --git a/app/cwm/client.c b/app/cwm/client.c index 1dc6c28b7..a8e6934b7 100644 --- a/app/cwm/client.c +++ b/app/cwm/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.162 2013/12/13 15:56:44 okan Exp $ + * $OpenBSD: client.c,v 1.163 2013/12/13 22:39:13 okan Exp $ */ #include <sys/param.h> @@ -261,7 +261,7 @@ client_maximize(struct client_ctx *cc) */ xine = screen_find_xinerama(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); cc->geom = xine; cc->bwidth = 0; @@ -302,7 +302,7 @@ client_vmaximize(struct client_ctx *cc) xine = screen_find_xinerama(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); cc->geom.y = xine.y; cc->geom.h = xine.h - (cc->bwidth * 2); @@ -343,7 +343,7 @@ client_hmaximize(struct client_ctx *cc) xine = screen_find_xinerama(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); cc->geom.x = xine.x; cc->geom.w = xine.w - (cc->bwidth * 2); @@ -691,7 +691,7 @@ client_placecalc(struct client_ctx *cc) int xmouse, ymouse; xu_ptr_getpos(sc->rootwin, &xmouse, &ymouse); - xine = screen_find_xinerama(sc, xmouse, ymouse); + xine = screen_find_xinerama(sc, xmouse, ymouse, CWM_GAP); xine.w += xine.x; xine.h += xine.y; xmouse = MAX(xmouse, xine.x) - cc->geom.w / 2; @@ -906,7 +906,7 @@ client_htile(struct client_ctx *cc) xine = screen_find_xinerama(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); if (cc->flags & CLIENT_VMAXIMIZED || cc->geom.h + (cc->bwidth * 2) >= xine.h) @@ -965,7 +965,7 @@ client_vtile(struct client_ctx *cc) xine = screen_find_xinerama(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); if (cc->flags & CLIENT_HMAXIMIZED || cc->geom.w + (cc->bwidth * 2) >= xine.w) diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c index aa1c304be..ae3ba713a 100644 --- a/app/cwm/kbfunc.c +++ b/app/cwm/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.83 2013/12/13 21:51:56 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.84 2013/12/13 22:39:13 okan Exp $ */ #include <sys/param.h> @@ -102,7 +102,7 @@ kbfunc_client_moveresize(struct client_ctx *cc, union arg *arg) xine = screen_find_xinerama(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); cc->geom.x += client_snapcalc(cc->geom.x, cc->geom.x + cc->geom.w + (cc->bwidth * 2), xine.x, xine.x + xine.w, sc->snapdist); diff --git a/app/cwm/menu.c b/app/cwm/menu.c index 68e0e653e..d1dad5594 100644 --- a/app/cwm/menu.c +++ b/app/cwm/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.68 2013/12/02 20:01:19 okan Exp $ + * $OpenBSD: menu.c,v 1.69 2013/12/13 22:39:13 okan Exp $ */ #include <sys/param.h> @@ -380,7 +380,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq) mc->num++; } - xine = screen_find_xinerama(sc, mc->x, mc->y); + xine = screen_find_xinerama(sc, mc->x, mc->y, CWM_GAP); xine.w += xine.x; xine.h += xine.y; diff --git a/app/cwm/mousefunc.c b/app/cwm/mousefunc.c index 18d0a4c0d..4d974eb10 100644 --- a/app/cwm/mousefunc.c +++ b/app/cwm/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.63 2013/12/13 21:51:56 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.64 2013/12/13 22:39:13 okan Exp $ */ #include <sys/param.h> @@ -148,7 +148,7 @@ mousefunc_client_move(struct client_ctx *cc, void *arg) xine = screen_find_xinerama(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); cc->geom.x += client_snapcalc(cc->geom.x, cc->geom.x + cc->geom.w + (cc->bwidth * 2), xine.x, xine.x + xine.w, sc->snapdist); diff --git a/app/cwm/screen.c b/app/cwm/screen.c index dce4065dd..11ff2863a 100644 --- a/app/cwm/screen.c +++ b/app/cwm/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.52 2013/06/17 17:11:10 okan Exp $ + * $OpenBSD: screen.c,v 1.53 2013/12/13 22:39:13 okan Exp $ */ #include <sys/param.h> @@ -126,7 +126,7 @@ screen_updatestackingorder(struct screen_ctx *sc) * Find which xinerama screen the coordinates (x,y) is on. */ struct geom -screen_find_xinerama(struct screen_ctx *sc, int x, int y) +screen_find_xinerama(struct screen_ctx *sc, int x, int y, int flags) { XineramaScreenInfo *info; struct geom geom; @@ -141,13 +141,19 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y) info = &sc->xinerama[i]; if (x >= info->x_org && x < info->x_org + info->width && y >= info->y_org && y < info->y_org + info->height) { - geom.x = info->x_org + sc->gap.left; - geom.y = info->y_org + sc->gap.top; - geom.w = info->width - (sc->gap.left + sc->gap.right); - geom.h = info->height - (sc->gap.top + sc->gap.bottom); + geom.x = info->x_org; + geom.y = info->y_org; + geom.w = info->width; + geom.h = info->height; break; } } + if (flags & CWM_GAP) { + geom.x += sc->gap.left; + geom.y += sc->gap.top; + geom.w -= (sc->gap.left + sc->gap.right); + geom.h -= (sc->gap.top + sc->gap.bottom); + } return (geom); } |