summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-12-07 19:37:38 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-12-07 19:37:38 +0800
commit2e84ad1ea59965ba9dde5dd8eac139925e920633 (patch)
tree1a12a081b37ed535ef47f1d68c72fae44131c19a
parent78916532848388ccfd44ce4a7d01fb91eecfd40e (diff)
downloadcompiz-with-glib-mainloop-2e84ad1ea59965ba9dde5dd8eac139925e920633.tar.gz
compiz-with-glib-mainloop-2e84ad1ea59965ba9dde5dd8eac139925e920633.tar.bz2
resize: Obey move's constrain_y option
Forward port 0d23e499774769d295509f189fbf4b7c21763ef6 to master
-rw-r--r--plugins/resize/src/resize.cpp33
-rw-r--r--plugins/resize/src/resize.h3
2 files changed, 35 insertions, 1 deletions
diff --git a/plugins/resize/src/resize.cpp b/plugins/resize/src/resize.cpp
index 386b2af..261766f 100644
--- a/plugins/resize/src/resize.cpp
+++ b/plugins/resize/src/resize.cpp
@@ -322,6 +322,7 @@ resizeInitiate (CompAction *action,
if (rs->grabIndex)
{
BoxRec box;
+ CompPlugin *pMove;
unsigned int grabMask = CompWindowGrabResizeMask |
CompWindowGrabButtonMask;
bool sourceExternalApp =
@@ -349,6 +350,23 @@ resizeInitiate (CompAction *action,
screen->warpPointer (xRoot - pointerX, yRoot - pointerY);
}
+ /* Update yConstrained and workArea at grab time */
+ pMove = CompPlugin::find ("move");
+
+ if (pMove)
+ {
+ CompOption::Vector &options = pMove->vTable->getOptions ();
+
+ rs->yConstrained =
+ CompOption::getBoolOptionNamed (options,
+ "constrain_y",
+ true);
+ if (rs->yConstrained)
+ rs->grabWindowWorkArea =
+ &(screen->outputDevs ().at (w->outputDevice ()).workArea ());
+
+ }
+
rs->isConstrained = sourceExternalApp;
if (sourceExternalApp)
@@ -711,6 +729,18 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot)
damageRectangle (&box);
}
+ if (mask & ResizeUpMask && yConstrained)
+ {
+ int decorTop = savedGeometry.y + savedGeometry.height -
+ (he + w->input ().top);
+
+ if (grabWindowWorkArea->y () > decorTop)
+ {
+ /* constrain to workarea */
+ he -= grabWindowWorkArea->y () - decorTop;
+ }
+ }
+
wi = cwi;
he = che;
@@ -1478,7 +1508,8 @@ ResizeScreen::ResizeScreen (CompScreen *s) :
stretchMask (0),
centeredMask (0),
releaseButton (0),
- isConstrained (false)
+ isConstrained (false),
+ yConstrained (true)
{
CompOption::Vector atomTemplate;
Display *dpy = s->dpy ();
diff --git a/plugins/resize/src/resize.h b/plugins/resize/src/resize.h
index 73c1c61..1293336 100644
--- a/plugins/resize/src/resize.h
+++ b/plugins/resize/src/resize.h
@@ -146,6 +146,9 @@ class ResizeScreen :
bool inRegionStatus;
int lastGoodHotSpotY;
CompSize lastGoodSize;
+
+ bool yConstrained;
+ const CompRect *grabWindowWorkArea;
};
class ResizeWindow :