Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > 0257cb64e4491c9033bccc46653056d9 > files > 7

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

From 7b4bc16d059436a17261c44fcf2d19f8aaa55eea Mon Sep 17 00:00:00 2001
From: Danny Baumann <dannybaumann@web.de>
Date: Thu, 25 Sep 2008 09:42:19 +0200
Subject: [PATCH] Make viewportForGeometry not take the current viewport into account.
 As the geometry passed to viewportForGeometry is not necessarily a window, it doesn't make much sense to assume so.
 Instead, move the return-current-viewport-if-window-is-on-it logic to the defaultViewportForWindow function.

---
 src/screen.c |   15 +--------------
 src/window.c |   18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/src/screen.c b/src/screen.c
index 7d051b3..80e83f1 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -4013,8 +4013,7 @@ clearScreenOutput (CompScreen	*s,
    more than one viewport the most appropriate viewport is returned. How the
    most appropriate viewport is computed can be made optional if necessary. It
    is currently computed as the viewport where the center of the window is
-   located, except for when the window is visible in the current viewport as
-   the current viewport is then always returned. */
+   located. */
 void
 viewportForGeometry (CompScreen *s,
 		     int	x,
@@ -4031,18 +4030,6 @@ viewportForGeometry (CompScreen *s,
     width  += borderWidth * 2;
     height += borderWidth * 2;
 
-    if ((x < s->width  && x + width  > 0) &&
-	(y < s->height && y + height > 0))
-    {
-	if (viewportX)
-	    *viewportX = s->x;
-
-	if (viewportY)
-	    *viewportY = s->y;
-
-	return;
-    }
-
     if (viewportX)
     {
 	centerX = x + (width >> 1);
diff --git a/src/window.c b/src/window.c
index dfa8bde..30990e0 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4924,7 +4924,23 @@ defaultViewportForWindow (CompWindow *w,
 			  int	     *vx,
 			  int	     *vy)
 {
-    viewportForGeometry (w->screen,
+    CompScreen *s = w->screen;
+
+    /* return the current viewport if a part of the window is
+       visible on it */
+    if ((w->serverX < s->width  && w->serverX + w->serverWidth  > 0) &&
+	(w->serverY < s->height && w->serverY + w->serverHeight > 0))
+    {
+	if (vx)
+	    *vx = s->x;
+
+	if (vy)
+	    *vy = s->y;
+
+	return;
+    }
+
+    viewportForGeometry (s,
 			 w->serverX, w->serverY,
 			 w->serverWidth, w->serverHeight,
 			 w->serverBorderWidth,
-- 
1.6.0.2