[PATCH] Added option to enable cube transparency only on button binding initiated rotatation.

Roi Cohen roico.beryl at gmail.com
Tue Jun 12 05:25:06 PDT 2007


---
 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 bdabedc..f555e0d 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;
 
@@ -1928,7 +1934,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


--=-BN45f9l1EBDZU+GMKjya--



More information about the compiz mailing list