about summary refs log tree commit diff
path: root/screen.c
diff options
context:
space:
mode:
authoranton <anton>2018-02-19 19:29:42 +0000
committeranton <anton>2018-02-19 19:29:42 +0000
commitcae69879221ff88eca85c731246eaf33a51ea50e (patch)
tree05400c8903ee52678b505d19aa97f0a8ffe71593 /screen.c
parentc6745ee21cabbdad5791494bb1d0a754ee264c39 (diff)
parent05510941822cb14969bae35d57ff7778fc4daee1 (diff)
downloadcwm-cae69879221ff88eca85c731246eaf33a51ea50e.tar.gz
cwm-cae69879221ff88eca85c731246eaf33a51ea50e.tar.xz
cwm-cae69879221ff88eca85c731246eaf33a51ea50e.zip
cvsimport
* refs/heads/master:
  Do not print any parse errors when ~/.cwmrc is missing. Regression introduced in revision 1.109 of calmwm.c.
  Store the screen's visual type and colormap.
  Consolidate region 'view' and 'area'.
  limit scope of screen_apply_gap()
  Clean up conf_file/homedir and conf_init() bits.
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/screen.c b/screen.c
index 526dcea..2c0b8c1 100644
--- a/screen.c
+++ b/screen.c
@@ -31,6 +31,8 @@
 
 #include "calmwm.h"
 
+static struct geom screen_apply_gap(struct screen_ctx *, struct geom);
+
 void
 screen_init(int which)
 {
@@ -48,6 +50,8 @@ screen_init(int which)
 
 	sc->which = which;
 	sc->rootwin = RootWindow(X_Dpy, sc->which);
+	sc->colormap = DefaultColormap(X_Dpy, sc->which);
+	sc->visual = DefaultVisual(X_Dpy, sc->which);
 	sc->cycling = 0;
 	sc->hideall = 0;
 
@@ -144,12 +148,12 @@ struct geom
 screen_area(struct screen_ctx *sc, int x, int y, enum apply_gap apply_gap)
 {
 	struct region_ctx	*rc;
-	struct geom		 area = sc->work;
+	struct geom		 area = sc->view;
 
 	TAILQ_FOREACH(rc, &sc->regionq, entry) {
-		if ((x >= rc->area.x) && (x < (rc->area.x + rc->area.w)) &&
-		    (y >= rc->area.y) && (y < (rc->area.y + rc->area.h))) {
-			area = rc->area;
+		if ((x >= rc->view.x) && (x < (rc->view.x + rc->view.w)) &&
+		    (y >= rc->view.y) && (y < (rc->view.y + rc->view.h))) {
+			area = rc->view;
 			break;
 		}
 	}
@@ -191,10 +195,6 @@ screen_update_geometry(struct screen_ctx *sc)
 
 			rc = xmalloc(sizeof(*rc));
 			rc->num = i;
-			rc->area.x = ci->x;
-			rc->area.y = ci->y;
-			rc->area.w = ci->width;
-			rc->area.h = ci->height;
 			rc->view.x = ci->x;
 			rc->view.y = ci->y;
 			rc->view.w = ci->width;
@@ -220,7 +220,7 @@ screen_update_geometry(struct screen_ctx *sc)
 	xu_ewmh_net_workarea(sc);
 }
 
-struct geom
+static struct geom
 screen_apply_gap(struct screen_ctx *sc, struct geom geom)
 {
 	geom.x += sc->gap.left;