summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergiy Korobov <sergiy@vikingsoftware.com>2018-06-05 14:27:52 +0300
committerSergiy Korobov (Viking Software) <sergiy@vikingsoftware.com>2018-06-05 14:41:21 +0000
commit7b797982751dad3a448037ae99c4c8967529dddc (patch)
tree2218ea2f64dda27badb32314daedf0cb98414055
parent2b8287b6660e9e3295e2a8662f9b57b1e384d0bd (diff)
Fix QWindowsWindow::requestActivateWindow()
QWindowsWindow::requestActivateWindow() does not work correct if QWindowsWindowFunctions::AlwaysActivateWindow is passed as a parameter to QWindowsWindowFunctions::setWindowActivationBehavior(). When the calling process is not the active process, only the taskbar entry is flashed. It is not correct. The window should be always activated, even when the calling process is not the active process. Task-number: QTBUG-37435 Task-number: QTBUG-14062 Change-Id: I7a321d7bac744a7776278210b1b5a2fd4288aa43 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index a2883e2601..3909c64c53 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -2201,6 +2201,15 @@ void QWindowsWindow::requestActivateWindow()
foregroundThread = GetWindowThreadProcessId(foregroundWindow, NULL);
if (foregroundThread && foregroundThread != currentThread)
attached = AttachThreadInput(foregroundThread, currentThread, TRUE) == TRUE;
+ if (attached) {
+ if (!window()->flags().testFlag(Qt::WindowStaysOnBottomHint)
+ && !window()->flags().testFlag(Qt::WindowStaysOnTopHint)
+ && window()->type() != Qt::ToolTip) {
+ const UINT swpFlags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER;
+ SetWindowPos(m_data.hwnd, HWND_TOPMOST, 0, 0, 0, 0, swpFlags);
+ SetWindowPos(m_data.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, swpFlags);
+ }
+ }
}
}
SetForegroundWindow(m_data.hwnd);