diff options
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 7 | ||||
| -rw-r--r-- | src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp | 10 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 9459e8bdfd3..f96f154f5b1 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -4035,10 +4035,13 @@ void QWindowsWindow::requestUpdate() // the Posted event on the GUI thread. if (m_vsyncUpdatePending.testAndSetAcquire(UpdateState::Requested, UpdateState::Posted)) { QWindowsWindow *oldSelf = this; - QMetaObject::invokeMethod(w, [w, oldSelf] { + qsizetype oldCallbackId = m_vsyncServiceCallbackId; + QMetaObject::invokeMethod(w, [w, oldSelf, oldCallbackId] { // 'oldSelf' is only used for comparison, don't access it directly! auto *self = static_cast<QWindowsWindow *>(w->handle()); - if (self && self == oldSelf) { + // NOTE: In the off chance that the window got destroyed and recreated with the + // same address, we also check that the callback id is the same. + if (self && self == oldSelf && self->m_vsyncServiceCallbackId == oldCallbackId) { // The platform window is still alive self->m_vsyncUpdatePending.storeRelease(UpdateState::Ready); self->deliverUpdateRequest(); diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp index e2f181aa628..2ea3fe38e1c 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp @@ -596,6 +596,16 @@ HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pR *pRetVal = QComVariant{ accessible->text(QAccessible::Help) }.release(); break; case UIA_HasKeyboardFocusPropertyId: + // If the top-level window has no focused child, report the top-level + // widget (window). If it already has a focused widget, it will be + // reported automatically. + if (topLevelWindow) { + QAccessibleInterface *focusacc = accessible->focusChild(); + if (!focusacc) { + *pRetVal = QComVariant{ accessible->state().active ? true : false }.release(); + break; + } + } *pRetVal = QComVariant{ accessible->state().focused ? true : false }.release(); break; case UIA_IsKeyboardFocusablePropertyId: |
