From 8ee45f99bd44dcf347cc84ebb8afdddda5b28997 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 26 Jun 2015 16:11:21 +0000 Subject: collect 'gap' applications --- calmwm.h | 3 ++- screen.c | 26 +++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/calmwm.h b/calmwm.h index edb541a..4759fbc 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.293 2015/06/26 15:21:58 okan Exp $ + * $OpenBSD: calmwm.h,v 1.294 2015/06/26 16:11:21 okan Exp $ */ #ifndef _CALMWM_H_ @@ -450,6 +450,7 @@ void search_match_text(struct menu_q *, struct menu_q *, char *); void search_print_client(struct menu *, int); +struct geom screen_apply_gap(struct screen_ctx *, struct geom); struct screen_ctx *screen_find(Window); struct geom screen_find_xinerama(struct screen_ctx *, int, int, int); diff --git a/screen.c b/screen.c index 76fad3d..9f05194 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.72 2015/06/26 15:21:58 okan Exp $ + * $OpenBSD: screen.c,v 1.73 2015/06/26 16:11:21 okan Exp $ */ #include @@ -140,12 +140,8 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y, int flags) 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); - } + if (flags & CWM_GAP) + geom = screen_apply_gap(sc, geom); return(geom); } @@ -160,10 +156,7 @@ screen_update_geometry(struct screen_ctx *sc) sc->view.w = DisplayWidth(X_Dpy, sc->which); sc->view.h = DisplayHeight(X_Dpy, sc->which); - sc->work.x = sc->view.x + sc->gap.left; - sc->work.y = sc->view.y + sc->gap.top; - sc->work.w = sc->view.w - (sc->gap.left + sc->gap.right); - sc->work.h = sc->view.h - (sc->gap.top + sc->gap.bottom); + sc->work = screen_apply_gap(sc, sc->view); while ((region = TAILQ_FIRST(&sc->regionq)) != NULL) { TAILQ_REMOVE(&sc->regionq, region, entry); @@ -200,3 +193,14 @@ screen_update_geometry(struct screen_ctx *sc) xu_ewmh_net_desktop_geometry(sc); xu_ewmh_net_workarea(sc); } + +struct geom +screen_apply_gap(struct screen_ctx *sc, struct geom geom) +{ + 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); +} -- cgit v1.2.3-2-gb3c3