Qt4 GUI: X11 wrong window pos stored in configfile

Report bugs, bug fixes and workarounds here.
Topic author
refsteff
Posts: 17
Joined: 30.07.2011
With us: 8 years 2 months

Qt4 GUI: X11 wrong window pos stored in configfile

Post #1by refsteff » 24.08.2011, 12:21

Hello,

This bug depends on the X11 and window manager combination, so if you use X11 on other platforms, you can be affected too.

If I maximize (no fullscreen) the celestia main window and quit, the values for pos in the config file are negative.
You can read the explanation in the qt4 docs (application-windows.html#window-geometry).
Therefore celestia starts with its default values for pos and size.

Until now I find only values in the range from -5 to -2, depending on the selected window style in KDE.

This is only a workaround :? :

Code: Select all

diff -urN celestia.org/src/celestia/qt/qtappwin.cpp celestia/src/celestia/qt/qtappwin.cpp
--- celestia.org/src/celestia/qt/qtappwin.cpp   2011-08-22 15:00:45.794111401 +0200
+++ celestia/src/celestia/qt/qtappwin.cpp   2011-08-22 15:02:59.255235837 +0200
@@ -476,6 +476,15 @@
     
     QSize windowSize = settings.value("Size", DEFAULT_MAIN_WINDOW_SIZE).toSize();
     QPoint windowPosition = settings.value("Pos", DEFAULT_MAIN_WINDOW_POSITION).toPoint();
+
+#ifdef __linux
+    // A problem between Qt and X11. If the window is maximized (not fullscreen), pos has negative
+    // values. You can find an explanation in the qt docs (application-windows.html#window-geometry)
+    if (windowPosition.x() >= -5 && windowPosition.x() < 0)
+        windowPosition.setX(0);
+    if (windowPosition.y() >= -5 && windowPosition.y() < 0)
+        windowPosition.setY(0);
+#endif
     
     // Make sure that the saved size fits on screen; it's possible for the previous saved
     // position to be off-screen if the monitor settings have changed.


Maybe it would be better to change the values before saving :?:
Specs: OpenSUSE 11.2 (modified), nVidia Geforce 9400 GT, Intel E7500, celestia svn 5166 Qt4

Return to “Bugs”

Who is online

Users browsing this forum: 3 guests