diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-10-24 10:37:17 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-10-24 13:40:55 +0200 |
commit | fa9d12f4a20d618caedc77880459fa1af75fd50d (patch) | |
tree | 11bd3cb4541afb924b3ee17f867133e71eb0e090 /src/plugins/platforms/cocoa | |
parent | 895cb4681ee78caaf9b99c88390a74ff1d79ae61 (diff) | |
parent | f174d31667dca184439f520b9624a1471d9556a6 (diff) |
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
src/plugins/platforms/windows/qwindowsmousehandler.cpp
src/plugins/platforms/xcb/qxcbimage.cpp
tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
tests/manual/qtabletevent/regular_widgets/main.cpp
Done-with: Friedemann Kleint<Friedemann.Kleint@qt.io>
Done-with: MÃ¥rten Nordheim<marten.nordheim@qt.io>
Change-Id: I5b2499513a92c590ed0756f7d2e93c35a64b7f30
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/cocoa.pro | 11 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm | 31 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoatheme.mm | 3 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 35 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 11 |
6 files changed, 34 insertions, 59 deletions
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 55a9d76b67..5354bdafbc 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -1,6 +1,6 @@ TARGET = qcocoa -OBJECTIVE_SOURCES += main.mm \ +SOURCES += main.mm \ qcocoaintegration.mm \ qcocoascreen.mm \ qcocoatheme.mm \ @@ -32,9 +32,8 @@ OBJECTIVE_SOURCES += main.mm \ qcocoasystemtrayicon.mm \ qcocoaintrospection.mm \ qcocoakeymapper.mm \ - qcocoamimetypes.mm - -SOURCES += messages.cpp + qcocoamimetypes.mm \ + messages.cpp HEADERS += qcocoaintegration.h \ qcocoascreen.h \ @@ -70,7 +69,7 @@ HEADERS += qcocoaintegration.h \ qcocoamimetypes.h qtConfig(opengl.*) { - OBJECTIVE_SOURCES += qcocoaglcontext.mm + SOURCES += qcocoaglcontext.mm HEADERS += qcocoaglcontext.h } @@ -89,7 +88,7 @@ CONFIG += no_app_extension_api_only qtHaveModule(widgets) { QT_FOR_CONFIG += widgets - OBJECTIVE_SOURCES += \ + SOURCES += \ qpaintengine_mac.mm \ qprintengine_mac.mm \ qcocoaprintersupport.mm \ diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm index 6af22facf9..13e9d8809e 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm @@ -92,7 +92,6 @@ QT_USE_NAMESPACE -@class QT_MANGLE_NAMESPACE(QNSMenu); @class QT_MANGLE_NAMESPACE(QNSImageView); @interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject <NSUserNotificationCenterDelegate> @@ -123,16 +122,8 @@ QT_USE_NAMESPACE -(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton; @end -@interface QT_MANGLE_NAMESPACE(QNSMenu) : NSMenu <NSMenuDelegate> { - QPlatformMenu *qmenu; -} --(QPlatformMenu*)menu; --(id)initWithQMenu:(QPlatformMenu*)qmenu; -@end - QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSStatusItem); QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSImageView); -QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSMenu); QT_BEGIN_NAMESPACE class QSystemTrayIconSys @@ -447,26 +438,4 @@ QT_END_NAMESPACE @end -class QSystemTrayIconQMenu : public QPlatformMenu -{ -public: - void doAboutToShow() { emit aboutToShow(); } -private: - QSystemTrayIconQMenu(); -}; - -@implementation QNSMenu --(id)initWithQMenu:(QPlatformMenu*)qm { - self = [super init]; - if (self) { - self->qmenu = qm; - [self setDelegate:self]; - } - return self; -} --(QPlatformMenu*)menu { - return qmenu; -} -@end - #endif // QT_NO_SYSTEMTRAYICON diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 2094f29770..2aab5fd545 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -55,6 +55,7 @@ #include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qcoregraphics_p.h> #include <QtGui/qpainter.h> +#include <QtGui/qtextformat.h> #include <QtFontDatabaseSupport/private/qcoretextfontdatabase_p.h> #include <QtThemeSupport/private/qabstractfileiconengine_p.h> #include <qpa/qplatformdialoghelper.h> @@ -344,6 +345,8 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const return QVariant(QChar(0x2022)); case QPlatformTheme::UiEffects: return QVariant(int(HoverEffect)); + case QPlatformTheme::SpellCheckUnderlineStyle: + return QVariant(int(QTextCharFormat::DotLine)); default: break; } diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 4028db2ce9..d9d7870da0 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -262,7 +262,7 @@ public: // for QNSView bool m_hasModalSession; bool m_frameStrutEventsEnabled; - bool m_isExposed; + QRect m_exposedRect; int m_registerTouchCount; bool m_resizableTransientParent; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 8e5a9268ec..ed942af1b1 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -150,7 +150,6 @@ QCocoaWindow::QCocoaWindow(QWindow *win, WId nativeHandle) , m_needsInvalidateShadow(false) , m_hasModalSession(false) , m_frameStrutEventsEnabled(false) - , m_isExposed(false) , m_registerTouchCount(0) , m_resizableTransientParent(false) , m_alertRequest(NoAlertRequest) @@ -692,7 +691,7 @@ void QCocoaWindow::lower() bool QCocoaWindow::isExposed() const { - return m_isExposed; + return !m_exposedRect.isEmpty(); } bool QCocoaWindow::isOpaque() const @@ -1120,7 +1119,7 @@ void QCocoaWindow::handleGeometryChange() void QCocoaWindow::handleExposeEvent(const QRegion ®ion) { - const bool wasExposed = isExposed(); + const QRect previouslyExposedRect = m_exposedRect; // Ideally we'd implement isExposed() in terms of these properties, // plus the occlusionState of the NSWindow, and let the expose event @@ -1133,27 +1132,29 @@ void QCocoaWindow::handleExposeEvent(const QRegion ®ion) // a window being obscured is an empty region, and in the case of // a drawRect call is a non-null region, even if occlusionState // is still hidden. This ensures the window is prepared for display. - m_isExposed = m_view.window.visible - && m_view.window.screen - && !geometry().size().isEmpty() - && !region.isEmpty() - && !m_view.hiddenOrHasHiddenAncestor; + if (m_view.window.visible && m_view.window.screen + && !geometry().size().isEmpty() && !region.isEmpty() + && !m_view.hiddenOrHasHiddenAncestor) { + m_exposedRect = region.boundingRect(); + } else { + m_exposedRect = QRect(); + } QWindowPrivate *windowPrivate = qt_window_private(window()); if (windowPrivate->updateRequestPending) { // We can only deliver update request events when the window is exposed, - // and we also have to make sure we deliver the first expose event after - // becoming exposed as a real expose event, otherwise the exposed state - // of the QWindow is never updated. - // FIXME: Should this logic live in QGuiApplication? - if (wasExposed && m_isExposed) { + // and we also have to make sure we deliver any change to the exposed + // rect as a real expose event (including going from non-exposed to + // exposed). FIXME: Should this logic live in QGuiApplication? + if (isExposed() && m_exposedRect == previouslyExposedRect) { qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::handleExposeEvent" << window() << region << "as update request"; windowPrivate->deliverUpdateRequest(); return; + } else { + // Since updateRequestPending is still set, we will issue a deferred setNeedsDisplay + // from drawRect and get back into this code on the next display cycle, delivering + // the pending update request. } - - // FIXME: Should we re-trigger setNeedsDisplay in case of !wasExposed && m_isExposed? - // Or possibly send the expose event first, and then the update request? } qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::handleExposeEvent" << window() << region << "isExposed" << isExposed(); @@ -1669,6 +1670,7 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window) if (!m_drawContentBorderGradient) { window.styleMask = window.styleMask & ~NSTexturedBackgroundWindowMask; [window.contentView.superview setNeedsDisplay:YES]; + window.titlebarAppearsTransparent = NO; return; } @@ -1693,6 +1695,7 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window) int effectiveBottomContentBorderThickness = m_bottomContentBorderThickness; [window setStyleMask:[window styleMask] | NSTexturedBackgroundWindowMask]; + window.titlebarAppearsTransparent = YES; [window setContentBorderThickness:effectiveTopContentBorderThickness forEdge:NSMaxYEdge]; [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge]; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 054dca122f..9708aa4ce6 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -324,12 +324,13 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") m_platformWindow->handleExposeEvent(exposedRegion); - // A call to QWindow::requestUpdate was issued during the expose event, but - // AppKit will reset the needsDisplay state of the view after completing the - // current display cycle, so we need to defer the request to redisplay. - // FIXME: Perhaps this should be a trigger to enable CADisplayLink? if (qt_window_private(m_platformWindow->window())->updateRequestPending) { - qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:] deferring setNeedsDisplay"; + // A call to QWindow::requestUpdate was issued during the expose event, or we + // had to deliver a real expose event and still need to deliver the update. + // But AppKit will reset the needsDisplay state of the view after completing + // the current display cycle, so we need to defer the request to redisplay. + // FIXME: Perhaps this should be a trigger to enable CADisplayLink? + qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:] issuing deferred setNeedsDisplay due to pending update request"; dispatch_async(dispatch_get_main_queue (), ^{ [self setNeedsDisplay:YES]; }); |