aboutsummaryrefslogtreecommitdiffstats
path: root/screen.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--screen.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/screen.c b/screen.c
index 4adc63f..eb52404 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.77 2015/08/21 16:52:37 okan Exp $
+ * $OpenBSD: screen.c,v 1.78 2015/11/09 20:03:30 okan Exp $
*/
#include <sys/types.h>
@@ -124,35 +124,29 @@ screen_updatestackingorder(struct screen_ctx *sc)
}
}
-struct geom
-screen_area(struct screen_ctx *sc, int x, int y, int flags)
+struct region_ctx *
+region_find(struct screen_ctx *sc, int x, int y)
{
struct region_ctx *rc;
- struct geom area = sc->work;
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))) {
break;
}
}
- if (flags & CWM_GAP)
- area = screen_apply_gap(sc, area);
- return(area);
+ return(rc);
}
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 +157,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++) {
@@ -176,15 +171,25 @@ 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;
+ 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);