summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2008-09-25 09:42:19 +0200
committerDanny Baumann <dannybaumann@web.de>2008-09-25 09:42:19 +0200
commitc0f31dd57a71e8f93a48772ba9340b9c14678e74 (patch)
treed49560fdc9b859caed2760fd55992c4b657b02d4 /src
parent98bdf75f332f04b670d36758e655eac8fa304f8d (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/screen.c15
-rw-r--r--src/window.c18
2 files changed, 18 insertions, 15 deletions
diff --git a/src/screen.c b/src/screen.c
index 7d051b3e..80e83f19 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 dfa8bde4..30990e08 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,