Properly manage window geometry in kms
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Thu, 2 Aug 2012 08:08:16 +0000 (11:08 +0300)
committerQt by Nokia <qt-info@nokia.com>
Tue, 7 Aug 2012 14:40:07 +0000 (16:40 +0200)
If QWindow::setGeometry() is called before QWindow::create(),
QKmsWindow::setGeometry() is not called at all. This is wrong
because there is some special size restricting happening there
which must never be skipped.

Change-Id: I321632d4fdb327b0a75e6791c019b3f4c2793888
Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
src/plugins/platforms/kms/qkmswindow.cpp
src/plugins/platforms/kms/qkmswindow.h

index 691d9a8..f016d9d 100644 (file)
 #include "qkmsscreen.h"
 
 #include <qpa/qwindowsysteminterface.h>
+#include <qpa/qplatformwindow_p.h>
+
 QT_BEGIN_NAMESPACE
 
 QKmsWindow::QKmsWindow(QWindow *window)
     : QPlatformWindow(window)
 {
+    Q_D(QPlatformWindow);
     m_screen = QPlatformScreen::platformScreenForWindow(window);
-
     static_cast<QKmsScreen *>(m_screen)->initializeWithFormat(window->requestedFormat());
+    setGeometry(d->rect); // rect is set to window->geometry() in base ctor
 }
 
 void QKmsWindow::setGeometry(const QRect &rect)
 {
-    Q_UNUSED(rect)
-    //All Windows must be fullscreen
+    // All windows must be fullscreen
     QRect fullscreenRect = m_screen->availableGeometry();
-    QWindowSystemInterface::handleGeometryChange(window(), fullscreenRect);
+    if (rect != fullscreenRect)
+        QWindowSystemInterface::handleGeometryChange(window(), fullscreenRect);
 
     QPlatformWindow::setGeometry(fullscreenRect);
 }
index c9b3c26..ba76b2b 100644 (file)
@@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE
 
 class QKmsWindow : public QPlatformWindow
 {
+    Q_DECLARE_PRIVATE(QPlatformWindow)
+
 public:
     QKmsWindow(QWindow *window);