[compiz] A little patch to make scale's show-desktop behaviour optional

Quinn Storm livinglatexkali at gmail.com
Sat Jun 2 20:25:15 PDT 2007


This particular behaviour drives me nuts, its so easy to accidentally click on 
desktop during scale and then all of your windows get minimized, which is no 
fun.  This little patch just makes this optional, leaving the default to be 
the normal behaviour.
-------------- next part --------------
From 4997067e5b34f0c4f05efff2dec00d3c6046bca6 Mon Sep 17 00:00:00 2001
From: Quinn Storm <quinn at quinn-laptop.(none)>
Date: Sat, 2 Jun 2007 23:21:16 -0400
Subject: [PATCH] add option to turn off scale behaviour where a click on the desktop shows the desktop

---
 metadata/scale.xml.in |    5 +++++
 plugins/scale.c       |    9 ++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/metadata/scale.xml.in b/metadata/scale.xml.in
index d9d3903..f576a3d 100644
--- a/metadata/scale.xml.in
+++ b/metadata/scale.xml.in
@@ -33,6 +33,11 @@
 		<default>
 		</default>
 	    </option>
+	    <option type="bool" name="show_desktop">
+		<_short>Click Desktop to Show Desktop</_short>
+		<_long>Enter Show Desktop mode when Desktop is clicked during Scale</_long>
+		<default>true</default>
+	    </option>
 	</display>
 	<screen>
 	    <option name="spacing" type="int">
diff --git a/plugins/scale.c b/plugins/scale.c
index 2b3835c..b6600c2 100644
--- a/plugins/scale.c
+++ b/plugins/scale.c
@@ -64,7 +64,8 @@ typedef struct _ScaleSlot {
 #define SCALE_DISPLAY_OPTION_INITIATE_ALL    1
 #define SCALE_DISPLAY_OPTION_INITIATE_GROUP  2
 #define SCALE_DISPLAY_OPTION_INITIATE_OUTPUT 3
-#define SCALE_DISPLAY_OPTION_NUM             4
+#define SCALE_DISPLAY_OPTION_SHOW_DESKTOP	 4
+#define SCALE_DISPLAY_OPTION_NUM             5
 
 typedef struct _ScaleDisplay {
     int		    screenPrivateIndex;
@@ -1546,7 +1547,8 @@ scaleHandleEvent (CompDisplay *d,
 		    {
 			scaleTerminate (d, action, 0, &o, 1);
 		    }
-		    else if (event->xbutton.x_root > s->workArea.x &&
+		    else if (sd->opt[SCALE_DISPLAY_OPTION_SHOW_DESKTOP].value.b &&
+					event->xbutton.x_root > s->workArea.x &&
 			     event->xbutton.x_root < (s->workArea.x +
 						      s->workArea.width) &&
 			     event->xbutton.y_root > s->workArea.y &&
@@ -1761,7 +1763,8 @@ static const CompMetadataOptionInfo scaleDisplayOptionInfo[] = {
     { "initiate", "action", 0, scaleInitiate, scaleTerminate },
     { "initiate_all", "action", 0, scaleInitiateAll, scaleTerminate },
     { "initiate_group", "action", 0, scaleInitiateGroup, scaleTerminate },
-    { "initiate_output", "action", 0, scaleInitiateOutput, scaleTerminate }
+    { "initiate_output", "action", 0, scaleInitiateOutput, scaleTerminate },
+	{ "show_desktop", "bool", 0, 0, 0 }
 };
 
 static Bool
-- 
1.4.4.2



More information about the compiz mailing list