Improve debugging in the windows accessibility bridge.

set QT_DEBUG_ACCESSIBILITY=(1|0) to turn logging on or off

Change-Id: Ibd5b77699decf0cf02bc6b6cc656fa237de29124
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
This commit is contained in:
Jan-Arve Saether 2012-03-02 16:06:04 +01:00 committed by Qt by Nokia
parent db1aa6dd99
commit c531fcc92e
2 changed files with 60 additions and 34 deletions

View File

@ -1198,11 +1198,23 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface)
if (iface->object()) {
d << "obj=" << iface->object();
}
if (iface->state().invisible) {
d << "invisible";
} else {
QStringList stateStrings;
QAccessible::State st = iface->state();
if (st.focusable)
stateStrings << QLatin1String("focusable");
if (st.focused)
stateStrings << QLatin1String("focused");
if (st.selected)
stateStrings << QLatin1String("selected");
if (st.invisible)
stateStrings << QLatin1String("invisible");
if (!stateStrings.isEmpty())
d << stateStrings.join(QLatin1String("|"));
if (!st.invisible)
d << "rect=" << iface->rect();
}
} else {
d << " invalid";
}

View File

@ -88,23 +88,37 @@
QT_BEGIN_NAMESPACE
//#define DEBUG_SHOW_ATCLIENT_COMMANDS
#ifdef DEBUG_SHOW_ATCLIENT_COMMANDS
#ifndef QT_NO_DEBUG
QT_BEGIN_INCLUDE_NAMESPACE
#include <qdebug.h>
# include <qdebug.h>
QT_END_INCLUDE_NAMESPACE
void showDebug(const char* funcName, const QAccessibleInterface *iface)
static inline bool debug_accessibility()
{
qDebug() << "Role:" << qAccessibleRoleString(iface->role(0))
<< "Name:" << iface->text(QAccessible::Name, 0)
<< "State:" << QString::number(int(iface->state(0)), 16)
<< QLatin1String(funcName);
static signed int debugging = -1;
if (debugging == -1)
debugging = qgetenv("QT_DEBUG_ACCESSIBILITY").toInt();
return !!debugging;
}
# define accessibleDebug !debug_accessibility() ? (void)0 : qDebug
#else
# define showDebug(f, iface)
# define accessibleDebug()
#endif
//#define DEBUG_SHOW_ATCLIENT_COMMANDS
#if defined(DEBUG_SHOW_ATCLIENT_COMMANDS)
void accessibleDebugClientCalls_helper(const char* funcName, const QAccessibleInterface *iface)
{
QString str;
QDebug dbg(&str);
dbg << iface << QLatin1String(funcName);
accessibleDebug("%s", qPrintable(str));
}
# define accessibleDebugClientCalls(iface) accessibleDebugClientCalls_helper(Q_FUNC_INFO, iface)
#else
# define accessibleDebugClientCalls(iface)
#endif
typedef QSharedPointer<QAccessibleInterface> QAIPointer;
// This stuff is used for widgets/items with no window handle:
@ -595,7 +609,7 @@ IAccessible::accHitTest documents the value returned in pvarID like this:
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accHitTest(long xLeft, long yTop, VARIANT *pvarID)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -635,7 +649,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accHitTest(long xLeft, long yTop,
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varID)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -659,7 +673,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accLocation(long *pxLeft, long *py
// moz: [important, but no need to implement up/down/left/right]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEnd)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -799,7 +813,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accNavigate(long navDir, VARIANT v
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accChild(VARIANT varChildID, IDispatch** ppdispChild)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -853,7 +867,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accChild(VARIANT varChildID, I
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accChildCount(long* pcountChildren)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -864,7 +878,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accChildCount(long* pcountChil
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accParent(IDispatch** ppdispParent)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -887,7 +901,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accParent(IDispatch** ppdispPa
HRESULT STDMETHODCALLTYPE QWindowsAccessible::accDoDefaultAction(VARIANT varID)
{
Q_UNUSED(varID);
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -904,7 +918,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accDoDefaultAction(VARIANT varID)
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accDefaultAction(VARIANT varID, BSTR* pszDefaultAction)
{
Q_UNUSED(varID);
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -919,7 +933,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accDefaultAction(VARIANT varID
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accDescription(VARIANT varID, BSTR* pszDescription)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -944,7 +958,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accDescription(VARIANT varID,
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accHelp(VARIANT varID, BSTR *pszHelp)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -974,7 +988,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accHelpTopic(BSTR *, VARIANT,
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accKeyboardShortcut(VARIANT varID, BSTR *pszKeyboardShortcut)
{
Q_UNUSED(varID);
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -1004,7 +1018,7 @@ static QAccessibleInterface *relatedInterface(QAccessibleInterface *iface, QAcce
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accName(VARIANT varID, BSTR* pszName)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -1040,14 +1054,14 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accName(VARIANT varID, BSTR* p
HRESULT STDMETHODCALLTYPE QWindowsAccessible::put_accName(VARIANT, BSTR)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
return DISP_E_MEMBERNOTFOUND;
}
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accRole(VARIANT varID, VARIANT *pvarRole)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -1075,7 +1089,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accRole(VARIANT varID, VARIANT
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accState(VARIANT varID, VARIANT *pvarState)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -1151,7 +1165,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accState(VARIANT varID, VARIAN
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accValue(VARIANT varID, BSTR* pszValue)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid() || varID.lVal)
return E_FAIL;
@ -1172,7 +1186,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accValue(VARIANT varID, BSTR*
HRESULT STDMETHODCALLTYPE QWindowsAccessible::put_accValue(VARIANT, BSTR)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
return DISP_E_MEMBERNOTFOUND;
}
@ -1181,7 +1195,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accSelect(long flagsSelect, VARIAN
{
Q_UNUSED(flagsSelect);
Q_UNUSED(varID);
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -1210,7 +1224,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accSelect(long flagsSelect, VARIAN
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accFocus(VARIANT *pvarID)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;
@ -1232,7 +1246,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accFocus(VARIANT *pvarID)
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accSelection(VARIANT *pvarChildren)
{
showDebug(__FUNCTION__, accessible);
accessibleDebugClientCalls(accessible);
if (!accessible->isValid())
return E_FAIL;