Fixed logic error that prevent JIS (Japanese) keyboard layouts from

being detected.
This commit is contained in:
Ben Byer 2007-11-05 20:01:34 -08:00
parent 154fb6417e
commit 67e96be13c

View File

@ -222,36 +222,27 @@ DarwinModeReadSystemKeymap (darwinKeyboardInfo *info)
KeySym *k; KeySym *k;
TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource(); TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource();
if (currentKeyLayoutRef) keyboard_type = LMGetKbdType ();
{ if (currentKeyLayoutRef) {
CFDataRef currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData); CFDataRef currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData);
if (currentKeyLayoutDataRef) if (currentKeyLayoutDataRef) chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef); }
}
if(chr_data == NULL) { if (chr_data == NULL) {
KLGetCurrentKeyboardLayout (&key_layout); KLGetCurrentKeyboardLayout (&key_layout);
KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data); KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data);
}
if (chr_data != NULL) if (chr_data == NULL) {
{ KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
is_uchr = 1; is_uchr = 0;
keyboard_type = LMGetKbdType (); num_keycodes = 128;
} }
else
{
KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
if (chr_data == NULL) if (chr_data == NULL) {
{ ErrorF ( "Couldn't get uchr or kchr resource\n");
ErrorF ( "Couldn't get uchr or kchr resource\n"); return FALSE;
return FALSE; }
}
is_uchr = 0;
num_keycodes = 128;
}
}
/* Scan the keycode range for the Unicode character that each /* Scan the keycode range for the Unicode character that each
key produces in the four shift states. Then convert that to key produces in the four shift states. Then convert that to