[fusion-commits] Compiz configuration system library: Changes to 'master' (4748c20019623c380b9ee11da6da6086b2cefe79)
onestone at server.beryl-project.org
onestone at server.beryl-project.org
Tue Jul 17 13:48:53 CEST 2007
New commits:
commit 4748c20019623c380b9ee11da6da6086b2cefe79
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date: Tue Jul 17 13:48:45 2007 +0200
Make sure that ccs and compiz use the same option type.
plugin/ccp.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
Modified: fusion/compizconfig/libcompizconfig/plugin/ccp.c
===================================================================
--- fusion/compizconfig/libcompizconfig/plugin/ccp.c
+++ fusion/compizconfig/libcompizconfig/plugin/ccp.c
@@ -361,6 +361,44 @@ ccpUpdateActivePlugins (CompDisplay *d, CompOption *o)
}
}
+static Bool
+ccpSameType (CCSSettingType st, CompOptionType ot)
+{
+ if (st == TypeBool && ot == CompOptionTypeBool)
+ return TRUE;
+ if (st == TypeInt && ot == CompOptionTypeInt)
+ return TRUE;
+ if (st == TypeFloat && ot == CompOptionTypeFloat)
+ return TRUE;
+ if (st == TypeColor && ot == CompOptionTypeColor)
+ return TRUE;
+ if (st == TypeString && ot == CompOptionTypeString)
+ return TRUE;
+ if (st == TypeMatch && ot == CompOptionTypeMatch)
+ return TRUE;
+ if (st == TypeAction && ot == CompOptionTypeAction)
+ return TRUE;
+ if (st == TypeList && ot == CompOptionTypeList)
+ return TRUE;
+ return FALSE;
+}
+
+static Bool
+ccpTypeCheck (CCSSetting *s, CompOption *o)
+{
+ switch (s->type)
+ {
+ case TypeList:
+ return ccpSameType (s->type, o->type) &&
+ ccpSameType (s->info.forList.listType, o->value.list.type);
+ break;
+ default:
+ return ccpSameType (s->type, o->type);
+ break;
+ }
+ return FALSE;
+}
+
static void
ccpSetOptionFromContext ( CompDisplay *d,
char *plugin,
@@ -446,6 +484,9 @@ ccpSetOptionFromContext ( CompDisplay *d,
if (!setting)
return;
+ if (!ccpTypeCheck (setting, o))
+ return;
+
value = o->value;
ccpSettingToValue (d, setting, &value);
@@ -551,6 +592,9 @@ ccpSetContextFromOption ( CompDisplay *d,
if (!setting)
return;
+ if (!ccpTypeCheck (setting, o))
+ return;
+
ccpValueToSetting (d, setting, &o->value);
ccsWriteChangedSettings (cd->context);
}
More information about the commits
mailing list