Sophie

Sophie

distrib > Mandriva > 2009.0 > x86_64 > media > main-testing-src > by-pkgid > 0257cb64e4491c9033bccc46653056d9 > files > 6

compiz-0.7.8-3mdv2009.0.src.rpm

From 8550ece632478fbc4e5d33b21479cb0df95b9fc9 Mon Sep 17 00:00:00 2001
From: Danny Baumann <dannybaumann@web.de>
Date: Wed, 24 Sep 2008 15:03:59 +0200
Subject: [PATCH] Make sure geometry rectangle is kept inside the screen area.

---
 src/screen.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/screen.c b/src/screen.c
index df7bd18..7d051b3 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -4103,17 +4103,26 @@ outputDeviceForGeometry (CompScreen *s,
 
     if (strategy == OUTPUT_OVERLAP_MODE_SMART)
     {
+	int centerX, centerY;
+
 	/* for smart mode, calculate the overlap of the whole rectangle
 	   with the output device rectangle */
 	geomRect.x2 = width + 2 * borderWidth;
 	geomRect.y2 = height + 2 * borderWidth;
 
 	geomRect.x1 = x % s->width;
-	if ((geomRect.x1 + geomRect.x2 / 2) < 0)
+	centerX = geomRect.x1 + (geomRect.x2 / 2);
+	if (centerX < 0)
 	    geomRect.x1 += s->width;
+	else if (centerX > s->width)
+	    geomRect.x1 -= s->width;
+
 	geomRect.y1 = y % s->height;
-	if ((geomRect.y1 + geomRect.y2 / 2) < 0)
+	centerY = geomRect.y1 + (geomRect.y2 / 2);
+	if (centerY < 0)
 	    geomRect.y1 += s->height;
+	else if (centerY > s->height)
+	    geomRect.y1 -= s->height;
 
 	geomRect.x2 += geomRect.x1;
 	geomRect.y2 += geomRect.y1;
-- 
1.6.0.2