Base active window handling on WM_SET/KILLFOCUS.
Make it work for child windows, fixing the isActive() test of QWindow. Task-number: QTBUG-24185 Change-Id: I75597c2d322969f7e109d76e30b9b1f4b66c6e1e Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
parent
543d994967
commit
4212898822
@ -77,6 +77,8 @@ enum WindowsEventType // Simplify event types
|
|||||||
ResizeEvent = WindowEventFlag + 12,
|
ResizeEvent = WindowEventFlag + 12,
|
||||||
QuerySizeHints = WindowEventFlag + 15,
|
QuerySizeHints = WindowEventFlag + 15,
|
||||||
CalculateSize = WindowEventFlag + 16,
|
CalculateSize = WindowEventFlag + 16,
|
||||||
|
FocusInEvent = WindowEventFlag + 17,
|
||||||
|
FocusOutEvent = WindowEventFlag + 18,
|
||||||
MouseEvent = MouseEventFlag + 1,
|
MouseEvent = MouseEventFlag + 1,
|
||||||
MouseWheelEvent = MouseEventFlag + 2,
|
MouseWheelEvent = MouseEventFlag + 2,
|
||||||
TouchEvent = TouchEventFlag + 1,
|
TouchEvent = TouchEventFlag + 1,
|
||||||
@ -170,6 +172,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI
|
|||||||
}
|
}
|
||||||
case WM_GETOBJECT:
|
case WM_GETOBJECT:
|
||||||
return QtWindows::AccessibleObjectFromWindowRequest;
|
return QtWindows::AccessibleObjectFromWindowRequest;
|
||||||
|
case WM_SETFOCUS:
|
||||||
|
return QtWindows::FocusInEvent;
|
||||||
|
case WM_KILLFOCUS:
|
||||||
|
return QtWindows::FocusOutEvent;
|
||||||
case WM_DISPLAYCHANGE:
|
case WM_DISPLAYCHANGE:
|
||||||
return QtWindows::DisplayChangedEvent;
|
return QtWindows::DisplayChangedEvent;
|
||||||
default:
|
default:
|
||||||
|
@ -676,10 +676,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
|
|||||||
}
|
}
|
||||||
// Events without an associated QWindow or events we are not interested in.
|
// Events without an associated QWindow or events we are not interested in.
|
||||||
switch (et) {
|
switch (et) {
|
||||||
case QtWindows::DeactivateApplicationEvent:
|
|
||||||
case QtWindows::DeactivateWindowEvent:
|
|
||||||
QWindowSystemInterface::handleWindowActivated(0);
|
|
||||||
return true;
|
|
||||||
case QtWindows::InputMethodStartCompositionEvent:
|
case QtWindows::InputMethodStartCompositionEvent:
|
||||||
return QWindowsInputContext::instance()->startComposition(hwnd);
|
return QWindowsInputContext::instance()->startComposition(hwnd);
|
||||||
case QtWindows::InputMethodCompositionEvent:
|
case QtWindows::InputMethodCompositionEvent:
|
||||||
@ -773,9 +769,12 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
|
|||||||
return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
|
return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
|
||||||
case QtWindows::TouchEvent:
|
case QtWindows::TouchEvent:
|
||||||
return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
|
return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
|
||||||
case QtWindows::ActivateWindowEvent:
|
case QtWindows::FocusInEvent: // see QWindowsWindow::requestActivateWindow().
|
||||||
QWindowSystemInterface::handleWindowActivated(platformWindow->window());
|
QWindowSystemInterface::handleWindowActivated(platformWindow->window());
|
||||||
return true;
|
return true;
|
||||||
|
case QtWindows::FocusOutEvent:
|
||||||
|
QWindowSystemInterface::handleWindowActivated(0);
|
||||||
|
return true;
|
||||||
case QtWindows::ShowEvent:
|
case QtWindows::ShowEvent:
|
||||||
platformWindow->handleShown();
|
platformWindow->handleShown();
|
||||||
return true;
|
return true;
|
||||||
|
@ -1220,8 +1220,12 @@ void QWindowsWindow::requestActivateWindow()
|
|||||||
{
|
{
|
||||||
if (QWindowsContext::verboseWindows)
|
if (QWindowsContext::verboseWindows)
|
||||||
qDebug() << __FUNCTION__ << this << window();
|
qDebug() << __FUNCTION__ << this << window();
|
||||||
if (m_data.hwnd)
|
// 'Active' state handling is based in focus since it needs to work for
|
||||||
|
// child windows as well.
|
||||||
|
if (m_data.hwnd) {
|
||||||
SetForegroundWindow(m_data.hwnd);
|
SetForegroundWindow(m_data.hwnd);
|
||||||
|
SetFocus(m_data.hwnd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWindowsWindow::setKeyboardGrabEnabled(bool grab)
|
bool QWindowsWindow::setKeyboardGrabEnabled(bool grab)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user