diff options
-rw-r--r-- | src/plugins/platforms/windows/qtwindowsglobal.h | 3 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 10 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index 7b574b0a56..ee640224cf 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -73,6 +73,7 @@ enum WindowsEventType // Simplify event types ExposeEvent = WindowEventFlag + 1, ActivateWindowEvent = WindowEventFlag + 2, DeactivateWindowEvent = WindowEventFlag + 3, + MouseActivateWindowEvent = WindowEventFlag + 4, LeaveEvent = WindowEventFlag + 5, CloseEvent = WindowEventFlag + 6, ShowEvent = WindowEventFlag + 7, @@ -131,6 +132,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI case WM_ACTIVATEAPP: return (int)wParamIn ? QtWindows::ActivateApplicationEvent : QtWindows::DeactivateApplicationEvent; + case WM_MOUSEACTIVATE: + return QtWindows::MouseActivateWindowEvent; case WM_ACTIVATE: return LOWORD(wParamIn) == WA_INACTIVE ? QtWindows::DeactivateWindowEvent : QtWindows::ActivateWindowEvent; diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 77cac647ba..a87dfe5f16 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -928,6 +928,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return true; #ifndef Q_OS_WINCE case QtWindows::ActivateWindowEvent: + if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) { + *result = LRESULT(MA_NOACTIVATE); + return true; + } #ifndef QT_NO_TABLETEVENT if (!d->m_tabletSupport.isNull()) d->m_tabletSupport->notifyActivate(); @@ -936,6 +940,12 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, if (const QWindow *modalWindow = QGuiApplication::modalWindow()) QWindowsWindow::baseWindowOf(modalWindow)->alertWindow(); break; + case QtWindows::MouseActivateWindowEvent: + if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) { + *result = LRESULT(MA_NOACTIVATE); + return true; + } + break; #endif #ifndef QT_NO_CONTEXTMENU case QtWindows::ContextMenu: diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 58047124a1..006a2802c1 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1188,7 +1188,7 @@ void QWindowsWindow::hide_sys() const if (flags & Qt::Popup) ShowWindow(m_data.hwnd, SW_HIDE); else - SetWindowPos(m_data.hwnd,0, 0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER); + SetWindowPos(m_data.hwnd,0, 0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE); } } |