Merge lp:~compiz-team/compiz/compiz.fix_1050796 into lp:compiz/0.9.8

Proposed by Sam Spilsbury
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3391
Merged at revision: 3393
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1050796
Merge into: lp:compiz/0.9.8
Prerequisite: lp:~compiz-team/compiz/compiz.fix_1042041
Diff against target: 991 lines (+463/-160)
12 files modified
compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting.h (+11/-0)
compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting_factory.h (+11/-0)
compizconfig/integration/gnome/gsettings/org.compiz.integrated.gschema.xml (+0/-21)
compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting.c (+26/-2)
compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting_factory.c (+37/-1)
compizconfig/integration/gnome/include/ccs_gnome_integration_constants.h (+2/-0)
compizconfig/integration/gnome/src/ccs_gnome_integration.c (+97/-30)
compizconfig/integration/gnome/src/ccs_gnome_integration_constants.c (+13/-9)
compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.c (+0/-2)
compizconfig/integration/gnome/tests/compizconfig_test_ccs_gnome_integration.cpp (+194/-48)
compizconfig/libcompizconfig/include/ccs.h (+6/-0)
compizconfig/libcompizconfig/src/main.c (+66/-47)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1050796
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
jenkins (community) continuous-integration Needs Fixing
Review via email: mp+126270@code.launchpad.net

This proposal supersedes a proposal from 2012-09-25.

Commit message

Remove some options from org.compiz.integrated and integrate them properly - adding special cases for options where upstream gnome forgot to change the key type.
(LP: #1050796)

Description of the change

Remove some options from org.compiz.integrated and integrate them properly - adding special cases for options where upstream gnome forgot to change the key type.

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Looks and works fine to me.

A couple of potential issues in ccsCopyValue:
  1. This is not C: 872 + if (!value)
  2. Unreachable code: 918 + return NULL;

But when and if those become a problem, the compiler will tell you.

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote : Posted in a previous version of this proposal

The prerequisite lp:~compiz-team/compiz/compiz.fix_1042041 has not yet been merged into lp:compiz.

Revision history for this message
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) wrote :
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Still approved as per previous comments.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting.h'
2--- compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting.h 2012-08-17 07:33:02 +0000
3+++ compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting.h 2012-09-25 15:17:24 +0000
4@@ -26,6 +26,17 @@
5 CCSGSettingsWrapper *wrapper,
6 CCSObjectAllocationInterface *ai);
7
8+/**
9+ * @brief ccsGSettingsIntegratedSettingsTranslateOldGNOMEKeyForGSettings
10+ * @param key the old style gnome key to translate
11+ * @return new-style key. Caller should free
12+ *
13+ * This translates old style keys (eg foo_bar) to new style keys
14+ * foo-bar and special cases a few keys
15+ */
16+char *
17+ccsGSettingsIntegratedSettingsTranslateOldGNOMEKeyForGSettings (const char *key);
18+
19 COMPIZCONFIG_END_DECLS
20
21 #endif
22
23=== modified file 'compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting_factory.h'
24--- compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting_factory.h 2012-08-17 02:20:20 +0000
25+++ compizconfig/integration/gnome/gsettings/include/ccs_gnome_integration_gsettings_integrated_setting_factory.h 2012-09-25 15:17:24 +0000
26@@ -39,6 +39,17 @@
27
28 unsigned int ccsCCSGNOMEIntegrationGSettingsWrapperFactoryInterfaceGetType ();
29
30+/**
31+ * @brief ccsGSettingsIntegratedSettingsTranslateNewGNOMEKeyForCCS
32+ * @param key the old style gnome key to translate
33+ * @return new-style key. Caller should free
34+ *
35+ * This translates new style keys (eg foo-bar) to old style keys
36+ * foo_bar and special cases a few keys
37+ */
38+char *
39+ccsGSettingsIntegratedSettingsTranslateNewGNOMEKeyForCCS (const char *key);
40+
41 CCSGSettingsWrapper *
42 ccsGNOMEIntegrationGSettingsWrapperFactoryNewGSettingsWrapper (CCSGNOMEIntegrationGSettingsWrapperFactory *factory,
43 const gchar *schemaName,
44
45=== modified file 'compizconfig/integration/gnome/gsettings/org.compiz.integrated.gschema.xml'
46--- compizconfig/integration/gnome/gsettings/org.compiz.integrated.gschema.xml 2012-09-05 23:26:55 +0000
47+++ compizconfig/integration/gnome/gsettings/org.compiz.integrated.gschema.xml 2012-09-25 15:17:24 +0000
48@@ -4,18 +4,12 @@
49 <key type="b" name="display-all-workspaces">
50 <default>true</default>
51 </key>
52- <key type="s" name="exec">
53- <default>"gnome-terminal"</default>
54- </key>
55 <key type="s" name="command-window-screenshot">
56 <default>"gnome-screenshot -w"</default>
57 </key>
58 <key type="s" name="command-screenshot">
59 <default>"gnome-screenshot"</default>
60 </key>
61- <key type="s" name="command-terminal">
62- <default>"gnome-terminal"</default>
63- </key>
64 <key type="as" name="run-command-12">
65 <default>["Disabled"]</default>
66 </key>
67@@ -88,21 +82,6 @@
68 <key type="s" name="command-1">
69 <default>""</default>
70 </key>
71- <key type="as" name="run-command-terminal">
72- <default>["&lt;Control&gt;&lt;Alt&gt;t"]</default>
73- </key>
74- <key type="as" name="run-command-window-screenshot">
75- <default>["&lt;Alt&gt;Print"]</default>
76- </key>
77- <key type="as" name="run-command-screenshot">
78- <default>["Print"]</default>
79- </key>
80- <key type="as" name="panel-main-menu">
81- <default>["&lt;Alt&gt;F1"]</default>
82- </key>
83- <key type="as" name="panel-run-dialog">
84- <default>["&lt;Alt&gt;F2"]</default>
85- </key>
86 <key type="as" name="show-hud">
87 <default>["&lt;Alt&gt;"]</default>
88 </key>
89
90=== modified file 'compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting.c'
91--- compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting.c 2012-09-24 10:44:29 +0000
92+++ compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting.c 2012-09-25 15:17:24 +0000
93@@ -24,6 +24,30 @@
94 CCSGSettingsWrapper *wrapper;
95 };
96
97+char *
98+ccsGSettingsIntegratedSettingsTranslateOldGNOMEKeyForGSettings (const char *key)
99+{
100+ char *newKey = translateKeyForGSettings (key);
101+
102+ if (g_strcmp0 (newKey, "run-command-screenshot") == 0)
103+ {
104+ free (newKey);
105+ newKey = strdup ("screenshot");
106+ }
107+ else if (g_strcmp0 (newKey, "run-command-window-screenshot") == 0)
108+ {
109+ free (newKey);
110+ newKey = strdup ("window-screenshot");
111+ }
112+ else if (g_strcmp0 (newKey, "run-command-terminal") == 0)
113+ {
114+ free (newKey);
115+ newKey = strdup ("terminal");
116+ }
117+
118+ return newKey;
119+}
120+
121 SpecialOptionType
122 ccsGSettingsIntegratedSettingGetSpecialOptionType (CCSGNOMEIntegratedSettingInfo *setting)
123 {
124@@ -46,7 +70,7 @@
125 CCSGSettingsIntegratedSettingPrivate *priv = (CCSGSettingsIntegratedSettingPrivate *) ccsObjectGetPrivate (setting);
126 CCSSettingValue *v = calloc (1, sizeof (CCSSettingValue));
127 const char *gnomeKeyName = ccsGNOMEIntegratedSettingInfoGetGNOMEName ((CCSGNOMEIntegratedSettingInfo *) setting);
128- char *gsettingsTranslatedName = translateKeyForGSettings (gnomeKeyName);
129+ char *gsettingsTranslatedName = ccsGSettingsIntegratedSettingsTranslateOldGNOMEKeyForGSettings (gnomeKeyName);
130
131 v->isListChild = FALSE;
132 v->parent = NULL;
133@@ -137,7 +161,7 @@
134 {
135 CCSGSettingsIntegratedSettingPrivate *priv = (CCSGSettingsIntegratedSettingPrivate *) ccsObjectGetPrivate (setting);
136 const char *gnomeKeyName = ccsGNOMEIntegratedSettingInfoGetGNOMEName ((CCSGNOMEIntegratedSettingInfo *) setting);
137- char *gsettingsTranslatedName = translateKeyForGSettings (gnomeKeyName);
138+ char *gsettingsTranslatedName = ccsGSettingsIntegratedSettingsTranslateOldGNOMEKeyForGSettings (gnomeKeyName);
139
140 GVariant *variant = ccsGSettingsWrapperGetValue (priv->wrapper, gsettingsTranslatedName);
141 const GVariantType *variantType = g_variant_get_type (variant);
142
143=== modified file 'compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting_factory.c'
144--- compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting_factory.c 2012-08-17 07:33:02 +0000
145+++ compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting_factory.c 2012-09-25 15:17:24 +0000
146@@ -21,6 +21,30 @@
147
148 INTERFACE_TYPE (CCSGNOMEIntegrationGSettingsWrapperFactoryInterface);
149
150+char *
151+ccsGSettingsIntegratedSettingsTranslateNewGNOMEKeyForCCS (const char *key)
152+{
153+ char *newKey = translateKeyForCCS (key);
154+
155+ if (g_strcmp0 (newKey, "screenshot") == 0)
156+ {
157+ free (newKey);
158+ newKey = strdup ("run_command_screenshot");
159+ }
160+ else if (g_strcmp0 (newKey, "window_screenshot") == 0)
161+ {
162+ free (newKey);
163+ newKey = strdup ("run_command_window_screenshot");
164+ }
165+ else if (g_strcmp0 (newKey, "terminal") == 0)
166+ {
167+ free (newKey);
168+ newKey = strdup ("run_command_terminal");
169+ }
170+
171+ return newKey;
172+}
173+
174 CCSGSettingsWrapper *
175 ccsGNOMEIntegrationGSettingsWrapperFactoryNewGSettingsWrapper (CCSGNOMEIntegrationGSettingsWrapperFactory *factory,
176 const gchar *schemaName,
177@@ -103,7 +127,7 @@
178 gpointer user_data)
179 {
180 CCSGNOMEValueChangeData *data = (CCSGNOMEValueChangeData *) user_data;
181- char *baseName = translateKeyForCCS (key);
182+ char *baseName = ccsGSettingsIntegratedSettingsTranslateNewGNOMEKeyForCCS (key);
183
184 /* We don't care if integration is not enabled */
185 if (!ccsGetIntegrationEnabled (data->context))
186@@ -185,6 +209,18 @@
187 gnomeGSettingsValueChanged,
188 data,
189 factory->object.object_allocation));
190+ g_hash_table_insert (quarksToGSettingsWrappers, GINT_TO_POINTER (quarks->ORG_GNOME_DESKTOP_DEFAULT_APPLICATIONS_TERMINAL),
191+ ccsGNOMEIntegrationGSettingsWrapperFactoryNewGSettingsWrapper (factory,
192+ g_quark_to_string (quarks->ORG_GNOME_DESKTOP_DEFAULT_APPLICATIONS_TERMINAL),
193+ gnomeGSettingsValueChanged,
194+ data,
195+ factory->object.object_allocation));
196+ g_hash_table_insert (quarksToGSettingsWrappers, GINT_TO_POINTER (quarks->ORG_GNOME_SETTINGS_DAEMON_PLUGINS_MEDIA_KEYS),
197+ ccsGNOMEIntegrationGSettingsWrapperFactoryNewGSettingsWrapper (factory,
198+ g_quark_to_string (quarks->ORG_GNOME_SETTINGS_DAEMON_PLUGINS_MEDIA_KEYS),
199+ gnomeGSettingsValueChanged,
200+ data,
201+ factory->object.object_allocation));
202
203 return quarksToGSettingsWrappers;
204 }
205
206=== modified file 'compizconfig/integration/gnome/include/ccs_gnome_integration_constants.h'
207--- compizconfig/integration/gnome/include/ccs_gnome_integration_constants.h 2012-09-23 16:46:19 +0000
208+++ compizconfig/integration/gnome/include/ccs_gnome_integration_constants.h 2012-09-25 15:17:24 +0000
209@@ -188,6 +188,8 @@
210 {
211 GQuark ORG_GNOME_DESKTOP_WM_PREFERENCES;
212 GQuark ORG_GNOME_DESKTOP_WM_KEYBINDINGS;
213+ GQuark ORG_GNOME_SETTINGS_DAEMON_PLUGINS_MEDIA_KEYS;
214+ GQuark ORG_GNOME_DESKTOP_DEFAULT_APPLICATIONS_TERMINAL;
215 GQuark ORG_COMPIZ_INTEGRATED;
216 } CCSGSettingsWrapperIntegratedSchemasQuarks;
217
218
219=== modified file 'compizconfig/integration/gnome/src/ccs_gnome_integration.c'
220--- compizconfig/integration/gnome/src/ccs_gnome_integration.c 2012-09-24 03:55:38 +0000
221+++ compizconfig/integration/gnome/src/ccs_gnome_integration.c 2012-09-25 15:17:24 +0000
222@@ -160,6 +160,29 @@
223 }
224
225 static Bool
226+ccsGNOMEIntegrationBackendReadISAndSetSettingForType (CCSIntegratedSetting *integratedSetting,
227+ CCSSetting *setting,
228+ CCSSettingValue **v,
229+ CCSSettingType type)
230+{
231+ *v = ccsIntegratedSettingReadValue (integratedSetting, type);
232+
233+ if ((*v)->value.asString)
234+ {
235+ CCSSettingKeyValue key;
236+
237+ memset (&key, 0, sizeof (CCSSettingKeyValue));
238+ if (ccsStringToKeyBinding ((*v)->value.asString, &key))
239+ {
240+ ccsSetKey (setting, key, TRUE);
241+ return TRUE;
242+ }
243+ }
244+
245+ return FALSE;
246+}
247+
248+static Bool
249 ccsGNOMEIntegrationBackendReadOptionIntoSetting (CCSIntegration *integration,
250 CCSContext *context,
251 CCSSetting *setting,
252@@ -209,20 +232,11 @@
253 case OptionKey:
254 {
255 type = TypeKey;
256- v = ccsIntegratedSettingReadValue (integratedSetting, type);
257-
258- if (v->value.asString)
259- {
260- CCSSettingKeyValue key;
261-
262- memset (&key, 0, sizeof (CCSSettingKeyValue));
263- ccsGetKey (setting, &key);
264- if (ccsStringToKeyBinding (v->value.asString, &key))
265- {
266- ccsSetKey (setting, key, TRUE);
267- ret = TRUE;
268- }
269- }
270+ if (ccsGNOMEIntegrationBackendReadISAndSetSettingForType (integratedSetting,
271+ setting,
272+ &v,
273+ type))
274+ ret = TRUE;
275 }
276 break;
277 case OptionSpecial:
278@@ -268,6 +282,17 @@
279 ret = TRUE;
280 }
281 }
282+ else if ((strcmp (settingName, "run_command_screenshot_key") == 0 ||
283+ strcmp (settingName, "run_command_window_screenshot_key") == 0 ||
284+ strcmp (settingName, "run_command_terminal_key") == 0))
285+ {
286+ type = TypeString;
287+ if (ccsGNOMEIntegrationBackendReadISAndSetSettingForType (integratedSetting,
288+ setting,
289+ &v,
290+ type))
291+ ret = TRUE;
292+ }
293 else if (((strcmp (settingName, "initiate_button") == 0) &&
294 ((strcmp (pluginName, "move") == 0) ||
295 (strcmp (pluginName, "resize") == 0))) ||
296@@ -373,6 +398,29 @@
297 }
298 }
299
300+static Bool
301+ccsGNOMEIntegrationBackendKeyValueToStringValue (CCSSettingValue *keyValue,
302+ CCSSettingValue *stringValue)
303+{
304+ char *newValue;
305+
306+ newValue = ccsKeyBindingToString (&keyValue->value.asKey);
307+ if (newValue)
308+ {
309+ if (strcmp (newValue, "Disabled") == 0)
310+ {
311+ /* Metacity doesn't like "Disabled", it wants "disabled" */
312+ newValue[0] = 'd';
313+ }
314+
315+ stringValue->value.asString = newValue;
316+
317+ return TRUE;
318+ }
319+
320+ return FALSE;
321+}
322+
323 static void
324 ccsGNOMEIntegrationBackendWriteOptionFromSetting (CCSIntegration *integration,
325 CCSContext *context,
326@@ -393,7 +441,14 @@
327 /* Do not allow recursing back into writeIntegratedSetting */
328 ccsIntegrationDisallowIntegratedWrites (integration);
329
330- CCSSettingValue *v = ccsSettingGetValue (setting);
331+ CCSSettingType sType = ccsSettingGetType (setting);
332+ CCSSettingInfo *sInfo = ccsSettingGetInfo (setting);
333+
334+ CCSSettingValue *vSetting = ccsSettingGetValue (setting);
335+ CCSSettingValue *v = ccsCopyValue (vSetting, sType, sInfo);
336+
337+ if (!v)
338+ return;
339
340 switch (ccsGNOMEIntegratedSettingInfoGetSpecialOptionType ((CCSGNOMEIntegratedSettingInfo *) integratedSetting))
341 {
342@@ -408,25 +463,22 @@
343 break;
344 case OptionKey:
345 {
346- char *newValue;
347-
348- newValue = ccsKeyBindingToString (&(ccsSettingGetValue (setting)->value.asKey));
349- if (newValue)
350- {
351- if (strcmp (newValue, "Disabled") == 0)
352- {
353- /* Metacity doesn't like "Disabled", it wants "disabled" */
354- newValue[0] = 'd';
355- }
356-
357+ CCSSettingValue *newValue = calloc (1, sizeof (CCSSettingValue));
358+
359+ newValue->isListChild = FALSE;
360+ newValue->parent = NULL;
361+ newValue->refCount = 1;
362+
363+ if (ccsGNOMEIntegrationBackendKeyValueToStringValue (v, newValue))
364+ {
365 /* Really this is a lie - the writer expects a string
366 * but it needs to know if its a key or a string */
367 type = TypeKey;
368- v->value.asString = newValue;
369-
370- ccsIntegratedSettingWriteValue (integratedSetting, v, type);
371- free (newValue);
372+ ccsIntegratedSettingWriteValue (integratedSetting, newValue, type);
373 }
374+
375+ if (newValue)
376+ ccsFreeSettingValueWithType (newValue, TypeString);
377 }
378 break;
379 case OptionSpecial:
380@@ -462,6 +514,18 @@
381
382 ccsIntegratedSettingWriteValue (integratedSetting, newValue, type);
383 }
384+ else if ((strcmp (settingName, "run_command_screenshot_key") == 0 ||
385+ strcmp (settingName, "run_command_window_screenshot_key") == 0 ||
386+ strcmp (settingName, "run_command_terminal_key") == 0))
387+ {
388+ if (ccsGNOMEIntegrationBackendKeyValueToStringValue (v, newValue))
389+ {
390+ /* These are actually stored as strings in the schemas */
391+ type = TypeString;
392+ ccsIntegratedSettingWriteValue (integratedSetting, newValue, type);
393+ }
394+
395+ }
396 else if (((strcmp (settingName, "initiate_button") == 0) &&
397 ((strcmp (pluginName, "move") == 0) ||
398 (strcmp (pluginName, "resize") == 0))) ||
399@@ -520,6 +584,9 @@
400 g_error_free (err);
401 }
402
403+ if (v)
404+ ccsFreeSettingValueWithType (v, sType);
405+
406 /* we should immediately write changed settings */
407 ccsWriteChangedSettings (priv->context);
408 ccsIntegrationAllowIntegratedWrites (integration);
409
410=== modified file 'compizconfig/integration/gnome/src/ccs_gnome_integration_constants.c'
411--- compizconfig/integration/gnome/src/ccs_gnome_integration_constants.c 2012-08-22 09:15:24 +0000
412+++ compizconfig/integration/gnome/src/ccs_gnome_integration_constants.c 2012-09-25 15:17:24 +0000
413@@ -431,10 +431,14 @@
414 static const char *org_compiz_integrated = "org.compiz.integrated";
415 static const char *org_gnome_desktop_wm_keybindings = "org.gnome.desktop.wm.keybindings";
416 static const char *org_gnome_desktop_wm_preferences = "org.gnome.desktop.wm.preferences";
417+ static const char *org_gnome_settings_daemon_plugins_media_keys = "org.gnome.settings-daemon.plugins.media-keys";
418+ static const char *org_gnome_desktop_default_applications_terminal = "org.gnome.desktop.default-applications.terminal";
419
420 quarks->ORG_COMPIZ_INTEGRATED = g_quark_from_string (org_compiz_integrated);
421 quarks->ORG_GNOME_DESKTOP_WM_KEYBINDINGS = g_quark_from_string (org_gnome_desktop_wm_keybindings);
422 quarks->ORG_GNOME_DESKTOP_WM_PREFERENCES = g_quark_from_string (org_gnome_desktop_wm_preferences);
423+ quarks->ORG_GNOME_SETTINGS_DAEMON_PLUGINS_MEDIA_KEYS = g_quark_from_string (org_gnome_settings_daemon_plugins_media_keys);
424+ quarks->ORG_GNOME_DESKTOP_DEFAULT_APPLICATIONS_TERMINAL = g_quark_from_string (org_gnome_desktop_default_applications_terminal);
425
426 return NULL;
427 }
428@@ -501,7 +505,7 @@
429 g_hash_table_insert (coreHashTable, (gpointer) names->CORE_AUTORAISE_DELAY.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_DESKTOP_WM_PREFERENCES));
430 g_hash_table_insert (coreHashTable, (gpointer) names->CORE_AUTORAISE.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_DESKTOP_WM_PREFERENCES));
431 g_hash_table_insert (thumbnailHashTable, (gpointer) names->THUMBNAIL_CURRENT_VIEWPORT.compizName, GINT_TO_POINTER (quarks->ORG_COMPIZ_INTEGRATED));
432- g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_COMMAND_TERMINAL.compizName, GINT_TO_POINTER (quarks->ORG_COMPIZ_INTEGRATED));
433+ g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_COMMAND_TERMINAL.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_DESKTOP_DEFAULT_APPLICATIONS_TERMINAL));
434 g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_COMMAND_WINDOW_SCREENSHOT.compizName, GINT_TO_POINTER (quarks->ORG_COMPIZ_INTEGRATED));
435 g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_COMMAND_SCREENSHOT.compizName, GINT_TO_POINTER (quarks->ORG_COMPIZ_INTEGRATED));
436 g_hash_table_insert (rotateHashTable, (gpointer) names->ROTATE_ROTATE_RIGHT_WINDOW_KEY.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_DESKTOP_WM_KEYBINDINGS));
437@@ -609,11 +613,11 @@
438 g_hash_table_insert (coreHashTable, (gpointer) names->CORE_MAXIMIZE_WINDOW_KEY.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_DESKTOP_WM_KEYBINDINGS));
439 g_hash_table_insert (coreHashTable, (gpointer) names->CORE_MINIMIZE_WINDOW_KEY.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_DESKTOP_WM_KEYBINDINGS));
440 g_hash_table_insert (coreHashTable, (gpointer) names->CORE_TOGGLE_WINDOW_MAXIMIZED_KEY.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_DESKTOP_WM_KEYBINDINGS));
441- g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_TERMINAL_KEY.compizName, GINT_TO_POINTER (quarks->ORG_COMPIZ_INTEGRATED));
442- g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_WINDOW_SCREENSHOT_KEY.compizName, GINT_TO_POINTER (quarks->ORG_COMPIZ_INTEGRATED));
443- g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_SCREENSHOT_KEY.compizName, GINT_TO_POINTER (quarks->ORG_COMPIZ_INTEGRATED));
444- g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_MAIN_MENU_KEY.compizName, GINT_TO_POINTER (quarks->ORG_COMPIZ_INTEGRATED));
445- g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_KEY.compizName, GINT_TO_POINTER (quarks->ORG_COMPIZ_INTEGRATED));
446+ g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_TERMINAL_KEY.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_SETTINGS_DAEMON_PLUGINS_MEDIA_KEYS));
447+ g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_WINDOW_SCREENSHOT_KEY.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_SETTINGS_DAEMON_PLUGINS_MEDIA_KEYS));
448+ g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_SCREENSHOT_KEY.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_SETTINGS_DAEMON_PLUGINS_MEDIA_KEYS));
449+ g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_MAIN_MENU_KEY.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_DESKTOP_WM_KEYBINDINGS));
450+ g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_KEY.compizName, GINT_TO_POINTER (quarks->ORG_GNOME_DESKTOP_WM_KEYBINDINGS));
451 g_hash_table_insert (unityshellHashTable, (gpointer) names->UNITYSHELL_SHOW_HUD.compizName, GINT_TO_POINTER (quarks->ORG_COMPIZ_INTEGRATED));
452
453 return masterHashTable;
454@@ -937,9 +941,9 @@
455 g_hash_table_insert (coreHashTable, (gpointer) names->CORE_MAXIMIZE_WINDOW_KEY.compizName, GINT_TO_POINTER (OptionKey));
456 g_hash_table_insert (coreHashTable, (gpointer) names->CORE_MINIMIZE_WINDOW_KEY.compizName, GINT_TO_POINTER (OptionKey));
457 g_hash_table_insert (coreHashTable, (gpointer) names->CORE_TOGGLE_WINDOW_MAXIMIZED_KEY.compizName, GINT_TO_POINTER (OptionKey));
458- g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_TERMINAL_KEY.compizName, GINT_TO_POINTER (OptionKey));
459- g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_WINDOW_SCREENSHOT_KEY.compizName, GINT_TO_POINTER (OptionKey));
460- g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_SCREENSHOT_KEY.compizName, GINT_TO_POINTER (OptionKey));
461+ g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_TERMINAL_KEY.compizName, GINT_TO_POINTER (OptionSpecial));
462+ g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_WINDOW_SCREENSHOT_KEY.compizName, GINT_TO_POINTER (OptionSpecial));
463+ g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_COMMAND_SCREENSHOT_KEY.compizName, GINT_TO_POINTER (OptionSpecial));
464 g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_MAIN_MENU_KEY.compizName, GINT_TO_POINTER (OptionKey));
465 g_hash_table_insert (gnomecompatHashTable, (gpointer) names->GNOMECOMPAT_RUN_KEY.compizName, GINT_TO_POINTER (OptionKey));
466 g_hash_table_insert (unityshellHashTable, (gpointer) names->UNITYSHELL_SHOW_HUD.compizName, GINT_TO_POINTER (OptionKey));
467
468=== modified file 'compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.c'
469--- compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.c 2012-09-23 16:46:19 +0000
470+++ compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.c 2012-09-25 15:17:24 +0000
471@@ -131,7 +131,6 @@
472
473 ccsIntegratedSettingUnref (priv->integratedSetting);
474 ccsGNOMEIntegratedSettingInfoUnref (priv->gnomeIntegratedSettingInfo);
475- ccsIntegratedSettingInfoUnref (priv->integratedSettingInfo);
476
477 ccsObjectFinalize (integratedSetting);
478 (*integratedSetting->object.object_allocation->free_)
479@@ -202,7 +201,6 @@
480
481 ccsIntegratedSettingRef (priv->integratedSetting);
482 ccsGNOMEIntegratedSettingInfoRef (priv->gnomeIntegratedSettingInfo);
483- ccsIntegratedSettingInfoRef (priv->integratedSettingInfo);
484
485 ccsObjectSetPrivate (composition, (CCSPrivate *) (priv));
486 ccsObjectAddInterface (composition,
487
488=== modified file 'compizconfig/integration/gnome/tests/compizconfig_test_ccs_gnome_integration.cpp'
489--- compizconfig/integration/gnome/tests/compizconfig_test_ccs_gnome_integration.cpp 2012-09-24 03:44:08 +0000
490+++ compizconfig/integration/gnome/tests/compizconfig_test_ccs_gnome_integration.cpp 2012-09-25 15:17:24 +0000
491@@ -58,6 +58,8 @@
492 using ::testing::ReturnNull;
493 using ::testing::SetArgPointee;
494 using ::testing::DoAll;
495+using ::testing::Values;
496+using ::testing::WithParamInterface;
497 using ::testing::_;
498
499 namespace
500@@ -80,6 +82,7 @@
501 setting.c_str (),
502 type,
503 allocator);
504+ /* This takes ownership of integratedSettingInfo */
505 CCSGNOMEIntegratedSettingInfo *gnomeIntegratedSettingInfo =
506 ccsGNOMEIntegratedSettingInfoNew (integratedSettingInfo,
507 gnomeType,
508@@ -100,7 +103,6 @@
509
510 /* We want the composition to take ownership here, so unref the
511 * original members of the composition */
512- ccsIntegratedSettingInfoUnref (integratedSettingInfo);
513 ccsGNOMEIntegratedSettingInfoUnref (gnomeIntegratedSettingInfo);
514 ccsIntegratedSettingUnref (integratedSetting);
515
516@@ -119,38 +121,37 @@
517 return std::tr1::get <1> (integratedSettingWithMocks).get ();
518 }
519
520- typedef std::tr1::tuple <CCSContextGMock &,
521- CCSBackendGMock &,
522- CCSIntegratedSettingsStorageGMock &,
523- CCSIntegratedSettingFactoryGMock &,
524- boost::shared_ptr <CCSContext> ,
525- boost::shared_ptr <CCSBackend> ,
526- boost::shared_ptr <CCSIntegratedSettingsStorage> ,
527- boost::shared_ptr <CCSIntegratedSettingFactory> ,
528- boost::shared_ptr <CCSIntegration> > CCSGNOMEIntegrationWithMocks;
529+ typedef std::tr1::tuple <CCSContextGMock &,
530+ CCSBackendGMock &,
531+ CCSIntegratedSettingsStorageGMock &,
532+ CCSIntegratedSettingFactoryGMock &,
533+ boost::shared_ptr <CCSContext> ,
534+ boost::shared_ptr <CCSBackend> ,
535+ CCSIntegratedSettingsStorage *,
536+ CCSIntegratedSettingFactory *,
537+ boost::shared_ptr <CCSIntegration> > CCSGNOMEIntegrationWithMocks;
538
539 CCSGNOMEIntegrationWithMocks
540 createIntegrationWithMocks (CCSObjectAllocationInterface *ai)
541 {
542- boost::shared_ptr <CCSContext> context (AutoDestroy (ccsMockContextNew (),
543- ccsFreeContext));
544- boost::shared_ptr <CCSBackend> backend (AutoDestroy (ccsMockBackendNew (),
545- ccsBackendUnref));
546- boost::shared_ptr <CCSIntegratedSettingsStorage> storage (AutoDestroy (ccsMockIntegratedSettingsStorageNew (ai),
547- ccsIntegratedSettingsStorageUnref));
548- boost::shared_ptr <CCSIntegratedSettingFactory> factory (AutoDestroy (ccsMockIntegratedSettingFactoryNew (ai),
549- ccsIntegratedSettingFactoryUnref));
550- boost::shared_ptr <CCSIntegration> integration (AutoDestroy (ccsGNOMEIntegrationBackendNew (backend.get (),
551- context.get (),
552- factory.get (),
553- storage.get (),
554- ai),
555- ccsIntegrationUnref));
556+ boost::shared_ptr <CCSContext> context (AutoDestroy (ccsMockContextNew (),
557+ ccsFreeContext));
558+ boost::shared_ptr <CCSBackend> backend (AutoDestroy (ccsMockBackendNew (),
559+ ccsFreeMockBackend));
560+ /* The GNOME Integration backend takes ownership of these two */
561+ CCSIntegratedSettingsStorage *storage (ccsMockIntegratedSettingsStorageNew (ai));
562+ CCSIntegratedSettingFactory *factory (ccsMockIntegratedSettingFactoryNew (ai));
563+ boost::shared_ptr <CCSIntegration> integration (AutoDestroy (ccsGNOMEIntegrationBackendNew (backend.get (),
564+ context.get (),
565+ factory,
566+ storage,
567+ ai),
568+ ccsIntegrationUnref));
569
570 CCSContextGMock &gmockContext = *(reinterpret_cast <CCSContextGMock *> (ccsObjectGetPrivate (context.get ())));
571 CCSBackendGMock &gmockBackend = *(reinterpret_cast <CCSBackendGMock *> (ccsObjectGetPrivate (backend.get ())));
572- CCSIntegratedSettingsStorageGMock &gmockStorage = *(reinterpret_cast <CCSIntegratedSettingsStorageGMock *> (ccsObjectGetPrivate (storage.get ())));
573- CCSIntegratedSettingFactoryGMock &gmockFactory = *(reinterpret_cast <CCSIntegratedSettingFactoryGMock *> (ccsObjectGetPrivate (factory.get ())));
574+ CCSIntegratedSettingsStorageGMock &gmockStorage = *(reinterpret_cast <CCSIntegratedSettingsStorageGMock *> (ccsObjectGetPrivate (storage)));
575+ CCSIntegratedSettingFactoryGMock &gmockFactory = *(reinterpret_cast <CCSIntegratedSettingFactoryGMock *> (ccsObjectGetPrivate (factory)));
576
577 return CCSGNOMEIntegrationWithMocks (gmockContext,
578 gmockBackend,
579@@ -222,10 +223,19 @@
580 EXPECT_CALL (plugin, getName ()).WillOnce (Return (pluginName.c_str ()));
581 }
582
583+ void
584+ SetTypeInfo (CCSSettingGMock &setting,
585+ CCSSettingType type,
586+ CCSSettingInfo *info)
587+ {
588+ EXPECT_CALL (setting, getType ()).WillOnce (Return (type));
589+ EXPECT_CALL (setting, getInfo ()).WillOnce (Return (info));
590+ }
591+
592 CCSSettingValue *
593 MakeSettingValue ()
594 {
595- CCSSettingValue *v = new CCSSettingValue;
596+ CCSSettingValue *v = reinterpret_cast <CCSSettingValue *> (calloc (1, sizeof (CCSSettingValue)));
597 v->parent = NULL;
598 v->isListChild = FALSE;
599 v->refCount = 1;
600@@ -236,7 +246,7 @@
601 boost::shared_ptr <CCSSettingValue>
602 MakeAutoDestroySettingValue (CCSSettingType type)
603 {
604- CCSSettingValue *v = new CCSSettingValue;
605+ CCSSettingValue *v = reinterpret_cast <CCSSettingValue *> (calloc (1, sizeof (CCSSettingValue)));
606 v->parent = NULL;
607 v->isListChild = FALSE;
608 v->refCount = 1;
609@@ -387,6 +397,82 @@
610
611 namespace
612 {
613+ struct IntegratedMediaKeysParam
614+ {
615+ public:
616+
617+ IntegratedMediaKeysParam (const std::string &settingName,
618+ const std::string &integratedName,
619+ const std::string &keyValueString) :
620+ settingName (settingName),
621+ integratedName (integratedName),
622+ keyValueString (keyValueString)
623+ {
624+ EXPECT_TRUE (ccsStringToKeyBinding (keyValueString.c_str (),
625+ &keyValue));
626+ }
627+
628+ const std::string settingName;
629+ const std::string integratedName;
630+ const std::string keyValueString;
631+ CCSSettingKeyValue keyValue;
632+ };
633+}
634+
635+namespace
636+{
637+ std::string RUN_COMMAND_SCREENSHOT_KEY ("run_command_screenshot_key");
638+ std::string SCREENSHOT ("screenshot");
639+ std::string SCREENSHOT_BINDING ("<Alt>Print");
640+ std::string RUN_COMMAND_WINDOW_SCREENSHOT_KEY ("run_command_window_screenshot_key");
641+ std::string WINDOW_SCREENSHOT ("window_screenshot");
642+ std::string WINDOW_SCREENSHOT_BINDING ("<Control><Alt>Print");
643+ std::string RUN_COMMAND_TERMINAL_KEY ("run_command_terminal_key");
644+ std::string TERMINAL ("terminal");
645+ std::string TERMINAL_BINDING ("<Control><Alt>t");
646+}
647+
648+class CCSGNOMEIntegrationTestReadIntegratedMediaKeys :
649+ public CCSGNOMEIntegrationTestReadIntegrated,
650+ public WithParamInterface <IntegratedMediaKeysParam>
651+{
652+};
653+
654+TEST_P (CCSGNOMEIntegrationTestReadIntegratedMediaKeys, TestReadIntegratedMediaKey)
655+{
656+ const std::string settingName (GetParam ().settingName);
657+ CCSSettingValue *v = MakeSettingValue ();
658+ v->value.asString = strdup (GetParam ().keyValueString.c_str ());
659+
660+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
661+ settingName,
662+ TypeString,
663+ OptionSpecial,
664+ MOCK_GNOME_NAME,
665+ &ccsDefaultObjectAllocator);
666+ SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
667+ EXPECT_CALL (Mock (*mIntegratedSetting), readValue (TypeString)).WillOnce (Return (v));
668+ EXPECT_CALL (mSettingMock, setKey (Eq (GetParam ().keyValue), IsTrue ()));
669+
670+ EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
671+ NULL,
672+ mSetting.get (),
673+ Real (*mIntegratedSetting)), IsTrue ());
674+}
675+
676+INSTANTIATE_TEST_CASE_P (CCSGNOMEMediaKeys, CCSGNOMEIntegrationTestReadIntegratedMediaKeys,
677+ Values (IntegratedMediaKeysParam (RUN_COMMAND_SCREENSHOT_KEY,
678+ SCREENSHOT,
679+ SCREENSHOT_BINDING),
680+ IntegratedMediaKeysParam (RUN_COMMAND_WINDOW_SCREENSHOT_KEY,
681+ WINDOW_SCREENSHOT,
682+ WINDOW_SCREENSHOT_BINDING),
683+ IntegratedMediaKeysParam (RUN_COMMAND_TERMINAL_KEY,
684+ TERMINAL,
685+ TERMINAL_BINDING)));
686+
687+namespace
688+{
689 const std::string DEFAULT_MOUSE_BUTTON_MODIFIERS_STRING ("<Alt>");
690 const std::string GNOME_MOUSE_BUTTON_MODIFIERS_STRING ("<Super>");
691 const unsigned int DEFAULT_MOUSE_BUTTON_MODIFIERS =
692@@ -622,7 +708,8 @@
693 newButtonValue.buttonModMask = 0;
694
695 /* Clear the old expectation */
696- ccsIntegratedSettingReadValue (mIntegratedSettingMBM.get (), TypeString);
697+ ccsFreeSettingValueWithType (ccsIntegratedSettingReadValue (mIntegratedSettingMBM.get (), TypeString),
698+ TypeString);
699 /* Now return null */
700 EXPECT_CALL (mIntegratedSettingMBMMock, readValue (TypeString)).WillOnce (ReturnNull ());
701
702@@ -661,6 +748,7 @@
703 MOCK_GNOME_NAME,
704 &ccsDefaultObjectAllocator);
705 SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
706+ SetTypeInfo (mSettingMock, TypeBool, &info);
707
708 EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (compizValue.get ()));
709 EXPECT_CALL (Mock (*mIntegratedSetting), writeValue (Pointee (SettingValueMatch (*gnomeValue,
710@@ -690,6 +778,7 @@
711 MOCK_GNOME_NAME,
712 &ccsDefaultObjectAllocator);
713 SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
714+ SetTypeInfo (mSettingMock, TypeBool, &info);
715
716 EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (compizValue.get ()));
717 EXPECT_CALL (Mock (*mIntegratedSetting), writeValue (Pointee (SettingValueMatch (*gnomeValue,
718@@ -719,25 +808,81 @@
719 MOCK_GNOME_NAME,
720 &ccsDefaultObjectAllocator);
721 SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
722-
723- EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (compizValue.get ()));
724- EXPECT_CALL (Mock (*mIntegratedSetting), writeValue (Pointee (SettingValueMatch (*gnomeValue,
725- TypeString,
726- &info)),
727- TypeString));
728- ccsIntegrationWriteSettingIntoOption (Real (mIntegration),
729- NULL,
730- mSetting.get (),
731- Real (*mIntegratedSetting));
732-}
733+ SetTypeInfo (mSettingMock, TypeBool, &info);
734+
735+ EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (compizValue.get ()));
736+ EXPECT_CALL (Mock (*mIntegratedSetting), writeValue (Pointee (SettingValueMatch (*gnomeValue,
737+ TypeString,
738+ &info)),
739+ TypeString));
740+ ccsIntegrationWriteSettingIntoOption (Real (mIntegration),
741+ NULL,
742+ mSetting.get (),
743+ Real (*mIntegratedSetting));
744+}
745+
746+class CCSGNOMEIntegrationTestWriteIntegratedMediaKeys :
747+ public CCSGNOMEIntegrationTestWriteIntegrated,
748+ public WithParamInterface <IntegratedMediaKeysParam>
749+{
750+};
751+
752+TEST_P (CCSGNOMEIntegrationTestWriteIntegratedMediaKeys, TestWriteIntegratedMediaKey)
753+{
754+ const std::string settingName (GetParam ().settingName);
755+ boost::shared_ptr <CCSSettingValue> compizValue (MakeAutoDestroySettingValue (TypeKey));
756+ boost::shared_ptr <CCSSettingValue> gnomeValue (MakeAutoDestroySettingValue (TypeString));
757+ CCSSettingInfo info;
758+
759+ compizValue->value.asKey = GetParam ().keyValue;
760+ gnomeValue->value.asString = strdup (GetParam ().keyValueString.c_str ());
761+
762+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
763+ settingName,
764+ TypeString,
765+ OptionSpecial,
766+ MOCK_GNOME_NAME,
767+ &ccsDefaultObjectAllocator);
768+ SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
769+ SetTypeInfo (mSettingMock, TypeKey, &info);
770+
771+ EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (compizValue.get ()));
772+ EXPECT_CALL (Mock (*mIntegratedSetting), writeValue (Pointee (SettingValueMatch (*gnomeValue,
773+ TypeString,
774+ &info)),
775+ TypeString));
776+ ccsIntegrationWriteSettingIntoOption (Real (mIntegration),
777+ NULL,
778+ mSetting.get (),
779+ Real (*mIntegratedSetting));
780+}
781+
782+INSTANTIATE_TEST_CASE_P (CCSGNOMEMediaKeys, CCSGNOMEIntegrationTestWriteIntegratedMediaKeys,
783+ Values (IntegratedMediaKeysParam (RUN_COMMAND_SCREENSHOT_KEY,
784+ SCREENSHOT,
785+ SCREENSHOT_BINDING),
786+ IntegratedMediaKeysParam (RUN_COMMAND_WINDOW_SCREENSHOT_KEY,
787+ WINDOW_SCREENSHOT,
788+ WINDOW_SCREENSHOT_BINDING),
789+ IntegratedMediaKeysParam (RUN_COMMAND_TERMINAL_KEY,
790+ TERMINAL,
791+ TERMINAL_BINDING)));
792
793 /*
794 * TODO: Break up the function that this test covers. Its way too complicated
795 */
796 TEST_F (CCSGNOMEIntegrationTestWithMocksWriteIntegratedMouseButtonModifiers, TestWriteMouseButtonModifier)
797 {
798- const std::string settingName ("initiate_button");
799- const std::string pluginName ("move");
800+ const std::string moveSettingName ("initiate_button");
801+ const std::string movePluginName ("move");
802+ const std::string resizeSettingName ("initiate_button");
803+ const std::string resizePluginName ("resize");
804+ const std::string coreSettingName ("window_menu_button");
805+ const std::string corePluginName ("core");
806+
807+ const std::string settingName (moveSettingName);
808+ const std::string pluginName (movePluginName);
809+
810 CCSSettingInfo info;
811
812 mIntegratedSetting = createIntegratedSettingCompositionFromMock (pluginName,
813@@ -747,19 +892,20 @@
814 MOCK_GNOME_NAME,
815 &ccsDefaultObjectAllocator);
816 SetNames (mSettingMock, mPluginMock, settingName, pluginName);
817+ SetTypeInfo (mSettingMock, TypeButton, &info);
818
819- EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq ("move"))).WillRepeatedly (Return (movePlugin.get ()));
820- EXPECT_CALL (movePluginMock, findSetting (Eq ("initiate_button"))).WillRepeatedly (Return (moveInitiateButtonSetting.get ()));
821+ EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq (movePluginName))).WillRepeatedly (Return (movePlugin.get ()));
822+ EXPECT_CALL (movePluginMock, findSetting (Eq (moveSettingName))).WillRepeatedly (Return (moveInitiateButtonSetting.get ()));
823 EXPECT_CALL (moveInitiateButtonSettingMock, getType ()).WillRepeatedly (Return (TypeButton));
824 EXPECT_CALL (moveInitiateButtonSettingMock, getValue ()).WillRepeatedly (Return (moveInitiateButton.get ()));
825
826- EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq ("resize"))).WillRepeatedly (Return (resizePlugin.get ()));
827- EXPECT_CALL (resizePluginMock, findSetting (Eq ("initiate_button"))).WillRepeatedly (Return (resizeInitiateButtonSetting.get ()));
828+ EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq (resizePluginName))).WillRepeatedly (Return (resizePlugin.get ()));
829+ EXPECT_CALL (resizePluginMock, findSetting (Eq (resizeSettingName))).WillRepeatedly (Return (resizeInitiateButtonSetting.get ()));
830 EXPECT_CALL (resizeInitiateButtonSettingMock, getType ()).WillRepeatedly (Return (TypeButton));
831 EXPECT_CALL (resizeInitiateButtonSettingMock, getValue ()).WillRepeatedly (Return (resizeInitiateButton.get ()));
832
833- EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq ("core"))).WillRepeatedly (Return (corePlugin.get ()));
834- EXPECT_CALL (corePluginMock, findSetting (Eq ("window_menu_button"))).WillRepeatedly (Return (coreWindowMenuSetting.get ()));
835+ EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq (corePluginName))).WillRepeatedly (Return (corePlugin.get ()));
836+ EXPECT_CALL (corePluginMock, findSetting (Eq (coreSettingName))).WillRepeatedly (Return (coreWindowMenuSetting.get ()));
837 EXPECT_CALL (coreWindowMenuSettingMock, getType ()).WillRepeatedly (Return (TypeButton));
838 EXPECT_CALL (coreWindowMenuSettingMock, getValue ()).WillRepeatedly (Return (coreWindowMenuButton.get ()));
839
840
841=== modified file 'compizconfig/libcompizconfig/include/ccs.h'
842--- compizconfig/libcompizconfig/include/ccs.h 2012-09-10 01:06:55 +0000
843+++ compizconfig/libcompizconfig/include/ccs.h 2012-09-25 15:17:24 +0000
844@@ -772,6 +772,12 @@
845 CCSSettingValueList
846 ccsCopyList (CCSSettingValueList l1, CCSSetting * setting);
847
848+/* Deep copy setting value */
849+CCSSettingValue *
850+ccsCopyValue (CCSSettingValue *orig,
851+ CCSSettingType type,
852+ CCSSettingInfo *info);
853+
854 /* Converts an array of data items to a setting value list. Behaves similar
855 to ccsGetListFromStringArray */
856 CCSSettingValueList ccsGetValueListFromStringArray (const char **array,
857
858=== modified file 'compizconfig/libcompizconfig/src/main.c'
859--- compizconfig/libcompizconfig/src/main.c 2012-09-25 08:39:18 +0000
860+++ compizconfig/libcompizconfig/src/main.c 2012-09-25 15:17:24 +0000
861@@ -2461,64 +2461,83 @@
862 return TRUE;
863 }
864
865+CCSSettingValue *
866+ccsCopyValue (CCSSettingValue *orig,
867+ CCSSettingType type,
868+ CCSSettingInfo *info)
869+{
870+ CCSSettingValue *value = calloc (1, sizeof (CCSSettingValue));
871+
872+ if (!value)
873+ return NULL;
874+
875+ value->refCount = 1;
876+ value->parent = orig->parent;
877+ value->isListChild = orig->isListChild;
878+
879+ CCSSettingType vType = value->isListChild ? info->forList.listType : type;
880+
881+ switch (vType)
882+ {
883+ case TypeInt:
884+ value->value.asInt = orig->value.asInt;
885+ break;
886+ case TypeBool:
887+ value->value.asBool = orig->value.asBool;
888+ break;
889+ case TypeFloat:
890+ value->value.asFloat = orig->value.asFloat;
891+ break;
892+ case TypeString:
893+ value->value.asString = strdup (orig->value.asString);
894+ break;
895+ case TypeMatch:
896+ value->value.asMatch = strdup (orig->value.asMatch);
897+ break;
898+ case TypeKey:
899+ memcpy (&value->value.asKey, &orig->value.asKey,
900+ sizeof (CCSSettingKeyValue));
901+ break;
902+ case TypeButton:
903+ memcpy (&value->value.asButton, &orig->value.asButton,
904+ sizeof (CCSSettingButtonValue));
905+ break;
906+ case TypeEdge:
907+ value->value.asEdge = orig->value.asEdge;
908+ break;
909+ case TypeBell:
910+ value->value.asBell = orig->value.asBell;
911+ break;
912+ case TypeColor:
913+ memcpy (&value->value.asColor, &orig->value.asColor,
914+ sizeof (CCSSettingColorValue));
915+ break;
916+ default:
917+ free (value);
918+ return NULL;
919+ break;
920+ }
921+
922+ return value;
923+}
924+
925 CCSSettingValueList
926 ccsCopyList (CCSSettingValueList l1, CCSSetting * setting)
927 {
928 CCSSettingInfo *info = ccsSettingGetInfo (setting);
929+ CCSSettingType type = ccsSettingGetType (setting);
930 CCSSettingValueList l2 = NULL;
931
932 while (l1)
933 {
934- CCSSettingValue *value = calloc (1, sizeof (CCSSettingValue));
935+ CCSSettingValue *value = ccsCopyValue (l1->data,
936+ type,
937+ info);
938+
939+ /* FIXME If l2 != NULL, we leak l2 */
940 if (!value)
941 return l2;
942
943- value->refCount = 1;
944- value->parent = setting;
945- value->isListChild = TRUE;
946-
947- switch (info->forList.listType)
948- {
949- case TypeInt:
950- value->value.asInt = l1->data->value.asInt;
951- break;
952- case TypeBool:
953- value->value.asBool = l1->data->value.asBool;
954- break;
955- case TypeFloat:
956- value->value.asFloat = l1->data->value.asFloat;
957- break;
958- case TypeString:
959- value->value.asString = strdup (l1->data->value.asString);
960- break;
961- case TypeMatch:
962- value->value.asMatch = strdup (l1->data->value.asMatch);
963- break;
964- case TypeKey:
965- memcpy (&value->value.asKey, &l1->data->value.asKey,
966- sizeof (CCSSettingKeyValue));
967- break;
968- case TypeButton:
969- memcpy (&value->value.asButton, &l1->data->value.asButton,
970- sizeof (CCSSettingButtonValue));
971- break;
972- case TypeEdge:
973- value->value.asEdge = l1->data->value.asEdge;
974- break;
975- case TypeBell:
976- value->value.asBell = l1->data->value.asBell;
977- break;
978- case TypeColor:
979- memcpy (&value->value.asColor, &l1->data->value.asColor,
980- sizeof (CCSSettingColorValue));
981- break;
982- default:
983- /* FIXME If l2 != NULL, we leak l2 */
984- free (value);
985- return NULL;
986- break;
987- }
988-
989 l2 = ccsSettingValueListAppend (l2, value);
990 l1 = l1->next;
991 }

Subscribers

People subscribed via source and target branches