diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-03-08 16:11:33 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-03-08 16:11:33 +0100 |
commit | 72e5124b8517662ca2cd25deb5806bc04d20c022 (patch) | |
tree | 5950af37125647a6f14369eab667c7d611d1ac69 /src/plugins/platforms/cocoa/qcocoawindow.mm | |
parent | a19c22ebf8775f73b840f52b7e03869166ca0dab (diff) | |
parent | a12f6ba302e54c1570c54aa4c722f2dafbf794af (diff) |
Merge remote-tracking branch 'origin/release' into stable
Conflicts:
tests/auto/opengl/qgl/tst_qgl.cpp
Change-Id: I3c601351c984c1f4b00478d3c47ac9eeb021e892
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 0091028896..30b6d6d84a 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -200,6 +200,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) , m_menubar(0) , m_hasModalSession(false) , m_frameStrutEventsEnabled(false) + , m_isExposed(false) { #ifdef QT_COCOA_ENABLE_WINDOW_DEBUG qDebug() << "QCocoaWindow::QCocoaWindow" << this; @@ -284,9 +285,12 @@ void QCocoaWindow::setVisible(bool visible) } - // Make sure the QWindow has a frame ready before we show the NSWindow. - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); - QWindowSystemInterface::flushWindowSystemEvents(); + // This call is here to handle initial window show correctly: + // - top-level windows need to have backing store content ready when the + // window is shown, sendin the expose event here makes that more likely. + // - QNSViews for child windows are initialy not hidden and won't get the + // viewDidUnhide message. + exposeWindow(); if (m_nsWindow) { // setWindowState might have been called while the window was hidden and @@ -338,8 +342,6 @@ void QCocoaWindow::setVisible(bool visible) } else { [m_contentView setHidden:YES]; } - if (!QCoreApplication::closingDown()) - QWindowSystemInterface::handleExposeEvent(window(), QRegion()); } } @@ -489,6 +491,11 @@ void QCocoaWindow::lower() [m_nsWindow orderBack: m_nsWindow]; } +bool QCocoaWindow::isExposed() const +{ + return m_isExposed; +} + void QCocoaWindow::propagateSizeHints() { QCocoaAutoReleasePool pool; @@ -873,6 +880,22 @@ qreal QCocoaWindow::devicePixelRatio() const } } +void QCocoaWindow::exposeWindow() +{ + if (!m_isExposed) { + m_isExposed = true; + QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); + } +} + +void QCocoaWindow::obscureWindow() +{ + if (m_isExposed) { + m_isExposed = false; + QWindowSystemInterface::handleExposeEvent(window(), QRegion()); + } +} + QMargins QCocoaWindow::frameMargins() const { NSRect frameW = [m_nsWindow frame]; |