diff options
Diffstat (limited to 'src/plugins')
7 files changed, 53 insertions, 50 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 7cf9365513..341d3bccf2 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -61,14 +61,14 @@ extern "C" { // Otherwise it won't find CWKeychain* symbols at link time #include <net/if.h> #include <ifaddrs.h> -@interface QT_MANGLE_NAMESPACE(QNSListener) : NSObject +@interface QT_MANGLE_NAMESPACE(QNSListener) : NSObject <CWEventDelegate> { NSNotificationCenter *notificationCenter; - CWInterface *currentInterface; + CWWiFiClient *client; QCoreWlanEngine *engine; NSLock *locker; } -- (void)notificationHandler:(NSNotification *)notification; +- (void)powerStateDidChangeForWiFiInterfaceWithName:(NSString *)interfaceName; - (void)remove; - (void)setEngine:(QCoreWlanEngine *)coreEngine; - (QCoreWlanEngine *)engine; @@ -85,8 +85,9 @@ extern "C" { // Otherwise it won't find CWKeychain* symbols at link time [locker lock]; QMacAutoReleasePool pool; notificationCenter = [NSNotificationCenter defaultCenter]; - currentInterface = [CWInterface interface]; - [notificationCenter addObserver:self selector:@selector(notificationHandler:) name:CWPowerDidChangeNotification object:nil]; + client = [CWWiFiClient sharedWiFiClient]; + client.delegate = self; + [client startMonitoringEventWithType:CWEventTypePowerDidChange error:nil]; [locker unlock]; return self; } @@ -95,6 +96,7 @@ static QT_MANGLE_NAMESPACE(QNSListener) *listener = 0; -(void)dealloc { + client.delegate = nil; listener = nil; [super dealloc]; } @@ -115,13 +117,13 @@ static QT_MANGLE_NAMESPACE(QNSListener) *listener = 0; -(void)remove { [locker lock]; - [notificationCenter removeObserver:self]; + [client stopMonitoringAllEventsAndReturnError:nil]; [locker unlock]; } -- (void)notificationHandler:(NSNotification *)notification +- (void)powerStateDidChangeForWiFiInterfaceWithName:(NSString *)interfaceName { - Q_UNUSED(notification); + Q_UNUSED(interfaceName); engine->requestUpdate(); } @end @@ -162,7 +164,8 @@ void QScanThread::run() QMacAutoReleasePool pool; QStringList found; mutex.lock(); - CWInterface *currentInterface = [CWInterface interfaceWithName:interfaceName.toNSString()]; + CWInterface *currentInterface = [[CWWiFiClient sharedWiFiClient] + interfaceWithName:interfaceName.toNSString()]; mutex.unlock(); const bool currentInterfaceServiceActive = currentInterface.serviceActive; @@ -284,10 +287,10 @@ void QScanThread::getUserConfigurations() QMacAutoReleasePool pool; userProfiles.clear(); - NSSet *wifiInterfaces = [CWInterface interfaceNames]; + NSArray<NSString *> *wifiInterfaces = [CWWiFiClient interfaceNames]; for (NSString *ifName in wifiInterfaces) { - CWInterface *wifiInterface = [CWInterface interfaceWithName:ifName]; + CWInterface *wifiInterface = [[CWWiFiClient sharedWiFiClient] interfaceWithName:ifName]; NSString *nsInterfaceName = wifiInterface.ssid; // add user configured system networks @@ -442,7 +445,7 @@ void QCoreWlanEngine::initialize() QMutexLocker locker(&mutex); QMacAutoReleasePool pool; - if ([[CWInterface interfaceNames] count] > 0 && !listener) { + if ([[CWWiFiClient interfaceNames] count] > 0 && !listener) { listener = [[QT_MANGLE_NAMESPACE(QNSListener) alloc] init]; listener.engine = this; hasWifi = true; @@ -476,7 +479,7 @@ void QCoreWlanEngine::connectToId(const QString &id) QString interfaceString = getInterfaceFromId(id); CWInterface *wifiInterface = - [CWInterface interfaceWithName:interfaceString.toNSString()]; + [[CWWiFiClient sharedWiFiClient] interfaceWithName:interfaceString.toNSString()]; if (wifiInterface.powerOn) { NSError *err = nil; @@ -559,7 +562,7 @@ void QCoreWlanEngine::disconnectFromId(const QString &id) QMacAutoReleasePool pool; CWInterface *wifiInterface = - [CWInterface interfaceWithName:interfaceString.toNSString()]; + [[CWWiFiClient sharedWiFiClient] interfaceWithName:interfaceString.toNSString()]; disconnectedInterfaceString = interfaceString; [wifiInterface disassociate]; @@ -573,8 +576,8 @@ void QCoreWlanEngine::checkDisconnect() if (!disconnectedInterfaceString.isEmpty()) { QMacAutoReleasePool pool; - CWInterface *wifiInterface = - [CWInterface interfaceWithName:disconnectedInterfaceString.toNSString()]; + CWInterface *wifiInterface = [[CWWiFiClient sharedWiFiClient] + interfaceWithName:disconnectedInterfaceString.toNSString()]; const QString networkSsid = QString::fromNSString([wifiInterface ssid]); if (!networkSsid.isEmpty()) { @@ -599,7 +602,7 @@ void QCoreWlanEngine::doRequestUpdate() QMacAutoReleasePool pool; - NSSet *wifiInterfaces = [CWInterface interfaceNames]; + NSArray<NSString *> *wifiInterfaces = [CWWiFiClient interfaceNames]; for (NSString *ifName in wifiInterfaces) { scanThread->interfaceName = QString::fromNSString(ifName); scanThread->start(); @@ -615,7 +618,8 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName) bool haswifi = false; if(hasWifi) { QMacAutoReleasePool pool; - CWInterface *defaultInterface = [CWInterface interfaceWithName:wifiDeviceName.toNSString()]; + CWInterface *defaultInterface = [[CWWiFiClient sharedWiFiClient] + interfaceWithName:wifiDeviceName.toNSString()]; if (defaultInterface.powerOn) { haswifi = true; } diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index e53c085e41..a8974c4de5 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -80,7 +80,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); mHelper = 0; mStolenContentView = 0; mPanelButtons = nil; - mResultCode = NSCancelButton; + mResultCode = NSModalResponseCancel; mDialogIsExecuting = false; mResultSet = false; mClosingDueToKnownButton = false; @@ -168,7 +168,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); mClosingDueToKnownButton = true; [mColorPanel close]; [self updateQtColor]; - [self finishOffWithCode:NSOKButton]; + [self finishOffWithCode:NSModalResponseOK]; } - (void)onCancelClicked @@ -177,7 +177,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); mClosingDueToKnownButton = true; [mColorPanel close]; mQtColor = QColor(); - [self finishOffWithCode:NSCancelButton]; + [self finishOffWithCode:NSModalResponseCancel]; } } @@ -238,12 +238,12 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); [NSApp runModalForWindow:mColorPanel]; mDialogIsExecuting = false; - return (mResultCode == NSOKButton); + return (mResultCode == NSModalResponseOK); } - (QPlatformDialogHelper::DialogCode)dialogResultCode { - return (mResultCode == NSOKButton) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; + return (mResultCode == NSModalResponseOK) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; } - (BOOL)windowShouldClose:(id)window @@ -252,7 +252,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); if (!mPanelButtons) [self updateQtColor]; if (mDialogIsExecuting) { - [self finishOffWithCode:NSCancelButton]; + [self finishOffWithCode:NSModalResponseCancel]; } else { mResultSet = true; if (mHelper) @@ -278,7 +278,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); // This check will prevent any such recursion. if (!mResultSet) { mResultSet = true; - if (mResultCode == NSCancelButton) { + if (mResultCode == NSModalResponseCancel) { emit mHelper->reject(); } else { emit mHelper->accept(); diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 72c7856c2d..d2f985ec87 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -401,7 +401,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) // [NSApp run], which is the normal code path for cocoa applications. if (NSModalSession session = d->currentModalSession()) { QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); - while ([NSApp runModalSession:session] == NSRunContinuesResponse && !d->interrupt) + while ([NSApp runModalSession:session] == NSModalResponseContinue && !d->interrupt) qt_mac_waitForMoreEvents(NSModalPanelRunLoopMode); if (!d->interrupt && session == d->currentModalSessionCached) { @@ -435,7 +435,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) if (flags & QEventLoop::WaitForMoreEvents) qt_mac_waitForMoreEvents(NSModalPanelRunLoopMode); NSInteger status = [NSApp runModalSession:session]; - if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) { + if (status != NSModalResponseContinue && session == d->currentModalSessionCached) { // INVARIANT: Someone called [NSApp stopModal:] from outside the event // dispatcher (e.g to stop a native dialog). But that call wrongly stopped // 'session' as well. As a result, we need to restart all internal sessions: diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index 33dd4260a5..e4b796dcde 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -106,7 +106,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); mHelper = 0; mStolenContentView = 0; mPanelButtons = 0; - mResultCode = NSCancelButton; + mResultCode = NSModalResponseCancel; mDialogIsExecuting = false; mResultSet = false; @@ -171,7 +171,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); - (void)onOkClicked { [mFontPanel close]; - [self finishOffWithCode:NSOKButton]; + [self finishOffWithCode:NSModalResponseOK]; } - (void)onCancelClicked @@ -179,7 +179,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); if (mPanelButtons) { [mFontPanel close]; mQtFont = QFont(); - [self finishOffWithCode:NSCancelButton]; + [self finishOffWithCode:NSModalResponseCancel]; } } @@ -224,12 +224,12 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); [NSApp runModalForWindow:mFontPanel]; mDialogIsExecuting = false; - return (mResultCode == NSOKButton); + return (mResultCode == NSModalResponseOK); } - (QPlatformDialogHelper::DialogCode)dialogResultCode { - return (mResultCode == NSOKButton) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; + return (mResultCode == NSModalResponseOK) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; } - (BOOL)windowShouldClose:(id)window @@ -238,7 +238,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); if (!mPanelButtons) [self updateQtFont]; if (mDialogIsExecuting) { - [self finishOffWithCode:NSCancelButton]; + [self finishOffWithCode:NSModalResponseCancel]; } else { mResultSet = true; if (mHelper) @@ -264,7 +264,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); // This check will prevent any such recursion. if (!mResultSet) { mResultSet = true; - if (mResultCode == NSCancelButton) { + if (mResultCode == NSModalResponseCancel) { emit mHelper->reject(); } else { emit mHelper->accept(); diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 972230349b..26ab07ffaf 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -172,11 +172,12 @@ void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard() { - QCFType<CFURLRef> url; const int ExpectedImageWidth = 242; const int ExpectedImageHeight = 414; - if (LSFindApplicationForInfo(kLSUnknownCreator, CFSTR("com.apple.KeyboardSetupAssistant"), - 0, 0, &url) == noErr) { + QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier( + CFSTR("com.apple.KeyboardSetupAssistant"), nullptr); + if (urls && CFArrayGetCount(urls) > 0) { + CFURLRef url = (CFURLRef)CFArrayGetValueAtIndex(urls, 0); QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url); if (bundle) { url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("png"), 0); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 96027f8e0a..04db975360 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1494,18 +1494,22 @@ void QWindowsWindow::handleResized(int wParam) case SIZE_MAXHIDE: // Some other window affected. case SIZE_MAXSHOW: return; - case SIZE_MINIMIZED: - handleWindowStateChange(Qt::WindowMinimized); + case SIZE_MINIMIZED: // QTBUG-53577, prevent state change events during programmatic state change + if (!testFlag(WithinSetStyle)) + handleWindowStateChange(Qt::WindowMinimized); return; case SIZE_MAXIMIZED: - handleWindowStateChange(Qt::WindowMaximized); + if (!testFlag(WithinSetStyle)) + handleWindowStateChange(Qt::WindowMaximized); handleGeometryChange(); break; case SIZE_RESTORED: - if (isFullScreen_sys()) - handleWindowStateChange(Qt::WindowFullScreen); - else if (m_windowState != Qt::WindowNoState && !testFlag(MaximizeToFullScreen)) - handleWindowStateChange(Qt::WindowNoState); + if (!testFlag(WithinSetStyle)) { + if (isFullScreen_sys()) + handleWindowStateChange(Qt::WindowFullScreen); + else if (m_windowState != Qt::WindowNoState && !testFlag(MaximizeToFullScreen)) + handleWindowStateChange(Qt::WindowNoState); + } handleGeometryChange(); break; } @@ -1513,9 +1517,6 @@ void QWindowsWindow::handleResized(int wParam) void QWindowsWindow::handleGeometryChange() { - //Prevent recursive resizes for Windows CE - if (testFlag(WithinSetStyle)) - return; const QRect previousGeometry = m_data.geometry; m_data.geometry = geometry_sys(); QPlatformWindow::setGeometry(m_data.geometry); diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index af9ffab8ae..47c85fce18 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -384,9 +384,6 @@ QVariant QXcbIntegration::styleHint(QPlatformIntegration::StyleHint hint) const case QPlatformIntegration::PasswordMaskCharacter: // TODO using various xcb, gnome or KDE settings break; // Not implemented, use defaults - case QPlatformIntegration::FontSmoothingGamma: - // Match Qt 4.8 text rendering, and rendering of other X11 toolkits. - return qreal(1.0); case QPlatformIntegration::StartDragDistance: { // The default (in QPlatformTheme::defaultThemeHint) is 10 pixels, but // on a high-resolution screen it makes sense to increase it. |