All pastes #561330 Raw Edit

Mine

public text v1 · immutable
·published 2007-06-12 12:28 UTC
rendered paste body
From 6fd236b9e6fd8e78ba9e41d4442e590ac5591113 Mon Sep 17 00:00:00 2001
From: Roi Cohen <roico.beryl@gmail.com>
Date: Tue, 12 Jun 2007 14:25:06 +0200
Subject: [PATCH] Added option to enable cube transparency only on button binding initiated rotatation.

---
 include/cube.h       |    3 ++-
 metadata/cube.xml.in |    5 +++++
 plugins/cube.c       |   11 +++++++++--
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/include/cube.h b/include/cube.h
index 24ad28d..a8baf1f 100644
--- a/include/cube.h
+++ b/include/cube.h
@@ -58,7 +58,8 @@ typedef struct _CubeDisplay {
 #define CUBE_SCREEN_OPTION_ACTIVE_OPACITY          15
 #define CUBE_SCREEN_OPTION_INACTIVE_OPACITY        16
 #define CUBE_SCREEN_OPTION_FADE_TIME               17
-#define CUBE_SCREEN_OPTION_NUM                     18
+#define CUBE_SCREEN_OPTION_TRANSPARENT_MANUAL_ONLY 18
+#define CUBE_SCREEN_OPTION_NUM                     19
 
 typedef void (*CubeGetRotationProc) (CompScreen *s,
 				     float      *x,
diff --git a/metadata/cube.xml.in b/metadata/cube.xml.in
index 23d93e0..7405531 100644
--- a/metadata/cube.xml.in
+++ b/metadata/cube.xml.in
@@ -158,6 +158,11 @@
 		<max>10.0</max>
 		<precision>0.1</precision>
 	    </option>
+	    <option name="transparent_manual_only" type="bool">
+		<_short>Transparency Only on Mouse Rotate</_short>
+		<_long>Initiates Cube transparency only if rotation is mouse driven.</_long>
+		<default>true</default>
+	    </option>
 	</screen>
     </plugin>
 </compiz>
diff --git a/plugins/cube.c b/plugins/cube.c
index 24e587c..843534a 100644
--- a/plugins/cube.c
+++ b/plugins/cube.c
@@ -839,10 +839,16 @@ cubePreparePaintScreen (CompScreen *s,
     memset (cs->cleared, 0, sizeof (Bool) * s->nOutputDev);
 
     /* Transparency handling */
-    if (cs->rotationState != RotationNone)
+    if (cs->rotationState == RotationManual ||
+	(cs->rotationState == RotationChange &&
+	 cs->opt[CUBE_SCREEN_OPTION_TRANSPARENT_MANUAL_ONLY].value.b))
+    {
 	opt = CUBE_SCREEN_OPTION_ACTIVE_OPACITY;
+    }
     else
+    {
 	opt = CUBE_SCREEN_OPTION_INACTIVE_OPACITY;
+    }
 
     cs->toOpacity = (cs->opt[opt].value.f / 100.0f) * OPAQUE;
 
@@ -1927,7 +1933,8 @@ static const CompMetadataOptionInfo cubeScreenOptionInfo[] = {
     { "adjust_image", "bool", 0, 0, 0 },
     { "active_opacity", "float", "<min>0.0</min><max>100.0</max>", 0, 0 },
     { "inactive_opacity", "float", "<min>0.0</min><max>100.0</max>", 0, 0 },
-    { "fade_time", "float", "<min>0.0</min>", 0, 0 }
+    { "fade_time", "float", "<min>0.0</min>", 0, 0 },
+    { "transparent_manual_only", "bool", 0, 0, 0 }
 };
 
 static Bool
-- 
1.5.0.6