diff options
author | Jan-Arve Saether <jan-arve.saether@nokia.com> | 2011-12-22 11:21:47 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-23 13:40:12 +0100 |
commit | a203debb0bae8b342372f18dd0c5db7a33ff2b44 (patch) | |
tree | ffaf5634e3a7fcfba4963f0ffb2411f957984d7f /src/plugins/platforms | |
parent | ae8c61db218dbd4329a6b10aa174ed4ef30de7d5 (diff) |
Fix regression, make sure hit testing work on windows again.
The previous code did not make much sense
This regressed due to 74c9f9d83f9f5cb934d0b62b468c74df5a3b9a0d
Change-Id: Ia4374623257863edca706a1c3d8b565d0c6bd4c1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsaccessibility.cpp | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/src/plugins/platforms/windows/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/qwindowsaccessibility.cpp index daf30ce027..556d516bc0 100644 --- a/src/plugins/platforms/windows/qwindowsaccessibility.cpp +++ b/src/plugins/platforms/windows/qwindowsaccessibility.cpp @@ -746,9 +746,28 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::Invoke(long dispIdMember, const _G /* IAccessible + +IAccessible::accHitTest documents the value returned in pvarID like this: + +| *Point location* | *vt member* | *Value member* | ++========================================================+=============+=========================+ +| Outside of the object's boundaries, and either inside | VT_EMPTY | None. | +| or outside of the object's bounding rectangle. | | | ++--------------------------------------------------------+-------------+-------------------------+ +| Within the object but not within a child element or a | VT_I4 | lVal is CHILDID_SELF | +| child object. | | | ++--------------------------------------------------------+-------------+-------------------------+ +| Within a child element. | VT_I4 | lVal contains | +| | | the child ID. | ++--------------------------------------------------------+-------------+-------------------------+ +| Within a child object. | VT_DISPATCH | pdispVal is set to the | +| | | child object's IDispatch| +| | | interface pointer | ++--------------------------------------------------------+-------------+-------------------------+ */ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accHitTest(long xLeft, long yTop, VARIANT *pvarID) { + showDebug(__FUNCTION__, accessible); if (!accessible->isValid()) return E_FAIL; @@ -757,29 +776,22 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accHitTest(long xLeft, long yTop, if (child == 0) { // no child found, return this item if it contains the coordinates if (accessible->rect().contains(xLeft, yTop)) { - IDispatch *iface = 0; - QueryInterface(IID_IDispatch, (void**)&iface); - if (iface) { - (*pvarID).vt = VT_DISPATCH; - (*pvarID).pdispVal = iface; - return S_OK; - } + (*pvarID).vt = VT_I4; + (*pvarID).lVal = CHILDID_SELF; + return S_OK; } - (*pvarID).vt = VT_EMPTY; - return S_FALSE; - } - - QWindowsAccessible* wacc = new QWindowsAccessible(child); - IDispatch *iface = 0; - wacc->QueryInterface(IID_IDispatch, (void**)&iface); - if (iface) { - (*pvarID).vt = VT_DISPATCH; - (*pvarID).pdispVal = iface; - return S_OK; } else { - delete wacc; + QWindowsAccessible* wacc = new QWindowsAccessible(child); + IDispatch *iface = 0; + wacc->QueryInterface(IID_IDispatch, (void**)&iface); + if (iface) { + (*pvarID).vt = VT_DISPATCH; + (*pvarID).pdispVal = iface; + return S_OK; + } } + // Did not find anything (*pvarID).vt = VT_EMPTY; return S_FALSE; } |