From a896a1d080919093476f9155512306f58bc5f15c Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Wed, 5 May 2010 14:10:36 +0000 Subject: Bug 311632 - AccessibleObject interfering with default accessibility of Text (with Orca) --- .../swt/accessibility/AccessibleObject.java | 46 +++++++++++++++------- 1 file changed, 32 insertions(+), 14 deletions(-) (limited to 'bundles') diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java index f8209c93cb..cf46b71e81 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java @@ -2209,6 +2209,9 @@ class AccessibleObject { if (text != null && text.length () > event.offset && text.length() >= event.offset + event.length) { return getStringPtr (text.substring(event.offset, event.offset + event.length)); } + if (iface != null && iface.get_text != 0) { + return ATK.call (iface.get_text, atkObject, event.offset, event.offset + event.length); + } return 0; } } @@ -2246,6 +2249,10 @@ class AccessibleObject { return getStringPtr (text); } } + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_text != 0) { + return ATK.call (iface.get_text, atkObject, start_offset, end_offset); + } return 0; } @@ -2441,6 +2448,10 @@ class AccessibleObject { return getStringPtr (text); } } + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_text_after_offset != 0) { + return ATK.call (iface.get_text_after_offset, atkObject, offset_value, boundary_type, start_offset, end_offset); + } return 0; } @@ -2579,6 +2590,10 @@ class AccessibleObject { return getStringPtr (text); } } + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_text_at_offset != 0) { + return ATK.call (iface.get_text_at_offset, atkObject, offset_value, boundary_type, start_offset, end_offset); + } return 0; } @@ -2722,6 +2737,10 @@ class AccessibleObject { return getStringPtr (text); } } + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_text_before_offset != 0) { + return ATK.call (iface.get_text_before_offset, atkObject, offset_value, boundary_type, start_offset, end_offset); + } return 0; } @@ -2884,22 +2903,21 @@ class AccessibleObject { } String getText () { - int /*long*/ parentResult = 0; - String parentText = ""; //$NON-NLS-1$ - AtkTextIface iface = getTextIface (handle); - if (iface != null && iface.get_character_count != 0) { - int /*long*/ characterCount = ATK.call (iface.get_character_count, handle); - if (characterCount > 0 && iface.get_text != 0) { - parentResult = ATK.call (iface.get_text, handle, 0, characterCount); - if (parentResult != 0) { - parentText = getString (parentResult); - OS.g_free(parentResult); - } - } - } Vector listeners = accessible.accessibleControlListeners; int length = listeners.size(); if (length > 0) { + String parentText = ""; //$NON-NLS-1$ + AtkTextIface iface = getTextIface (handle); + if (iface != null && iface.get_character_count != 0) { + int /*long*/ characterCount = ATK.call (iface.get_character_count, handle); + if (characterCount > 0 && iface.get_text != 0) { + int /*long*/ parentResult = ATK.call (iface.get_text, handle, 0, characterCount); + if (parentResult != 0) { + parentText = getString (parentResult); + OS.g_free(parentResult); + } + } + } AccessibleControlEvent event = new AccessibleControlEvent (accessible); event.childID = id; event.result = parentText; @@ -2909,7 +2927,7 @@ class AccessibleObject { } return event.result; } - return parentText; + return null; } static int /*long*/ gObjectClass_finalize (int /*long*/ atkObject) { -- cgit