diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-12-20 09:24:48 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-01-04 14:18:26 (GMT) |
commit | d79b18d59cc39396f4993a294f24cfb804be728f (patch) | |
tree | 5388ee5b6ebf1d8a751da5f0a15bf8a4e853d0c4 /src/plugins/platforms | |
parent | 91a438cad2139ae33f8a18c8ca8f81a41795ebe9 (diff) | |
download | Qt-d79b18d59cc39396f4993a294f24cfb804be728f.zip Qt-d79b18d59cc39396f4993a294f24cfb804be728f.tar.gz Qt-d79b18d59cc39396f4993a294f24cfb804be728f.tar.bz2 |
Make TestLite show windows in correct position
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/testlite/qtestlitewindow.cpp | 28 | ||||
-rw-r--r-- | src/plugins/platforms/testlite/qtestlitewindow.h | 2 |
2 files changed, 27 insertions, 3 deletions
diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 42f2302..6f9ad58 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -517,10 +517,13 @@ void QTestLiteWindow::setVisible(bool visible) #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; #endif - if (visible) - XMapWindow(mScreen->display(), x_window); - else + if (visible) { + //ensure that the window is viewed in correct position. + doSizeHints(); + XMapWindow(mScreen->display(), x_window); + } else { XUnmapWindow(mScreen->display(), x_window); + } } void QTestLiteWindow::setCursor(const Cursor &cursor) @@ -552,4 +555,23 @@ GC QTestLiteWindow::graphicsContext() const return gc; } +void QTestLiteWindow::doSizeHints() +{ + Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); + XSizeHints s; + s.flags = 0; + QRect g = geometry(); + s.x = g.x(); + s.y = g.y(); + s.width = g.width(); + s.height = g.height(); + s.flags |= USPosition; + s.flags |= PPosition; + s.flags |= USSize; + s.flags |= PSize; + s.flags |= PWinGravity; + s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; + XSetWMNormalHints(mScreen->display(), x_window, &s); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 35ba677..4b952dc 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -126,6 +126,8 @@ protected: void setMWMHints(const QtMWMHints &mwmhints); QtMWMHints getMWMHints() const; + void doSizeHints(); + private: Window x_window; GC gc; |