summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/move.c
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-06 12:41:21 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-06 12:41:21 +0000
commit85f72c7b9812104d88205d8a562ac76c31e9c387 (patch)
treec75b3c447dfd97c1f99cc5e2c22f32e414d2a91d /beryl-plugins/src/move.c
parent616fc492d3b221adf9fd61b80514c42dfb028ad9 (diff)
downloadmarex-dev-85f72c7b9812104d88205d8a562ac76c31e9c387.tar.gz
marex-dev-85f72c7b9812104d88205d8a562ac76c31e9c387.tar.bz2
move plugin: another attempt at constraining properly for multihead and mixed resolutions
git-svn-id: file:///beryl/trunk@2413 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/move.c')
-rw-r--r--beryl-plugins/src/move.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/beryl-plugins/src/move.c b/beryl-plugins/src/move.c
index 6e50d24..08f9c23 100644
--- a/beryl-plugins/src/move.c
+++ b/beryl-plugins/src/move.c
@@ -285,12 +285,24 @@ moveGetYConstrainRegion (CompScreen *s)
if (!region)
return NULL;
- for (i = 0;i < s->nOutputDev; i++)
- XUnionRegion (&s->outputDev[i].region, region, region);
-
r.rects = &r.extents;
r.numRects = r.size = 1;
+ r.extents.x1 = MINSHORT;
+ r.extents.y1 = 0;
+ r.extents.x2 = MAXSHORT;
+ r.extents.y2 = s->height;
+
+ XUnionRegion (&r, region, region);
+
+ r.extents.x1 = 0;
+ r.extents.x2 = s->width;
+
+ XSubtractRegion(&r, region, region);
+
+ for (i = 0;i < s->nOutputDev; i++)
+ XUnionRegion (&s->outputDev[i].region, region, region);
+
for (w = s->windows; w; w = w->next)
{
if (!w->mapNum)
@@ -368,7 +380,7 @@ static void moveHandleMotionEvent(CompScreen * s, int xRoot, int yRoot)
region */
if (md->region)
{
- int y, height;
+ int x, y, width, height;
int status;
if (constrainTop)
@@ -384,15 +396,30 @@ static void moveHandleMotionEvent(CompScreen * s, int xRoot, int yRoot)
height = w->input.bottom ? w->input.bottom : 1;
}
- status = XRectInRegion (md->region, xRoot, y, 1, height);
+ x = w->attrib.x + dx - w->input.left;
+ width = w->width + w->input.left + w->input.right;
+
+ status = XRectInRegion (md->region, x, y, width, height);
/* only constrain movement if previous position was valid */
if (md->status == RectangleIn)
{
+ int xStatus = status;
+
+ while (dx && xStatus != RectangleIn)
+ {
+ xStatus = XRectInRegion (md->region, x, y - dy, width, height);
+
+ if (xStatus != RectangleIn)
+ dx += (dx < 0) ? 1 : -1;
+
+ x = w->attrib.x + dx - w->input.left;
+ }
+
while (dy && status != RectangleIn)
{
status = XRectInRegion (md->region,
- xRoot, y, 1, height);
+ x, y, width, height);
if (status != RectangleIn)
dy += (dy < 0) ? 1 : -1;