quartz: update the keymap only if the input method changed
and not on each keystroke, which for some IMs apparently caused a full update on each keystroke, not just a check for changes. Patch from Takuro Ashie, bug #698183.
This commit is contained in:
committed by
Michael Natterer
parent
38d78f48b5
commit
bbe3554fa9
@ -267,7 +267,7 @@ const static struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
maybe_update_keymap (void)
|
update_keymap (void)
|
||||||
{
|
{
|
||||||
const void *chr_data = NULL;
|
const void *chr_data = NULL;
|
||||||
|
|
||||||
@ -542,8 +542,6 @@ gdk_quartz_keymap_get_entries_for_keyval (GdkKeymap *keymap,
|
|||||||
GArray *keys_array;
|
GArray *keys_array;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
maybe_update_keymap ();
|
|
||||||
|
|
||||||
*n_keys = 0;
|
*n_keys = 0;
|
||||||
keys_array = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
|
keys_array = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
|
||||||
|
|
||||||
@ -579,8 +577,6 @@ gdk_quartz_keymap_get_entries_for_keycode (GdkKeymap *keymap,
|
|||||||
int i;
|
int i;
|
||||||
guint *p;
|
guint *p;
|
||||||
|
|
||||||
maybe_update_keymap ();
|
|
||||||
|
|
||||||
*n_entries = 0;
|
*n_entries = 0;
|
||||||
|
|
||||||
if (hardware_keycode > NUM_KEYCODES)
|
if (hardware_keycode > NUM_KEYCODES)
|
||||||
@ -689,8 +685,6 @@ gdk_quartz_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
|||||||
GdkModifierType bit;
|
GdkModifierType bit;
|
||||||
guint tmp_modifiers = 0;
|
guint tmp_modifiers = 0;
|
||||||
|
|
||||||
maybe_update_keymap ();
|
|
||||||
|
|
||||||
if (keyval)
|
if (keyval)
|
||||||
*keyval = 0;
|
*keyval = 0;
|
||||||
if (effective_group)
|
if (effective_group)
|
||||||
@ -835,14 +829,36 @@ _gdk_quartz_keys_is_modifier (guint keycode)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
input_sources_changed_notification (CFNotificationCenterRef center,
|
||||||
|
void *observer,
|
||||||
|
CFStringRef name,
|
||||||
|
const void *object,
|
||||||
|
CFDictionaryRef userInfo)
|
||||||
|
{
|
||||||
|
update_keymap ();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_quartz_keymap_init (GdkQuartzKeymap *keymap)
|
gdk_quartz_keymap_init (GdkQuartzKeymap *keymap)
|
||||||
{
|
{
|
||||||
|
update_keymap ();
|
||||||
|
CFNotificationCenterAddObserver (CFNotificationCenterGetDistributedCenter (),
|
||||||
|
keymap,
|
||||||
|
input_sources_changed_notification,
|
||||||
|
CFSTR ("AppleSelectedInputSourcesChangedNotification"),
|
||||||
|
NULL,
|
||||||
|
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_quartz_keymap_finalize (GObject *object)
|
gdk_quartz_keymap_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
|
CFNotificationCenterRemoveObserver (CFNotificationCenterGetDistributedCenter (),
|
||||||
|
object,
|
||||||
|
CFSTR ("AppleSelectedInputSourcesChangedNotification"),
|
||||||
|
NULL);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gdk_quartz_keymap_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gdk_quartz_keymap_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user