summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Frank Erikson <kristian@kristian-desktop.(none)>2008-11-20 13:14:13 +1300
committerKristian Frank Erikson <kristian@kristian-desktop.(none)>2008-11-20 13:14:13 +1300
commitb937e1bbb2caf03dea705ee544765fbf241b9076 (patch)
tree4cad887b96a4700ad5e7a24bf527a82e28434dfa
parentd233df96a022812815426ab974198107b06ff80d (diff)
downloadcf-squeeze-b937e1bbb2caf03dea705ee544765fbf241b9076.tar.gz
cf-squeeze-b937e1bbb2caf03dea705ee544765fbf241b9076.tar.bz2
Fixed window moving position during OpenGL resize
-rw-r--r--squeeze.c92
1 files changed, 24 insertions, 68 deletions
diff --git a/squeeze.c b/squeeze.c
index 43f25f2..b966afb 100644
--- a/squeeze.c
+++ b/squeeze.c
@@ -50,7 +50,7 @@
static int displayPrivateIndex;
-static int adjustSqueezeResize (CompDisplay *d, CompWindow *w);
+static int adjustSqueezeResize (CompWindow *w);
static void squeezeDoWindowResize (CompDisplay *d, int newWidth, int newHeight);
@@ -152,60 +152,14 @@ resizeGetStretchScale (CompWindow *w,
}
-/* Function to account for the error introduced by OpenGL
- * also scaling the window borders. This functions tries to
- * keep the window in place.
- */
-static void
-resizeGetScaleError (CompWindow *w,
- float *xScale,
- float *yScale,
- float *xScaleError,
- float *yScaleError)
-{
- *xScaleError = (w->serverBorderWidth)
- - (w->serverBorderWidth * *xScale);
-
- *yScaleError = (w->serverBorderWidth)
- - (w->serverBorderWidth * *yScale);
-
- //compLogMessage ("squeeze", CompLogLevelInfo,
- // "xScaleError is: %i yScaleError is: %i", *xScaleError,*yScaleError);
- // *xScaleError = -4.0f;
- // *yScaleError = -4.0f;
-}
-
-
/*
* Calculate width and height for animation
*/
static int
-adjustSqueezeResize (CompDisplay *d,
- CompWindow *w)
+adjustSqueezeResize (CompWindow *w)
{
-
- SQUEEZE_DISPLAY (d);
SQUEEZE_WINDOW (w);
-
- /*From getPaintRectangle
- pBox->x1 = sd->geometry.x - sd->w->input.left;
- pBox->y1 = sd->geometry.y - sd->w->input.top;
- pBox->x2 = sd->geometry.x +
- sd->geometry.width + sd->w->serverBorderWidth * 2 +
- sd->w->input.right;
-
- if (sd->w->shaded)
- {
- pBox->y2 = sd->geometry.y + sd->w->height + sd->w->input.bottom;
- }
- else
- {
- pBox->y2 = sd->geometry.y +
- sd->geometry.height + sd->w->serverBorderWidth * 2 +
- sd->w->input.bottom;
- }*/
-
-
+
if ( sw->resizeAnimActive )
{
// Increase the counter for the animation
@@ -294,6 +248,16 @@ resizeUpdateWindowSize (CompDisplay *d)
SQUEEZE_DISPLAY (d);
SQUEEZE_WINDOW (sd->w);
+
+
+ compLogMessage ("squeeze", CompLogLevelInfo,
+ "sd->geometry.x is: %i", sd->geometry.x);
+ compLogMessage ("squeeze", CompLogLevelInfo,
+ "sw->targetX is: %i", sw->targetX);
+ compLogMessage ("squeeze", CompLogLevelInfo,
+ "sd->geometry.y is: %i", sd->geometry.y);
+ compLogMessage ("squeeze", CompLogLevelInfo,
+ "sw->targetY is: %i", sw->targetY);
if (sd->w->syncWait)
return;
@@ -433,7 +397,7 @@ squeezePreparePaintScreen (CompScreen *s,
if (!sw->putAnimActive)
{
- /* animation done */
+ // animation done
moveWindow (w, sw->targetX - w->attrib.x,
sw->targetY - w->attrib.y, TRUE, TRUE);
syncWindowPosition (w);
@@ -443,21 +407,19 @@ squeezePreparePaintScreen (CompScreen *s,
}
}
- // Do the resize also
+ // Do the resize animation
if (sw->resizeAnimActive & !sw->putAnimActive)
{
-
- compLogMessage ("squeeze", CompLogLevelInfo,
- "TargetX is: %i Actual X is: %i", sw->targetX,w->attrib.x);
-
- sw->resizeAnimActive = adjustSqueezeResize (s->display, w);
+ sw->resizeAnimActive = adjustSqueezeResize (w);
if (!sw->resizeAnimActive)
+ {
+ //If the animation is complete do the actual resize
squeezeDoWindowResize(s->display,sw->newWidth,sw->newHeight);
+ }
- // Make sure animation keeps running till done.
+ // Make sure animation flag stays on
ss->animationsActive |= sw->resizeAnimActive;
-
}
}
@@ -549,13 +511,10 @@ squeezePaintWindow (CompWindow *w,
}
else if (sw->resizeAnimActive)
{
- //SQUEEZE_DISPLAY (s->display);
-
FragmentAttrib fragment;
CompTransform wTransform = *transform;
BoxRec box;
float xOrigin, yOrigin;
- float xScaleError, yScaleError;
float xScale, yScale;
if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
@@ -573,18 +532,16 @@ squeezePaintWindow (CompWindow *w,
resizeGetPaintRectangle (s->display, &box);
resizeGetStretchScale (w, &box, &xScale, &yScale);
- resizeGetScaleError (w, &xScale, &yScale, &xScaleError, &yScaleError);
-
- //xOrigin = 6; // FIXME: I need to make sure the origins are
- //yOrigin = 10; // accurate! and this most definetly is not
- // I think I should look at resize.c to fix this
xOrigin = w->attrib.x - w->input.left;
yOrigin = w->attrib.y - w->input.top;
matrixTranslate (&wTransform, sw->tx, sw->ty, 0.0f);
matrixScale (&wTransform, xScale, yScale, 1.0f);
- matrixTranslate (&wTransform, xScaleError, yScaleError, 0.0f);
+ matrixTranslate (&wTransform,
+ (sw->targetX) / xScale - xOrigin,
+ (sw->targetY) / yScale - yOrigin,
+ 0.0f);
glPushMatrix ();
glLoadMatrixf (wTransform.m);
@@ -593,7 +550,6 @@ squeezePaintWindow (CompWindow *w,
mask | PAINT_WINDOW_TRANSFORMED_MASK);
glPopMatrix ();
-
}
else
{