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>
This commit is contained in:
parent
b808461854
commit
434b37323a
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user