summaryrefslogtreecommitdiff
path: root/app/cwm/screen.c
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2015-06-26 16:11:22 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2015-06-26 16:11:22 +0000
commitcb8081ebbdf0e7f8d505b3dd240e91bbc4bb88e3 (patch)
tree6eae71c8113a66db698a4d8fde9441d47c3537cc /app/cwm/screen.c
parent0e197f8f6ea40fa112ba06d2158b41dcb7707e96 (diff)
collect 'gap' applications
Diffstat (limited to 'app/cwm/screen.c')
-rw-r--r--app/cwm/screen.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/app/cwm/screen.c b/app/cwm/screen.c
index 76fad3d07..9f0519454 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.72 2015/06/26 15:21:58 okan Exp $
+ * $OpenBSD: screen.c,v 1.73 2015/06/26 16:11:21 okan Exp $
*/
#include <sys/types.h>
@@ -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);
+}