summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-08-10 09:21:48 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-08-10 09:23:37 (GMT)
commit167b333e2c428947264f283f6eec275b27f8f0db (patch)
tree835ec59dd3fc394799e29ff55cc6a3f3f6858d67 /src/gui
parent89f0156b21b4cff8fec0cee283d75f413cf36c61 (diff)
downloadQt-167b333e2c428947264f283f6eec275b27f8f0db.zip
Qt-167b333e2c428947264f283f6eec275b27f8f0db.tar.gz
Qt-167b333e2c428947264f283f6eec275b27f8f0db.tar.bz2
Fix default QWidget size on X servers with Xinerama
The default widget size is normally calculated from the root window size, but when running on an X server with Xinerama enabled, the root window spans all screens, making the widget far to large. Use the default screen's size instead to give the widget a size that should fit on a single screen.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qwidget_x11.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 2a3d2f3..cf65af3 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -512,6 +512,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
dialog = popup = false; // force these flags off
data.crect.setRect(0, 0, sw, sh);
} else if (topLevel && !q->testAttribute(Qt::WA_Resized)) {
+ QDesktopWidget *desktopWidget = qApp->desktop();
+ if (desktopWidget->isVirtualDesktop()) {
+ QRect r = desktopWidget->screenGeometry();
+ sw = r.width();
+ sh = r.height();
+ }
+
int width = sw / 2;
int height = 4 * sh / 10;
if (extra) {