summaryrefslogtreecommitdiff
path: root/capplets
diff options
context:
space:
mode:
Diffstat (limited to 'capplets')
-rw-r--r--capplets/keybindings/eggaccelerators.c114
-rw-r--r--capplets/keybindings/eggcellrendererkeys.c10
-rw-r--r--capplets/keybindings/mate-keybinding-properties.c31
3 files changed, 89 insertions, 66 deletions
diff --git a/capplets/keybindings/eggaccelerators.c b/capplets/keybindings/eggaccelerators.c
index 1a3e91ec..643808bf 100644
--- a/capplets/keybindings/eggaccelerators.c
+++ b/capplets/keybindings/eggaccelerators.c
@@ -152,7 +152,7 @@ static inline gboolean is_super(const gchar* string)
(string[6] == '>'));
}
-static inline gboolean is_hyper (const gchar *string)
+static inline gboolean is_hyper(const gchar *string)
{
return ((string[0] == '<') &&
(string[1] == 'h' || string[1] == 'H') &&
@@ -163,6 +163,19 @@ static inline gboolean is_hyper (const gchar *string)
(string[6] == '>'));
}
+static inline gboolean is_primary(const gchar* string)
+{
+ return ((string[0] == '<') &&
+ (string[1] == 'p' || string[1] == 'P') &&
+ (string[2] == 'r' || string[2] == 'R') &&
+ (string[3] == 'i' || string[3] == 'I') &&
+ (string[4] == 'm' || string[4] == 'M') &&
+ (string[5] == 'a' || string[5] == 'A') &&
+ (string[6] == 'r' || string[6] == 'R') &&
+ (string[7] == 'y' || string[7] == 'Y') &&
+ (string[8] == '>'));
+}
+
static inline gboolean is_keycode(const gchar *string)
{
return ((string[0] == '0') &&
@@ -235,6 +248,12 @@ egg_accelerator_parse_virtual (const gchar *accelerator,
len -= 9;
mods |= EGG_VIRTUAL_CONTROL_MASK;
}
+ else if (len >= 9 && is_primary (accelerator))
+ {
+ accelerator += 9;
+ len -= 9;
+ mods |= EGG_VIRTUAL_CONTROL_MASK;
+ }
else if (len >= 7 && is_shift (accelerator))
{
accelerator += 7;
@@ -372,26 +391,28 @@ egg_accelerator_parse_virtual (const gchar *accelerator,
*
* The caller of this function must free the returned string.
*/
-gchar*
-egg_virtual_accelerator_name (guint accelerator_key,
- guint keycode,
- EggVirtualModifierType accelerator_mods)
+gchar* egg_virtual_accelerator_name (guint accelerator_key, guint keycode, EggVirtualModifierType accelerator_mods)
{
- gchar *gtk_name;
- GdkModifierType gdkmods = 0;
+ /* Acá esta el problema...
+ * */
+ gchar* gtk_name;
+ GdkModifierType gdkmods = 0;
- egg_keymap_resolve_virtual_modifiers (NULL, accelerator_mods, &gdkmods);
- gtk_name = gtk_accelerator_name (accelerator_key, gdkmods);
+ egg_keymap_resolve_virtual_modifiers(NULL, accelerator_mods, &gdkmods);
- if (!accelerator_key)
- {
- gchar *name;
- name = g_strdup_printf ("%s0x%02x", gtk_name, keycode);
- g_free (gtk_name);
- return name;
- }
+ /* en la funcion gtk_accelerator_name, desde la modificacion del 16 de sep
+ * del 2011 en GTK+, la tecla <Control> es tomada como <Primary> (?) */
+ gtk_name = gtk_accelerator_name(accelerator_key, gdkmods);
+
+ if (!accelerator_key)
+ {
+ gchar *name;
+ name = g_strdup_printf ("%s0x%02x", gtk_name, keycode);
+ g_free (gtk_name);
+ return name;
+ }
- return gtk_name;
+ return gtk_name;
}
/**
@@ -413,47 +434,46 @@ egg_virtual_accelerator_label (guint accelerator_key,
guint keycode,
EggVirtualModifierType accelerator_mods)
{
- gchar *gtk_label;
- GdkModifierType gdkmods = 0;
+ gchar *gtk_label;
+ GdkModifierType gdkmods = 0;
- egg_keymap_resolve_virtual_modifiers (NULL, accelerator_mods, &gdkmods);
- gtk_label = gtk_accelerator_get_label (accelerator_key, gdkmods);
+ egg_keymap_resolve_virtual_modifiers (NULL, accelerator_mods, &gdkmods);
+ gtk_label = gtk_accelerator_get_label (accelerator_key, gdkmods);
- if (!accelerator_key)
- {
- gchar *label;
- label = g_strdup_printf ("%s0x%02x", gtk_label, keycode);
- g_free (gtk_label);
- return label;
- }
+ if (!accelerator_key)
+ {
+ gchar *label;
+ label = g_strdup_printf ("%s0x%02x", gtk_label, keycode);
+ g_free (gtk_label);
+ return label;
+ }
- return gtk_label;
+ return gtk_label;
}
-void
-egg_keymap_resolve_virtual_modifiers (GdkKeymap *keymap,
- EggVirtualModifierType virtual_mods,
- GdkModifierType *concrete_mods)
+void egg_keymap_resolve_virtual_modifiers (GdkKeymap* keymap, EggVirtualModifierType virtual_mods, GdkModifierType* concrete_mods)
{
- GdkModifierType concrete;
- int i;
- const EggModmap *modmap;
+ GdkModifierType concrete;
+ int i;
+ const EggModmap* modmap;
- g_return_if_fail (concrete_mods != NULL);
- g_return_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap));
+ g_return_if_fail (concrete_mods != NULL);
+ g_return_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap));
- modmap = egg_keymap_get_modmap (keymap);
+ modmap = egg_keymap_get_modmap(keymap);
- /* Not so sure about this algorithm. */
+ /* Not so sure about this algorithm. */
+ concrete = 0;
- concrete = 0;
- for (i = 0; i < EGG_MODMAP_ENTRY_LAST; ++i)
- {
- if (modmap->mapping[i] & virtual_mods)
- concrete |= MODMAP_ENTRY_TO_MODIFIER (i);
- }
+ for (i = 0; i < EGG_MODMAP_ENTRY_LAST; ++i)
+ {
+ if (modmap->mapping[i] & virtual_mods)
+ {
+ concrete |= MODMAP_ENTRY_TO_MODIFIER (i);
+ }
+ }
- *concrete_mods = concrete;
+ *concrete_mods = concrete;
}
void
diff --git a/capplets/keybindings/eggcellrendererkeys.c b/capplets/keybindings/eggcellrendererkeys.c
index 7b9c9332..5d84c2de 100644
--- a/capplets/keybindings/eggcellrendererkeys.c
+++ b/capplets/keybindings/eggcellrendererkeys.c
@@ -214,16 +214,14 @@ egg_cell_renderer_keys_class_init (EggCellRendererKeysClass *cell_keys_class)
}
-GtkCellRenderer *
-egg_cell_renderer_keys_new (void)
+GtkCellRenderer* egg_cell_renderer_keys_new(void)
{
- return GTK_CELL_RENDERER (g_object_new (EGG_TYPE_CELL_RENDERER_KEYS, NULL));
+ return GTK_CELL_RENDERER(g_object_new(EGG_TYPE_CELL_RENDERER_KEYS, NULL));
}
-static void
-egg_cell_renderer_keys_finalize (GObject *object)
+static void egg_cell_renderer_keys_finalize(GObject* object)
{
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ (*G_OBJECT_CLASS(parent_class)->finalize)(object);
}
static gchar* convert_keysym_state_to_string(guint keysym, guint keycode, EggVirtualModifierType mask)
diff --git a/capplets/keybindings/mate-keybinding-properties.c b/capplets/keybindings/mate-keybinding-properties.c
index 5155d445..b0ac2f7f 100644
--- a/capplets/keybindings/mate-keybinding-properties.c
+++ b/capplets/keybindings/mate-keybinding-properties.c
@@ -104,18 +104,23 @@ create_builder (void)
return builder;
}
-static char*
-binding_name (guint keyval,
- guint keycode,
- EggVirtualModifierType mask,
- gboolean translate)
+static char* binding_name(guint keyval, guint keycode, EggVirtualModifierType mask, gboolean translate)
{
- if (keyval != 0 || keycode != 0)
- return translate ?
- egg_virtual_accelerator_label (keyval, keycode, mask) :
- egg_virtual_accelerator_name (keyval, keycode, mask);
- else
- return g_strdup (translate ? _("Disabled") : "");
+ if (keyval != 0 || keycode != 0)
+ {
+ if (translate)
+ {
+ return egg_virtual_accelerator_label (keyval, keycode, mask);
+ }
+ else
+ {
+ return egg_virtual_accelerator_name (keyval, keycode, mask);
+ }
+ }
+ else
+ {
+ return g_strdup (translate ? _("Disabled") : "");
+ }
}
static gboolean
@@ -1165,7 +1170,7 @@ static void accel_edited_callback(GtkCellRendererText* cell, const char* path_st
|| (tmp_key.keyval >= GDK_Hangul_Kiyeog && tmp_key.keyval <= GDK_Hangul_J_YeorinHieuh)
|| keyval_is_forbidden (tmp_key.keyval))
{
-
+
GtkWidget *dialog;
char *name;
@@ -1202,7 +1207,7 @@ static void accel_edited_callback(GtkCellRendererText* cell, const char* path_st
int response;
name = binding_name(keyval, keycode, mask, TRUE);
-
+
dialog = gtk_message_dialog_new(
GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(view))),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,