[PATCH] Added rotation state.
Danny Baumann
dannybaumann at web.de
Tue Jun 12 05:12:07 PDT 2007
This variable should be set appropriately by plugins rotating the cube.
---
include/cube.h | 9 +++++++++
plugins/cube.c | 2 ++
plugins/rotate.c | 12 ++++++++++++
3 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/include/cube.h b/include/cube.h
index 00e5b47..4010b6b 100644
--- a/include/cube.h
+++ b/include/cube.h
@@ -77,6 +77,13 @@ typedef enum _PaintOrder
FTB
} PaintOrder;
+typedef enum _RotationState
+{
+ RotationNone = 0,
+ RotationChange,
+ RotationManual
+} RotationState;
+
typedef struct _CubeScreen {
PreparePaintScreenProc preparePaintScreen;
DonePaintScreenProc donePaintScreen;
@@ -98,6 +105,8 @@ typedef struct _CubeScreen {
int xRotations;
PaintOrder paintOrder;
+ RotationState rotationState;
+
GLfloat distance;
GLushort color[3];
GLfloat tc[12];
diff --git a/plugins/cube.c b/plugins/cube.c
index 7c4df03..0162e0d 100644
--- a/plugins/cube.c
+++ b/plugins/cube.c
@@ -1859,6 +1859,8 @@ cubeInitScreen (CompPlugin *p,
cs->bg = NULL;
cs->nBg = 0;
+ cs->rotationState = RotationNone;
+
memset (cs->cleared, 0, sizeof (cs->cleared));
cubeUpdateOutputs (s);
diff --git a/plugins/rotate.c b/plugins/rotate.c
index 7aecd56..fdd9442 100644
--- a/plugins/rotate.c
+++ b/plugins/rotate.c
@@ -346,6 +346,9 @@ rotatePreparePaintScreen (CompScreen *s,
else
tx = (s->hsize * xrot / 360.0f) + 0.5f;
+ /* flag end of rotation */
+ cs->rotationState = RotationNone;
+
moveScreenViewport (s, tx, 0, TRUE);
rs->xrot = 0.0f;
@@ -559,6 +562,7 @@ rotateInitiate (CompDisplay *d,
if (s)
{
ROTATE_SCREEN (s);
+ CUBE_SCREEN (s);
if (s->hsize < 2)
return FALSE;
@@ -577,6 +581,14 @@ rotateInitiate (CompDisplay *d,
rs->moving = FALSE;
rs->slow = FALSE;
+ /* Set the rotation state for cube - if action is non-NULL,
+ we set it to manual (as we were called from the 'Initiate
+ Rotation' binding. Otherwise, we set to to Change. */
+ if (action)
+ cs->rotationState = RotationManual;
+ else
+ cs->rotationState = RotationChange;
+
if (!rs->grabIndex)
{
rs->grabIndex = pushScreenGrab (s, s->invisibleCursor, "rotate");
--
1.5.0.6
--=-BN45f9l1EBDZU+GMKjya
Content-Disposition: attachment; filename=0003-Add-cube-transparency.patch
Content-Type: application/mbox; name=0003-Add-cube-transparency.patch
Content-Transfer-Encoding: 7bit
More information about the compiz
mailing list