From e02ecba61f3a271c4f2559c82904c4b8d3b03e61 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 28 Jan 2013 15:48:25 +0000 Subject: Delay initialization of QQnxRootWindow until first access. QtWebProcess, for example, doesn't create any QWindow, so it doesn't need any root window. This fixes Webkit2 rendering on QNX. Change-Id: I1d4c0dd20869798ba2bcd15f9d96e5fca4beb48e Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxscreen.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'src/plugins/platforms/qnx/qqnxscreen.cpp') diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 8b413de4fb..1e58f047ab 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -106,7 +106,6 @@ static QSize determineScreenSize(screen_display_t display, bool primaryScreen) { QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, bool primaryScreen) : m_screenContext(screenContext), m_display(display), - m_rootWindow(), m_primaryScreen(primaryScreen), m_posted(false), m_keyboardHeight(0), @@ -145,10 +144,6 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, m_currentPhysicalSize = m_initialPhysicalSize = screenSize; else m_currentPhysicalSize = m_initialPhysicalSize = screenSize.transposed(); - - // We only create the root window if we are the primary display. - if (primaryScreen) - m_rootWindow = QSharedPointer(new QQnxRootWindow(this)); } QQnxScreen::~QQnxScreen() @@ -248,8 +243,8 @@ void QQnxScreen::setRotation(int rotation) // Check if rotation changed if (m_currentRotation != rotation) { // Update rotation of root window - if (m_rootWindow) - m_rootWindow->setRotation(rotation); + if (rootWindow()) + rootWindow()->setRotation(rotation); const QRect previousScreenGeometry = geometry(); @@ -265,16 +260,16 @@ void QQnxScreen::setRotation(int rotation) // Resize root window if we've rotated 90 or 270 from previous orientation if (isOrthogonal(m_currentRotation, rotation)) { qScreenDebug() << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size(); - if (m_rootWindow) - m_rootWindow->resize(m_currentGeometry.size()); + if (rootWindow()) + rootWindow()->resize(m_currentGeometry.size()); if (m_primaryScreen) resizeWindows(previousScreenGeometry); } else { // TODO: Find one global place to flush display updates // Force immediate display update if no geometry changes required - if (m_rootWindow) - m_rootWindow->flush(); + if (rootWindow()) + rootWindow()->flush(); } // Save new rotation @@ -491,8 +486,8 @@ void QQnxScreen::onWindowPost(QQnxWindow *window) // post app window (so navigator will show it) after first child window // has posted; this only needs to happen once as the app window's content // never changes - if (!m_posted && m_rootWindow) { - m_rootWindow->post(); + if (!m_posted && rootWindow()) { + rootWindow()->post(); m_posted = true; } } @@ -573,4 +568,13 @@ void QQnxScreen::deactivateWindowGroup(const QByteArray &id) QWindowSystemInterface::handleWindowActivated(0); } +QSharedPointer QQnxScreen::rootWindow() const +{ + // We only create the root window if we are the primary display. + if (m_primaryScreen && !m_rootWindow) + m_rootWindow = QSharedPointer(new QQnxRootWindow(this)); + + return m_rootWindow; +} + QT_END_NAMESPACE -- cgit v1.2.3