File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -106,9 +106,15 @@ void _GetKeyMap(const FunctionCallbackInfo<Value>& args) {
106
106
TISInputSourceRef source = TISCopyCurrentKeyboardInputSource ();
107
107
CFDataRef layout_data = static_cast <CFDataRef >((TISGetInputSourceProperty (source, kTISPropertyUnicodeKeyLayoutData )));
108
108
if (!layout_data) {
109
- // https://developer.apple.com/library/mac/documentation/TextFonts/Reference/TextInputSourcesReference/#//apple_ref/c/func/TISGetInputSourceProperty
110
- args.GetReturnValue ().Set (result);
111
- return ;
109
+ // TISGetInputSourceProperty returns null with Japanese keyboard layout.
110
+ // Using TISCopyCurrentKeyboardLayoutInputSource to fix NULL return.
111
+ source = TISCopyCurrentKeyboardLayoutInputSource ();
112
+ layout_data = static_cast <CFDataRef >((TISGetInputSourceProperty (source, kTISPropertyUnicodeKeyLayoutData )));
113
+ if (!layout_data) {
114
+ // https://developer.apple.com/library/mac/documentation/TextFonts/Reference/TextInputSourcesReference/#//apple_ref/c/func/TISGetInputSourceProperty
115
+ args.GetReturnValue ().Set (result);
116
+ return ;
117
+ }
112
118
}
113
119
114
120
const UCKeyboardLayout* keyboardLayout = reinterpret_cast <const UCKeyboardLayout*>(CFDataGetBytePtr (layout_data));
You can’t perform that action at this time.
0 commit comments