summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-07-06 14:00:48 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-07-07 09:29:11 +0000
commitd7bfbf3a13029e26145c64acfe2e5e09f6faba3f (patch)
tree22fb79cc6700391643589ce9d89b6150e9a2bbd7 /src/plugins/platforms
parente53a57d25421cfbb8cbbd1d1a8201d4a02ef3d67 (diff)
Windows QPA: Further restrict windows for WM_DPICHANGED
Exclude popups among other non-applicable windows types from resizing in WM_DPICHANGED. When resizing was enabled for non-fixed size windows by c854fc5a6be1e94d2ea313a1d0ef637bc3df178f it turned out that context menus were truncated when moving an application from a high resolution to a low resolution monitor. Factor out a function to check for the applicable window types. Amends 886ce572d628e7cd98cc39edcc930ffae951e95e, c854fc5a6be1e94d2ea313a1d0ef637bc3df178f. Task-number: QTBUG-55510 Change-Id: I16fee07f3e11828848ec71cdceadff958cedb13a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index a042212dd3..7115d074c9 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -824,6 +824,27 @@ static inline QWindowsInputContext *windowsInputContext()
return qobject_cast<QWindowsInputContext *>(QWindowsIntegration::instance()->inputContext());
}
+
+// Child windows, fixed-size windows or pop-ups and similar should not be resized
+static inline bool resizeOnDpiChanged(const QWindow *w)
+{
+ bool result = false;
+ if (w->isTopLevel()) {
+ switch (w->type()) {
+ case Qt::Window:
+ case Qt::Dialog:
+ case Qt::Sheet:
+ case Qt::Drawer:
+ case Qt::Tool:
+ result = !w->flags().testFlag(Qt::MSWindowsFixedSizeDialogHint);
+ break;
+ default:
+ break;
+ }
+ }
+ return result;
+}
+
/*!
\brief Main windows procedure registered for windows.
@@ -1106,9 +1127,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
#endif
} break;
case QtWindows::DpiChangedEvent: {
- if (platformWindow->window()->flags().testFlag(Qt::MSWindowsFixedSizeDialogHint))
- return false; // Fixed-size window should not be resized
-
+ if (!resizeOnDpiChanged(platformWindow->window()))
+ return false;
platformWindow->setFlag(QWindowsWindow::WithinDpiChanged);
const RECT *prcNewWindow = reinterpret_cast<RECT *>(lParam);
SetWindowPos(hwnd, NULL, prcNewWindow->left, prcNewWindow->top,