diff --git a/src/external/cocotron b/src/external/cocotron index 9bb1d9f34..66952e655 160000 --- a/src/external/cocotron +++ b/src/external/cocotron @@ -1 +1 @@ -Subproject commit 9bb1d9f34f6aef3d08778a577abb8865f2c4c4e2 +Subproject commit 66952e6552cb5eb9a870b5640d356314d38b3fd0 diff --git a/src/frameworks/Carbon/HIToolbox/TextInputSources.h b/src/frameworks/Carbon/HIToolbox/TextInputSources.h index f05fc0d76..41fc4e901 100644 --- a/src/frameworks/Carbon/HIToolbox/TextInputSources.h +++ b/src/frameworks/Carbon/HIToolbox/TextInputSources.h @@ -9,8 +9,11 @@ extern "C" { typedef struct __TISInputSource* TISInputSourceRef; extern const CFStringRef kTISPropertyUnicodeKeyLayoutData; +extern const CFStringRef kTISPropertyInputSourceLanguages; +extern const CFStringRef kTISPropertyLocalizedName; extern TISInputSourceRef TISCopyCurrentKeyboardLayoutInputSource(void); +extern TISInputSourceRef TISCopyCurrentKeyboardInputSource(void); extern void* TISGetInputSourceProperty(TISInputSourceRef inputSourceRef, CFStringRef key); diff --git a/src/frameworks/Carbon/HIToolbox/TextInputSources.mm b/src/frameworks/Carbon/HIToolbox/TextInputSources.mm index 314c749d5..cf05ba767 100644 --- a/src/frameworks/Carbon/HIToolbox/TextInputSources.mm +++ b/src/frameworks/Carbon/HIToolbox/TextInputSources.mm @@ -8,6 +8,14 @@ static os_unfair_lock g_keyboardLock = OS_UNFAIR_LOCK_INIT; static int g_lastKeyboardLayoutId = -1; static TISInputSourceRef g_lastKeyboardLayout = NULL; +const CFStringRef kTISPropertyInputSourceLanguages = CFSTR("TISPropertyInputSourceLanguages"); +const CFStringRef kTISPropertyLocalizedName = CFSTR("TISPropertyLocalizedName"); + +TISInputSourceRef TISCopyCurrentKeyboardInputSource(void) +{ + return TISCopyCurrentKeyboardLayoutInputSource(); +} + TISInputSourceRef TISCopyCurrentKeyboardLayoutInputSource(void) { NSDisplay* display = [NSClassFromString(@"NSDisplay") currentDisplay]; @@ -35,9 +43,12 @@ TISInputSourceRef TISCopyCurrentKeyboardLayoutInputSource(void) CFDataRef data = CFDataCreate(NULL, (UInt8*) layout, length); free(layout); - const void* keys[1] = { kTISPropertyUnicodeKeyLayoutData }; - const void* values[1] = { data }; - CFDictionaryRef dict = CFDictionaryCreate(NULL, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + NSString *name, *fullName; + [display keyboardLayoutName: &name fullName:&fullName]; + + const void* keys[] = { kTISPropertyUnicodeKeyLayoutData, kTISPropertyLocalizedName, kTISPropertyInputSourceLanguages }; + const void* values[] = { data, fullName, @[name] }; + CFDictionaryRef dict = CFDictionaryCreate(NULL, keys, values, 3, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFRelease(data); diff --git a/src/native/CMakeLists.txt b/src/native/CMakeLists.txt index e0e3cff48..f785b60e7 100644 --- a/src/native/CMakeLists.txt +++ b/src/native/CMakeLists.txt @@ -11,9 +11,10 @@ wrap_elf(X11 libX11.so) wrap_elf(Xext libXext.so) wrap_elf(XRandR libXrandr.so) wrap_elf(Xcursor libXcursor.so) +wrap_elf(xkbfile libxkbfile.so) wrap_elf(cairo libcairo.so) wrap_elf(EGL libEGL.so) wrap_elf(fontconfig libfontconfig.so) wrap_elf(dbus libdbus-1.so) wrap_elf(GL libGL.so "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries") -wrap_elf(GLU libGLU.so "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries") \ No newline at end of file +wrap_elf(GLU libGLU.so "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries")