From e1014a013840bfeb14b5ddc2ec29ebb7cc677885 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Tue, 17 Nov 2015 12:07:52 +0100 Subject: [PATCH] re-enabled keyboard switching on Mac OS // functionality is still spotty.. --- src/frameworks/UBPlatformUtils_mac.mm | 5 ++++- src/gui/UBKeyboardPalette_mac.mm | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index 70619205..d4685fe5 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -537,11 +537,14 @@ void UBPlatformUtils::SetMacLocaleByIdentifier(const QString& id) const char * strName = id.toLatin1().data(); - CFStringRef iName = CFStringCreateWithCString(NULL, strName, kCFStringEncodingMacRoman ); + CFStringRef iName = CFStringCreateWithCString(NULL, strName, kCFStringEncodingISOLatin1 ); + CFStringRef keys[] = { kTISPropertyInputSourceCategory, kTISPropertyInputSourceID }; CFStringRef values[] = { kTISCategoryKeyboardInputSource, iName }; CFDictionaryRef dict = CFDictionaryCreate(NULL, (const void **)keys, (const void **)values, 2, NULL, NULL); + + // get list of current enabled keyboard layouts. dict filters the list CFArrayRef kbds = TISCreateInputSourceList(dict, true); if (kbds!=NULL) { diff --git a/src/gui/UBKeyboardPalette_mac.mm b/src/gui/UBKeyboardPalette_mac.mm index 8fa984fd..f5d12959 100644 --- a/src/gui/UBKeyboardPalette_mac.mm +++ b/src/gui/UBKeyboardPalette_mac.mm @@ -32,6 +32,7 @@ #include #import +#import #include #include @@ -75,8 +76,7 @@ void UBKeyboardPalette::createCtrlButtons() void UBKeyboardPalette::checkLayout() { - /* - * REMOVED FOR NOW -- check if is still needed in 10.9/10.10 + TISInputSourceRef selectedLocale = TISCopyCurrentKeyboardInputSource(); CFStringRef sr = (CFStringRef) TISGetInputSourceProperty(selectedLocale, @@ -99,7 +99,7 @@ void UBKeyboardPalette::checkLayout() } } } - */ + } void UBKeyboardPalette::onActivated(bool)