diff options
author | Morten Sorvig <morten.sorvig@nokia.com> | 2011-08-23 12:51:11 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-08-31 16:16:03 +0200 |
commit | 071914232189735ae6475d44d07f11f90b4729a1 (patch) | |
tree | f749a96da620f6a4e9de74fbd09aa4d6c5d0adf1 /src/plugins/platforms/cocoa/qcocoawindow.mm | |
parent | 090ee21eac7257644422e35395194e5fd7fb8efa (diff) |
Cocoa: Fix qmlscene flicker on startup.
The SG render thread was racing window creation in
the GUI thread, which would cause flicker if the
window won the race and was shown before the SG
thread had a frame ready.
Send a synchronous expose event before showing the
window - this will wait for the SG render thread.
In addition, don't defer NSwindow creation. The GL
context setup is done before the window is shown
and needs a fully created window.
New API: QWindowSystemInterface::handleSynchronousExposeEvent
Retire: QWindowSystemInterface::handleExposeEvent
Change-Id: I0bb46089d16ec4882aaac8db67b57d15e0f51531
Reviewed-on: http://codereview.qt.nokia.com/3399
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 78785a8527..ef04fc4238 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -121,8 +121,10 @@ void QCocoaWindow::setVisible(bool visible) if (window()->transientParent()) setGeometry(window()->geometry()); + // Make sure the QWindow has a frame ready before we show the NSWindow. + QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRect(QPoint(), geometry().size())); + [m_nsWindow makeKeyAndOrderFront:nil]; - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); } else { [m_nsWindow orderOut:nil]; } @@ -319,7 +321,7 @@ QNSWindow * QCocoaWindow::createWindow() panel = [[NSPanel alloc] initWithContentRect:frame styleMask:m_windowAttributes backing:NSBackingStoreBuffered - defer:YES]; + defer:NO]; // see window case below // ### crashes // [panel setFloatingPanel:needFloating]; // [panel setWorksWhenModal:worksWhenModal]; @@ -330,7 +332,8 @@ QNSWindow * QCocoaWindow::createWindow() window = [[QNSWindow alloc] initWithContentRect:frame styleMask:(NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask) backing:NSBackingStoreBuffered - defer:YES]; + defer:NO]; // Deferring window creation breaks OpenGL (the GL context is set up + // before the window is shown and needs a proper window.). break; } |