summary refs log tree commit diff
path: root/screen.c
diff options
context:
space:
mode:
authorokan <okan>2015-11-12 21:28:03 +0000
committerokan <okan>2015-11-12 21:28:03 +0000
commit4e51ce57a7b773f66304072f7c369f58e0a62159 (patch)
tree9ad7cbe078aac6879cba972d04d1781025b8b5b3 /screen.c
parentcd21e166754c24e9bbcde1ee3a689079a073cc5b (diff)
parent323672ace778a61f6f51032453f781d50701e349 (diff)
downloadcwm-4e51ce57a7b773f66304072f7c369f58e0a62159.tar.gz
cwm-4e51ce57a7b773f66304072f7c369f58e0a62159.tar.xz
cwm-4e51ce57a7b773f66304072f7c369f58e0a62159.zip
cvsimport
* refs/heads/master:
  more client vs screen context differences
  If a client sets hints, honor them for kb resize requests, just like we do for mouse based resize requests.
  Move kb pointer movement out of the kbfunc_client_moveresize since it's got nothing to do with clients, thus doing flags work causes lots of waste and almost useless jumpy pointer movements; while here, split out move and resize since they share almost no code, just like mouse client move/resize; factor out amount and factor. Still wonder why this is here, but it works now.
  pledge "stdio rpath proc exec" cwm before main event loop, after init/setup - mostly for menu building.
  Partial revert of replacing screen_area() with region_find(); until a fix for a regression is found; this bug has been around for a long time it seems, but this change exposed it. Likely need to track clients in to and out of regions.
  Use position on root to figure out region.
  Start cleaning up name vs function differences; replace magic numbers.
  Clean up unused defines.
  Extend region to include both view and work areas; switch to region_find() which no longer needs to recalculate gap each time a client (or menu) is created or altered. If no RandR, fall back to display dimensions while building regions instead of during execution.
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/screen.c b/screen.c
index c51082b..37bb292 100644
--- a/screen.c
+++ b/screen.c
@@ -124,6 +124,20 @@ screen_updatestackingorder(struct screen_ctx *sc)
 	}
 }
 
+struct region_ctx *
+region_find(struct screen_ctx *sc, int x, int y)
+{
+	struct region_ctx	*rc;
+
+	TAILQ_FOREACH(rc, &sc->regionq, entry) {
+		if ((x >= rc->view.x) && (x < (rc->view.x + rc->view.w)) &&
+		    (y >= rc->view.y) && (y < (rc->view.y + rc->view.h))) {
+			break;
+		}
+	}
+	return(rc);
+}
+
 struct geom
 screen_area(struct screen_ctx *sc, int x, int y, int flags)
 {
@@ -146,13 +160,11 @@ void
 screen_update_geometry(struct screen_ctx *sc)
 {
 	struct region_ctx	*rc;
-	int			 i;
 
 	sc->view.x = 0;
 	sc->view.y = 0;
 	sc->view.w = DisplayWidth(X_Dpy, sc->which);
 	sc->view.h = DisplayHeight(X_Dpy, sc->which);
-
 	sc->work = screen_apply_gap(sc, sc->view);
 
 	while ((rc = TAILQ_FIRST(&sc->regionq)) != NULL) {
@@ -163,6 +175,7 @@ screen_update_geometry(struct screen_ctx *sc)
 	if (HasRandr) {
 		XRRScreenResources *sr;
 		XRRCrtcInfo *ci;
+		int i;
 
 		sr = XRRGetScreenResources(X_Dpy, sc->rootwin);
 		for (i = 0, ci = NULL; i < sr->ncrtc; i++) {
@@ -180,11 +193,25 @@ screen_update_geometry(struct screen_ctx *sc)
 			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;
+			rc->view.h = ci->height;
+			rc->work = screen_apply_gap(sc, rc->view);
 			TAILQ_INSERT_TAIL(&sc->regionq, rc, entry);
 
 			XRRFreeCrtcInfo(ci);
 		}
 		XRRFreeScreenResources(sr);
+	} else {
+		rc = xmalloc(sizeof(*rc));
+		rc->num = 0;
+		rc->view.x = 0;
+		rc->view.y = 0;
+		rc->view.w = DisplayWidth(X_Dpy, sc->which);
+		rc->view.h = DisplayHeight(X_Dpy, sc->which);
+		rc->work = screen_apply_gap(sc, rc->view);
+		TAILQ_INSERT_TAIL(&sc->regionq, rc, entry);
 	}
 
 	xu_ewmh_net_desktop_geometry(sc);