~compiz-team/compiz/0.9.8

« back to all changes in this revision

Viewing changes to compizconfig/integration/gnome/src/ccs_gnome_integration.c

  • Committer: Tarmac
  • Author(s): Sam Spilsbury
  • Date: 2012-09-25 10:58:53 UTC
  • mfrom: (3368.3.27 compiz.fix_1041535)
  • Revision ID: tarmac-20120925105853-4prur0xexqsyayup
Check the returned value for NULL as the integration backend may fail. If the integration backend fails, it should fail properly

Increased test coverage on CCSGSettingsIntegratedSetting and CCSGNOMEIntegration. Added mocks where appropriate, split out the matcher used in the previous branch.. Fixes: https://bugs.launchpad.net/bugs/1041535. Approved by Daniel van Vugt, jenkins, Tim Penhey.

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
    CCSSettingType type = TypeString;
133
133
    CCSSettingValue *v = ccsIntegratedSettingReadValue (mouseButtonModifierSetting, type);
134
134
 
135
 
    modMask = ccsStringToModifiers (v->value.asString);
 
135
    if (v)
 
136
    {
 
137
        modMask = ccsStringToModifiers (v->value.asString);
136
138
 
137
 
    ccsFreeSettingValueWithType (v, type);
 
139
        ccsFreeSettingValueWithType (v, type);
 
140
    }
138
141
 
139
142
    return modMask;
140
143
}
445
448
            }
446
449
            else if (strcmp (settingName, "fullscreen_visual_bell") == 0)
447
450
            {
448
 
                const char *newValueString = v->value.asString ? "fullscreen" : "frame_flash";
 
451
                const char *newValueString = v->value.asBool ? "fullscreen" : "frame_flash";
449
452
                newValue->value.asString = strdup (newValueString);
450
453
                type = TypeString;
451
454
 
453
456
            }
454
457
            else if (strcmp (settingName, "click_to_focus") == 0)
455
458
            {
456
 
                const char *newValueString = v->value.asString ? "click" : "sloppy";
 
459
                const char *newValueString = v->value.asBool ? "click" : "sloppy";
457
460
                newValue->value.asString = strdup (newValueString);
458
461
                type = TypeString;
459
462
 
468
471
                unsigned int modMask;
469
472
                Bool         resizeWithRightButton = FALSE;
470
473
 
471
 
                if ((getButtonBindingForSetting (context, "resize",
 
474
                if ((getButtonBindingForSetting (priv->context, "resize",
472
475
                                                 "initiate_button") == 3) ||
473
 
                    (getButtonBindingForSetting (context, "core",
 
476
                    (getButtonBindingForSetting (priv->context, "core",
474
477
                                                 "window_menu_button") == 2))
475
478
                {
476
479
                     resizeWithRightButton = TRUE;
489
492
                                                                                                                ccsGNOMEIntegratedPluginNames.SPECIAL,
490
493
                                                                                                                ccsGNOMEIntegratedSettingNames.NULL_MOUSE_BUTTON_MODIFIER.compizName);
491
494
 
492
 
                modMask = ccsSettingGetValue (setting)->value.asButton.buttonModMask;
 
495
                modMask = v->value.asButton.buttonModMask;
493
496
                if (setGnomeMouseButtonModifier (integratedSettingsMBM->data, modMask))
494
497
                {
495
 
                    setButtonBindingForSetting (context, "move",
 
498
                    setButtonBindingForSetting (priv->context, "move",
496
499
                                                "initiate_button", 1, modMask);
497
 
                    setButtonBindingForSetting (context, "resize",
 
500
                    setButtonBindingForSetting (priv->context, "resize",
498
501
                                                "initiate_button", 
499
502
                                                resizeWithRightButton ? 3 : 2,
500
503
                                                modMask);
501
 
                    setButtonBindingForSetting (context, "core",
 
504
                    setButtonBindingForSetting (priv->context, "core",
502
505
                                                "window_menu_button",
503
506
                                                resizeWithRightButton ? 2 : 3,
504
507
                                                modMask);