diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index 78f41d21..259d1d59 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -20,8 +20,8 @@ NSString* bundleShortVersion(NSBundle *bundle) } OSStatus emptySetSystemUIMode ( - SystemUIMode inMode, - SystemUIOptions inOptions) + SystemUIMode inMode, + SystemUIOptions inOptions) { Q_UNUSED(inMode); Q_UNUSED(inOptions); @@ -33,7 +33,7 @@ void *originalSetSystemUIMode = 0; void UBPlatformUtils::init() { - initializeKeyboardLayouts(); + initializeKeyboardLayouts(); // qwidget_mac.mm qt_mac_set_fullscreen_mode uses kUIModeAllSuppressed which is unfortunate in our case // @@ -252,7 +252,7 @@ void UBPlatformUtils::runInstaller(const QString &installerFilePath) bool success = process.startDetached(escaped); if(success) - return; + return; } // did not work .. lets load the dmg ... @@ -336,205 +336,206 @@ void UBPlatformUtils::setWindowNonActivableFlag(QWidget* widget, bool nonAcivabl } QPixmap qpixmapFromIconRef(IconRef iconRef, int size) { - OSErr result; - int iconSize; - OSType elementType; - - // Determine elementType and iconSize - if (size <= 16) { - elementType = kSmall32BitData; - iconSize = 16; - } else if (size <= 32) { - elementType = kLarge32BitData; - iconSize = 32; - } else { - elementType = kThumbnail32BitData; - iconSize = 128; - } - - // Get icon into an IconFamily - IconFamilyHandle hIconFamily = 0; - IconRefToIconFamily(iconRef, kSelectorAllAvailableData, &hIconFamily); - - // Extract data - Handle hRawBitmapData = NewHandle(iconSize * iconSize * 4); - result = GetIconFamilyData( hIconFamily, elementType, hRawBitmapData ); - if (result != noErr) { - DisposeHandle(hRawBitmapData); - return QPixmap(); - } - - // Convert data to QImage - QImage image(iconSize, iconSize, QImage::Format_ARGB32); - HLock(hRawBitmapData); - unsigned long* data = (unsigned long*) *hRawBitmapData; - for (int posy=0; posy> 8) & 0xff, kbdType, kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 100, &cnt2, unicodeString2); + UCKeyTranslate(keyLayout, vkk, kUCKeyActionDisplay, 0, kbdType, kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 100, &cnt1, unicodeString1); + UCKeyTranslate(keyLayout, vkk, kUCKeyActionDisplay, (shiftKey >> 8) & 0xff, kbdType, kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 100, &cnt2, unicodeString2); - return new KEYBT(unicodeString1[0], vkk, unicodeString2[0], vkk); + return new KEYBT(unicodeString1[0], vkk, unicodeString2[0], vkk); } void UBPlatformUtils::initializeKeyboardLayouts() { - CFStringRef keys[] = { kTISPropertyInputSourceCategory, kTISPropertyInputSourceIsEnableCapable, kTISPropertyInputSourceIsSelectCapable }; - const void* values[] = { kTISCategoryKeyboardInputSource, kCFBooleanTrue, kCFBooleanTrue }; - CFDictionaryRef dict = CFDictionaryCreate(NULL, (const void **)keys, (const void **)values, 3, NULL, NULL); - CFArrayRef kbds = TISCreateInputSourceList(dict, false); - - int count = CFArrayGetCount(kbds); - QList result; - - for(int i=0; i0) - { - CFStringRef langRef = (CFStringRef)CFArrayGetValueAtIndex(langs, 0); - name = QStringFromStringRef(langRef); - qDebug() << "name is " + name; - - } - - //IconRef iconRef = (IconRef)TISGetInputSourceProperty(kTISPropertyIconRef, kTISPropertyInputSourceLanguages); - - const QString resName = ":/images/flags/" + name + ".png"; - QIcon *iconLang = new QIcon(resName); - - result.append(new UBKeyboardLocale(fullName, name, ID, iconLang, keybt)); - } - - if (result.size()==0) - { - nKeyboardLayouts = 0; - keyboardLayouts = NULL; - } - else - { - nKeyboardLayouts = result.size(); - keyboardLayouts = new UBKeyboardLocale*[nKeyboardLayouts]; - for(int i=0; i result; + for(int i=0; i0) + { + CFStringRef langRef = (CFStringRef)CFArrayGetValueAtIndex(langs, 0); + name = QStringFromStringRef(langRef); + qDebug() << "name is " + name; + + } + + //IconRef iconRef = (IconRef)TISGetInputSourceProperty(kTISPropertyIconRef, kTISPropertyInputSourceLanguages); + + const QString resName = ":/images/flags/" + name + ".png"; + QIcon *iconLang = new QIcon(resName); + + result.append(new UBKeyboardLocale(fullName, name, ID, iconLang, keybt)); + } + + if (result.size()==0) + { + nKeyboardLayouts = 0; + keyboardLayouts = NULL; + } + else + { + nKeyboardLayouts = result.size(); + keyboardLayouts = new UBKeyboardLocale*[nKeyboardLayouts]; + for(int i=0; i