commit 3a6ad19c72667fa0f0ecea825f60a2c0017ddc60 Author: abilyk Date: Wed Jun 26 15:14:08 2024 -0700 * reverted some files back to 5.15.14 to address CLI acc issue in 5.15.16; diff --git a/qtbase/src/platformsupport/fbconvenience/qfbcursor.cpp b/qtbase/src/platformsupport/fbconvenience/qfbcursor.cpp index e3550a722f..e22d07e1be 100644 --- a/qtbase/src/platformsupport/fbconvenience/qfbcursor.cpp +++ b/qtbase/src/platformsupport/fbconvenience/qfbcursor.cpp @@ -69,7 +69,7 @@ QFbCursor::QFbCursor(QFbScreen *screen) if (!mVisible) return; - mCursorImage.reset(new QPlatformCursorImage(0, 0, 0, 0, 0, 0)); + mCursorImage = new QPlatformCursorImage(0, 0, 0, 0, 0, 0); setCursor(Qt::ArrowCursor); mDeviceListener = new QFbCursorDeviceListener(this); diff --git a/qtbase/src/platformsupport/fbconvenience/qfbcursor_p.h b/qtbase/src/platformsupport/fbconvenience/qfbcursor_p.h index 2ca8bd417b..7ce57d4a75 100644 --- a/qtbase/src/platformsupport/fbconvenience/qfbcursor_p.h +++ b/qtbase/src/platformsupport/fbconvenience/qfbcursor_p.h @@ -113,7 +113,7 @@ private: QRect mPrevRect; // last place the cursor was drawn bool mDirty; bool mOnScreen; - QScopedPointer mCursorImage; + QPlatformCursorImage *mCursorImage; QFbCursorDeviceListener *mDeviceListener; QPoint m_pos; }; diff --git a/qtbase/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp b/qtbase/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp index 217a968c64..ba683cf686 100644 --- a/qtbase/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp +++ b/qtbase/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp @@ -1471,70 +1471,36 @@ QT_WARNING_POP return fontEngine; } -static QList getTrueTypeFontOffsets(const uchar *fontData, const uchar *fileEndSentinel) +static QList getTrueTypeFontOffsets(const uchar *fontData) { QList offsets; - if (fileEndSentinel - fontData < 12) { - qCWarning(lcQpaFonts) << "Corrupted font data detected"; - return offsets; - } - - const quint32 headerTag = qFromUnaligned(fontData); + const quint32 headerTag = *reinterpret_cast(fontData); if (headerTag != MAKE_TAG('t', 't', 'c', 'f')) { if (headerTag != MAKE_TAG(0, 1, 0, 0) && headerTag != MAKE_TAG('O', 'T', 'T', 'O') && headerTag != MAKE_TAG('t', 'r', 'u', 'e') - && headerTag != MAKE_TAG('t', 'y', 'p', '1')) { + && headerTag != MAKE_TAG('t', 'y', 'p', '1')) return offsets; - } offsets << 0; return offsets; } - - const quint32 maximumNumFonts = 0xffff; const quint32 numFonts = qFromBigEndian(fontData + 8); - if (numFonts > maximumNumFonts) { - qCWarning(lcQpaFonts) << "Font collection of" << numFonts << "fonts is too large. Aborting."; - return offsets; + for (uint i = 0; i < numFonts; ++i) { + offsets << qFromBigEndian(fontData + 12 + i * 4); } - - if (quintptr(fileEndSentinel - fontData) > 12 + (numFonts - 1) * 4) { - for (quint32 i = 0; i < numFonts; ++i) - offsets << qFromBigEndian(fontData + 12 + i * 4); - } else { - qCWarning(lcQpaFonts) << "Corrupted font data detected"; - } - return offsets; } -static void getFontTable(const uchar *fileBegin, const uchar *fileEndSentinel, const uchar *data, quint32 tag, const uchar **table, quint32 *length) +static void getFontTable(const uchar *fileBegin, const uchar *data, quint32 tag, const uchar **table, quint32 *length) { - if (fileEndSentinel - data >= 6) { - const quint16 numTables = qFromBigEndian(data + 4); - if (fileEndSentinel - data >= 28 + 16 * (numTables - 1)) { - for (quint32 i = 0; i < numTables; ++i) { - const quint32 offset = 12 + 16 * i; - if (qFromUnaligned(data + offset) == tag) { - const quint32 tableOffset = qFromBigEndian(data + offset + 8); - if (quintptr(fileEndSentinel - fileBegin) <= tableOffset) { - qCWarning(lcQpaFonts) << "Corrupted font data detected"; - break; - } - *table = fileBegin + tableOffset; - *length = qFromBigEndian(data + offset + 12); - if (quintptr(fileEndSentinel - *table) < *length) { - qCWarning(lcQpaFonts) << "Corrupted font data detected"; - break; - } - return; - } - } - } else { - qCWarning(lcQpaFonts) << "Corrupted font data detected"; + const quint16 numTables = qFromBigEndian(data + 4); + for (uint i = 0; i < numTables; ++i) { + const quint32 offset = 12 + 16 * i; + if (*reinterpret_cast(data + offset) == tag) { + *table = fileBegin + qFromBigEndian(data + offset + 8); + *length = qFromBigEndian(data + offset + 12); + return; } - } else { - qCWarning(lcQpaFonts) << "Corrupted font data detected"; } *table = 0; *length = 0; @@ -1547,9 +1513,8 @@ static void getFamiliesAndSignatures(const QByteArray &fontData, QVector *values) { const uchar *data = reinterpret_cast(fontData.constData()); - const uchar *dataEndSentinel = data + fontData.size(); - QList offsets = getTrueTypeFontOffsets(data, dataEndSentinel); + QList offsets = getTrueTypeFontOffsets(data); if (offsets.isEmpty()) return; @@ -1557,7 +1522,7 @@ static void getFamiliesAndSignatures(const QByteArray &fontData, const uchar *font = data + offsets.at(i); const uchar *table; quint32 length; - getFontTable(data, dataEndSentinel, font, MAKE_TAG('n', 'a', 'm', 'e'), &table, &length); + getFontTable(data, font, MAKE_TAG('n', 'a', 'm', 'e'), &table, &length); if (!table) continue; QFontNames names = qt_getCanonicalFontNames(table, length); @@ -1567,7 +1532,7 @@ static void getFamiliesAndSignatures(const QByteArray &fontData, families->append(std::move(names)); if (values || signatures) - getFontTable(data, dataEndSentinel, font, MAKE_TAG('O', 'S', '/', '2'), &table, &length); + getFontTable(data, font, MAKE_TAG('O', 'S', '/', '2'), &table, &length); if (values) { QFontValues fontValues; diff --git a/qtbase/src/platformsupport/input/xkbcommon/qxkbcommon.cpp b/qtbase/src/platformsupport/input/xkbcommon/qxkbcommon.cpp index 5a245b6c38..79ca910519 100644 --- a/qtbase/src/platformsupport/input/xkbcommon/qxkbcommon.cpp +++ b/qtbase/src/platformsupport/input/xkbcommon/qxkbcommon.cpp @@ -273,14 +273,10 @@ static constexpr const auto KeyTbl = qMakeArray( Xkb2Qt, Xkb2Qt, Xkb2Qt, -/* The following four XKB_KEY_dead keys got removed in libxkbcommon 1.6.0 - The define check is kind of version check here. */ -#ifdef XKB_KEY_dead_lowline Xkb2Qt, Xkb2Qt, Xkb2Qt, Xkb2Qt, -#endif // Special keys from X.org - This include multimedia keys, // wireless/bluetooth/uwb keys, special launcher keys, etc. @@ -551,15 +547,7 @@ static int keysymToQtKey_internal(xkb_keysym_t keysym, Qt::KeyboardModifiers mod // numeric keypad keys qtKey = Qt::Key_0 + (keysym - XKB_KEY_KP_0); } else if (QXkbCommon::isLatin1(keysym)) { - // Upper-case first, since Qt::Keys are defined in terms of their - // upper-case versions. qtKey = QXkbCommon::qxkbcommon_xkb_keysym_to_upper(keysym); - // Upper-casing a Latin1 character might move it out of Latin1 range, - // for example U+00B5 MICRO SIGN, which upper-case equivalent is - // U+039C GREEK CAPITAL LETTER MU. If that's the case, then map the - // original lower-case character. - if (!QXkbCommon::isLatin1(qtKey)) - qtKey = keysym; } else { // check if we have a direct mapping xkb2qt_t searchKey{keysym, 0}; @@ -766,8 +754,6 @@ xkb_keysym_t QXkbCommon::lookupLatinKeysym(xkb_state *state, xkb_keycode_t keyco { xkb_layout_index_t layout; xkb_keysym_t sym = XKB_KEY_NoSymbol; - if (!state) - return sym; xkb_keymap *keymap = xkb_state_get_keymap(state); const xkb_layout_index_t layoutCount = xkb_keymap_num_layouts_for_key(keymap, keycode); const xkb_layout_index_t currentLayout = xkb_state_key_get_layout(state, keycode); diff --git a/qtbase/src/platformsupport/windowsuiautomation/qwindowsuiawrapper.cpp b/qtbase/src/platformsupport/windowsuiautomation/qwindowsuiawrapper.cpp index 8dfb1a34e1..37e611d541 100644 --- a/qtbase/src/platformsupport/windowsuiautomation/qwindowsuiawrapper.cpp +++ b/qtbase/src/platformsupport/windowsuiautomation/qwindowsuiawrapper.cpp @@ -53,6 +53,7 @@ QWindowsUiaWrapper::QWindowsUiaWrapper() m_pUiaHostProviderFromHwnd = reinterpret_cast(uiaLib.resolve("UiaHostProviderFromHwnd")); m_pUiaRaiseAutomationPropertyChangedEvent = reinterpret_cast(uiaLib.resolve("UiaRaiseAutomationPropertyChangedEvent")); m_pUiaRaiseAutomationEvent = reinterpret_cast(uiaLib.resolve("UiaRaiseAutomationEvent")); + m_pUiaRaiseNotificationEvent = reinterpret_cast(uiaLib.resolve("UiaRaiseNotificationEvent")); m_pUiaClientsAreListening = reinterpret_cast(uiaLib.resolve("UiaClientsAreListening")); } } @@ -68,7 +69,7 @@ QWindowsUiaWrapper *QWindowsUiaWrapper::instance() return &wrapper; } -// True if all symbols resolved. +// True if most symbols resolved (UiaRaiseNotificationEvent is optional). BOOL QWindowsUiaWrapper::ready() { return m_pUiaReturnRawElementProvider @@ -113,5 +114,12 @@ HRESULT QWindowsUiaWrapper::raiseAutomationEvent(IRawElementProviderSimple *pPro return m_pUiaRaiseAutomationEvent(pProvider, id); } +HRESULT QWindowsUiaWrapper::raiseNotificationEvent(IRawElementProviderSimple *provider, NotificationKind notificationKind, NotificationProcessing notificationProcessing, BSTR displayString, BSTR activityId) +{ + if (!m_pUiaRaiseNotificationEvent) + return UIA_E_NOTSUPPORTED; + return m_pUiaRaiseNotificationEvent(provider, notificationKind, notificationProcessing, displayString, activityId); +} + QT_END_NAMESPACE diff --git a/qtbase/src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h b/qtbase/src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h index 9b119d6345..87fe484a97 100644 --- a/qtbase/src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h +++ b/qtbase/src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h @@ -80,17 +80,20 @@ public: HRESULT hostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **ppProvider); HRESULT raiseAutomationPropertyChangedEvent(IRawElementProviderSimple *pProvider, PROPERTYID id, VARIANT oldValue, VARIANT newValue); HRESULT raiseAutomationEvent(IRawElementProviderSimple *pProvider, EVENTID id); + HRESULT raiseNotificationEvent(IRawElementProviderSimple *provider, NotificationKind notificationKind, NotificationProcessing notificationProcessing, BSTR displayString, BSTR activityId); private: typedef LRESULT (WINAPI *PtrUiaReturnRawElementProvider)(HWND, WPARAM, LPARAM, IRawElementProviderSimple *); typedef HRESULT (WINAPI *PtrUiaHostProviderFromHwnd)(HWND, IRawElementProviderSimple **); typedef HRESULT (WINAPI *PtrUiaRaiseAutomationPropertyChangedEvent)(IRawElementProviderSimple *, PROPERTYID, VARIANT, VARIANT); typedef HRESULT (WINAPI *PtrUiaRaiseAutomationEvent)(IRawElementProviderSimple *, EVENTID); + typedef HRESULT (WINAPI *PtrUiaRaiseNotificationEvent)(IRawElementProviderSimple *, NotificationKind, NotificationProcessing, BSTR, BSTR); typedef BOOL (WINAPI *PtrUiaClientsAreListening)(); PtrUiaReturnRawElementProvider m_pUiaReturnRawElementProvider = nullptr; PtrUiaHostProviderFromHwnd m_pUiaHostProviderFromHwnd = nullptr; PtrUiaRaiseAutomationPropertyChangedEvent m_pUiaRaiseAutomationPropertyChangedEvent = nullptr; PtrUiaRaiseAutomationEvent m_pUiaRaiseAutomationEvent = nullptr; + PtrUiaRaiseNotificationEvent m_pUiaRaiseNotificationEvent = nullptr; PtrUiaClientsAreListening m_pUiaClientsAreListening = nullptr; }; diff --git a/qtbase/src/platformsupport/windowsuiautomation/uiatypes_p.h b/qtbase/src/platformsupport/windowsuiautomation/uiatypes_p.h index f5a1e76268..7c87a5c9b7 100644 --- a/qtbase/src/platformsupport/windowsuiautomation/uiatypes_p.h +++ b/qtbase/src/platformsupport/windowsuiautomation/uiatypes_p.h @@ -162,6 +162,22 @@ enum ExpandCollapseState { ExpandCollapseState_LeafNode = 3 }; +enum NotificationKind { + NotificationKind_ItemAdded = 0, + NotificationKind_ItemRemoved = 1, + NotificationKind_ActionCompleted = 2, + NotificationKind_ActionAborted = 3, + NotificationKind_Other = 4 +}; + +enum NotificationProcessing { + NotificationProcessing_ImportantAll = 0, + NotificationProcessing_ImportantMostRecent = 1, + NotificationProcessing_All = 2, + NotificationProcessing_MostRecent = 3, + NotificationProcessing_CurrentThenMostRecent = 4 +}; + struct UiaRect { double left; double top; diff --git a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp index bc39b92562..103b43591f 100644 --- a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp +++ b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp @@ -172,11 +172,27 @@ void QWindowsUiaMainProvider::notifyValueChange(QAccessibleValueChangeEvent *eve } if (event->value().type() == QVariant::String) { if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) { - // Notifies changes in string values. - VARIANT oldVal, newVal; - clearVariant(&oldVal); - setVariantString(event->value().toString(), &newVal); - QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_ValueValuePropertyId, oldVal, newVal); + + // Tries to notify the change using UiaRaiseNotificationEvent(), which is only available on + // Windows 10 version 1709 or newer. Otherwise uses UiaRaiseAutomationPropertyChangedEvent(). + + BSTR displayString = bStrFromQString(event->value().toString()); + BSTR activityId = bStrFromQString(QString()); + + HRESULT hr = QWindowsUiaWrapper::instance()->raiseNotificationEvent(provider, NotificationKind_Other, + NotificationProcessing_ImportantMostRecent, + displayString, activityId); + + ::SysFreeString(displayString); + ::SysFreeString(activityId); + + if (hr == static_cast(UIA_E_NOTSUPPORTED)) { + VARIANT oldVal, newVal; + clearVariant(&oldVal); + setVariantString(event->value().toString(), &newVal); + QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_ValueValuePropertyId, oldVal, newVal); + ::SysFreeString(newVal.bstrVal); + } } } else if (QAccessibleValueInterface *valueInterface = accessible->valueInterface()) { if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) {