summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2014-06-11 12:54:21 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-11 16:42:43 +0200
commitdbe6db192aa1a3e708b00a98a17636af37ceec27 (patch)
tree116dc913f967f1e02d10d78d7f8838facfd822e6
parentf65333b027463ea40e0cd4603e48fca62d60216a (diff)
Windows: Fix maximizing frameless windows on secondary screens.
They would either disappear or be positioned at bogus coordinates. The MINMAXINFO structure works with coords from the primary screen then uses an "interesting" algorithm to adjust to secondary screen: Say you have a primary screen with width=1000 and secondary screen with width=2000, here's what you get when you set ptMaxSize to: ptMaxSize.x | Size window gets in second screen -------------------------------------------------- 500 | 500 1000 | 2000 1001 | 2001 1100 | 2100 So basically you can't get any value between 1000 and 1999 How many people use the taskbar on a second display and maximimize a frameless window anyway ? Task-number: QTBUG-39537 Change-Id: Ic9b3120e7fb5a9a5d97828a2e44be02ae587b92e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index c8eaded38d..cdc0b24464 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1936,7 +1936,10 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
&& (m_data.flags & Qt::FramelessWindowHint)) {
// This block fixes QTBUG-8361: Frameless windows shouldn't cover the
// taskbar when maximized
- if (const QScreen *screen = effectiveScreen(window())) {
+ const QScreen *screen = effectiveScreen(window());
+
+ // Documentation of MINMAXINFO states that it will only work for the primary screen
+ if (screen && screen == QGuiApplication::primaryScreen()) {
mmi->ptMaxSize.y = screen->availableGeometry().height();
// Width, because you can have the taskbar on the sides too.
@@ -1945,8 +1948,8 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
// If you have the taskbar on top, or on the left you don't want it at (0,0):
mmi->ptMaxPosition.x = screen->availableGeometry().x();
mmi->ptMaxPosition.y = screen->availableGeometry().y();
- } else {
- qWarning() << "Invalid screen";
+ } else if (!screen){
+ qWarning() << "effectiveScreen() returned a null screen";
}
}