mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
In case of GConf failure, fall back to local keybinding values
Always compile the default keybindings into Metacity, and if we fail to retrieve the values from GConf, use the compiled-in value. This makes things more robust especially in an environment like JHBuild where GConf-schema-installation may not work correctly. Also use these values for the no-GConf case, rather than having a separate arrray and code path. http://bugzilla.gnome.org/show_bug.cgi?id=576127
This commit is contained in:
parent
514d00698d
commit
52638b9d8e
@ -1871,48 +1871,15 @@ meta_prefs_set_num_workspaces (int n_workspaces)
|
||||
}
|
||||
|
||||
#define keybind(name, handler, param, flags, stroke, description) \
|
||||
{ #name, NULL, !!(flags & BINDING_REVERSES), !!(flags & BINDING_PER_WINDOW) },
|
||||
{ #name, stroke, NULL, !!(flags & BINDING_REVERSES), !!(flags & BINDING_PER_WINDOW) },
|
||||
static MetaKeyPref key_bindings[] = {
|
||||
#include "all-keybindings.h"
|
||||
{ NULL, NULL, FALSE }
|
||||
{ NULL, NULL, NULL, FALSE }
|
||||
};
|
||||
#undef keybind
|
||||
|
||||
static MetaKeyCombo overlay_key_combo = { 0, 0, 0 };
|
||||
|
||||
#ifndef HAVE_GCONF
|
||||
|
||||
/**
|
||||
* A type to map names of keybindings (such as "switch_windows")
|
||||
* to the binding strings themselves (such as "<Alt>Tab").
|
||||
* It exists only when GConf is turned off in ./configure and
|
||||
* functions as a sort of ersatz GConf.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
const char *keybinding;
|
||||
} MetaSimpleKeyMapping;
|
||||
|
||||
/* FIXME: This would be neater if the array only contained entries whose
|
||||
* default keystroke was non-null. You COULD do this by defining
|
||||
* ONLY_BOUND_BY_DEFAULT around various blocks at the cost of making
|
||||
* the bindings file way more complicated. However, we could stop this being
|
||||
* data and move it into code. Then the compiler would optimise away
|
||||
* the problem lines.
|
||||
*/
|
||||
|
||||
#define keybind(name, handler, param, flags, stroke, description) \
|
||||
{ #name, stroke },
|
||||
|
||||
static MetaSimpleKeyMapping key_string_bindings[] = {
|
||||
#include "all-keybindings.h"
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#undef keybind
|
||||
|
||||
#endif /* NOT HAVE_GCONF */
|
||||
|
||||
/* These bindings are for modifiers alone, so they need special handling */
|
||||
static void
|
||||
init_special_bindings (void)
|
||||
@ -2000,22 +1967,13 @@ init_bindings (void)
|
||||
|
||||
#else /* HAVE_GCONF */
|
||||
int i = 0;
|
||||
int which = 0;
|
||||
|
||||
while (key_string_bindings[i].name)
|
||||
while (key_bindings[i].name)
|
||||
{
|
||||
if (key_string_bindings[i].keybinding == NULL) {
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
while (strcmp(key_bindings[which].name,
|
||||
key_string_bindings[i].name) != 0)
|
||||
which++;
|
||||
|
||||
/* Set the binding */
|
||||
update_binding (&key_bindings[which],
|
||||
key_string_bindings[i].keybinding);
|
||||
if (key_bindings[i].default_keybinding)
|
||||
{
|
||||
/* Set the binding */
|
||||
update_binding (&key_bindings[i], NULL);
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
@ -2105,6 +2063,9 @@ update_binding (MetaKeyPref *binding,
|
||||
MetaKeyCombo *combo;
|
||||
gboolean changed;
|
||||
|
||||
if (value == NULL)
|
||||
value = binding->default_keybinding;
|
||||
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Binding \"%s\" has new gconf value \"%s\"\n",
|
||||
binding->name, value ? value : "none");
|
||||
|
@ -222,6 +222,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
const char *default_keybinding;
|
||||
/**
|
||||
* A list of MetaKeyCombos. Each of them is bound to
|
||||
* this keypref. If one has keysym==modifiers==0, it is
|
||||
|
Loading…
Reference in New Issue
Block a user