diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-03-31 10:03:31 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-03-31 10:03:31 +0200 |
commit | ce9519593a0b3deb99d1dd2529770f7e9fffef92 (patch) | |
tree | c9bca05230dd68f49494240ae930bad1fe0c5956 /src/plugins/platforms/cocoa | |
parent | 509f77cca28aa3edea5523c5869bae4412ed2ccc (diff) | |
parent | 7baaec17edb06634f1d6235a55c7adbd112cba3e (diff) |
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts:
mkspecs/android-g++/qmake.conf
qmake/generators/unix/unixmake2.cpp
src/gui/image/qimage_conversions.cpp
Change-Id: Ib76264b8c2d29a0228438ec02bd97d4b97545be0
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rwxr-xr-x | src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm | 19 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 28 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 4 |
3 files changed, 10 insertions, 41 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm index 000a47c7b4..f50f552623 100755 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm @@ -94,7 +94,6 @@ QT_USE_NAMESPACE QCocoaSystemTrayIcon *systray; NSStatusItem *item; QCocoaMenu *menu; - bool menuVisible; QIcon icon; QT_MANGLE_NAMESPACE(QNSImageView) *imageCell; } @@ -194,8 +193,6 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon) m_sys->item->icon = icon; - const bool menuVisible = m_sys->item->menu && m_sys->item->menuVisible; - // The reccomended maximum title bar icon height is 18 points // (device independent pixels). The menu height on past and // current OS X versions is 22 points. Provide some future-proofing @@ -210,9 +207,8 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon) // devicePixelRatio for the "best" screen on the system. qreal devicePixelRatio = qApp->devicePixelRatio(); const int maxPixmapHeight = maxImageHeight * devicePixelRatio; - const QIcon::Mode mode = menuVisible ? QIcon::Selected : QIcon::Normal; QSize selectedSize; - Q_FOREACH (const QSize& size, sortByHeight(icon.availableSizes(mode))) { + Q_FOREACH (const QSize& size, sortByHeight(icon.availableSizes())) { // Select a pixmap based on the height. We want the largest pixmap // with a height smaller or equal to maxPixmapHeight. The pixmap // may rectangular; assume it has a reasonable size. If there is @@ -226,7 +222,11 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon) } } - QPixmap pixmap = icon.pixmap(selectedSize, mode); + // Handle SVG icons, which do not return anything for availableSizes(). + if (!selectedSize.isValid()) + selectedSize = icon.actualSize(QSize(maxPixmapHeight, maxPixmapHeight)); + + QPixmap pixmap = icon.pixmap(selectedSize); // Draw a low-resolution icon if there is not enough pixels for a retina // icon. This prevents showing a small icon on retina displays. @@ -373,9 +373,6 @@ QT_END_NAMESPACE Q_UNUSED(notification); down = NO; - parent->systray->updateIcon(parent->icon); - parent->menuVisible = false; - [self setNeedsDisplay:YES]; } @@ -385,8 +382,6 @@ QT_END_NAMESPACE int clickCount = [mouseEvent clickCount]; [self setNeedsDisplay:YES]; - parent->systray->updateIcon(parent->icon); - if (clickCount == 2) { [self menuTrackingDone:nil]; [parent doubleClickSelector:self]; @@ -442,7 +437,6 @@ QT_END_NAMESPACE if (self) { item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; menu = 0; - menuVisible = false; systray = sys; imageCell = [[QNSImageView alloc] initWithParent:self]; [item setView: imageCell]; @@ -486,7 +480,6 @@ QT_END_NAMESPACE selector:@selector(menuTrackingDone:) name:NSMenuDidEndTrackingNotification object:m]; - menuVisible = true; [item popUpStatusItemMenu: m]; } } diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index f811bd630f..bc40bbb6ce 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -74,31 +74,6 @@ static bool isMouseEvent(NSEvent *ev) } } -static void selectNextKeyWindow(NSWindow *currentKeyWindow) -{ - if (!currentKeyWindow) - return; - - const QCocoaAutoReleasePool pool; - - if ([[NSApplication sharedApplication] keyWindow] != currentKeyWindow) - return;//currentKeyWindow is not a key window actually. - - NSArray *const windows = [[NSApplication sharedApplication] windows]; - bool startLookup = false; - for (NSWindow *candidate in [windows reverseObjectEnumerator]) { - if (!startLookup) { - if (candidate == currentKeyWindow) - startLookup = true; - } else { - if ([candidate isVisible] && [candidate canBecomeKeyWindow]) { - [candidate makeKeyWindow]; - break; - } - } - } -} - @implementation QNSWindowHelper @synthesize window = _window; @@ -607,9 +582,6 @@ void QCocoaWindow::hide(bool becauseOfAncestor) foreach (QCocoaWindow *childWindow, m_childWindows) childWindow->hide(true); - if (window()->transientParent() && m_nsWindow == [[NSApplication sharedApplication] keyWindow]) - selectNextKeyWindow(m_nsWindow); // Otherwise, Cocoa can do it wrong. - [m_nsWindow orderOut:nil]; } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 0b0dcc4322..3a3a17a474 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -368,6 +368,8 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; // calles, which Qt and Qt applications do not excpect. if (!m_platformWindow->m_inSetGeometry) QWindowSystemInterface::flushWindowSystemEvents(); + else + m_backingStore = QImage(); } } @@ -956,6 +958,7 @@ QT_WARNING_POP if (m_window->flags() & Qt::WindowTransparentForInput) return [super rightMouseDown:theEvent]; m_buttons |= Qt::RightButton; + m_sendUpAsRightButton = true; [self handleMouseEvent:theEvent]; } @@ -973,6 +976,7 @@ QT_WARNING_POP if (m_window->flags() & Qt::WindowTransparentForInput) return [super rightMouseUp:theEvent]; m_buttons &= ~Qt::RightButton; + m_sendUpAsRightButton = false; [self handleMouseEvent:theEvent]; } |