[mutter/wayland] keybindings: Rename and move keysym_to_keycode
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] keybindings: Rename and move keysym_to_keycode
- Date: Mon, 7 Apr 2014 20:05:06 +0000 (UTC)
commit 1d08d751086c4b0a112f79c7543425809a9a736a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Apr 7 14:51:13 2014 -0400
keybindings: Rename and move keysym_to_keycode
This makes it more what it's actually doing.
src/core/keybindings.c | 37 +++++++++++++++++++++++--------------
1 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index a487a45..1dd04d5 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -342,6 +342,25 @@ get_keycodes_for_keysym (MetaDisplay *display,
return n_keycodes;
}
+static guint
+get_first_keycode_for_keysym (MetaDisplay *display,
+ guint keysym)
+{
+ int *keycodes;
+ int n_keycodes;
+ int keycode;
+
+ n_keycodes = get_keycodes_for_keysym (display, keysym, &keycodes);
+
+ if (n_keycodes > 0)
+ keycode = keycodes[0];
+ else
+ keycode = 0;
+
+ g_free (keycodes);
+ return keycode;
+}
+
static void
reload_iso_next_group_combos (MetaDisplay *display)
{
@@ -472,16 +491,6 @@ reload_iso_next_group_combos (MetaDisplay *display)
display->iso_next_group_combos = combos;
}
-static guint
-keysym_to_keycode (MetaDisplay *display,
- guint keysym)
-{
- if (keysym == META_KEY_ABOVE_TAB)
- return meta_display_get_above_tab_keycode (display);
- else
- return XKeysymToKeycode (display->xdisplay, keysym);
-}
-
static void
binding_reload_keycode_foreach (gpointer key,
gpointer value,
@@ -491,7 +500,7 @@ binding_reload_keycode_foreach (gpointer key,
MetaKeyBinding *binding = value;
if (binding->keysym)
- binding->keycode = keysym_to_keycode (display, binding->keysym);
+ binding->keycode = get_first_keycode_for_keysym (display, binding->keysym);
}
static void
@@ -503,7 +512,7 @@ reload_keycodes (MetaDisplay *display)
if (display->overlay_key_combo.keysym != 0)
{
display->overlay_key_combo.keycode =
- keysym_to_keycode (display, display->overlay_key_combo.keysym);
+ get_first_keycode_for_keysym (display, display->overlay_key_combo.keysym);
}
else
{
@@ -1304,7 +1313,7 @@ meta_display_grab_accelerator (MetaDisplay *display,
}
meta_display_devirtualize_modifiers (display, modifiers, &mask);
- keycode = keysym_to_keycode (display, keysym);
+ keycode = get_first_keycode_for_keysym (display, keysym);
if (keycode == 0)
return META_KEYBINDING_ACTION_NONE;
@@ -1356,7 +1365,7 @@ meta_display_ungrab_accelerator (MetaDisplay *display,
return FALSE;
meta_display_devirtualize_modifiers (display, grab->combo->modifiers, &mask);
- keycode = keysym_to_keycode (display, grab->combo->keysym);
+ keycode = get_first_keycode_for_keysym (display, grab->combo->keysym);
binding = display_get_keybinding (display, keycode, mask);
if (binding)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]