collect 'gap' applications

This commit is contained in:
okan 2015-06-26 16:11:21 +00:00
parent 8aa40078d1
commit 90288e2fc3
2 changed files with 15 additions and 10 deletions

View File

@ -450,6 +450,7 @@ void search_match_text(struct menu_q *, struct menu_q *,
char *); char *);
void search_print_client(struct menu *, int); void search_print_client(struct menu *, int);
struct geom screen_apply_gap(struct screen_ctx *, struct geom);
struct screen_ctx *screen_find(Window); struct screen_ctx *screen_find(Window);
struct geom screen_find_xinerama(struct screen_ctx *, struct geom screen_find_xinerama(struct screen_ctx *,
int, int, int); int, int, int);

View File

@ -140,12 +140,8 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y, int flags)
break; break;
} }
} }
if (flags & CWM_GAP) { if (flags & CWM_GAP)
geom.x += sc->gap.left; geom = screen_apply_gap(sc, geom);
geom.y += sc->gap.top;
geom.w -= (sc->gap.left + sc->gap.right);
geom.h -= (sc->gap.top + sc->gap.bottom);
}
return(geom); return(geom);
} }
@ -160,10 +156,7 @@ screen_update_geometry(struct screen_ctx *sc)
sc->view.w = DisplayWidth(X_Dpy, sc->which); sc->view.w = DisplayWidth(X_Dpy, sc->which);
sc->view.h = DisplayHeight(X_Dpy, sc->which); sc->view.h = DisplayHeight(X_Dpy, sc->which);
sc->work.x = sc->view.x + sc->gap.left; sc->work = screen_apply_gap(sc, sc->view);
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);
while ((region = TAILQ_FIRST(&sc->regionq)) != NULL) { while ((region = TAILQ_FIRST(&sc->regionq)) != NULL) {
TAILQ_REMOVE(&sc->regionq, region, entry); 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_desktop_geometry(sc);
xu_ewmh_net_workarea(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);
}