diff options
author | Olli Werwolff <qt-info@nokia.com> | 2011-02-28 14:18:33 +0100 |
---|---|---|
committer | Olli Werwolff <qt-info@nokia.com> | 2011-03-10 13:46:57 +0100 |
commit | a2d3de38660d478f8643f9caf159d28d510d3a46 (patch) | |
tree | 75a98966b9e49d50a2f8ba27dcfdce4f7d84849f | |
parent | b807c326bb7e31c12c23c0025516023cbe3c32e6 (diff) |
Bring Simulator to front when new application is registered
Task-number: QTSIM-138
Reviewed-by: joerg
-rw-r--r-- | src/shared/qtsingleapplication/qtsingleapplication.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/shared/qtsingleapplication/qtsingleapplication.cpp b/src/shared/qtsingleapplication/qtsingleapplication.cpp index fdb00b1..fc452db 100644 --- a/src/shared/qtsingleapplication/qtsingleapplication.cpp +++ b/src/shared/qtsingleapplication/qtsingleapplication.cpp @@ -148,9 +148,14 @@ void QtSingleApplication::activateWindow() actWin->raise(); actWin->activateWindow(); #ifdef Q_OS_WIN - SetWindowPos(actWin->winId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE ); - SetWindowPos(actWin->winId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | - SWP_NOSIZE ); + WId winId = actWin->winId(); + DWORD foregroundPId = GetWindowThreadProcessId(GetForegroundWindow(), NULL); + DWORD myPId = GetWindowThreadProcessId(winId, NULL); + if (foregroundPId != myPId) { + AttachThreadInput(foregroundPId, myPId, true); + BringWindowToTop(winId); + AttachThreadInput(foregroundPId, myPId, false); + } #elif defined(Q_WS_X11) XEvent xev; xev.xclient.type = ClientMessage; |