Browse Source

cocoa: fix crash when typing with RIME as input method

Fixes #620
rdb 6 years ago
parent
commit
5530074945
1 changed files with 2 additions and 2 deletions
  1. 2 2
      panda/src/cocoadisplay/cocoaGraphicsWindow.mm

+ 2 - 2
panda/src/cocoadisplay/cocoaGraphicsWindow.mm

@@ -1618,7 +1618,7 @@ handle_key_event(NSEvent *event) {
   if ([event type] == NSKeyDown) {
   if ([event type] == NSKeyDown) {
     // Translate it to a unicode character for keystrokes.  I would use
     // Translate it to a unicode character for keystrokes.  I would use
     // interpretKeyEvents and insertText, but that doesn't handle dead keys.
     // interpretKeyEvents and insertText, but that doesn't handle dead keys.
-    TISInputSourceRef input_source = TISCopyCurrentKeyboardInputSource();
+    TISInputSourceRef input_source = TISCopyCurrentKeyboardLayoutInputSource();
     CFDataRef layout_data = (CFDataRef)TISGetInputSourceProperty(input_source, kTISPropertyUnicodeKeyLayoutData);
     CFDataRef layout_data = (CFDataRef)TISGetInputSourceProperty(input_source, kTISPropertyUnicodeKeyLayoutData);
     const UCKeyboardLayout *layout = (const UCKeyboardLayout *)CFDataGetBytePtr(layout_data);
     const UCKeyboardLayout *layout = (const UCKeyboardLayout *)CFDataGetBytePtr(layout_data);
 
 
@@ -1827,7 +1827,7 @@ get_keyboard_map() const {
   const UCKeyboardLayout *layout;
   const UCKeyboardLayout *layout;
 
 
   // Get the current keyboard layout data.
   // Get the current keyboard layout data.
-  input_source = TISCopyCurrentKeyboardInputSource();
+  input_source = TISCopyCurrentKeyboardLayoutInputSource();
   layout_data = (CFDataRef) TISGetInputSourceProperty(input_source, kTISPropertyUnicodeKeyLayoutData);
   layout_data = (CFDataRef) TISGetInputSourceProperty(input_source, kTISPropertyUnicodeKeyLayoutData);
   layout = (const UCKeyboardLayout *)CFDataGetBytePtr(layout_data);
   layout = (const UCKeyboardLayout *)CFDataGetBytePtr(layout_data);