forked from AuroraMiddleware/gtk
quartz: fix crashes that sometimes happened on the first key press
because nobody has called gdk_keymap_get_for_display() before. Now we simply make sure the default display's keymap exists if somebody calls any gdk_keymap_*() function with a NULL keymap (which is an allowed value).
This commit is contained in:
parent
561d1c6358
commit
bbcde7e380
@ -537,6 +537,9 @@ gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
|
||||
g_return_val_if_fail (n_keys != NULL, FALSE);
|
||||
g_return_val_if_fail (keyval != 0, FALSE);
|
||||
|
||||
if (!keymap)
|
||||
keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
|
||||
|
||||
*n_keys = 0;
|
||||
keys_array = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
|
||||
|
||||
@ -575,6 +578,9 @@ gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
|
||||
g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
|
||||
g_return_val_if_fail (n_entries != NULL, FALSE);
|
||||
|
||||
if (!keymap)
|
||||
keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
|
||||
|
||||
*n_entries = 0;
|
||||
|
||||
if (hardware_keycode > NUM_KEYCODES)
|
||||
@ -631,6 +637,9 @@ gdk_keymap_lookup_key (GdkKeymap *keymap,
|
||||
g_return_val_if_fail (key != NULL, 0);
|
||||
g_return_val_if_fail (key->group < 4, 0);
|
||||
|
||||
if (!keymap)
|
||||
keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
|
||||
|
||||
/* FIXME: Implement */
|
||||
|
||||
return 0;
|
||||
@ -691,7 +700,10 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
|
||||
g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
|
||||
g_return_val_if_fail (group >= 0 && group <= 1, FALSE);
|
||||
|
||||
|
||||
if (!keymap)
|
||||
keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
|
||||
|
||||
if (keyval)
|
||||
*keyval = 0;
|
||||
if (effective_group)
|
||||
|
Loading…
Reference in New Issue
Block a user