summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-02-03 01:23:13 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-02-03 01:23:13 +0800
commitb43b4eb0ead685787bb2423e194940272978f943 (patch)
tree82232372c561ee743c59603e6688c0e09ec83c7a
parent946f55f16f479c45f28f7f2643447ff4cdd42e06 (diff)
downloadzcomp-b43b4eb0ead685787bb2423e194940272978f943.tar.gz
zcomp-b43b4eb0ead685787bb2423e194940272978f943.tar.bz2
Prevent sticky windows from moving off-screen.
Forward port of f02bf9d435def37d4587014a4548e8d99401f19d to master
-rw-r--r--src/window.cpp54
1 files changed, 34 insertions, 20 deletions
diff --git a/src/window.cpp b/src/window.cpp
index f06e2ec..3bbe71d 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2815,16 +2815,23 @@ CompWindow::moveResize (XWindowChanges *xwc,
min = screen->workArea ().y () + priv->input.top;
max = screen->workArea ().bottom ();
-
- min -= screen->vp ().y () * screen->height ();
- max += (screen->vpSize ().height () -
- screen->vp ().y () - 1) *
- screen->height ();
-
- if (xwc->y < min)
- xwc->y = min;
- else if (xwc->y > max)
- xwc->y = max;
+
+ if (priv->state & CompWindowStateStickyMask &&
+ (xwc->y < min || xwc->y > max))
+ {
+ xwc->y = priv->serverGeometry.y ();
+ }
+ else
+ {
+ min -= screen->vp ().y () * screen->height ();
+ max += (screen->vpSize ().height () - screen->vp ().y () - 1) *
+ screen->height ();
+
+ if (xwc->y < min)
+ xwc->y = min;
+ else if (xwc->y > max)
+ xwc->y = max;
+ }
}
if (xwcm & CWX)
@@ -2833,16 +2840,23 @@ CompWindow::moveResize (XWindowChanges *xwc,
min = screen->workArea ().x () + priv->input.left;
max = screen->workArea ().right ();
-
- min -= screen->vp ().x () * screen->width ();
- max += (screen->vpSize ().width () -
- screen->vp ().x () - 1) *
- screen->width ();
-
- if (xwc->x < min)
- xwc->x = min;
- else if (xwc->x > max)
- xwc->x = max;
+
+ if (priv->state & CompWindowStateStickyMask &&
+ (xwc->x < min || xwc->x > max))
+ {
+ xwc->x = priv->serverGeometry.x ();
+ }
+ else
+ {
+ min -= screen->vp ().x () * screen->width ();
+ max += (screen->vpSize ().height () - screen->vp ().x () - 2) *
+ screen->width ();
+
+ if (xwc->x < min)
+ xwc->x = min;
+ else if (xwc->x > max)
+ xwc->x = max;
+ }
}
}