Hi,

I've been using the attached patch to set a default snapping mode in the
wobbly plugin. The patch seems to work fine, with the exception that the
setting is not correctly read from gconf.

That is if I set the default to TRUE or FALSE in the code, then compiz
behaves correctly, but changing the setting in gconf subsequently does not
have any effect. I'm sure there's a trivial way to fix that and I'm just too
blind to see it.

I would very much like to see a similar patch applied to compiz.

 - Thierry

Index: plugins/wobbly.c
===================================================================
--- plugins/wobbly.c    (revision 3581)
+++ plugins/wobbly.c    (working copy)
@@ -177,7 +177,8 @@
 
 #define WOBBLY_DISPLAY_OPTION_SNAP   0
 #define WOBBLY_DISPLAY_OPTION_SHIVER 1
-#define WOBBLY_DISPLAY_OPTION_NUM    2
+#define WOBBLY_DISPLAY_OPTION_SNAP_ENABLE 2
+#define WOBBLY_DISPLAY_OPTION_NUM    3
 
 typedef struct _WobblyDisplay {
     int                    screenPrivateIndex;
@@ -2334,6 +2335,7 @@
                XkbStateNotifyEvent *stateEvent = (XkbStateNotifyEvent *) event;
                CompAction          *action;
                unsigned int        mods = 0xffffffff;
+               Bool snap_enable = 
&wd->opt[WOBBLY_DISPLAY_OPTION_SNAP_ENABLE].value.b;
 
                action = &wd->opt[WOBBLY_DISPLAY_OPTION_SNAP].value.action;
 
@@ -2341,9 +2343,15 @@
                    mods = action->key.modifiers;
 
                if ((stateEvent->mods & mods) == mods)
-                   wobblyEnableSnapping (d, NULL, 0, NULL, 0);
+                   if (snap_enable)
+                       wobblyDisableSnapping (d, NULL, 0, NULL, 0);
+                   else
+                       wobblyEnableSnapping (d, NULL, 0, NULL, 0);
                else
-                   wobblyDisableSnapping (d, NULL, 0, NULL, 0);
+                   if (snap_enable)
+                       wobblyEnableSnapping (d, NULL, 0, NULL, 0);
+                   else
+                       wobblyDisableSnapping (d, NULL, 0, NULL, 0);
            }
        }
        break;
@@ -2855,6 +2863,9 @@
        if (setDisplayAction (display, o, value))
            return TRUE;
        break;
+       case WOBBLY_DISPLAY_OPTION_SNAP_ENABLE:
+       if (compSetBoolOption(o, value))
+           return TRUE;
     default:
        break;
     }
@@ -2894,6 +2905,13 @@
     o->value.action.state    |= CompActionStateInitKey;
     o->value.action.state    |= CompActionStateInitButton;
     o->value.action.type      = 0;
+
+    o = &wd->opt[WOBBLY_DISPLAY_OPTION_SNAP_ENABLE];
+    o->name = "snap_enable";
+    o->shortDesc = N_("Snap Enable");
+    o->longDesc = N_("Default window snapping mode.");
+    o->type = CompOptionTypeBool;
+    o->value.b = TRUE;
 }
 
 static Bool
Index: plugins/compiz.schemas.in
===================================================================
--- plugins/compiz.schemas.in   (revision 3581)
+++ plugins/compiz.schemas.in   (working copy)
@@ -22738,6 +22738,18 @@
         </schema>
 
         <schema>
+            
<key>/schemas/apps/compiz/plugins/wobbly/allscreens/options/snap_enable</key>
+            
<applyto>/apps/compiz/plugins/wobbly/allscreens/options/snap_enable</applyto>
+            <owner>compiz</owner>
+            <type>bool</type>
+            <default>true</default>
+            <locale name="C">
+                <short>Snap Enable</short>
+                <long>Default window snapping mode.</long>
+            </locale>
+        </schema>
+
+        <schema>
             
<key>/schemas/apps/compiz/plugins/wobbly/screen0/options/friction</key>
             
<applyto>/apps/compiz/plugins/wobbly/screen0/options/friction</applyto>
             <owner>compiz</owner>

Attachment: signature.asc
Description: Digital signature

_______________________________________________
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz

Reply via email to