summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java
diff options
context:
space:
mode:
authorCarolyn MacLeod <carolyn>2008-05-20 18:55:36 +0000
committerCarolyn MacLeod <carolyn>2008-05-20 18:55:36 +0000
commitf69d75cc3fb0aa90baf729e9d5be0fedd8d56818 (patch)
treeeaac9fd13a9fcacac8fea2e8b62c51ea5f8ce43f /bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java
parentb334d44ba3c70fd8db4e08687ef0db9af2bd2587 (diff)
downloadeclipse.platform.swt-f69d75cc3fb0aa90baf729e9d5be0fedd8d56818.tar.gz
eclipse.platform.swt-f69d75cc3fb0aa90baf729e9d5be0fedd8d56818.tar.xz
eclipse.platform.swt-f69d75cc3fb0aa90baf729e9d5be0fedd8d56818.zip
232114 - [Accessibility] VoiceOver speaks name of some controls twice
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java55
1 files changed, 35 insertions, 20 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java
index 3b2e0065d8..ab1b54826e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java
@@ -536,27 +536,42 @@ public class Accessible {
int getTitleAttribute (int nextHandler, int theEvent, int userData) {
int code = userData != OS.eventNotHandledErr ? userData : OS.CallNextEventHandler (nextHandler, theEvent);
- String osTitleAttribute = null;
- int [] stringRef = new int [1];
- if (code == OS.noErr) {
- int status = OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, null, 4, null, stringRef);
- if (status == OS.noErr) {
- osTitleAttribute = stringRefToString (stringRef [0]);
- }
- }
- AccessibleEvent event = new AccessibleEvent(this);
- event.childID = getChildIDFromEvent(theEvent);
- event.result = osTitleAttribute;
- for (int i = 0; i < accessibleListeners.size(); i++) {
- AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
- listener.getName(event);
+ int childID = getChildIDFromEvent(theEvent);
+
+ /*
+ * Feature of the Macintosh. The text of a Label is returned in its value,
+ * not its title, so ensure that the role is not Label before asking for the title.
+ */
+ AccessibleControlEvent roleEvent = new AccessibleControlEvent(this);
+ roleEvent.childID = childID;
+ roleEvent.detail = -1;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getRole(roleEvent);
}
- if (event.result != null) {
- stringRef [0] = stringToStringRef (event.result);
- if (stringRef [0] != 0) {
- OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, stringRef);
- OS.CFRelease(stringRef [0]);
- code = OS.noErr;
+ if (roleEvent.detail != ACC.ROLE_LABEL) {
+ String osTitleAttribute = null;
+ int [] stringRef = new int [1];
+ if (code == OS.noErr) {
+ int status = OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, null, 4, null, stringRef);
+ if (status == OS.noErr) {
+ osTitleAttribute = stringRefToString (stringRef [0]);
+ }
+ }
+ AccessibleEvent event = new AccessibleEvent(this);
+ event.childID = childID;
+ event.result = osTitleAttribute;
+ for (int i = 0; i < accessibleListeners.size(); i++) {
+ AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
+ listener.getName(event);
+ }
+ if (event.result != null) {
+ stringRef [0] = stringToStringRef (event.result);
+ if (stringRef [0] != 0) {
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, stringRef);
+ OS.CFRelease(stringRef [0]);
+ code = OS.noErr;
+ }
}
}
return code;