summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2013-11-26 07:23:13 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-05 17:19:07 +0100
commit434b37323a6feb3210168f70ad59f5ecdaa5a597 (patch)
tree72474021b27ee755fd8160bf10e9dc9f7e15e97a /src
parentb8084618545570a8832d344a2e9586e1226cc697 (diff)
Respect the WindowDoesNotAcceptFocus flag
When the window is requested to be made active then it should check if the window accepts focus or not. If it does not then it should ensure it informs the underlying system that it does not accept the activate event. Change-Id: I3e6533be792d8bdbb2bfcdf3b9c1a93e2c67c75a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/windows/qtwindowsglobal.h3
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp2
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);
}
}