diff options
author | David Reveman <davidr@novell.com> | 2007-04-05 12:34:50 +0200 |
---|---|---|
committer | David Reveman <davidr@novell.com> | 2007-04-05 12:34:50 +0200 |
commit | 384832f6de05eb38239c57d07a3d1a2b41c4add2 (patch) | |
tree | 86263b5fac1a36263e304fed0cc59961bdd0244f /plugins | |
parent | 2d381e9f879610f4c02b6cf0ce1ac3ffbd3ed218 (diff) |
Update constrain region creation so that windows are constrained from
being moved to screen regions that are not visible in any output.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/move.c | 76 |
1 files changed, 58 insertions, 18 deletions
diff --git a/plugins/move.c b/plugins/move.c index 073094bc..7c0b822d 100644 --- a/plugins/move.c +++ b/plugins/move.c @@ -266,6 +266,9 @@ moveGetYConstrainRegion (CompScreen *s) CompWindow *w; Region region; REGION r; + XRectangle workArea; + BoxRec extents; + int i; region = XCreateRegion (); if (!region) @@ -276,33 +279,70 @@ moveGetYConstrainRegion (CompScreen *s) r.extents.x1 = MINSHORT; r.extents.y1 = 0; - r.extents.x2 = MAXSHORT; + r.extents.x2 = 0; r.extents.y2 = s->height; XUnionRegion (&r, region, region); - for (w = s->windows; w; w = w->next) + r.extents.x1 = s->width; + r.extents.x2 = MAXSHORT; + + XUnionRegion (&r, region, region); + + for (i = 0; i < s->nOutputDev; i++) { - if (!w->mapNum) - continue; + XUnionRegion (&s->outputDev[i].region, region, region); - if (w->struts) - { - r.extents.x1 = w->struts->top.x; - r.extents.y1 = w->struts->top.y; - r.extents.x2 = r.extents.x1 + w->struts->top.width; - r.extents.y2 = r.extents.y1 + w->struts->top.height; + getWorkareaForOutput (s, i, &workArea); + extents = s->outputDev[i].region.extents; - if (r.extents.y2 <= s->workArea.y) - XSubtractRegion (region, &r, region); + for (w = s->windows; w; w = w->next) + { + if (!w->mapNum) + continue; - r.extents.x1 = w->struts->bottom.x; - r.extents.y1 = w->struts->bottom.y; - r.extents.x2 = r.extents.x1 + w->struts->bottom.width; - r.extents.y2 = r.extents.y1 + w->struts->bottom.height; + if (w->struts) + { + r.extents.x1 = w->struts->top.x; + r.extents.y1 = w->struts->top.y; + r.extents.x2 = r.extents.x1 + w->struts->top.width; + r.extents.y2 = r.extents.y1 + w->struts->top.height; + + if (r.extents.x1 < extents.x1) + r.extents.x1 = extents.x1; + if (r.extents.x2 > extents.x2) + r.extents.x2 = extents.x2; + if (r.extents.y1 < extents.y1) + r.extents.y1 = extents.y1; + if (r.extents.y2 > extents.y2) + r.extents.y2 = extents.y2; + + if (r.extents.x1 < r.extents.x2 && r.extents.y1 < r.extents.y2) + { + if (r.extents.y2 <= workArea.y) + XSubtractRegion (region, &r, region); + } - if (r.extents.y1 >= (s->workArea.y + s->workArea.height)) - XSubtractRegion (region, &r, region); + r.extents.x1 = w->struts->bottom.x; + r.extents.y1 = w->struts->bottom.y; + r.extents.x2 = r.extents.x1 + w->struts->bottom.width; + r.extents.y2 = r.extents.y1 + w->struts->bottom.height; + + if (r.extents.x1 < extents.x1) + r.extents.x1 = extents.x1; + if (r.extents.x2 > extents.x2) + r.extents.x2 = extents.x2; + if (r.extents.y1 < extents.y1) + r.extents.y1 = extents.y1; + if (r.extents.y2 > extents.y2) + r.extents.y2 = extents.y2; + + if (r.extents.x1 < r.extents.x2 && r.extents.y1 < r.extents.y2) + { + if (r.extents.y1 >= (workArea.y + workArea.height)) + XSubtractRegion (region, &r, region); + } + } } } |