summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsaccessibility.cpp
diff options
context:
space:
mode:
authorJan-Arve Saether <jan-arve.saether@nokia.com>2012-03-02 16:06:04 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-02 18:35:21 +0100
commitc531fcc92eeae600732d8e9fb63b70889322c018 (patch)
tree0aa99d9c31471f38d8aa1c8bdf6a42c0cc593be1 /src/plugins/platforms/windows/qwindowsaccessibility.cpp
parentdb1aa6dd99aa7ce3118452c811dcf88a863511d7 (diff)
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>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsaccessibility.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsaccessibility.cpp72
1 files changed, 43 insertions, 29 deletions
diff --git a/src/plugins/platforms/windows/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/qwindowsaccessibility.cpp
index 3ef21fa0b7..4c24cdd8d0 100644
--- a/src/plugins/platforms/windows/qwindowsaccessibility.cpp
+++ b/src/plugins/platforms/windows/qwindowsaccessibility.cpp
@@ -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
+static inline bool debug_accessibility()
+{
+ 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 accessibleDebug()
+#endif
-void showDebug(const char* funcName, const QAccessibleInterface *iface)
+//#define DEBUG_SHOW_ATCLIENT_COMMANDS
+#if defined(DEBUG_SHOW_ATCLIENT_COMMANDS)
+void accessibleDebugClientCalls_helper(const char* funcName, const QAccessibleInterface *iface)
{
- qDebug() << "Role:" << qAccessibleRoleString(iface->role(0))
- << "Name:" << iface->text(QAccessible::Name, 0)
- << "State:" << QString::number(int(iface->state(0)), 16)
- << QLatin1String(funcName);
+ QString str;
+ QDebug dbg(&str);
+ dbg << iface << QLatin1String(funcName);
+ accessibleDebug("%s", qPrintable(str));
}
+# define accessibleDebugClientCalls(iface) accessibleDebugClientCalls_helper(Q_FUNC_INFO, iface)
#else
-# define showDebug(f, iface)
+# 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;