ResizeEvent = WindowEventFlag + 12,
QuerySizeHints = WindowEventFlag + 15,
CalculateSize = WindowEventFlag + 16,
+ FocusInEvent = WindowEventFlag + 17,
+ FocusOutEvent = WindowEventFlag + 18,
MouseEvent = MouseEventFlag + 1,
MouseWheelEvent = MouseEventFlag + 2,
TouchEvent = TouchEventFlag + 1,
}
case WM_GETOBJECT:
return QtWindows::AccessibleObjectFromWindowRequest;
+ case WM_SETFOCUS:
+ return QtWindows::FocusInEvent;
+ case WM_KILLFOCUS:
+ return QtWindows::FocusOutEvent;
case WM_DISPLAYCHANGE:
return QtWindows::DisplayChangedEvent;
default:
}
// Events without an associated QWindow or events we are not interested in.
switch (et) {
- case QtWindows::DeactivateApplicationEvent:
- case QtWindows::DeactivateWindowEvent:
- QWindowSystemInterface::handleWindowActivated(0);
- return true;
case QtWindows::InputMethodStartCompositionEvent:
return QWindowsInputContext::instance()->startComposition(hwnd);
case QtWindows::InputMethodCompositionEvent:
return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
case QtWindows::TouchEvent:
return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
- case QtWindows::ActivateWindowEvent:
+ case QtWindows::FocusInEvent: // see QWindowsWindow::requestActivateWindow().
QWindowSystemInterface::handleWindowActivated(platformWindow->window());
return true;
+ case QtWindows::FocusOutEvent:
+ QWindowSystemInterface::handleWindowActivated(0);
+ return true;
case QtWindows::ShowEvent:
platformWindow->handleShown();
return true;
{
if (QWindowsContext::verboseWindows)
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);
+ SetFocus(m_data.hwnd);
+ }
}
bool QWindowsWindow::setKeyboardGrabEnabled(bool grab)