[gnome-control-center] keyboard: Add dedicated key combo type
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] keyboard: Add dedicated key combo type
- Date: Mon, 10 Jul 2017 17:42:02 +0000 (UTC)
commit dccf79489707235149b946f78a430e96f37077bb
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Aug 27 00:59:11 2013 +0200
keyboard: Add dedicated key combo type
We currently store keyval, keycode and mask that make up a particular
key combo separately. However as we want to consider multiple bindings
for a single item, it makes more sense to combine them in a dedicated
struct type.
https://bugzilla.gnome.org/show_bug.cgi?id=673078
panels/keyboard/cc-keyboard-item.c | 42 ++++++---------
panels/keyboard/cc-keyboard-item.h | 10 +++-
panels/keyboard/cc-keyboard-manager.c | 37 ++++++--------
panels/keyboard/cc-keyboard-manager.h | 4 +-
panels/keyboard/cc-keyboard-panel.c | 15 +++---
panels/keyboard/cc-keyboard-shortcut-editor.c | 67 ++++++++++++-------------
panels/keyboard/keyboard-shortcuts.c | 37 ++++++--------
panels/keyboard/keyboard-shortcuts.h | 15 ++----
8 files changed, 99 insertions(+), 128 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-item.c b/panels/keyboard/cc-keyboard-item.c
index e1558aa..0810c7b 100644
--- a/panels/keyboard/cc-keyboard-item.c
+++ b/panels/keyboard/cc-keyboard-item.c
@@ -78,29 +78,24 @@ get_binding_from_variant (GVariant *variant)
}
static gboolean
-binding_from_string (const char *str,
- guint *accelerator_key,
- guint *keycode,
- GdkModifierType *accelerator_mods)
+binding_from_string (const char *str,
+ CcKeyCombo *combo)
{
- g_return_val_if_fail (accelerator_key != NULL, FALSE);
+ g_return_val_if_fail (combo != NULL, FALSE);
guint *keycodes;
if (str == NULL || strcmp (str, "disabled") == 0)
{
- *accelerator_key = 0;
- *keycode = 0;
- *accelerator_mods = 0;
+ memset (combo, 0, sizeof(CcKeyCombo));
return TRUE;
}
- gtk_accelerator_parse_with_keycode (str, accelerator_key, &keycodes, accelerator_mods);
+ gtk_accelerator_parse_with_keycode (str, &combo->keyval, &keycodes, &combo->mask);
- if (keycode != NULL)
- *keycode = (keycodes ? keycodes[0] : 0);
+ combo->keycode = (keycodes ? keycodes[0] : 0);
g_free (keycodes);
- if (*accelerator_key == 0)
+ if (combo->keyval == 0)
return FALSE;
else
return TRUE;
@@ -163,8 +158,7 @@ _set_binding (CcKeyboardItem *item,
g_clear_pointer (&item->priv->binding, g_free);
item->priv->binding = enabled ? g_strdup (value) : g_strdup ("");
- binding_from_string (item->priv->binding, &item->keyval,
- &item->keycode, &item->mask);
+ binding_from_string (item->priv->binding, item->primary_combo);
/*
* Always treat the pair (item, reverse) as a unit: setting one also
@@ -174,19 +168,17 @@ _set_binding (CcKeyboardItem *item,
{
GdkModifierType reverse_mask;
- reverse_mask = enabled ? item->mask ^ GDK_SHIFT_MASK : item->mask;
+ reverse_mask = enabled ? item->primary_combo->mask ^ GDK_SHIFT_MASK
+ : item->primary_combo->mask;
g_clear_pointer (&reverse->priv->binding, g_free);
if (enabled)
reverse->priv->binding = gtk_accelerator_name_with_keycode (NULL,
- item->keyval,
- item->keycode,
+ item->primary_combo->keyval,
+ item->primary_combo->keycode,
reverse_mask);
- binding_from_string (reverse->priv->binding,
- &reverse->keyval,
- &reverse->keycode,
- &reverse->mask);
+ binding_from_string (reverse->priv->binding, reverse->primary_combo);
}
if (set_backend == FALSE)
@@ -353,6 +345,7 @@ static void
cc_keyboard_item_init (CcKeyboardItem *item)
{
item->priv = CC_KEYBOARD_ITEM_GET_PRIVATE (item);
+ item->primary_combo = g_new0 (CcKeyCombo, 1);
}
static void
@@ -372,6 +365,7 @@ cc_keyboard_item_finalize (GObject *object)
/* Free memory */
g_free (item->priv->binding);
+ g_free (item->primary_combo);
g_free (item->gsettings_path);
g_free (item->description);
g_free (item->command);
@@ -458,8 +452,7 @@ cc_keyboard_item_load_from_gsettings_path (CcKeyboardItem *item,
g_free (item->priv->binding);
item->priv->binding = settings_get_binding (item->settings, item->key);
- binding_from_string (item->priv->binding, &item->keyval,
- &item->keycode, &item->mask);
+ binding_from_string (item->priv->binding, item->primary_combo);
g_signal_connect (G_OBJECT (item->settings), "changed::binding",
G_CALLBACK (binding_changed), item);
@@ -482,8 +475,7 @@ cc_keyboard_item_load_from_gsettings (CcKeyboardItem *item,
g_free (item->priv->binding);
item->priv->binding = settings_get_binding (item->settings, item->key);
item->editable = g_settings_is_writable (item->settings, item->key);
- binding_from_string (item->priv->binding, &item->keyval,
- &item->keycode, &item->mask);
+ binding_from_string (item->priv->binding, item->primary_combo);
signal_name = g_strdup_printf ("changed::%s", item->key);
g_signal_connect (G_OBJECT (item->settings), signal_name,
diff --git a/panels/keyboard/cc-keyboard-item.h b/panels/keyboard/cc-keyboard-item.h
index 32ee3df..22ffd1b 100644
--- a/panels/keyboard/cc-keyboard-item.h
+++ b/panels/keyboard/cc-keyboard-item.h
@@ -46,6 +46,12 @@ typedef enum {
CC_KEYBOARD_ITEM_TYPE_GSETTINGS
} CcKeyboardItemType;
+typedef struct {
+ guint keyval;
+ guint keycode;
+ GdkModifierType mask;
+} CcKeyCombo;
+
typedef struct CcKeyboardItemPrivate CcKeyboardItemPrivate;
typedef struct
@@ -58,10 +64,8 @@ typedef struct
/* common */
/* FIXME move to priv? */
- guint keyval;
- guint keycode;
+ CcKeyCombo *primary_combo;
BindingGroupType group;
- GdkModifierType mask;
GtkTreeModel *model;
char *description;
gboolean editable;
diff --git a/panels/keyboard/cc-keyboard-manager.c b/panels/keyboard/cc-keyboard-manager.c
index 7e47b29..bea9719 100644
--- a/panels/keyboard/cc-keyboard-manager.c
+++ b/panels/keyboard/cc-keyboard-manager.c
@@ -105,15 +105,17 @@ static gboolean
is_shortcut_different (CcUniquenessData *data,
CcKeyboardItem *item)
{
+ CcKeyCombo *combo = item->primary_combo;
+
if (data->orig_item && cc_keyboard_item_equal (data->orig_item, item))
return FALSE;
if (data->new_keyval != 0)
{
- if (data->new_keyval != item->keyval)
+ if (data->new_keyval != combo->keyval)
return TRUE;
}
- else if (item->keyval != 0 || data->new_keycode != item->keycode)
+ else if (combo->keyval != 0 || data->new_keycode != combo->keycode)
{
return TRUE;
}
@@ -130,7 +132,7 @@ compare_keys_for_uniqueness (CcKeyboardItem *current_item,
/* No conflict for: blanks, different modifiers or ourselves */
if (!current_item ||
data->orig_item == current_item ||
- data->new_mask != current_item->mask)
+ data->new_mask != current_item->primary_combo->mask)
{
return FALSE;
}
@@ -909,9 +911,7 @@ cc_keyboard_manager_remove_custom_shortcut (CcKeyboardManager *self,
* cc_keyboard_manager_get_collision:
* @self: a #CcKeyboardManager
* @item: (nullable): a keyboard shortcut
- * @keyval: the key value
- * @mask: a mask for the key sequence
- * @keycode: the code of the key.
+ * @combo: a #CcKeyCombo
*
* Retrieves the collision item for the given shortcut.
*
@@ -920,9 +920,7 @@ cc_keyboard_manager_remove_custom_shortcut (CcKeyboardManager *self,
CcKeyboardItem*
cc_keyboard_manager_get_collision (CcKeyboardManager *self,
CcKeyboardItem *item,
- gint keyval,
- GdkModifierType mask,
- gint keycode)
+ CcKeyCombo *combo)
{
CcUniquenessData data;
BindingGroupType i;
@@ -930,12 +928,12 @@ cc_keyboard_manager_get_collision (CcKeyboardManager *self,
g_return_val_if_fail (CC_IS_KEYBOARD_MANAGER (self), NULL);
data.orig_item = item;
- data.new_keyval = keyval;
- data.new_mask = mask;
- data.new_keycode = keycode;
+ data.new_keyval = combo->keyval;
+ data.new_mask = combo->mask;
+ data.new_keycode = combo->keycode;
data.conflict_item = NULL;
- if (keyval == 0 && keycode == 0)
+ if (combo->keyval == 0 && combo->keycode == 0)
return NULL;
/* Any number of shortcuts can be disabled */
@@ -995,19 +993,14 @@ cc_keyboard_manager_reset_shortcut (CcKeyboardManager *self,
/* Disables any shortcut that conflicts with the new shortcut's value */
if (default_binding && *default_binding != '\0')
{
- GdkModifierType mask;
CcKeyboardItem *collision;
+ CcKeyCombo combo;
guint *keycodes;
- guint keyval;
-
- gtk_accelerator_parse_with_keycode (default_binding, &keyval, &keycodes, &mask);
- collision = cc_keyboard_manager_get_collision (self,
- NULL,
- keyval,
- mask,
- keycodes ? keycodes[0] : 0);
+ gtk_accelerator_parse_with_keycode (default_binding, &combo.keyval, &keycodes, &combo.mask);
+ combo.keycode = keycodes ? keycodes[0] : 0;
+ collision = cc_keyboard_manager_get_collision (self, NULL, &combo);
if (collision)
cc_keyboard_manager_disable_shortcut (self, collision);
diff --git a/panels/keyboard/cc-keyboard-manager.h b/panels/keyboard/cc-keyboard-manager.h
index dde58c6..232c4b2 100644
--- a/panels/keyboard/cc-keyboard-manager.h
+++ b/panels/keyboard/cc-keyboard-manager.h
@@ -47,9 +47,7 @@ void cc_keyboard_manager_remove_custom_shortcut (CcKeyboardMana
CcKeyboardItem* cc_keyboard_manager_get_collision (CcKeyboardManager *self,
CcKeyboardItem *item,
- gint keyval,
- GdkModifierType mask,
- gint keycode);
+ CcKeyCombo *combo);
void cc_keyboard_manager_disable_shortcut (CcKeyboardManager *self,
CcKeyboardItem *item);
diff --git a/panels/keyboard/cc-keyboard-panel.c b/panels/keyboard/cc-keyboard-panel.c
index 99e5e95..02f250a 100644
--- a/panels/keyboard/cc-keyboard-panel.c
+++ b/panels/keyboard/cc-keyboard-panel.c
@@ -109,18 +109,18 @@ transform_binding_to_accel (GBinding *binding,
gpointer user_data)
{
CcKeyboardItem *item;
+ CcKeyCombo *combo;
gchar *accelerator;
item = CC_KEYBOARD_ITEM (g_binding_get_source (binding));
+ combo = item->primary_combo;
/* Embolden the label when the shortcut is modified */
if (!cc_keyboard_item_is_value_default (item))
{
gchar *tmp;
- tmp = convert_keysym_state_to_string (item->keyval,
- item->mask,
- item->keycode);
+ tmp = convert_keysym_state_to_string (combo);
accelerator = g_strdup_printf ("<b>%s</b>", tmp);
@@ -128,9 +128,7 @@ transform_binding_to_accel (GBinding *binding,
}
else
{
- accelerator = convert_keysym_state_to_string (item->keyval,
- item->mask,
- item->keycode);
+ accelerator = convert_keysym_state_to_string (combo);
}
g_value_take_string (to_value, accelerator);
@@ -396,17 +394,18 @@ static gboolean
search_match_shortcut (CcKeyboardItem *item,
const gchar *search)
{
+ CcKeyCombo *combo = item->primary_combo;
GStrv shortcut_tokens, search_tokens;
g_autofree gchar *normalized_accel = NULL;
g_autofree gchar *accel = NULL;
gboolean match;
guint i;
- if (is_empty_binding (item->keyval, item->mask, item->keycode))
+ if (is_empty_binding (combo))
return FALSE;
match = TRUE;
- accel = convert_keysym_state_to_string (item->keyval, item->mask, item->keycode);
+ accel = convert_keysym_state_to_string (combo);
normalized_accel = cc_util_normalize_casefold_and_unaccent (accel);
shortcut_tokens = g_strsplit_set (normalized_accel, SHORTCUT_DELIMITERS, -1);
diff --git a/panels/keyboard/cc-keyboard-shortcut-editor.c b/panels/keyboard/cc-keyboard-shortcut-editor.c
index efb2bc8..24eacdf 100644
--- a/panels/keyboard/cc-keyboard-shortcut-editor.c
+++ b/panels/keyboard/cc-keyboard-shortcut-editor.c
@@ -59,9 +59,7 @@ struct _CcKeyboardShortcutEditor
GdkDevice *grab_pointer;
guint grab_idle_id;
- guint custom_keycode;
- guint custom_keyval;
- GdkModifierType custom_mask;
+ CcKeyCombo *custom_combo;
gboolean custom_is_modifier;
gboolean edited : 1;
};
@@ -154,19 +152,20 @@ apply_custom_item_fields (CcKeyboardShortcutEditor *self,
/* Only setup the binding when it was actually edited */
if (self->edited)
{
+ CcKeyCombo *combo = item->primary_combo;
gchar *binding;
- item->keycode = self->custom_keycode;
- item->keyval = self->custom_keyval;
- item->mask = self->custom_mask;
+ combo->keycode = self->custom_combo->keycode;
+ combo->keyval = self->custom_combo->keyval;
+ combo->mask = self->custom_combo->mask;
- if (item->keycode == 0 && item->keyval == 0 && item->mask == 0)
+ if (combo->keycode == 0 && combo->keyval == 0 && combo->mask == 0)
binding = g_strdup ("");
else
binding = gtk_accelerator_name_with_keycode (NULL,
- item->keyval,
- item->keycode,
- item->mask);
+ combo->keyval,
+ combo->keycode,
+ combo->mask);
g_object_set (G_OBJECT (item), "binding", binding, NULL);
@@ -194,9 +193,7 @@ clear_custom_entries (CcKeyboardShortcutEditor *self)
gtk_label_set_label (GTK_LABEL (self->new_shortcut_conflict_label), "");
gtk_label_set_label (GTK_LABEL (self->shortcut_conflict_label), "");
- self->custom_keycode = 0;
- self->custom_keyval = 0;
- self->custom_mask = 0;
+ memset (self->custom_combo, 0, sizeof (CcKeyCombo));
self->custom_is_modifier = TRUE;
self->edited = FALSE;
@@ -352,11 +349,11 @@ setup_custom_shortcut (CcKeyboardShortcutEditor *self)
gchar *accel;
is_custom = is_custom_shortcut (self);
- accel_valid = is_valid_binding (self->custom_keyval, self->custom_mask, self->custom_keycode) &&
- is_valid_accel (self->custom_keyval, self->custom_mask) &&
+ accel_valid = is_valid_binding (self->custom_combo) &&
+ is_valid_accel (self->custom_combo) &&
!self->custom_is_modifier;
- is_accel_empty = is_empty_binding (self->custom_keyval, self->custom_mask, self->custom_keycode);
+ is_accel_empty = is_empty_binding (self->custom_combo);
if (is_accel_empty)
accel_valid = TRUE;
@@ -400,11 +397,9 @@ setup_custom_shortcut (CcKeyboardShortcutEditor *self)
collision_item = cc_keyboard_manager_get_collision (self->manager,
self->item,
- self->custom_keyval,
- self->custom_mask,
- self->custom_keycode);
+ self->custom_combo);
- accel = gtk_accelerator_name (self->custom_keyval, self->custom_mask);
+ accel = gtk_accelerator_name (self->custom_combo->keyval, self->custom_combo->mask);
/* Setup the accelerator label */
@@ -427,9 +422,7 @@ setup_custom_shortcut (CcKeyboardShortcutEditor *self)
gchar *friendly_accelerator;
gchar *collision_text;
- friendly_accelerator = convert_keysym_state_to_string (self->custom_keyval,
- self->custom_mask,
- self->custom_keycode);
+ friendly_accelerator = convert_keysym_state_to_string (self->custom_combo);
collision_text = g_strdup_printf (_("%s is already being used for <b>%s</b>. If you "
"replace it, %s will be disabled"),
@@ -556,12 +549,14 @@ reset_custom_clicked_cb (CcKeyboardShortcutEditor *self)
static void
reset_item_clicked_cb (CcKeyboardShortcutEditor *self)
{
+ CcKeyCombo *combo;
gchar *accel;
/* Reset first, then update the shortcut */
cc_keyboard_manager_reset_shortcut (self->manager, self->item);
- accel = gtk_accelerator_name (self->item->keyval, self->item->mask);
+ combo = self->item->primary_combo;
+ accel = gtk_accelerator_name (combo->keyval, combo->mask);
gtk_shortcut_label_set_accelerator (GTK_SHORTCUT_LABEL (self->shortcut_accel_label), accel);
g_free (accel);
@@ -578,6 +573,7 @@ static void
setup_keyboard_item (CcKeyboardShortcutEditor *self,
CcKeyboardItem *item)
{
+ CcKeyCombo *combo;
gboolean is_custom;
gchar *accel;
gchar *text;
@@ -585,15 +581,16 @@ setup_keyboard_item (CcKeyboardShortcutEditor *self,
if (!item)
return;
+ combo = item->primary_combo;
is_custom = item->type == CC_KEYBOARD_ITEM_TYPE_GSETTINGS_PATH;
- accel = gtk_accelerator_name (item->keyval, item->mask);
+ accel = gtk_accelerator_name (combo->keyval, combo->mask);
/* To avoid accidentally thinking we unset the current keybinding, set the values
* of the keyboard item that is being edited */
self->custom_is_modifier = FALSE;
- self->custom_keycode = item->keycode;
- self->custom_keyval = item->keyval;
- self->custom_mask = item->mask;
+ self->custom_combo->keycode = combo->keycode;
+ self->custom_combo->keyval = combo->keyval;
+ self->custom_combo->mask = combo->mask;
/* Headerbar */
gtk_header_bar_set_title (GTK_HEADER_BAR (self->headerbar),
@@ -664,6 +661,7 @@ cc_keyboard_shortcut_editor_finalize (GObject *object)
g_clear_object (&self->item);
g_clear_object (&self->manager);
+ g_clear_pointer (&self->custom_combo, g_free);
g_clear_pointer (&self->reset_item_binding, g_binding_unbind);
G_OBJECT_CLASS (cc_keyboard_shortcut_editor_parent_class)->finalize (object);
@@ -770,9 +768,7 @@ cc_keyboard_shortcut_editor_key_press_event (GtkWidget *widget,
{
self->edited = TRUE;
self->custom_is_modifier = FALSE;
- self->custom_keycode = 0;
- self->custom_keyval = 0;
- self->custom_mask = 0;
+ memset (self->custom_combo, 0, sizeof (CcKeyCombo));
gtk_shortcut_label_set_accelerator (GTK_SHORTCUT_LABEL (self->custom_shortcut_accel_label), "");
gtk_shortcut_label_set_accelerator (GTK_SHORTCUT_LABEL (self->shortcut_accel_label), "");
@@ -787,12 +783,12 @@ cc_keyboard_shortcut_editor_key_press_event (GtkWidget *widget,
}
self->custom_is_modifier = event->is_modifier;
- self->custom_keycode = event->hardware_keycode;
- self->custom_keyval = keyval_lower;
- self->custom_mask = real_mask;
+ self->custom_combo->keycode = event->hardware_keycode;
+ self->custom_combo->keyval = keyval_lower;
+ self->custom_combo->mask = real_mask;
/* CapsLock isn't supported as a keybinding modifier, so keep it from confusing us */
- self->custom_mask &= ~GDK_LOCK_MASK;
+ self->custom_combo->mask &= ~GDK_LOCK_MASK;
setup_custom_shortcut (self);
@@ -945,6 +941,7 @@ cc_keyboard_shortcut_editor_init (CcKeyboardShortcutEditor *self)
self->mode = CC_SHORTCUT_EDITOR_EDIT;
self->custom_is_modifier = TRUE;
+ self->custom_combo = g_new0 (CcKeyCombo, 1);
gtk_widget_set_direction (self->custom_shortcut_accel_label, GTK_TEXT_DIR_LTR);
gtk_widget_set_direction (self->shortcut_accel_label, GTK_TEXT_DIR_LTR);
diff --git a/panels/keyboard/keyboard-shortcuts.c b/panels/keyboard/keyboard-shortcuts.c
index 1c22f5a..bebc50a 100644
--- a/panels/keyboard/keyboard-shortcuts.c
+++ b/panels/keyboard/keyboard-shortcuts.c
@@ -266,12 +266,12 @@ keyval_is_forbidden (guint keyval)
}
gboolean
-is_valid_binding (guint keyval,
- GdkModifierType mask,
- guint keycode)
+is_valid_binding (CcKeyCombo *combo)
{
- if ((mask == 0 || mask == GDK_SHIFT_MASK) && keycode != 0)
+ if ((combo->mask == 0 || combo->mask == GDK_SHIFT_MASK) && combo->keycode != 0)
{
+ guint keyval = combo->keyval;
+
if ((keyval >= GDK_KEY_a && keyval <= GDK_KEY_z)
|| (keyval >= GDK_KEY_A && keyval <= GDK_KEY_Z)
|| (keyval >= GDK_KEY_0 && keyval <= GDK_KEY_9)
@@ -282,7 +282,7 @@ is_valid_binding (guint keyval,
|| (keyval >= GDK_KEY_hebrew_doublelowline && keyval <= GDK_KEY_hebrew_taf)
|| (keyval >= GDK_KEY_Thai_kokai && keyval <= GDK_KEY_Thai_lekkao)
|| (keyval >= GDK_KEY_Hangul_Kiyeog && keyval <= GDK_KEY_Hangul_J_YeorinHieuh)
- || (keyval == GDK_KEY_space && mask == 0)
+ || (keyval == GDK_KEY_space && combo->mask == 0)
|| keyval_is_forbidden (keyval)) {
return FALSE;
}
@@ -291,26 +291,23 @@ is_valid_binding (guint keyval,
}
gboolean
-is_empty_binding (guint keyval,
- GdkModifierType mask,
- guint keycode)
+is_empty_binding (CcKeyCombo *combo)
{
- if (keyval == 0 &&
- mask == 0 &&
- keycode == 0)
+ if (combo->keyval == 0 &&
+ combo->mask == 0 &&
+ combo->keycode == 0)
return TRUE;
return FALSE;
}
gboolean
-is_valid_accel (guint keyval,
- GdkModifierType mask)
+is_valid_accel (CcKeyCombo *combo)
{
/* Unlike gtk_accelerator_valid(), we want to allow Tab when combined
* with some modifiers (Alt+Tab and friends)
*/
- return gtk_accelerator_valid (keyval, mask) ||
- (keyval == GDK_KEY_Tab && mask != 0);
+ return gtk_accelerator_valid (combo->keyval, combo->mask) ||
+ (combo->keyval == GDK_KEY_Tab && combo->mask != 0);
}
gchar*
@@ -426,13 +423,11 @@ parse_keylist_from_file (const gchar *path)
* https://git.gnome.org/browse/gtk+/tree/gtk/gtkcellrendereraccel.c#n261
*/
gchar*
-convert_keysym_state_to_string (guint keysym,
- GdkModifierType mask,
- guint keycode)
+convert_keysym_state_to_string (CcKeyCombo *combo)
{
gchar *name;
- if (keysym == 0 && keycode == 0)
+ if (combo->keyval == 0 && combo->keycode == 0)
{
/* This label is displayed in a treeview cell displaying
* a disabled accelerator key combination.
@@ -441,10 +436,10 @@ convert_keysym_state_to_string (guint keysym,
}
else
{
- name = gtk_accelerator_get_label_with_keycode (NULL, keysym, keycode, mask);
+ name = gtk_accelerator_get_label_with_keycode (NULL, combo->keyval, combo->keycode, combo->mask);
if (name == NULL)
- name = gtk_accelerator_name_with_keycode (NULL, keysym, keycode, mask);
+ name = gtk_accelerator_name_with_keycode (NULL, combo->keyval, combo->keycode, combo->mask);
}
return name;
diff --git a/panels/keyboard/keyboard-shortcuts.h b/panels/keyboard/keyboard-shortcuts.h
index 6c98eee..2642782 100644
--- a/panels/keyboard/keyboard-shortcuts.h
+++ b/panels/keyboard/keyboard-shortcuts.h
@@ -85,19 +85,12 @@ void fill_xkb_options_shortcuts (GtkTreeModel *model);
void setup_keyboard_options (GtkListStore *store);
-gboolean is_valid_binding (guint keyval,
- GdkModifierType mask,
- guint keycode);
+gboolean is_valid_binding (CcKeyCombo *combo);
-gboolean is_empty_binding (guint keyval,
- GdkModifierType mask,
- guint keycode);
+gboolean is_empty_binding (CcKeyCombo *combo);
-gboolean is_valid_accel (guint keyval,
- GdkModifierType mask);
+gboolean is_valid_accel (CcKeyCombo *combo);
KeyList* parse_keylist_from_file (const gchar *path);
-gchar* convert_keysym_state_to_string (guint keysym,
- GdkModifierType mask,
- guint keycode);
+gchar* convert_keysym_state_to_string (CcKeyCombo *combo);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]