Commit 83e2e23f authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Don't corrupt odd keymaps (#316638, Kean Johnston)

2005-11-10  Matthias Clasen  <mclasen@redhat.com>

	Don't corrupt odd keymaps (#316638, Kean Johnston)

	* gdk/x11/gdkkeys-x11.c (set_symbol): Auxiliary function to
	handle frobbing keymaps with odd numbers of syms/code.

	* gdk/x11/gdkkeys-x11.c (update_keymaps): Use set_symbol() to
	frob the keymap.
parent 938d34c0
2005-11-10 Matthias Clasen <mclasen@redhat.com> 2005-11-10 Matthias Clasen <mclasen@redhat.com>
Don't corrupt odd keymaps (#316638, Kean Johnston)
* gdk/x11/gdkkeys-x11.c (set_symbol): Auxiliary function to
handle frobbing keymaps with odd numbers of syms/code.
* gdk/x11/gdkkeys-x11.c (update_keymaps): Use set_symbol() to
frob the keymap.
Improve navigation to parent folders. (#318444, Andrei Yurkevich) Improve navigation to parent folders. (#318444, Andrei Yurkevich)
* gtk/gtkpathbar.[hc]: Add a child_path argument to * gtk/gtkpathbar.[hc]: Add a child_path argument to
......
2005-11-10 Matthias Clasen <mclasen@redhat.com> 2005-11-10 Matthias Clasen <mclasen@redhat.com>
Don't corrupt odd keymaps (#316638, Kean Johnston)
* gdk/x11/gdkkeys-x11.c (set_symbol): Auxiliary function to
handle frobbing keymaps with odd numbers of syms/code.
* gdk/x11/gdkkeys-x11.c (update_keymaps): Use set_symbol() to
frob the keymap.
Improve navigation to parent folders. (#318444, Andrei Yurkevich) Improve navigation to parent folders. (#318444, Andrei Yurkevich)
* gtk/gtkpathbar.[hc]: Add a child_path argument to * gtk/gtkpathbar.[hc]: Add a child_path argument to
......
...@@ -323,12 +323,28 @@ get_symbol (const KeySym *syms, ...@@ -323,12 +323,28 @@ get_symbol (const KeySym *syms,
gint index; gint index;
index = KEYSYM_INDEX(keymap_x11, group, level); index = KEYSYM_INDEX(keymap_x11, group, level);
if (index > keymap_x11->keysyms_per_keycode) if (index >= keymap_x11->keysyms_per_keycode)
return NoSymbol; return NoSymbol;
return syms[index]; return syms[index];
} }
static void
set_symbol (KeySym *syms,
GdkKeymapX11 *keymap_x11,
gint group,
gint level,
KeySym sym)
{
gint index;
index = KEYSYM_INDEX(keymap_x11, group, level);
if (index >= keymap_x11->keysyms_per_keycode)
return;
syms[index] = sym;
}
static void static void
update_keymaps (GdkKeymapX11 *keymap_x11) update_keymaps (GdkKeymapX11 *keymap_x11)
{ {
...@@ -374,7 +390,7 @@ update_keymaps (GdkKeymapX11 *keymap_x11) ...@@ -374,7 +390,7 @@ update_keymaps (GdkKeymapX11 *keymap_x11)
for (i = 0 ; i < 2 ; i++) for (i = 0 ; i < 2 ; i++)
{ {
if (get_symbol (syms, keymap_x11, i, 0) == GDK_Tab) if (get_symbol (syms, keymap_x11, i, 0) == GDK_Tab)
syms[KEYSYM_INDEX (keymap_x11, i, 1)] = GDK_ISO_Left_Tab; set_symbol (syms, keymap_x11, i, 1, GDK_ISO_Left_Tab);
} }
/* /*
...@@ -389,8 +405,8 @@ update_keymaps (GdkKeymapX11 *keymap_x11) ...@@ -389,8 +405,8 @@ update_keymaps (GdkKeymapX11 *keymap_x11)
gdk_keyval_convert_case (get_symbol (syms, keymap_x11, 0, 0), &lower, &upper); gdk_keyval_convert_case (get_symbol (syms, keymap_x11, 0, 0), &lower, &upper);
if (lower != upper) if (lower != upper)
{ {
syms[KEYSYM_INDEX (keymap_x11, 0, 0)] = lower; set_symbol (syms, keymap_x11, 0, 0, lower);
syms[KEYSYM_INDEX (keymap_x11, 0, 1)] = upper; set_symbol (syms, keymap_x11, 0, 1, upper);
} }
} }
...@@ -1201,7 +1217,7 @@ MyEnhancedXkbTranslateKeyCode(register XkbDescPtr xkb, ...@@ -1201,7 +1217,7 @@ MyEnhancedXkbTranslateKeyCode(register XkbDescPtr xkb,
/* ---- End stuff GDK adds to the original Xlib version ---- */ /* ---- End stuff GDK adds to the original Xlib version ---- */
return (syms[col]!=NoSymbol); return (syms[col] != NoSymbol);
} }
#endif /* HAVE_XKB */ #endif /* HAVE_XKB */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment