Ticket #62964: patch-qcocoa-build-on-109.diff

File patch-qcocoa-build-on-109.diff, 6.4 KB (added by Wowfunhappy (Jonathan), 3 years ago)
  • src/plugins/platforms/cocoa/qcocoamenu.mm

    diff --git src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/cocoa/qcocoamenu.mm
    index 981d900..77eca5a 100644
    void QCocoaMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem * 
    331331
    332332    // Empty menus on a menubar are hidden by default. If the menu gets
    333333    // added to the menubar before it contains any item, we need to sync.
    334     if (isVisible() && attachedItem().hidden) {
     334    if (isVisible() && [m_attachedItem isHidden]) {
    335335        if (auto *mb = qobject_cast<QCocoaMenuBar *>(menuParent()))
    336336            mb->syncMenu(this);
    337337    }
  • src/plugins/platforms/cocoa/qcocoanativeinterface.mm

    diff --git src/plugins/platforms/cocoa/qcocoanativeinterface.mm src/plugins/platforms/cocoa/qcocoanativeinterface.mm
    index ee762f6..de47af3 100644
    void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine 
    172172
    173173QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard()
    174174{
     175    QCFType<CFURLRef> url109;
     176    CFURLRef url = nullptr;
    175177    const int ExpectedImageWidth = 242;
    176178    const int ExpectedImageHeight = 414;
    177     QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier(
    178         CFSTR("com.apple.KeyboardSetupAssistant"), nullptr);
    179     if (urls && CFArrayGetCount(urls) > 0) {
    180         CFURLRef url = (CFURLRef)CFArrayGetValueAtIndex(urls, 0);
     179    bool ok = false;
     180    if (QSysInfo::macVersion() < QSysInfo::MV_10_10) {
     181        if (LSFindApplicationForInfo(kLSUnknownCreator, CFSTR("com.apple.KeyboardSetupAssistant"),
     182                                     0, 0, &url109) == noErr) {
     183            url = url109;
     184            ok = true;
     185        }
     186    } else {
     187#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10)
     188        QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier(
     189            CFSTR("com.apple.KeyboardSetupAssistant"), nullptr);
     190        if (urls && CFArrayGetCount(urls) > 0) {
     191            url = (CFURLRef)CFArrayGetValueAtIndex(urls, 0);
     192            ok = true;
     193        }
     194#endif
     195    }
     196    if (ok) {
    181197        QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url);
    182198        if (bundle) {
    183199            url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("png"), 0);
  • src/plugins/platforms/cocoa/qcocoawindow.mm

    diff --git src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qcocoawindow.mm
    index 7f94e31..7516826 100644
     
    6060
    6161#include <vector>
    6262
     63#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10)
     64#   define NSWINPROPERTY(w,property,selector) (w).property
     65#else
     66#   define NSWINPROPERTY(w,property,selector) [(w) selector]
     67#endif
     68
     69#ifndef __has_builtin
     70#   define __has_builtin(x) false
     71#endif
     72
    6373enum {
    6474    defaultWindowWidth = 160,
    6575    defaultWindowHeight = 160
    static void qt_closePopups() 
    320326+ (void)applicationActivationChanged:(NSNotification*)notification
    321327{
    322328    const id sender = self;
     329#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_11)
     330    // ObjC generics were introduced with Xcode 7 (= OS X 10.10) but only allow the compiler
     331    // to generate errors when storing a deviant type. The 10.10SDK on 10.9 doesn't yet
     332    // know about them, so we only support them from 10.11 onwards.
    323333    NSEnumerator<NSWindow*> *windowEnumerator = nullptr;
     334#else
     335    NSEnumerator *windowEnumerator = nullptr;
     336#endif
    324337    NSApplication *application = [NSApplication sharedApplication];
    325338
    326339#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12)
    void QCocoaWindow::show(bool becauseOfAncestor) 
    779792    if ([m_nsWindow isVisible])
    780793        return;
    781794
    782     if (m_view.window.parentWindow && !m_view.window.parentWindow.visible) {
     795    if (m_view.window.parentWindow && !NSWINPROPERTY(m_view.window.parentWindow,visible,isVisible)) {
    783796        m_hiddenByAncestor = true; // Parent still hidden, don't show now
    784797    } else if ((becauseOfAncestor == m_hiddenByAncestor) // Was NEITHER explicitly hidden
    785798               && !m_hiddenByClipping) { // ... NOR clipped
    Qt::WindowState QCocoaWindow::windowState() const 
    20952108    // FIXME: Support compound states (Qt::WindowStates)
    20962109
    20972110    NSWindow *window = m_view.window;
    2098     if (window.miniaturized)
     2111    if (NSWINPROPERTY(window, miniaturized, isMiniaturized))
    20992112        return Qt::WindowMinimized;
    21002113    if (window.qt_fullScreen)
    21012114        return Qt::WindowFullScreen;
    2102     if ((window.zoomed && !isTransitioningToFullScreen())
     2115    if ((NSWINPROPERTY(window, zoomed, isZoomed) && !isTransitioningToFullScreen())
    21032116        || (m_lastReportedWindowState == Qt::WindowMaximized && isTransitioningToFullScreen()))
    21042117        return Qt::WindowMaximized;
    21052118
    void QCocoaWindow::applyContentBorderThickness(NSWindow *window) 
    22292242
    22302243    QMacAutoReleasePool pool;
    22312244
     2245#if !__has_builtin(__builtin_available)  // #if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
     2246    bool hasTitlebarAppearsTransparent = [window respondsToSelector:@selector(setTitlebarAppearsTransparent:)];
     2247#endif
     2248
    22322249    if (!m_drawContentBorderGradient) {
    22332250        [window setStyleMask:[window styleMask] & ~NSTexturedBackgroundWindowMask];
    22342251        [[[window contentView] superview] setNeedsDisplay:YES];
    2235         window.titlebarAppearsTransparent = NO;
     2252#if __has_builtin(__builtin_available)  // #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
     2253        if (__builtin_available(macOS 10.10, *)) {
     2254            window.titlebarAppearsTransparent = NO;
     2255        }
     2256#else
     2257        if (hasTitlebarAppearsTransparent) {
     2258            [window setTitlebarAppearsTransparent:NO];
     2259        }
     2260#endif
    22362261        return;
    22372262    }
    22382263
    void QCocoaWindow::applyContentBorderThickness(NSWindow *window) 
    22572282    int effectiveBottomContentBorderThickness = m_bottomContentBorderThickness;
    22582283
    22592284    [window setStyleMask:[window styleMask] | NSTexturedBackgroundWindowMask];
    2260     window.titlebarAppearsTransparent = YES;
     2285#if __has_builtin(__builtin_available)  // #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
     2286    if (__builtin_available(macOS 10.10, *)) {
     2287        window.titlebarAppearsTransparent = YES;
     2288    }
     2289#else
     2290    if (hasTitlebarAppearsTransparent) {
     2291        [window setTitlebarAppearsTransparent:YES];
     2292    }
     2293#endif
    22612294
    22622295    [window setContentBorderThickness:effectiveTopContentBorderThickness forEdge:NSMaxYEdge];
    22632296    [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];