8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
Move files from open to closed Reviewed-by: prr, mchung, erikj, ihse, serb, bpatel
This commit is contained in:
parent
78bab3fc15
commit
a6872dbbfb
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -168,9 +168,6 @@ POLICY_SRC_LIST :=
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
|
||||
ifndef OPENJDK
|
||||
POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
|
||||
endif
|
||||
endif
|
||||
|
||||
POLICY_SRC_LIST += $(POLICY_SRC)
|
||||
|
47
jdk/make/copy/Copy-jdk.accessibility.gmk
Normal file
47
jdk/make/copy/Copy-jdk.accessibility.gmk
Normal file
@ -0,0 +1,47 @@
|
||||
#
|
||||
# Copyright (c) 2104, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
include CopyCommon.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
TARGETS += $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCallbacks.h \
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.h \
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgePackages.h \
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.c \
|
||||
$(CONF_DST_DIR)/accessibility.properties
|
||||
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/%: \
|
||||
$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge/%
|
||||
$(install-file)
|
||||
|
||||
$(CONF_DST_DIR)/accessibility.properties: \
|
||||
$(JDK_TOPDIR)/src/jdk.accessibility/windows/conf/accessibility.properties
|
||||
$(install-file)
|
||||
|
||||
endif
|
||||
|
||||
################################################################################
|
60
jdk/make/launcher/Launcher-jdk.accessibility.gmk
Normal file
60
jdk/make/launcher/Launcher-jdk.accessibility.gmk
Normal file
@ -0,0 +1,60 @@
|
||||
#
|
||||
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
include LauncherCommon.gmk
|
||||
|
||||
################################################################################
|
||||
# jabswitch
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
|
||||
JABSWITCH_SRC := $(JDK_TOPDIR)/src/jdk.accessibility/windows/native/jabswitch
|
||||
ACCESSBRIDGE_SRC := $(JDK_TOPDIR)/src/jdk.accessibility/windows/native/common
|
||||
|
||||
$(eval $(call SetupNativeCompilation,BUILD_JABSWITCH, \
|
||||
SRC := $(JABSWITCH_SRC), \
|
||||
INCLUDE_FILES := jabswitch.cpp, \
|
||||
LANG := C++, \
|
||||
CFLAGS := $(filter-out -Zc:wchar_t-, $(CFLAGS_JDKEXE)) -Zc:wchar_t \
|
||||
-analyze- -Od -Gd -D_WINDOWS \
|
||||
-D_UNICODE -DUNICODE -RTC1 -EHsc, \
|
||||
DISABLED_WARNINGS_microsoft := 4267, \
|
||||
LDFLAGS := $(LDFLAGS_JDKEXE) \
|
||||
Advapi32.lib Version.lib User32.lib, \
|
||||
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jabswitch, \
|
||||
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
|
||||
PROGRAM := jabswitch, \
|
||||
DEBUG_SYMBOLS := true, \
|
||||
VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRC)/AccessBridgeStatusWindow.RC, \
|
||||
RC_FLAGS := $(RC_FLAGS) \
|
||||
-D "JDK_FNAME=jabswitch.exe" \
|
||||
-D "JDK_INTERNAL_NAME=jabswitch" \
|
||||
-D "JDK_FTYPE=0x01L", \
|
||||
MANIFEST := $(JABSWITCH_SRC)/jabswitch.manifest))
|
||||
|
||||
TARGETS += $(BUILD_JABSWITCH)
|
||||
endif
|
||||
|
||||
################################################################################
|
138
jdk/make/lib/Lib-jdk.accessibility.gmk
Normal file
138
jdk/make/lib/Lib-jdk.accessibility.gmk
Normal file
@ -0,0 +1,138 @@
|
||||
#
|
||||
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
include LibCommon.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
|
||||
ROOT_SRCDIR := $(JDK_TOPDIR)/src/jdk.accessibility/windows/native
|
||||
JAVA_AB_SRCDIR := $(ROOT_SRCDIR)/libjavaaccessbridge $(ROOT_SRCDIR)/common
|
||||
WIN_AB_SRCDIR := $(ROOT_SRCDIR)/libwindowsaccessbridge $(ROOT_SRCDIR)/common
|
||||
SYSINFO_SRCDIR := $(ROOT_SRCDIR)/libjabsysinfo
|
||||
ACCESSBRIDGE_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/jdk.accessibility \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/include
|
||||
|
||||
define SetupJavaDLL
|
||||
# Parameter 1 Suffix
|
||||
# Parameter 2 ACCESSBRIDGE_ARCH_ suffix
|
||||
|
||||
$(call SetupNativeCompilation,BUILD_JAVAACCESSBRIDGE$1, \
|
||||
LIBRARY = javaaccessbridge$1, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
SRC := $(JAVA_AB_SRCDIR), \
|
||||
LANG := C++, \
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) $(ACCESSBRIDGE_CFLAGS) \
|
||||
$(addprefix -I,$(JAVA_AB_SRCDIR)) \
|
||||
-I$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge \
|
||||
-DACCESSBRIDGE_ARCH_$2, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
|
||||
winspool.lib comdlg32.lib advapi32.lib shell32.lib \
|
||||
$(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib \
|
||||
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
|
||||
-subsystem:windows, \
|
||||
VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
|
||||
RC_FLAGS := $(RC_FLAGS) \
|
||||
-D "JDK_FNAME=javaaccessbridge$1.dll" \
|
||||
-D "JDK_INTERNAL_NAME=javaaccessbridge$1" \
|
||||
-D "JDK_FTYPE=0x02L", \
|
||||
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavaaccessbridge$1, \
|
||||
DEBUG_SYMBOLS := true)
|
||||
|
||||
$$(BUILD_JAVAACCESSBRIDGE$1): $(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib
|
||||
|
||||
TARGETS += $$(BUILD_JAVAACCESSBRIDGE$1)
|
||||
endef
|
||||
|
||||
define SetupWinDLL
|
||||
# Parameter 1 Suffix
|
||||
# Parameter 2 ACCESSBRIDGE_ARCH_ suffix
|
||||
$(call SetupNativeCompilation,BUILD_WINDOWSACCESSBRIDGE$1, \
|
||||
LIBRARY = windowsaccessbridge$1, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
SRC := $(WIN_AB_SRCDIR), \
|
||||
LANG := C++, \
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS := $(filter-out -MD, $(CFLAGS_JDKLIB)) -MT $(ACCESSBRIDGE_CFLAGS) \
|
||||
$(addprefix -I,$(WIN_AB_SRCDIR)) \
|
||||
-I$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge \
|
||||
-DACCESSBRIDGE_ARCH_$2, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
|
||||
winspool.lib comdlg32.lib advapi32.lib shell32.lib \
|
||||
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
|
||||
-subsystem:windows \
|
||||
-def:$(ROOT_SRCDIR)/libwindowsaccessbridge/WinAccessBridge.DEF, \
|
||||
VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
|
||||
RC_FLAGS := $(RC_FLAGS) \
|
||||
-D "JDK_FNAME=windowsaccessbridge$1.dll" \
|
||||
-D "JDK_INTERNAL_NAME=windowsaccessbridge$1" \
|
||||
-D "JDK_FTYPE=0x02L", \
|
||||
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libwindowsaccessbridge$1, \
|
||||
DEBUG_SYMBOLS := true)
|
||||
|
||||
TARGETS += $$(BUILD_WINDOWSACCESSBRIDGE$1)
|
||||
|
||||
endef
|
||||
|
||||
define SetupAccessBridgeSysInfo
|
||||
|
||||
$(call SetupNativeCompilation,BUILD_ACCESSBRIDGESYSINFO, \
|
||||
LIBRARY = jabsysinfo, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
SRC := $(SYSINFO_SRCDIR), \
|
||||
LANG := C++, \
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) $(ACCESSBRIDGE_CFLAGS), \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
-subsystem:windows -machine:I386, \
|
||||
VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
|
||||
RC_FLAGS := $(RC_FLAGS) \
|
||||
-D "JDK_FNAME=jabsysinfo.dll" \
|
||||
-D "JDK_INTERNAL_NAME=jabsysinfo" \
|
||||
-D "JDK_FTYPE=0x02L", \
|
||||
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/lib/libjabsysinfo, \
|
||||
DEBUG_SYMBOLS := true)
|
||||
|
||||
TARGETS += $$(BUILD_ACCESSBRIDGESYSINFO)
|
||||
|
||||
endef
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
|
||||
$(eval $(call SetupAccessBridgeSysInfo))
|
||||
$(eval $(call SetupJavaDLL,-32,32))
|
||||
$(eval $(call SetupJavaDLL,,LEGACY))
|
||||
$(eval $(call SetupWinDLL,-32,32))
|
||||
$(eval $(call SetupWinDLL,,LEGACY))
|
||||
else
|
||||
$(eval $(call SetupJavaDLL,,64))
|
||||
$(eval $(call SetupWinDLL,-64,64))
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
################################################################################
|
@ -4,7 +4,7 @@ java.corba
|
||||
java.transaction
|
||||
java.xml.bind
|
||||
java.xml.ws
|
||||
jdk.accessbridge
|
||||
jdk.accessibility
|
||||
jdk.crypto.ec
|
||||
jdk.crypto.mscapi
|
||||
jdk.crypto.pkcs11
|
||||
|
@ -6,3 +6,7 @@ grant codeBase "jrt:/jdk.crypto.mscapi" {
|
||||
permission java.security.SecurityPermission "clearProviderProperties.SunMSCAPI";
|
||||
permission java.security.SecurityPermission "removeProviderProperty.SunMSCAPI";
|
||||
};
|
||||
|
||||
grant codeBase "jrt:/jdk.accessibility" {
|
||||
permission java.security.AllPermission;
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,376 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util;
|
||||
|
||||
import java.util.*;
|
||||
import java.beans.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.accessibility.*;
|
||||
|
||||
/**
|
||||
* <P>{@code AccessibilityEventMonitor} implements a PropertyChange listener
|
||||
* on every UI object that implements interface {@code Accessible} in the Java
|
||||
* Virtual Machine. The events captured by these listeners are made available
|
||||
* through listeners supported by {@code AccessibilityEventMonitor}.
|
||||
* With this, all the individual events on each of the UI object
|
||||
* instances are funneled into one set of PropertyChange listeners.
|
||||
* <p>This class depends upon {@link EventQueueMonitor}, which provides the base
|
||||
* level support for capturing the top-level containers as they are created.
|
||||
*
|
||||
*/
|
||||
|
||||
@jdk.Exported
|
||||
public class AccessibilityEventMonitor {
|
||||
|
||||
// listeners
|
||||
/**
|
||||
* The current list of registered {@link java.beans.PropertyChangeListener
|
||||
* PropertyChangeListener} classes.
|
||||
*
|
||||
* @see #addPropertyChangeListener
|
||||
* @see #removePropertyChangeListener
|
||||
*/
|
||||
static protected final AccessibilityListenerList listenerList =
|
||||
new AccessibilityListenerList();
|
||||
|
||||
|
||||
/**
|
||||
* The actual listener that is installed on the component instances.
|
||||
* This listener calls the other registered listeners when an event
|
||||
* occurs. By doing things this way, the actual number of listeners
|
||||
* installed on a component instance is drastically reduced.
|
||||
*/
|
||||
static protected final AccessibilityEventListener accessibilityListener =
|
||||
new AccessibilityEventListener();
|
||||
|
||||
/**
|
||||
* Adds the specified listener to receive all PropertyChange events on
|
||||
* each UI object instance in the Java Virtual Machine as they occur.
|
||||
* <P>Note: This listener is automatically added to all component
|
||||
* instances created after this method is called. In addition, it
|
||||
* is only added to UI object instances that support this listener type.
|
||||
*
|
||||
* @param l the listener to add
|
||||
*
|
||||
* @see #removePropertyChangeListener
|
||||
*/
|
||||
static public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (listenerList.getListenerCount(PropertyChangeListener.class) == 0) {
|
||||
accessibilityListener.installListeners();
|
||||
}
|
||||
listenerList.add(PropertyChangeListener.class, l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified listener so it no longer receives PropertyChange
|
||||
* events when they occur.
|
||||
* @see #addPropertyChangeListener
|
||||
* @param l the listener to remove
|
||||
*/
|
||||
static public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
listenerList.remove(PropertyChangeListener.class, l);
|
||||
if (listenerList.getListenerCount(PropertyChangeListener.class) == 0) {
|
||||
accessibilityListener.removeListeners();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* AccessibilityEventListener is the class that does all the work for
|
||||
* AccessibilityEventMonitor. It is not intended for use by any other
|
||||
* class except AccessibilityEventMonitor.
|
||||
*
|
||||
*/
|
||||
|
||||
static class AccessibilityEventListener implements TopLevelWindowListener,
|
||||
PropertyChangeListener {
|
||||
|
||||
/**
|
||||
* Create a new instance of this class and install it on each component
|
||||
* instance in the virtual machine that supports any of the currently
|
||||
* registered listeners in AccessibilityEventMonitor. Also registers
|
||||
* itself as a TopLevelWindowListener with EventQueueMonitor so it can
|
||||
* automatically add new listeners to new components.
|
||||
* @see EventQueueMonitor
|
||||
* @see AccessibilityEventMonitor
|
||||
*/
|
||||
public AccessibilityEventListener() {
|
||||
EventQueueMonitor.addTopLevelWindowListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs PropertyChange listeners on all Accessible objects based
|
||||
* upon the current topLevelWindows cached by EventQueueMonitor.
|
||||
* @see EventQueueMonitor
|
||||
* @see AWTEventMonitor
|
||||
*/
|
||||
protected void installListeners() {
|
||||
Window topLevelWindows[] = EventQueueMonitor.getTopLevelWindows();
|
||||
if (topLevelWindows != null) {
|
||||
for (int i = 0; i < topLevelWindows.length; i++) {
|
||||
if (topLevelWindows[i] instanceof Accessible) {
|
||||
installListeners((Accessible) topLevelWindows[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs PropertyChange listeners to the Accessible object, and it's
|
||||
* children (so long as the object isn't of TRANSIENT state).
|
||||
* @param a the Accessible object to add listeners to
|
||||
*/
|
||||
protected void installListeners(Accessible a) {
|
||||
installListeners(a.getAccessibleContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs PropertyChange listeners to the AccessibleContext object,
|
||||
* and it's * children (so long as the object isn't of TRANSIENT state).
|
||||
* @param a the Accessible object to add listeners to
|
||||
*/
|
||||
private void installListeners(AccessibleContext ac) {
|
||||
|
||||
if (ac != null) {
|
||||
AccessibleStateSet states = ac.getAccessibleStateSet();
|
||||
if (!states.contains(AccessibleState.TRANSIENT)) {
|
||||
ac.addPropertyChangeListener(this);
|
||||
/*
|
||||
* Don't add listeners to transient children. Components
|
||||
* with transient children should return an AccessibleStateSet
|
||||
* containing AccessibleState.MANAGES_DESCENDANTS. Components
|
||||
* may not explicitly return the MANAGES_DESCENDANTS state.
|
||||
* In this case, don't add listeners to the children of
|
||||
* lists, tables and trees.
|
||||
*/
|
||||
AccessibleStateSet set = ac.getAccessibleStateSet();
|
||||
if (set.contains(_AccessibleState.MANAGES_DESCENDANTS)) {
|
||||
return;
|
||||
}
|
||||
AccessibleRole role = ac.getAccessibleRole();
|
||||
if (role == AccessibleRole.LIST ||
|
||||
role == AccessibleRole.TREE) {
|
||||
return;
|
||||
}
|
||||
if (role == AccessibleRole.TABLE) {
|
||||
// handle Oracle tables containing tables
|
||||
Accessible child = ac.getAccessibleChild(0);
|
||||
if (child != null) {
|
||||
AccessibleContext ac2 = child.getAccessibleContext();
|
||||
if (ac2 != null) {
|
||||
role = ac2.getAccessibleRole();
|
||||
if (role != null && role != AccessibleRole.TABLE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int count = ac.getAccessibleChildrenCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
Accessible child = ac.getAccessibleChild(i);
|
||||
if (child != null) {
|
||||
installListeners(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes PropertyChange listeners on all Accessible objects based
|
||||
* upon the topLevelWindows cached by EventQueueMonitor.
|
||||
* @param eventID the event ID
|
||||
* @see EventID
|
||||
*/
|
||||
protected void removeListeners() {
|
||||
Window topLevelWindows[] = EventQueueMonitor.getTopLevelWindows();
|
||||
if (topLevelWindows != null) {
|
||||
for (int i = 0; i < topLevelWindows.length; i++) {
|
||||
if (topLevelWindows[i] instanceof Accessible) {
|
||||
removeListeners((Accessible) topLevelWindows[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes PropertyChange listeners for the given Accessible object,
|
||||
* it's children (so long as the object isn't of TRANSIENT state).
|
||||
* @param a the Accessible object to remove listeners from
|
||||
*/
|
||||
protected void removeListeners(Accessible a) {
|
||||
removeListeners(a.getAccessibleContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes PropertyChange listeners for the given AccessibleContext
|
||||
* object, it's children (so long as the object isn't of TRANSIENT
|
||||
* state).
|
||||
* @param a the Accessible object to remove listeners from
|
||||
*/
|
||||
private void removeListeners(AccessibleContext ac) {
|
||||
|
||||
|
||||
if (ac != null) {
|
||||
// Listeners are not added to transient components.
|
||||
AccessibleStateSet states = ac.getAccessibleStateSet();
|
||||
if (!states.contains(AccessibleState.TRANSIENT)) {
|
||||
ac.removePropertyChangeListener(this);
|
||||
/*
|
||||
* Listeners are not added to transient children. Components
|
||||
* with transient children should return an AccessibleStateSet
|
||||
* containing AccessibleState.MANAGES_DESCENDANTS. Components
|
||||
* may not explicitly return the MANAGES_DESCENDANTS state.
|
||||
* In this case, don't remove listeners from the children of
|
||||
* lists, tables and trees.
|
||||
*/
|
||||
if (states.contains(_AccessibleState.MANAGES_DESCENDANTS)) {
|
||||
return;
|
||||
}
|
||||
AccessibleRole role = ac.getAccessibleRole();
|
||||
if (role == AccessibleRole.LIST ||
|
||||
role == AccessibleRole.TABLE ||
|
||||
role == AccessibleRole.TREE) {
|
||||
return;
|
||||
}
|
||||
int count = ac.getAccessibleChildrenCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
Accessible child = ac.getAccessibleChild(i);
|
||||
if (child != null) {
|
||||
removeListeners(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Listener Interface Methods */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
|
||||
/* TopLevelWindow Methods ***************************************/
|
||||
|
||||
/**
|
||||
* Called when top level window is created.
|
||||
* @see EventQueueMonitor
|
||||
* @see EventQueueMonitor#addTopLevelWindowListener
|
||||
*/
|
||||
public void topLevelWindowCreated(Window w) {
|
||||
if (w instanceof Accessible) {
|
||||
installListeners((Accessible) w);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when top level window is destroyed.
|
||||
* @see EventQueueMonitor
|
||||
* @see EventQueueMonitor#addTopLevelWindowListener
|
||||
*/
|
||||
public void topLevelWindowDestroyed(Window w) {
|
||||
if (w instanceof Accessible) {
|
||||
removeListeners((Accessible) w);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* PropertyChangeListener Methods **************************************/
|
||||
|
||||
public void propertyChange(PropertyChangeEvent e) {
|
||||
// propogate the event
|
||||
Object[] listeners =
|
||||
AccessibilityEventMonitor.listenerList.getListenerList();
|
||||
for (int i = listeners.length-2; i>=0; i-=2) {
|
||||
if (listeners[i]==PropertyChangeListener.class) {
|
||||
((PropertyChangeListener)listeners[i+1]).propertyChange(e);
|
||||
}
|
||||
}
|
||||
|
||||
// handle childbirth/death
|
||||
String name = e.getPropertyName();
|
||||
if (name.compareTo(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY) == 0) {
|
||||
Object oldValue = e.getOldValue();
|
||||
Object newValue = e.getNewValue();
|
||||
|
||||
if ((oldValue == null) ^ (newValue == null)) { // one null, not both
|
||||
if (oldValue != null) {
|
||||
// this Accessible is a child that's going away
|
||||
if (oldValue instanceof Accessible) {
|
||||
Accessible a = (Accessible) oldValue;
|
||||
removeListeners(a.getAccessibleContext());
|
||||
} else if (oldValue instanceof AccessibleContext) {
|
||||
removeListeners((AccessibleContext) oldValue);
|
||||
}
|
||||
} else if (newValue != null) {
|
||||
// this Accessible is a child was just born
|
||||
if (newValue instanceof Accessible) {
|
||||
Accessible a = (Accessible) newValue;
|
||||
installListeners(a.getAccessibleContext());
|
||||
} else if (newValue instanceof AccessibleContext) {
|
||||
installListeners((AccessibleContext) newValue);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("ERROR in usage of PropertyChangeEvents for: " + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* workaround for no public AccessibleState constructor
|
||||
*/
|
||||
class _AccessibleState extends AccessibleState {
|
||||
/**
|
||||
* Indicates this object is responsible for managing its
|
||||
* subcomponents. This is typically used for trees and tables
|
||||
* that have a large number of subcomponents and where the
|
||||
* objects are created only when needed and otherwise remain virtual.
|
||||
* The application should not manage the subcomponents directly.
|
||||
*/
|
||||
public static final _AccessibleState MANAGES_DESCENDANTS
|
||||
= new _AccessibleState ("managesDescendants");
|
||||
|
||||
/**
|
||||
* Creates a new AccessibleState using the given locale independent key.
|
||||
* This should not be a public method. Instead, it is used to create
|
||||
* the constants in this file to make it a strongly typed enumeration.
|
||||
* Subclasses of this class should enforce similar policy.
|
||||
* <p>
|
||||
* The key String should be a locale independent key for the state.
|
||||
* It is not intended to be used as the actual String to display
|
||||
* to the user. To get the localized string, use toDisplayString.
|
||||
*
|
||||
* @param key the locale independent name of the state.
|
||||
* @see AccessibleBundle#toDisplayString
|
||||
*/
|
||||
protected _AccessibleState(String key) {
|
||||
super(key);
|
||||
}
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util;
|
||||
|
||||
import java.util.*;
|
||||
import java.beans.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.accessibility.*;
|
||||
|
||||
/**
|
||||
* <P>The {@code AccessibilityListenerList} is a copy of the Swing
|
||||
* {@link javax.swing.event.EventListenerList EventListerList} class.
|
||||
*
|
||||
*/
|
||||
|
||||
@jdk.Exported
|
||||
public class AccessibilityListenerList {
|
||||
/* A null array to be shared by all empty listener lists */
|
||||
private final static Object[] NULL_ARRAY = new Object[0];
|
||||
|
||||
/**
|
||||
* The list of listener type, listener pairs
|
||||
*/
|
||||
protected transient Object[] listenerList = NULL_ARRAY;
|
||||
|
||||
/**
|
||||
* Passes back the event listener list as an array of listener type, listener pairs.
|
||||
* Note that for performance reasons, this implementation passes back the actual
|
||||
* data structure in which the listener data is stored internally. This method
|
||||
* is guaranteed to pass back a non-null array, so that no null-checking
|
||||
* is required in fire methods. A zero-length array of Object is returned if
|
||||
* there are currently no listeners.
|
||||
* <p>
|
||||
* Absolutely no modification of the data contained in this array should be
|
||||
* made. If any such manipulation is necessary, it should be done on a copy
|
||||
* of the array returned rather than the array itself.
|
||||
*
|
||||
* @return an array of listener type, listener pairs.
|
||||
*/
|
||||
public Object[] getListenerList() {
|
||||
return listenerList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total number of listeners for this listener list.
|
||||
*
|
||||
* @return the total number of listeners for this listener list.
|
||||
*/
|
||||
public int getListenerCount() {
|
||||
return listenerList.length/2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the total number of listeners of the supplied type
|
||||
* for this listener list.
|
||||
*
|
||||
* @param t the type of the listener to be counted
|
||||
* @return the number of listeners found
|
||||
*/
|
||||
public int getListenerCount(Class<? extends EventListener> t) {
|
||||
int count = 0;
|
||||
Object[] lList = listenerList;
|
||||
for (int i = 0; i < lList.length; i+=2) {
|
||||
if (t == (Class)lList[i])
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the listener as a listener of the specified type.
|
||||
*
|
||||
* @param t the type of the listener to be added
|
||||
* @param l the listener to be added
|
||||
*/
|
||||
public synchronized void add(Class<? extends EventListener> t, EventListener l) {
|
||||
if (!t.isInstance(l)) {
|
||||
throw new IllegalArgumentException("Listener " + l +
|
||||
" is not of type " + t);
|
||||
}
|
||||
if (l ==null) {
|
||||
throw new IllegalArgumentException("Listener " + l +
|
||||
" is null");
|
||||
}
|
||||
if (listenerList == NULL_ARRAY) {
|
||||
// if this is the first listener added,
|
||||
// initialize the lists
|
||||
listenerList = new Object[] { t, l };
|
||||
} else {
|
||||
// Otherwise copy the array and add the new listener
|
||||
int i = listenerList.length;
|
||||
Object[] tmp = new Object[i+2];
|
||||
System.arraycopy(listenerList, 0, tmp, 0, i);
|
||||
|
||||
tmp[i] = t;
|
||||
tmp[i+1] = l;
|
||||
|
||||
listenerList = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the listener as a listener of the specified type.
|
||||
*
|
||||
* @param t the type of the listener to be removed
|
||||
* @param l the listener to be removed
|
||||
*/
|
||||
public synchronized void remove(Class<? extends EventListener> t, EventListener l) {
|
||||
if (!t.isInstance(l)) {
|
||||
throw new IllegalArgumentException("Listener " + l +
|
||||
" is not of type " + t);
|
||||
}
|
||||
if (l ==null) {
|
||||
throw new IllegalArgumentException("Listener " + l +
|
||||
" is null");
|
||||
}
|
||||
|
||||
// Is l on the list?
|
||||
int index = -1;
|
||||
for (int i = listenerList.length-2; i>=0; i-=2) {
|
||||
if ((listenerList[i]==t) && (listenerList[i+1] == l)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If so, remove it
|
||||
if (index != -1) {
|
||||
Object[] tmp = new Object[listenerList.length-2];
|
||||
// Copy the list up to index
|
||||
System.arraycopy(listenerList, 0, tmp, 0, index);
|
||||
// Copy from two past the index, up to
|
||||
// the end of tmp (which is two elements
|
||||
// shorter than the old list)
|
||||
if (index < tmp.length)
|
||||
System.arraycopy(listenerList, index+2, tmp, index,
|
||||
tmp.length - index);
|
||||
// set the listener array to the new array or null
|
||||
listenerList = (tmp.length == 0) ? NULL_ARRAY : tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string representation of the {@code AccessibilityListenerList}.
|
||||
*
|
||||
* @return a string representation of the {@code AccessibilityListenerList}.
|
||||
*/
|
||||
public String toString() {
|
||||
Object[] lList = listenerList;
|
||||
String s = "EventListenerList: ";
|
||||
s += lList.length/2 + " listeners: ";
|
||||
for (int i = 0 ; i <= lList.length-2 ; i+=2) {
|
||||
s += " type " + ((Class)lList[i]).getName();
|
||||
s += " listener " + lList[i+1];
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
@ -0,0 +1,206 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util;
|
||||
|
||||
/**
|
||||
* EventID contains integer constants that map to event support in
|
||||
* AWT and Swing. They are used by primarily by AWTEventMonitor,
|
||||
* AWTEventsListener, SwingEventMonitor, and SwingEventListener, but
|
||||
* can be freely used by any other class.
|
||||
*
|
||||
* @see AWTEventMonitor
|
||||
* @see SwingEventMonitor
|
||||
*
|
||||
*/
|
||||
@jdk.Exported
|
||||
public class EventID {
|
||||
|
||||
/**
|
||||
* Maps to AWT Action support (i.e., ActionListener and ActionEvent)
|
||||
*/
|
||||
static public final int ACTION = 0;
|
||||
|
||||
/**
|
||||
* Maps to AWT Adjustment support (i.e., AdjustmentListener
|
||||
* and AdjustmentEvent)
|
||||
*/
|
||||
static public final int ADJUSTMENT = 1;
|
||||
|
||||
/**
|
||||
* Maps to AWT Component support (i.e., ComponentListener
|
||||
* and ComponentEvent)
|
||||
*/
|
||||
static public final int COMPONENT = 2;
|
||||
|
||||
/**
|
||||
* Maps to AWT Container support (i.e., ContainerListener
|
||||
* and ContainerEvent)
|
||||
*/
|
||||
static public final int CONTAINER = 3;
|
||||
|
||||
/**
|
||||
* Maps to AWT Focus support (i.e., FocusListener and FocusEvent)
|
||||
*/
|
||||
static public final int FOCUS = 4;
|
||||
|
||||
/**
|
||||
* Maps to AWT Item support (i.e., ItemListener and ItemEvent)
|
||||
*/
|
||||
static public final int ITEM = 5;
|
||||
|
||||
/**
|
||||
* Maps to AWT Key support (i.e., KeyListener and KeyEvent)
|
||||
*/
|
||||
static public final int KEY = 6;
|
||||
|
||||
/**
|
||||
* Maps to AWT Mouse support (i.e., MouseListener and MouseEvent)
|
||||
*/
|
||||
static public final int MOUSE = 7;
|
||||
|
||||
/**
|
||||
* Maps to AWT MouseMotion support (i.e., MouseMotionListener
|
||||
* and MouseMotionEvent)
|
||||
*/
|
||||
static public final int MOTION = 8;
|
||||
|
||||
/**
|
||||
* Maps to AWT Text support (i.e., TextListener and TextEvent)
|
||||
*/
|
||||
static public final int TEXT = 10;
|
||||
|
||||
/**
|
||||
* Maps to AWT Window support (i.e., WindowListener and WindowEvent)
|
||||
*/
|
||||
static public final int WINDOW = 11;
|
||||
|
||||
/**
|
||||
* Maps to Swing Ancestor support (i.e., AncestorListener and
|
||||
* AncestorEvent)
|
||||
*/
|
||||
static public final int ANCESTOR = 12;
|
||||
|
||||
/**
|
||||
* Maps to Swing Text Caret support (i.e., CaretListener and
|
||||
* CaretEvent)
|
||||
*/
|
||||
static public final int CARET = 13;
|
||||
|
||||
/**
|
||||
* Maps to Swing CellEditor support (i.e., CellEditorListener and
|
||||
* CellEditorEvent)
|
||||
*/
|
||||
static public final int CELLEDITOR = 14;
|
||||
|
||||
/**
|
||||
* Maps to Swing Change support (i.e., ChangeListener and
|
||||
* ChangeEvent)
|
||||
*/
|
||||
static public final int CHANGE = 15;
|
||||
|
||||
/**
|
||||
* Maps to Swing TableColumnModel support (i.e.,
|
||||
* TableColumnModelListener and TableColumnModelEvent)
|
||||
*/
|
||||
static public final int COLUMNMODEL = 16;
|
||||
|
||||
/**
|
||||
* Maps to Swing Document support (i.e., DocumentListener and
|
||||
* DocumentEvent)
|
||||
*/
|
||||
static public final int DOCUMENT = 17;
|
||||
|
||||
/**
|
||||
* Maps to Swing ListData support (i.e., ListDataListener and
|
||||
* ListDataEvent)
|
||||
*/
|
||||
static public final int LISTDATA = 18;
|
||||
|
||||
/**
|
||||
* Maps to Swing ListSelection support (i.e., ListSelectionListener and
|
||||
* ListSelectionEvent)
|
||||
*/
|
||||
static public final int LISTSELECTION = 19;
|
||||
|
||||
/**
|
||||
* Maps to Swing Menu support (i.e., MenuListener and
|
||||
* MenuEvent)
|
||||
*/
|
||||
static public final int MENU = 20;
|
||||
|
||||
/**
|
||||
* Maps to Swing PopupMenu support (i.e., PopupMenuListener and
|
||||
* PopupMenuEvent)
|
||||
*/
|
||||
static public final int POPUPMENU = 21;
|
||||
|
||||
/**
|
||||
* Maps to Swing TableModel support (i.e., TableModelListener and
|
||||
* TableModelEvent)
|
||||
*/
|
||||
static public final int TABLEMODEL = 22;
|
||||
|
||||
/**
|
||||
* Maps to Swing TreeExpansion support (i.e., TreeExpansionListener and
|
||||
* TreeExpansionEvent)
|
||||
*/
|
||||
static public final int TREEEXPANSION = 23;
|
||||
|
||||
/**
|
||||
* Maps to Swing TreeModel support (i.e., TreeModelListener and
|
||||
* TreeModelEvent)
|
||||
*/
|
||||
static public final int TREEMODEL = 24;
|
||||
|
||||
/**
|
||||
* Maps to Swing TreeSelection support (i.e., TreeSelectionListener and
|
||||
* TreeSelectionEvent)
|
||||
*/
|
||||
static public final int TREESELECTION = 25;
|
||||
|
||||
/**
|
||||
* Maps to Swing UndoableEdit support (i.e., UndoableEditListener and
|
||||
* UndoableEditEvent)
|
||||
*/
|
||||
static public final int UNDOABLEEDIT = 26;
|
||||
|
||||
/**
|
||||
* Maps to Beans PropertyChange support (i.e., PropertyChangeListener
|
||||
* and PropertyChangeEvent)
|
||||
*/
|
||||
static public final int PROPERTYCHANGE = 27;
|
||||
|
||||
/**
|
||||
* Maps to Beans VetoableChange support (i.e., VetoableChangeListener
|
||||
* and VetoableChangeEvent)
|
||||
*/
|
||||
static public final int VETOABLECHANGE = 28;
|
||||
|
||||
/**
|
||||
* Maps to Swing InternalFrame support (i.e., InternalFrameListener)
|
||||
*/
|
||||
static public final int INTERNALFRAME = 29;
|
||||
}
|
@ -0,0 +1,619 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util;
|
||||
|
||||
import java.util.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.accessibility.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
/**
|
||||
* The {@code EventQueueMonitor} class provides key core functionality for Assistive
|
||||
* Technologies (and other system-level technologies that need some of the same
|
||||
* things that Assistive Technology needs).
|
||||
*
|
||||
* @see AWTEventMonitor
|
||||
* @see SwingEventMonitor
|
||||
*/
|
||||
@jdk.Exported
|
||||
public class EventQueueMonitor
|
||||
implements AWTEventListener {
|
||||
|
||||
// NOTE: All of the following properties are static. The reason
|
||||
// for this is that there may be multiple EventQueue instances
|
||||
// in use in the same VM. By making these properties static,
|
||||
// we can guarantee we get the information from all of the
|
||||
// EventQueue instances.
|
||||
|
||||
// The stuff that is cached.
|
||||
//
|
||||
static Vector<Container>topLevelWindows = new Vector<>();
|
||||
static Window topLevelWindowWithFocus = null;
|
||||
static Point currentMousePosition = null;
|
||||
static Component currentMouseComponent = null;
|
||||
|
||||
// Low-level listener interfaces
|
||||
//
|
||||
static GUIInitializedListener guiInitializedListener = null;
|
||||
static TopLevelWindowListener topLevelWindowListener = null;
|
||||
static MouseMotionListener mouseMotionListener = null;
|
||||
|
||||
/**
|
||||
* Class variable stating whether the assistive technologies have
|
||||
* been loaded yet or not. The assistive technologies won't be
|
||||
* loaded until the first event is posted to the EventQueue. This
|
||||
* gives the toolkit a chance to do all the necessary initialization
|
||||
* it needs to do.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class variable stating whether the GUI subsystem has been initialized
|
||||
* or not.
|
||||
*
|
||||
* @see #isGUIInitialized
|
||||
*/
|
||||
static boolean guiInitialized = false;
|
||||
|
||||
/**
|
||||
* Queue that holds events for later processing.
|
||||
*/
|
||||
static EventQueueMonitorItem componentEventQueue = null;
|
||||
|
||||
/**
|
||||
* Class that tells us what the component event dispatch thread is.
|
||||
*/
|
||||
static private ComponentEvtDispatchThread cedt = null;
|
||||
|
||||
/**
|
||||
* Handle the synchronization between the thing that populates the
|
||||
* component event dispatch thread ({@link #queueComponentEvent})
|
||||
* and the thing that processes the events ({@link ComponentEvtDispatchThread}).
|
||||
*/
|
||||
static Object componentEventQueueLock = new Object();
|
||||
|
||||
/**
|
||||
* Create a new {@code EventQueueMonitor} instance. Normally, this will
|
||||
* be called only by the AWT Toolkit during initialization time.
|
||||
* Assistive technologies should not create instances of
|
||||
* EventQueueMonitor by themselves. Instead, they should either
|
||||
* refer to it directly via the static methods in this class, e.g.,
|
||||
* {@link #getCurrentMousePosition} or obtain the instance by asking the
|
||||
* Toolkit, e.g., {@link java.awt.Toolkit#getSystemEventQueue}.
|
||||
*/
|
||||
public EventQueueMonitor() {
|
||||
if (cedt == null) {
|
||||
cedt = new ComponentEvtDispatchThread("EventQueueMonitor-ComponentEvtDispatch");
|
||||
|
||||
cedt.setDaemon(true);
|
||||
cedt.start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue up a {@link java.awt.event.ComponentEvent ComponentEvent} for later
|
||||
* processing by the {@link ComponentEvtDispatch} thread.
|
||||
*
|
||||
* @param e a {@code ComponentEvent}
|
||||
*/
|
||||
static void queueComponentEvent(ComponentEvent e) {
|
||||
synchronized(componentEventQueueLock) {
|
||||
EventQueueMonitorItem eqi = new EventQueueMonitorItem(e);
|
||||
if (componentEventQueue == null) {
|
||||
componentEventQueue = eqi;
|
||||
} else {
|
||||
EventQueueMonitorItem q = componentEventQueue;
|
||||
while (true) {
|
||||
if (q.next != null) {
|
||||
q = q.next;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
q.next = eqi;
|
||||
}
|
||||
componentEventQueueLock.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the {@code EventQueueMonitor} to start listening for events.
|
||||
*/
|
||||
public static void maybeInitialize() {
|
||||
if (cedt == null) {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
try {
|
||||
long eventMask = AWTEvent.WINDOW_EVENT_MASK |
|
||||
AWTEvent.FOCUS_EVENT_MASK |
|
||||
AWTEvent.MOUSE_MOTION_EVENT_MASK;
|
||||
|
||||
Toolkit.getDefaultToolkit().addAWTEventListener(new EventQueueMonitor(), eventMask);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle events as a result of registering a listener
|
||||
* on the {@link java.awt.EventQueue EventQueue} in {@link #maybeInitialize}.
|
||||
*/
|
||||
public void eventDispatched(AWTEvent theEvent) {
|
||||
processEvent(theEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assisitive technologies that have
|
||||
* registered a {@link GUIInitializedListener} will be notified.
|
||||
*
|
||||
* @see #addGUIInitializedListener
|
||||
*/
|
||||
static void maybeNotifyAssistiveTechnologies() {
|
||||
|
||||
if (!guiInitialized) {
|
||||
guiInitialized = true;
|
||||
if (guiInitializedListener != null) {
|
||||
guiInitializedListener.guiInitialized();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Package Private Methods */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
|
||||
/**
|
||||
* Add a Container to the list of top-level containers
|
||||
* in the cache. This follows the object's hierarchy up the
|
||||
* tree until it finds the top most parent. If the parent is
|
||||
* not already in the list of Containers, it adds it to the list.
|
||||
*
|
||||
* @param c the Container
|
||||
*/
|
||||
static void addTopLevelWindow(Component c) {
|
||||
Container parent;
|
||||
|
||||
if (c == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(c instanceof Window)) {
|
||||
addTopLevelWindow(c.getParent());
|
||||
return;
|
||||
}
|
||||
|
||||
if ((c instanceof Dialog) || (c instanceof Window)) {
|
||||
parent = (Container) c;
|
||||
} else {
|
||||
parent = c.getParent();
|
||||
if (parent != null) {
|
||||
addTopLevelWindow(parent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (parent == null) {
|
||||
parent = (Container) c;
|
||||
}
|
||||
|
||||
// Because this method is static, do not make it synchronized because
|
||||
// it can lock the whole class. Instead, just lock what needs to be
|
||||
// locked.
|
||||
//
|
||||
synchronized (topLevelWindows) {
|
||||
if ((parent != null) && !topLevelWindows.contains(parent)) {
|
||||
topLevelWindows.addElement(parent);
|
||||
if (topLevelWindowListener != null) {
|
||||
topLevelWindowListener.topLevelWindowCreated((Window) parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a container from the list of top level containers in the cache.
|
||||
*
|
||||
* @param c the top level container to remove
|
||||
*/
|
||||
static void removeTopLevelWindow(Window w) {
|
||||
|
||||
// Because this method is static, do not make it synchronized because
|
||||
// it can lock the whole class. Instead, just lock what needs to be
|
||||
// locked.
|
||||
//
|
||||
synchronized (topLevelWindows) {
|
||||
if (topLevelWindows.contains(w)) {
|
||||
topLevelWindows.removeElement(w);
|
||||
if (topLevelWindowListener != null) {
|
||||
topLevelWindowListener.topLevelWindowDestroyed(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update current mouse position.
|
||||
*
|
||||
* @param mouseEvent the MouseEvent that holds the new mouse position.
|
||||
*/
|
||||
static void updateCurrentMousePosition(MouseEvent mouseEvent) {
|
||||
Point oldMousePos = currentMousePosition;
|
||||
// Be careful here. The component in the event might be
|
||||
// hidden by the time we process the event.
|
||||
try {
|
||||
Point eventPoint = mouseEvent.getPoint();
|
||||
currentMouseComponent = (Component) (mouseEvent.getSource());
|
||||
currentMousePosition = currentMouseComponent.getLocationOnScreen();
|
||||
currentMousePosition.translate(eventPoint.x,eventPoint.y);
|
||||
} catch (Exception e) {
|
||||
currentMousePosition = oldMousePos;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the event. This maintains the event cache in addition
|
||||
* to calling all the registered listeners. NOTE: The events that
|
||||
* come through here are from peered Components.
|
||||
*
|
||||
* @param theEvent the AWTEvent
|
||||
*/
|
||||
static void processEvent(AWTEvent theEvent) {
|
||||
switch (theEvent.getID()) {
|
||||
case MouseEvent.MOUSE_MOVED:
|
||||
case MouseEvent.MOUSE_DRAGGED:
|
||||
case FocusEvent.FOCUS_GAINED:
|
||||
case WindowEvent.WINDOW_DEACTIVATED:
|
||||
queueComponentEvent((ComponentEvent) theEvent);
|
||||
break;
|
||||
|
||||
case WindowEvent.WINDOW_ACTIVATED:
|
||||
// Dialogs fire WINDOW_ACTIVATED and FOCUS_GAINED events
|
||||
// before WINDOW_OPENED so we need to add topLevelListeners
|
||||
// for the dialog when it is first activated to get a
|
||||
// focus gained event for the focus component in the dialog.
|
||||
if (theEvent instanceof ComponentEvent) {
|
||||
ComponentEvent ce = (ComponentEvent)theEvent;
|
||||
if (ce.getComponent() instanceof Window) {
|
||||
EventQueueMonitor.addTopLevelWindow(ce.getComponent());
|
||||
EventQueueMonitor.maybeNotifyAssistiveTechnologies();
|
||||
} else {
|
||||
EventQueueMonitor.maybeNotifyAssistiveTechnologies();
|
||||
EventQueueMonitor.addTopLevelWindow(ce.getComponent());
|
||||
}
|
||||
}
|
||||
queueComponentEvent((ComponentEvent) theEvent);
|
||||
break;
|
||||
|
||||
// handle WINDOW_OPENED and WINDOW_CLOSED events synchronously
|
||||
case WindowEvent.WINDOW_OPENED:
|
||||
if (theEvent instanceof ComponentEvent) {
|
||||
ComponentEvent ce = (ComponentEvent)theEvent;
|
||||
if (ce.getComponent() instanceof Window) {
|
||||
EventQueueMonitor.addTopLevelWindow(ce.getComponent());
|
||||
EventQueueMonitor.maybeNotifyAssistiveTechnologies();
|
||||
} else {
|
||||
EventQueueMonitor.maybeNotifyAssistiveTechnologies();
|
||||
EventQueueMonitor.addTopLevelWindow(ce.getComponent());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WindowEvent.WINDOW_CLOSED:
|
||||
if (theEvent instanceof ComponentEvent) {
|
||||
ComponentEvent ce = (ComponentEvent)theEvent;
|
||||
EventQueueMonitor.removeTopLevelWindow((Window) (ce.getComponent()));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal test
|
||||
*/
|
||||
static synchronized Component getShowingComponentAt(Container c, int x, int y) {
|
||||
if (!c.contains(x, y)) {
|
||||
return null;
|
||||
}
|
||||
int ncomponents = c.getComponentCount();
|
||||
for (int i = 0 ; i < ncomponents ; i++) {
|
||||
Component comp = c.getComponent(i);
|
||||
if (comp != null && comp.isShowing()) {
|
||||
Point location = comp.getLocation();
|
||||
if (comp.contains(x - location.x, y - location.y)) {
|
||||
return comp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Component at the given Point on the screen in the
|
||||
* given Container.
|
||||
*
|
||||
* @param c the Container to search
|
||||
* @param p the Point in screen coordinates
|
||||
* @return the Component at the given Point on the screen in the
|
||||
* given Container -- can be null if no Component is at that Point
|
||||
*/
|
||||
static synchronized Component getComponentAt(Container c, Point p) {
|
||||
if (!c.isShowing()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Component comp;
|
||||
Point containerLoc = c.getLocationOnScreen();
|
||||
Point containerPoint = new Point(p.x - containerLoc.x,
|
||||
p.y - containerLoc.y);
|
||||
|
||||
comp = getShowingComponentAt(c, containerPoint.x, containerPoint.y);
|
||||
|
||||
if ((comp != c) && (comp instanceof Container)) {
|
||||
return getComponentAt((Container)comp,p);
|
||||
} else {
|
||||
return comp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the {@link javax.accessibility.Accessible Accessible} object at the given point on the Screen.
|
||||
* The return value may be null if an {@code Accessible} object cannot be
|
||||
* found at the particular point.
|
||||
*
|
||||
* @param p the point to be accessed
|
||||
* @return the {@code Accessible} at the specified point
|
||||
*/
|
||||
static public Accessible getAccessibleAt(Point p) {
|
||||
Window w = getTopLevelWindowWithFocus();
|
||||
Window[] wins = getTopLevelWindows();
|
||||
Component c = null;
|
||||
|
||||
// See if the point we're being asked about is the
|
||||
// currentMousePosition. If so, start with the component
|
||||
// that we know the currentMousePostion is over
|
||||
//
|
||||
if (currentMousePosition == null) {
|
||||
return null;
|
||||
}
|
||||
if (currentMousePosition.equals(p)) {
|
||||
if (currentMouseComponent instanceof Container) {
|
||||
c = getComponentAt((Container) currentMouseComponent, p);
|
||||
}
|
||||
}
|
||||
|
||||
// Try the window with focus next
|
||||
//
|
||||
if (c == null && w != null) {
|
||||
c = getComponentAt(w,p);
|
||||
}
|
||||
|
||||
// Try the other windows next. [[[WDW: Stacking order???]]]
|
||||
if (c == null) {
|
||||
for (int i = 0; i < wins.length; i++) {
|
||||
c = getComponentAt(wins[i],p);
|
||||
if (c != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (c instanceof Accessible) {
|
||||
AccessibleContext ac = ((Accessible) c).getAccessibleContext();
|
||||
if (ac != null) {
|
||||
AccessibleComponent acmp = ac.getAccessibleComponent();
|
||||
if ((acmp != null) && (ac.getAccessibleChildrenCount() != 0)) {
|
||||
Point location = acmp.getLocationOnScreen();
|
||||
location.move(p.x - location.x, p.y - location.y);
|
||||
return acmp.getAccessibleAt(location);
|
||||
}
|
||||
}
|
||||
return (Accessible) c;
|
||||
} else {
|
||||
return Translator.getAccessible(c);
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Public Methods */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
|
||||
/**
|
||||
* Says whether the GUI subsystem has been initialized or not.
|
||||
* If this returns true, the assistive technology can freely
|
||||
* create GUI component instances. If the return value is false,
|
||||
* the assistive technology should register a {@link GUIInitializedListener}
|
||||
* and wait to create GUI component instances until the listener is
|
||||
* called.
|
||||
*
|
||||
* @return true if the GUI subsystem has been initialized
|
||||
* @see #addGUIInitializedListener
|
||||
*/
|
||||
static public boolean isGUIInitialized() {
|
||||
maybeInitialize();
|
||||
return guiInitialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified listener to be notified when the GUI subsystem
|
||||
* is initialized. Assistive technologies should get the results of
|
||||
* {@link #isGUIInitialized} before calling this method.
|
||||
*
|
||||
* @param l the listener to add
|
||||
* @see #isGUIInitialized
|
||||
* @see #removeTopLevelWindowListener
|
||||
*/
|
||||
static public void addGUIInitializedListener(GUIInitializedListener l) {
|
||||
maybeInitialize();
|
||||
guiInitializedListener =
|
||||
GUIInitializedMulticaster.add(guiInitializedListener,l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified listener to be notified when the GUI subsystem
|
||||
* is initialized.
|
||||
*
|
||||
* @param l the listener to remove
|
||||
* @see #addGUIInitializedListener
|
||||
*/
|
||||
static public void removeGUIInitializedListener(GUIInitializedListener l) {
|
||||
guiInitializedListener =
|
||||
GUIInitializedMulticaster.remove(guiInitializedListener,l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified listener to be notified when a top level window
|
||||
* is created or destroyed.
|
||||
*
|
||||
* @param l the listener to add
|
||||
* @see #removeTopLevelWindowListener
|
||||
*/
|
||||
static public void addTopLevelWindowListener(TopLevelWindowListener l) {
|
||||
topLevelWindowListener =
|
||||
TopLevelWindowMulticaster.add(topLevelWindowListener,l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified listener to be notified when a top level window
|
||||
* is created or destroyed.
|
||||
*
|
||||
* @param l the listener to remove
|
||||
* @see #addTopLevelWindowListener
|
||||
*/
|
||||
static public void removeTopLevelWindowListener(TopLevelWindowListener l) {
|
||||
topLevelWindowListener =
|
||||
TopLevelWindowMulticaster.remove(topLevelWindowListener,l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the last recorded position of the mouse in screen coordinates.
|
||||
*
|
||||
* @return the last recorded position of the mouse in screen coordinates
|
||||
*/
|
||||
static public Point getCurrentMousePosition() {
|
||||
return currentMousePosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of top level Windows in use in the Java Virtual Machine.
|
||||
*
|
||||
* @return an array of top level {@code Window}s in use in the Java Virtual Machine
|
||||
*/
|
||||
static public Window[] getTopLevelWindows() {
|
||||
|
||||
// Because this method is static, do not make it synchronized because
|
||||
// it can lock the whole class. Instead, just lock what needs to be
|
||||
// locked.
|
||||
//
|
||||
synchronized (topLevelWindows) {
|
||||
int count = topLevelWindows.size();
|
||||
if (count > 0) {
|
||||
Window[] w = new Window[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
w[i] = (Window)topLevelWindows.elementAt(i);
|
||||
}
|
||||
return w;
|
||||
} else {
|
||||
return new Window[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the top level {@code Window} that currently has keyboard focus.
|
||||
*
|
||||
* @return the top level {@code Window} that currently has keyboard focus
|
||||
*/
|
||||
static public Window getTopLevelWindowWithFocus() {
|
||||
return topLevelWindowWithFocus;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle all Component events in a separate thread. The reason for this is
|
||||
* that WindowEvents tend to be used to do lots of processing on the Window
|
||||
* hierarchy. As a result, it can frequently result in deadlock situations.
|
||||
*/
|
||||
class ComponentEvtDispatchThread extends Thread {
|
||||
public ComponentEvtDispatchThread(String name) {
|
||||
super(name);
|
||||
}
|
||||
public void run() {
|
||||
ComponentEvent ce = null;
|
||||
while (true) {
|
||||
synchronized(EventQueueMonitor.componentEventQueueLock) {
|
||||
while (EventQueueMonitor.componentEventQueue == null) {
|
||||
try {
|
||||
EventQueueMonitor.componentEventQueueLock.wait();
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
ce = (ComponentEvent)EventQueueMonitor.componentEventQueue.event;
|
||||
EventQueueMonitor.componentEventQueue =
|
||||
EventQueueMonitor.componentEventQueue.next;
|
||||
}
|
||||
switch (ce.getID()) {
|
||||
case MouseEvent.MOUSE_MOVED:
|
||||
case MouseEvent.MOUSE_DRAGGED:
|
||||
EventQueueMonitor.updateCurrentMousePosition((MouseEvent) ce);
|
||||
break;
|
||||
case WindowEvent.WINDOW_ACTIVATED:
|
||||
EventQueueMonitor.maybeNotifyAssistiveTechnologies();
|
||||
EventQueueMonitor.topLevelWindowWithFocus = ((WindowEvent) ce).getWindow();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* EventQueueMonitorItem is the basic type that handles the
|
||||
* queue for queueComponentEvent and the ComponentEvtDispatchThread.
|
||||
*/
|
||||
class EventQueueMonitorItem {
|
||||
AWTEvent event;
|
||||
EventQueueMonitorItem next;
|
||||
|
||||
EventQueueMonitorItem(AWTEvent evt) {
|
||||
event = evt;
|
||||
next = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import javax.accessibility.*;
|
||||
|
||||
/**
|
||||
* The {@code GUIInitializedListener} interface is used by the {@link EventQueueMonitor}
|
||||
* class to notify an interested party when the GUI subsystem has been
|
||||
* initialized. This is necessary because assistive technologies can
|
||||
* be loaded before the GUI subsystem is initialized. As a result,
|
||||
* assistive technologies should check the
|
||||
* {@link EventQueueMonitor#isGUIInitialized isGUIInitialized} method
|
||||
* of {@code EventQueueMonitor} before creating any GUI components. If the
|
||||
* return value is true, assistive technologies can create GUI components
|
||||
* following the same thread restrictions as any other application. If
|
||||
* the return value is false, the assistive technology should register
|
||||
* a {@code GUIInitializedListener} with the {@code EventQueueMonitor} to be notified
|
||||
* when the GUI subsystem is initialized.
|
||||
*
|
||||
* @see EventQueueMonitor
|
||||
* @see EventQueueMonitor#isGUIInitialized
|
||||
* @see EventQueueMonitor#addGUIInitializedListener
|
||||
* @see EventQueueMonitor#removeGUIInitializedListener
|
||||
*
|
||||
*/
|
||||
@jdk.Exported
|
||||
public interface GUIInitializedListener extends EventListener {
|
||||
|
||||
/**
|
||||
* Invoked when the GUI subsystem is initialized and it's OK for
|
||||
* the assisitive technology to create instances of GUI objects.
|
||||
*/
|
||||
public void guiInitialized();
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.EventListener;
|
||||
import javax.accessibility.*;
|
||||
|
||||
|
||||
/**
|
||||
* The GUIInitializedMulticaster class is used to maintain a list of
|
||||
* GUIInitializedListener classes. It is intended to be used primarily
|
||||
* for internal support in the EventQueueMonitor class, and is not intended
|
||||
* to be used by classes outside the Java Accessibility Utility package.
|
||||
*
|
||||
* @see EventQueueMonitor
|
||||
* @see EventQueueMonitor#addGUIInitializedListener
|
||||
* @see EventQueueMonitor#removeGUIInitializedListener
|
||||
*
|
||||
*/
|
||||
class GUIInitializedMulticaster
|
||||
extends AWTEventMulticaster implements GUIInitializedListener
|
||||
{
|
||||
protected GUIInitializedMulticaster(EventListener a, EventListener b) {
|
||||
super(a, b);
|
||||
}
|
||||
|
||||
public void guiInitialized() {
|
||||
((GUIInitializedListener)a).guiInitialized();
|
||||
((GUIInitializedListener)b).guiInitialized();
|
||||
}
|
||||
|
||||
public static GUIInitializedListener add(GUIInitializedListener a, GUIInitializedListener b) {
|
||||
return (GUIInitializedListener)addInternal(a, b);
|
||||
}
|
||||
|
||||
public static GUIInitializedListener remove(GUIInitializedListener l, GUIInitializedListener oldl) {
|
||||
return (GUIInitializedListener)removeInternal(l, oldl);
|
||||
}
|
||||
|
||||
protected static EventListener addInternal(EventListener a, EventListener b) {
|
||||
if (a == null) return b;
|
||||
if (b == null) return a;
|
||||
return new GUIInitializedMulticaster(a, b);
|
||||
}
|
||||
|
||||
protected static EventListener removeInternal(EventListener l, EventListener oldl) {
|
||||
if (l == oldl || l == null) {
|
||||
return null;
|
||||
} else if (l instanceof GUIInitializedMulticaster) {
|
||||
return ((GUIInitializedMulticaster)l).remove(oldl);
|
||||
} else {
|
||||
return l; // it's not here
|
||||
}
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import javax.accessibility.*;
|
||||
|
||||
/**
|
||||
* The {@code TopLevelWindowListener} interface is used by the {@link EventQueueMonitor}
|
||||
* class to notify an interested party when a top level window is created
|
||||
* or destroyed in the Java Virtual Machine. Classes wishing to express
|
||||
* an interest in top level window events should implement this interface
|
||||
* and register themselves with the {@code EventQueueMonitor} by calling the
|
||||
* {@link EventQueueMonitor#addTopLevelWindowListener EventQueueMonitor.addTopLevelWindowListener}
|
||||
* class method.
|
||||
*
|
||||
* @see EventQueueMonitor
|
||||
* @see EventQueueMonitor#addTopLevelWindowListener
|
||||
* @see EventQueueMonitor#removeTopLevelWindowListener
|
||||
*
|
||||
*/
|
||||
@jdk.Exported
|
||||
public interface TopLevelWindowListener extends EventListener {
|
||||
|
||||
/**
|
||||
* Invoked when a new top level window has been created.
|
||||
*
|
||||
* @param w the Window that was created
|
||||
*/
|
||||
public void topLevelWindowCreated(Window w);
|
||||
|
||||
/**
|
||||
* Invoked when a top level window has been destroyed.
|
||||
*
|
||||
* @param w the Window that was destroyed
|
||||
*/
|
||||
public void topLevelWindowDestroyed(Window w);
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.EventListener;
|
||||
import javax.accessibility.*;
|
||||
|
||||
|
||||
/**
|
||||
* The TopLevelWindowMulticaster class is used to maintain a list of
|
||||
* TopLevelWindowListener classes. It is intended to be used primarily
|
||||
* for internal support in the EventQueueMonitor class, and is not intended
|
||||
* to be used by classes outside the Java Accessibility Utility package.
|
||||
*
|
||||
* @see EventQueueMonitor
|
||||
* @see EventQueueMonitor#addTopLevelWindowListener
|
||||
* @see EventQueueMonitor#removeTopLevelWindowListener
|
||||
*
|
||||
*/
|
||||
class TopLevelWindowMulticaster
|
||||
extends AWTEventMulticaster implements TopLevelWindowListener
|
||||
{
|
||||
protected TopLevelWindowMulticaster(EventListener a, EventListener b) {
|
||||
super(a, b);
|
||||
}
|
||||
|
||||
public void topLevelWindowCreated(Window w) {
|
||||
((TopLevelWindowListener)a).topLevelWindowCreated(w);
|
||||
((TopLevelWindowListener)b).topLevelWindowCreated(w);
|
||||
}
|
||||
|
||||
public void topLevelWindowDestroyed(Window w) {
|
||||
((TopLevelWindowListener)a).topLevelWindowDestroyed(w);
|
||||
((TopLevelWindowListener)b).topLevelWindowDestroyed(w);
|
||||
}
|
||||
|
||||
public static TopLevelWindowListener add(TopLevelWindowListener a, TopLevelWindowListener b) {
|
||||
return (TopLevelWindowListener)addInternal(a, b);
|
||||
}
|
||||
|
||||
public static TopLevelWindowListener remove(TopLevelWindowListener l, TopLevelWindowListener oldl) {
|
||||
return (TopLevelWindowListener)removeInternal(l, oldl);
|
||||
}
|
||||
|
||||
protected static EventListener addInternal(EventListener a, EventListener b) {
|
||||
if (a == null) return b;
|
||||
if (b == null) return a;
|
||||
return new TopLevelWindowMulticaster(a, b);
|
||||
}
|
||||
|
||||
protected static EventListener removeInternal(EventListener l, EventListener oldl) {
|
||||
if (l == oldl || l == null) {
|
||||
return null;
|
||||
} else if (l instanceof TopLevelWindowMulticaster) {
|
||||
return ((TopLevelWindowMulticaster)l).remove(oldl);
|
||||
} else {
|
||||
return l; // it's not here
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,744 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.java.accessibility.util;
|
||||
|
||||
import java.lang.*;
|
||||
import java.beans.*;
|
||||
import java.util.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.image.*;
|
||||
// Do not import Swing classes. This module is intended to work
|
||||
// with both Swing and AWT.
|
||||
// import javax.swing.*;
|
||||
import javax.accessibility.*;
|
||||
|
||||
/**
|
||||
* <p>The {@code Translator} class provides a translation to interface
|
||||
* {@link javax.accessibility.Accessible Accessible}
|
||||
* for objects that do not implement interface {@code Accessible}. Assistive
|
||||
* technologies can use the {@link #getAccessible getAccessible} class method of
|
||||
* {@code Translator} to obtain an object that implements interface {@code Accessible}.
|
||||
* If the object passed in already implements interface {@code Accessible},
|
||||
* {@code getAccessible} merely returns the object.
|
||||
*
|
||||
* <p>An example of how an assistive technology might use the {@code Translator}
|
||||
* class is as follows:
|
||||
*
|
||||
* <PRE>
|
||||
* Accessible accessible = Translator.getAccessible(someObj);
|
||||
* // obtain information from the 'accessible' object.
|
||||
* </PRE>
|
||||
*
|
||||
* <P>Note: This implementation is missing many things and is not a recommended way
|
||||
* to implement accessibility features for a toolkit. Instead of relying upon this
|
||||
* code, a toolkit's components should implement interface {@code Accessible} directly.
|
||||
*/
|
||||
@jdk.Exported
|
||||
public class Translator extends AccessibleContext
|
||||
implements Accessible, AccessibleComponent {
|
||||
|
||||
/** The source object needing translating. */
|
||||
protected Object source;
|
||||
|
||||
/**
|
||||
* Find a translator for this class. If one doesn't exist for this
|
||||
* class explicitly, try its superclass and so on.
|
||||
*
|
||||
* @param c a Class
|
||||
* @return the {@code Translator} Class for the Class passed in
|
||||
*/
|
||||
protected static Class<?> getTranslatorClass(Class<?> c) {
|
||||
Class<?> t = null;
|
||||
if (c == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
t = Class.forName("com.sun.java.accessibility.util."
|
||||
+ c.getName()
|
||||
+ "Translator");
|
||||
return t;
|
||||
} catch (Exception e) {
|
||||
return getTranslatorClass(c.getSuperclass());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain an object that implements interface {@code Accessible}. If the object
|
||||
* passed in already implements interface {@code Accessible}, {@code getAccessible}
|
||||
* merely returns the object.
|
||||
*
|
||||
* @param o an Object; if a null is passed in a null is returned
|
||||
* @return an {@code Object}, possibly the {@code Object} passed in, that
|
||||
* implements the {@code Accessible} interface for the {@code Object}
|
||||
* which was passed in
|
||||
*/
|
||||
public static Accessible getAccessible(Object o) {
|
||||
Accessible a = null;
|
||||
|
||||
if (o == null) {
|
||||
return null;
|
||||
}
|
||||
if (o instanceof Accessible) {
|
||||
a = (Accessible)o;
|
||||
} else {
|
||||
Class<?> translatorClass = getTranslatorClass(o.getClass());
|
||||
if (translatorClass != null) {
|
||||
try {
|
||||
Translator t = (Translator)translatorClass.newInstance();
|
||||
t.setSource(o);
|
||||
a = t;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (a == null) {
|
||||
a = new Translator(o);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@code Translator}. You must call the {@link #setSource setSource}
|
||||
* method to set the object to be translated after calling this constructor.
|
||||
*/
|
||||
public Translator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@code Translator} with the source object o.
|
||||
*
|
||||
* @param o the Component that does not implement interface
|
||||
* {@link javax.accessibility.Accessible Accessible}
|
||||
*/
|
||||
public Translator(Object o) {
|
||||
source = o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the source {@code Object} of the {@code Translator}.
|
||||
*
|
||||
* @return the source {@code Object} of the {@code Translator}
|
||||
*/
|
||||
public Object getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the source object of the {@code Translator}.
|
||||
*
|
||||
* @param o the Component that does not implement interface Accessible
|
||||
*/
|
||||
public void setSource(Object o) {
|
||||
source = o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this object is the same as the one passed in.
|
||||
*
|
||||
* @param o the {@code Object} to check against
|
||||
* @return true if this is the same object
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof Translator) {
|
||||
return java.util.Objects.equals(source, o);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return hashcode.
|
||||
*
|
||||
* @return hashcode
|
||||
*/
|
||||
public int hashCode() {
|
||||
return java.util.Objects.hashCode(source);
|
||||
}
|
||||
|
||||
|
||||
// Accessible methods
|
||||
|
||||
/**
|
||||
* Returns this object.
|
||||
*/
|
||||
public AccessibleContext getAccessibleContext() {
|
||||
return this;
|
||||
}
|
||||
|
||||
// AccessibleContext methods
|
||||
|
||||
/**
|
||||
* Get the accessible name of this object.
|
||||
*
|
||||
* @return the localized name of the object; can be null if this object
|
||||
* does not have a name
|
||||
*/
|
||||
public String getAccessibleName() {
|
||||
if (source instanceof MenuItem) {
|
||||
return ((MenuItem) source).getLabel();
|
||||
} else if (source instanceof Component) {
|
||||
return ((Component) source).getName();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of this object.
|
||||
*/
|
||||
public void setAccessibleName(String s) {
|
||||
if (source instanceof MenuItem) {
|
||||
((MenuItem) source).setLabel(s);
|
||||
} else if (source instanceof Component) {
|
||||
((Component) source).setName(s);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the accessible description of this object.
|
||||
*
|
||||
* @return the description of the object; can be null if this object does
|
||||
* not have a description
|
||||
*/
|
||||
public String getAccessibleDescription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the accessible description of this object.
|
||||
*
|
||||
* @param s the new localized description of the object
|
||||
*/
|
||||
public void setAccessibleDescription(String s) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the role of this object.
|
||||
*
|
||||
* @return an instance of AccessibleRole describing the role of the object
|
||||
*/
|
||||
public AccessibleRole getAccessibleRole() {
|
||||
return AccessibleRole.UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the state of this object, given an already populated state.
|
||||
* This method is intended for use by subclasses so they don't have
|
||||
* to check for everything.
|
||||
*
|
||||
* @return an instance of {@code AccessibleStateSet}
|
||||
* containing the current state of the object
|
||||
*/
|
||||
public AccessibleStateSet getAccessibleStateSet() {
|
||||
AccessibleStateSet states = new AccessibleStateSet();
|
||||
if (source instanceof Component) {
|
||||
Component c = (Component) source;
|
||||
for (Container p = c.getParent(); p != null; p = p.getParent()) {
|
||||
if (p instanceof Window) {
|
||||
if (((Window)p).getFocusOwner() == c) {
|
||||
states.add(AccessibleState.FOCUSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isEnabled()) {
|
||||
states.add(AccessibleState.ENABLED);
|
||||
}
|
||||
if (isFocusTraversable()) {
|
||||
states.add(AccessibleState.FOCUSABLE);
|
||||
}
|
||||
if (source instanceof MenuItem) {
|
||||
states.add(AccessibleState.FOCUSABLE);
|
||||
}
|
||||
return states;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the accessible parent of this object.
|
||||
*
|
||||
* @return the accessible parent of this object; can be null if this
|
||||
* object does not have an accessible parent
|
||||
*/
|
||||
public Accessible getAccessibleParent() {
|
||||
if (accessibleParent != null) {
|
||||
return accessibleParent;
|
||||
} else if (source instanceof Component) {
|
||||
return getAccessible(((Component) source).getParent());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the index of this object in its accessible parent.
|
||||
*
|
||||
* @return -1 of this object does not have an accessible parent; otherwise,
|
||||
* the index of the child in its accessible parent
|
||||
*/
|
||||
public int getAccessibleIndexInParent() {
|
||||
if (source instanceof Component) {
|
||||
Container parent = ((Component) source).getParent();
|
||||
if (parent != null) {
|
||||
Component ca[] = parent.getComponents();
|
||||
for (int i = 0; i < ca.length; i++) {
|
||||
if (source.equals(ca[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of accessible children in the object.
|
||||
*
|
||||
* @return the number of accessible children in the object
|
||||
*/
|
||||
public int getAccessibleChildrenCount() {
|
||||
if (source instanceof Container) {
|
||||
Component[] children = ((Container) source).getComponents();
|
||||
int count = 0;
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
Accessible a = getAccessible(children[i]);
|
||||
if (a != null) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the nth accessible child of the object.
|
||||
*
|
||||
* @param i zero-based index of child
|
||||
* @return the nth accessible child of the object
|
||||
*/
|
||||
public Accessible getAccessibleChild(int i) {
|
||||
if (source instanceof Container) {
|
||||
Component[] children = ((Container) source).getComponents();
|
||||
int count = 0;
|
||||
|
||||
for (int j = 0; j < children.length; j++) {
|
||||
Accessible a = getAccessible(children[j]);
|
||||
if (a != null) {
|
||||
if (count == i) {
|
||||
AccessibleContext ac = a.getAccessibleContext();
|
||||
if (ac != null) {
|
||||
ac.setAccessibleParent(this);
|
||||
}
|
||||
return a;
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@code Locale} of the component. If the component does not have a
|
||||
* locale, the locale of its parent is returned.
|
||||
*
|
||||
* @return the {@code Locale} of the object
|
||||
*/
|
||||
public Locale getLocale() throws IllegalComponentStateException {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).getLocale();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a {@code PropertyChangeListener} to the listener list. The listener
|
||||
* is registered for all properties.
|
||||
*/
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the {@code PropertyChangeListener} from the listener list.
|
||||
*/
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
}
|
||||
|
||||
// AccessibleComponent methods
|
||||
|
||||
/**
|
||||
* Get the background {@code Color} of this object.
|
||||
*
|
||||
* @return if supported, the background {@code Color} of the object;
|
||||
* otherwise, null
|
||||
*
|
||||
*/
|
||||
public Color getBackground() {
|
||||
if (source instanceof Component) { // MenuComponent doesn't do background
|
||||
return ((Component) source).getBackground();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the background {@code Color} of this object.
|
||||
*
|
||||
* @param c the new {@code Color} for the background
|
||||
*/
|
||||
public void setBackground(Color c) {
|
||||
if (source instanceof Component) { // MenuComponent doesn't do background
|
||||
((Component) source).setBackground(c);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the foreground {@code Color} of this object.
|
||||
*
|
||||
* @return if supported, the foreground {@code Color} of the object; otherwise, null
|
||||
*/
|
||||
public Color getForeground() {
|
||||
if (source instanceof Component) { // MenuComponent doesn't do foreground
|
||||
return ((Component) source).getForeground();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the foreground {@code Color} of this object.
|
||||
*
|
||||
* @param c the new {@code Color} for the foreground
|
||||
*/
|
||||
public void setForeground(Color c) {
|
||||
if (source instanceof Component) { // MenuComponent doesn't do foreground
|
||||
((Component) source).setForeground(c);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@code Cursor} of this object.
|
||||
*
|
||||
* @return if supported, the Cursor of the object; otherwise, null
|
||||
*/
|
||||
public Cursor getCursor() {
|
||||
if (source instanceof Component) { // MenuComponent doesn't do cursor
|
||||
return ((Component) source).getCursor();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@code Cursor} of this object.
|
||||
* @param c the new {@code Cursor} for the object
|
||||
*/
|
||||
public void setCursor(Cursor c) {
|
||||
if (source instanceof Component) { // MenuComponent doesn't do cursor
|
||||
((Component) source).setCursor(c);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@code Font} of this object.
|
||||
*
|
||||
* @return if supported, the {@code Font} for the object; otherwise, null
|
||||
*/
|
||||
public Font getFont() {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).getFont();
|
||||
} else if (source instanceof MenuComponent) {
|
||||
return ((MenuComponent) source).getFont();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@code Font} of this object.
|
||||
*
|
||||
* @param f the new {@code Font} for the object
|
||||
*/
|
||||
public void setFont(Font f) {
|
||||
if (source instanceof Component) {
|
||||
((Component) source).setFont(f);
|
||||
} else if (source instanceof MenuComponent) {
|
||||
((MenuComponent) source).setFont(f);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@code FontMetrics} of this object.
|
||||
*
|
||||
* @param f the {@code Font}
|
||||
* @return if supported, the {@code FontMetrics} the object; otherwise, null
|
||||
* @see #getFont
|
||||
*/
|
||||
public FontMetrics getFontMetrics(Font f) {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).getFontMetrics(f);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the object is enabled.
|
||||
*
|
||||
* @return true if object is enabled; otherwise, false
|
||||
*/
|
||||
public boolean isEnabled() {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).isEnabled();
|
||||
} else if (source instanceof MenuItem) {
|
||||
return ((MenuItem) source).isEnabled();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the enabled state of the object.
|
||||
*
|
||||
* @param b if true, enables this object; otherwise, disables it
|
||||
*/
|
||||
public void setEnabled(boolean b) {
|
||||
if (source instanceof Component) {
|
||||
((Component) source).setEnabled(b);
|
||||
} else if (source instanceof MenuItem) {
|
||||
((MenuItem) source).setEnabled(b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the object is visible.
|
||||
*
|
||||
* @return true if object is visible; otherwise, false
|
||||
*/
|
||||
public boolean isVisible() {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).isVisible();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the visible state of the object.
|
||||
*
|
||||
* @param b if true, shows this object; otherwise, hides it
|
||||
*/
|
||||
public void setVisible(boolean b) {
|
||||
if (source instanceof Component) {
|
||||
((Component) source).setVisible(b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the object is showing. This is determined by checking
|
||||
* the visibility of the object and ancestors of the object.
|
||||
*
|
||||
* @return true if object is showing; otherwise, false
|
||||
*/
|
||||
public boolean isShowing() {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).isShowing();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the specified {@code Point} is within this
|
||||
* object's bounds, where the {@code Point} is relative to the coordinate
|
||||
* system of the object.
|
||||
*
|
||||
* @param p the {@code Point} relative to the coordinate system of the object
|
||||
* @return true if object contains {@code Point}; otherwise false
|
||||
*/
|
||||
public boolean contains(Point p) {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).contains(p);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the location of the object on the screen.
|
||||
*
|
||||
* @return location of object on screen; can be null if this object
|
||||
* is not on the screen
|
||||
*/
|
||||
public Point getLocationOnScreen() {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).getLocationOnScreen();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the location of the object relative to parent.
|
||||
*
|
||||
* @return location of object relative to parent; can be null if
|
||||
* this object or its parent are not on the screen
|
||||
*/
|
||||
public Point getLocation() {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).getLocation();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the location of the object relative to parent.
|
||||
*/
|
||||
public void setLocation(Point p) {
|
||||
if (source instanceof Component) {
|
||||
((Component) source).setLocation(p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current bounds of this object.
|
||||
*
|
||||
* @return current bounds of object; can be null if this object
|
||||
* is not on the screen
|
||||
*/
|
||||
public Rectangle getBounds() {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).getBounds();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current bounds of this object.
|
||||
*/
|
||||
public void setBounds(Rectangle r) {
|
||||
if (source instanceof Component) {
|
||||
((Component) source).setBounds(r);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current size of this object.
|
||||
*
|
||||
* @return current size of object; can be null if this object is
|
||||
* not on the screen
|
||||
*/
|
||||
public Dimension getSize() {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).getSize();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current size of this object.
|
||||
*/
|
||||
public void setSize(Dimension d) {
|
||||
if (source instanceof Component) {
|
||||
((Component) source).setSize(d);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the accessible child contained at the local coordinate
|
||||
* Point, if one exists.
|
||||
*
|
||||
* @return the Accessible at the specified location, if it exists
|
||||
*/
|
||||
public Accessible getAccessibleAt(Point p) {
|
||||
if (source instanceof Component) {
|
||||
Component c = ((Component) source).getComponentAt(p);
|
||||
if (c != null) {
|
||||
return (getAccessible(c));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this object can accept focus or not.
|
||||
*
|
||||
* @return true if object can accept focus; otherwise false
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isFocusTraversable() {
|
||||
if (source instanceof Component) {
|
||||
return ((Component) source).isFocusTraversable();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests focus for this object.
|
||||
*/
|
||||
public void requestFocus() {
|
||||
if (source instanceof Component) {
|
||||
((Component) source).requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified {@code FocusListener} to receive focus events from
|
||||
* this component.
|
||||
*
|
||||
* @param l the focus listener
|
||||
*/
|
||||
public synchronized void addFocusListener(FocusListener l) {
|
||||
if (source instanceof Component) {
|
||||
((Component) source).addFocusListener(l);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified focus listener so it no longer receives focus
|
||||
* events from this component.
|
||||
*
|
||||
* @param l the focus listener; this method performs no function, nor does it
|
||||
* throw an exception if the listener specified was not previously added
|
||||
* to this component; if listener is null, no exception is thrown and no
|
||||
* action is performed.
|
||||
*/
|
||||
public synchronized void removeFocusListener(FocusListener l) {
|
||||
if (source instanceof Component) {
|
||||
((Component) source).removeFocusListener(l);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util.java.awt;
|
||||
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import javax.accessibility.*;
|
||||
import com.sun.java.accessibility.util.*;
|
||||
|
||||
/**
|
||||
* <p>The Translator class provides a translation to interface Accessible
|
||||
* for objects that do not implement interface Accessible. Assistive
|
||||
* technologies can use the 'getAccessible' class method of Translator to
|
||||
* obtain an object that implements interface Accessible. If the object
|
||||
* passed in already implements interface Accessible, getAccessible merely
|
||||
* returns the object.
|
||||
*
|
||||
* <p>An example of how an assistive technology might use the Translator
|
||||
* class is as follows:
|
||||
*
|
||||
* <PRE>
|
||||
* Accessible accessible = Translator.getAccessible(someObj);
|
||||
* // obtain information from the 'accessible' object.
|
||||
* </PRE>
|
||||
*
|
||||
* <P>This class extends the Translator class to provide specific support
|
||||
* for the Button class. Translator.getAccessible() will automatically
|
||||
* load this class when an assistive technology asks for an accessible
|
||||
* translator for Button.
|
||||
*
|
||||
*/
|
||||
public class ButtonTranslator extends Translator {
|
||||
|
||||
/**
|
||||
* Get the name of this object.
|
||||
* @return the name of the object -- can be null if this object does
|
||||
* not have a name
|
||||
*/
|
||||
public String getAccessibleName() {
|
||||
return ((Button) source).getLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of this object.
|
||||
*/
|
||||
public void setAccessibleName(String s) {
|
||||
((Button) source).setLabel(s);
|
||||
}
|
||||
|
||||
public AccessibleRole getAccessibleRole() {
|
||||
return AccessibleRole.PUSH_BUTTON;
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util.java.awt;
|
||||
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import javax.accessibility.*;
|
||||
import com.sun.java.accessibility.util.*;
|
||||
|
||||
/**
|
||||
* <p>The Translator class provides a translation to interface Accessible
|
||||
* for objects that do not implement interface Accessible. Assistive
|
||||
* technologies can use the 'getAccessible' class method of Translator to
|
||||
* obtain an object that implements interface Accessible. If the object
|
||||
* passed in already implements interface Accessible, getAccessible merely
|
||||
* returns the object.
|
||||
*
|
||||
* <p>An example of how an assistive technology might use the Translator
|
||||
* class is as follows:
|
||||
*
|
||||
* <PRE>
|
||||
* Accessible accessible = Translator.getAccessible(someObj);
|
||||
* // obtain information from the 'accessible' object.
|
||||
* </PRE>
|
||||
*
|
||||
* <P>This class extends the Translator class to provide specific support
|
||||
* for the Checkbox class. Translator.getAccessible() will automatically
|
||||
* load this class when an assistive technology asks for an accessible
|
||||
* translator for Checkbox.
|
||||
*
|
||||
*/
|
||||
public class CheckboxTranslator extends Translator {
|
||||
|
||||
/**
|
||||
* Get the state of this object.
|
||||
* @return an instance of AccessibleState containing the current state of the object
|
||||
* @see AccessibleState
|
||||
*/
|
||||
public AccessibleStateSet getAccessibleStateSet() {
|
||||
AccessibleStateSet states = super.getAccessibleStateSet();
|
||||
if (((Checkbox) source).getState()) {
|
||||
states.add(AccessibleState.CHECKED);
|
||||
}
|
||||
return states;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of this object.
|
||||
* @return the name of the object -- can be null if this object does
|
||||
* not have a name
|
||||
*/
|
||||
public String getAccessibleName() {
|
||||
return ((Checkbox) source).getLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of this object.
|
||||
*/
|
||||
public void setAccessibleName(String s) {
|
||||
((Checkbox) source).setLabel(s);
|
||||
}
|
||||
|
||||
public AccessibleRole getAccessibleRole() {
|
||||
return AccessibleRole.CHECK_BOX;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util.java.awt;
|
||||
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import javax.accessibility.*;
|
||||
import com.sun.java.accessibility.util.*;
|
||||
|
||||
/**
|
||||
* <p>The Translator class provides a translation to interface Accessible
|
||||
* for objects that do not implement interface Accessible. Assistive
|
||||
* technologies can use the 'getAccessible' class method of Translator to
|
||||
* obtain an object that implements interface Accessible. If the object
|
||||
* passed in already implements interface Accessible, getAccessible merely
|
||||
* returns the object.
|
||||
*
|
||||
* <p>An example of how an assistive technology might use the Translator
|
||||
* class is as follows:
|
||||
*
|
||||
* <PRE>
|
||||
* Accessible accessible = Translator.getAccessible(someObj);
|
||||
* // obtain information from the 'accessible' object.
|
||||
* </PRE>
|
||||
*
|
||||
* <P>This class extends the Translator class to provide specific support
|
||||
* for the Label class. Translator.getAccessible() will automatically
|
||||
* load this class when an assistive technology asks for an accessible
|
||||
* translator for Label.
|
||||
*
|
||||
*/
|
||||
public class LabelTranslator extends Translator {
|
||||
|
||||
public String getAccessibleName() {
|
||||
return ((Label) source).getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of this object.
|
||||
*/
|
||||
public void setAccessibleName(String s) {
|
||||
((Label) source).setText(s);
|
||||
}
|
||||
|
||||
public AccessibleRole getAccessibleRole() {
|
||||
return AccessibleRole.LABEL;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util.java.awt;
|
||||
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import javax.accessibility.*;
|
||||
import com.sun.java.accessibility.util.*;
|
||||
|
||||
/**
|
||||
* <p>The Translator class provides a translation to interface Accessible
|
||||
* for objects that do not implement interface Accessible. Assistive
|
||||
* technologies can use the 'getAccessible' class method of Translator to
|
||||
* obtain an object that implements interface Accessible. If the object
|
||||
* passed in already implements interface Accessible, getAccessible merely
|
||||
* returns the object.
|
||||
*
|
||||
* <p>An example of how an assistive technology might use the Translator
|
||||
* class is as follows:
|
||||
*
|
||||
* <PRE>
|
||||
* Accessible accessible = Translator.getAccessible(someObj);
|
||||
* // obtain information from the 'accessible' object.
|
||||
* </PRE>
|
||||
*
|
||||
* <P>This class extends the Translator class to provide specific support
|
||||
* for the List class. Translator.getAccessible() will automatically
|
||||
* load this class when an assistive technology asks for an accessible
|
||||
* translator for List.
|
||||
*
|
||||
*/
|
||||
public class ListTranslator extends Translator {
|
||||
|
||||
/**
|
||||
* Get the state of this object.
|
||||
* @return an instance of AccessibleState containing the current state of the object
|
||||
* @see AccessibleState
|
||||
*/
|
||||
public AccessibleStateSet getAccessibleStateSet() {
|
||||
AccessibleStateSet states = super.getAccessibleStateSet();
|
||||
if (((java.awt.List) source).isMultipleMode()) {
|
||||
states.add(AccessibleState.MULTISELECTABLE);
|
||||
}
|
||||
if (((java.awt.List) source).getSelectedItems().length > 0) {
|
||||
states.add(AccessibleState.SELECTED);
|
||||
}
|
||||
return states;
|
||||
}
|
||||
|
||||
public AccessibleRole getAccessibleRole() {
|
||||
return AccessibleRole.LIST;
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.java.accessibility.util.java.awt;
|
||||
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import javax.accessibility.*;
|
||||
import com.sun.java.accessibility.util.*;
|
||||
|
||||
/**
|
||||
* <p>The Translator class provides a translation to interface Accessible
|
||||
* for objects that do not implement interface Accessible. Assistive
|
||||
* technologies can use the 'getAccessible' class method of Translator to
|
||||
* obtain an object that implements interface Accessible. If the object
|
||||
* passed in already implements interface Accessible, getAccessible merely
|
||||
* returns the object.
|
||||
*
|
||||
* <p>An example of how an assistive technology might use the Translator
|
||||
* class is as follows:
|
||||
*
|
||||
* <PRE>
|
||||
* Accessible accessible = Translator.getAccessible(someObj);
|
||||
* // obtain information from the 'accessible' object.
|
||||
* </PRE>
|
||||
*
|
||||
* <P>This class extends the Translator class to provide specific support
|
||||
* for the TextComponent class. Translator.getAccessible() will automatically
|
||||
* load this class when an assistive technology asks for an accessible
|
||||
* translator for TextComponent.
|
||||
*
|
||||
*/
|
||||
public class TextComponentTranslator extends Translator {
|
||||
|
||||
public AccessibleRole getAccessibleRole() {
|
||||
return AccessibleRole.TEXT;
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides a collection of interfaces and classes that compose the Java Accessibility
|
||||
* Utilities. The classes are used by Assistive Technologies, such as the screen
|
||||
* readers which are used by those who are blind, and help provide access to GUI
|
||||
* toolkits that implement the Java Accessibility API. An overview of the important
|
||||
* classes follows.
|
||||
*
|
||||
* <p>The class {@code AccessibilityEventMonitor} implements a PropertyChange
|
||||
* listener on every UI object that implements interface {@code Accessible} in the Java
|
||||
* Virtual Machine.
|
||||
*
|
||||
* <p> The class {@code AWTEventMonitor} implements a suite of listeners that are
|
||||
* conditionally installed on every AWT component instance in the Java Virtual Machine.
|
||||
*
|
||||
* <p>The class {@code EventQueueMonitor} provides key core functionality for
|
||||
* Assistive Technologies (and other system-level technologies that need some of
|
||||
* the same things that Assistive Technology needs).
|
||||
*
|
||||
* <p>The class {@code GUIInitializedMulticaster} is used to maintain a list of
|
||||
* {@code GUIInitializedListener} classes which are used by the {@code EventQueueMonitor}
|
||||
* class to notify an interested party when the GUI subsystem has been initialized.
|
||||
* Note that this class is intended to be used primarily for internal support in
|
||||
* the {@code EventQueueMonitor} class, and is not intended to be used by classes
|
||||
* outside the Java Accessibility Utility package.
|
||||
*
|
||||
* <p>The class {@code SwingEventMonitor} extends {@code AWTEventMonitor} by adding
|
||||
* a suite of listeners conditionally installed on every Swing component instance
|
||||
* in the Java Virtual Machine.
|
||||
*
|
||||
* <p>The class {@code TopLevelWindowMulticaster} is used to maintain a list of
|
||||
* {@code TopLevelWindowListener} classes which are used by the {@code EventQueueMonitor}
|
||||
* class to notify an interested party when a top level window is created or destroyed
|
||||
* in the Java Virtual Machine Note that this class is intended to be used primarily
|
||||
* for internal support in the {@code EventQueueMonitor} class, and is not intended
|
||||
* to be used by classes outside the Java Accessibility Utility package.
|
||||
*
|
||||
* <p>The class {@code Translator} provides a translation to interface {@code Accessible}
|
||||
* for objects that do not implement interface {@code Accessible}.
|
||||
*
|
||||
* @since JDK1.7
|
||||
*/
|
||||
package com.sun.java.accessibility.util;
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,6 @@
|
||||
#
|
||||
# Load the Java Access Bridge class into the JVM
|
||||
#
|
||||
#assistive_technologies=com.sun.java.accessibility.AccessBridge
|
||||
#screen_magnifier_present=true
|
||||
|
@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A class to manage AccessBridge debugging
|
||||
*/
|
||||
|
||||
#include "AccessBridgeDebug.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* print a GetLastError message
|
||||
*/
|
||||
char *printError(char *msg) {
|
||||
LPVOID lpMsgBuf = NULL;
|
||||
static char retbuf[256];
|
||||
|
||||
if (msg != NULL) {
|
||||
strncpy((char *)retbuf, msg, sizeof(retbuf));
|
||||
}
|
||||
if (!FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0,
|
||||
NULL ))
|
||||
{
|
||||
PrintDebugString(" %s: FormatMessage failed", msg);
|
||||
} else {
|
||||
PrintDebugString(" %s: %s", msg, (char *)lpMsgBuf);
|
||||
}
|
||||
if (lpMsgBuf != NULL) {
|
||||
strncat((char *)retbuf, ": ", sizeof(retbuf) - strlen(retbuf) - 1);
|
||||
strncat((char *)retbuf, (char *)lpMsgBuf, sizeof(retbuf) - strlen(retbuf) - 1);
|
||||
}
|
||||
return (char *)retbuf;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send debugging info to the appropriate place
|
||||
*/
|
||||
void PrintDebugString(char *msg, ...) {
|
||||
#ifdef DEBUGGING_ON
|
||||
char buf[1024];
|
||||
va_list argprt;
|
||||
|
||||
va_start(argprt, msg); // set up argptr
|
||||
vsprintf(buf, msg, argprt);
|
||||
#ifdef SEND_TO_OUTPUT_DEBUG_STRING
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
#ifdef SEND_TO_CONSOLE
|
||||
printf(buf);
|
||||
printf("\r\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Java debugging info to the appropriate place
|
||||
*/
|
||||
void PrintJavaDebugString2(char *msg, ...) {
|
||||
#ifdef JAVA_DEBUGGING_ON
|
||||
char buf[1024];
|
||||
va_list argprt;
|
||||
|
||||
va_start(argprt, msg); // set up argptr
|
||||
vsprintf(buf, msg, argprt);
|
||||
#ifdef SEND_TO_OUTPUT_DEBUG_STRING
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
#ifdef SEND_TO_CONSOLE
|
||||
printf(buf);
|
||||
printf("\r\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* Wide version of the method to send debugging info to the appropriate place
|
||||
*/
|
||||
void wPrintDebugString(wchar_t *msg, ...) {
|
||||
#ifdef DEBUGGING_ON
|
||||
char buf[1024];
|
||||
char charmsg[256];
|
||||
va_list argprt;
|
||||
|
||||
va_start(argprt, msg); // set up argptr
|
||||
sprintf(charmsg, "%ls", msg); // convert format string to multi-byte
|
||||
vsprintf(buf, charmsg, argprt);
|
||||
#ifdef SEND_TO_OUTPUT_DEBUG_STRING
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
#ifdef SEND_TO_CONSOLE
|
||||
printf(buf);
|
||||
printf("\r\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Wide version of the method to send Java debugging info to the appropriate place
|
||||
*/
|
||||
void wPrintJavaDebugString(wchar_t *msg, ...) {
|
||||
#ifdef JAVA_DEBUGGING_ON
|
||||
char buf[1024];
|
||||
char charmsg[256];
|
||||
va_list argprt;
|
||||
|
||||
va_start(argprt, msg); // set up argptr
|
||||
sprintf(charmsg, "%ls", msg); // convert format string to multi-byte
|
||||
vsprintf(buf, charmsg, argprt);
|
||||
#ifdef SEND_TO_OUTPUT_DEBUG_STRING
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
#ifdef SEND_TO_CONSOLE
|
||||
printf(buf);
|
||||
printf("\r\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A class to manage AccessBridge debugging
|
||||
*/
|
||||
|
||||
#ifndef __AccessBridgeDebug_H__
|
||||
#define __AccessBridgeDebug_H__
|
||||
|
||||
#include <crtdbg.h>
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUGGING_ON
|
||||
#define SEND_TO_OUTPUT_DEBUG_STRING
|
||||
//#define JAVA_DEBUGGING_ON
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGGING_ON
|
||||
#define DEBUG_CODE(x) x
|
||||
#else
|
||||
#define DEBUG_CODE(x) /* */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
char *printError(char *msg);
|
||||
void PrintDebugString(char *msg, ...);
|
||||
void PrintJavaDebugString(char *msg, ...);
|
||||
void wPrintJavaDebugString(wchar_t *msg, ...);
|
||||
void wPrintDebugString(wchar_t *msg, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Common AccessBridge IPC message definitions
|
||||
*/
|
||||
|
||||
#include "AccessBridgeMessages.h"
|
||||
|
||||
|
||||
// unique broadcast msg. IDs gotten dymanically
|
||||
|
||||
// wParam == sourceHwnc; lParam = *vmID
|
||||
UINT theFromJavaHelloMsgID;
|
||||
// wParam == sourceHwnc; lParam unused
|
||||
UINT theFromWindowsHelloMsgID;
|
||||
|
||||
|
||||
BOOL initBroadcastMessageIDs() {
|
||||
theFromJavaHelloMsgID = RegisterWindowMessage("AccessBridge-FromJava-Hello");
|
||||
theFromWindowsHelloMsgID = RegisterWindowMessage("AccessBridge-FromWindows-Hello");
|
||||
|
||||
if (theFromJavaHelloMsgID == 0 || theFromWindowsHelloMsgID) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Common AccessBridge IPC message definitions
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winuser.h>
|
||||
|
||||
#ifndef __AccessBridgeMessages_H__
|
||||
#define __AccessBridgeMessages_H__
|
||||
|
||||
|
||||
// used for messages between AccessBridge dlls to manage IPC
|
||||
// In the SendMessage call, the third param (WPARAM) is
|
||||
// the source HWND (ourAccessBridgeWindow in this case),
|
||||
// and the fourth param (LPARAM) is the size in bytes of
|
||||
// the package put into shared memory.
|
||||
#define AB_MEMORY_MAPPED_FILE_SETUP (WM_USER+0x1000)
|
||||
|
||||
// used for messages between AccessBridge dlls to manage IPC
|
||||
// In the SendMessage call, the third param (WPARAM) is
|
||||
// the source HWND (ourAccessBridgeWindow in this case),
|
||||
// and the fourth param (LPARAM) is the size in bytes of
|
||||
// the package put into shared memory.
|
||||
#define AB_MESSAGE_WAITING (WM_USER+0x1001)
|
||||
|
||||
// used for messages from JavaDLL to itself (or perhaps later also
|
||||
// for messages from WindowsDLL to itself). Used with PostMessage,
|
||||
// it is called for deferred processing of messages to send across
|
||||
// to another DLL (or DLLs)
|
||||
#define AB_MESSAGE_QUEUED (WM_USER+0x1002)
|
||||
|
||||
// used to let other AccessBridge DLLs know that one of the DLLs
|
||||
// they are communicating with is going away (not reversable)
|
||||
#define AB_DLL_GOING_AWAY (WM_USER+0x1003)
|
||||
|
||||
|
||||
// used as part of the Memory-Mapped file IPC setup. The first
|
||||
// constant is the query, the second the response, that are put
|
||||
// into the memory mapped file for reading by the opposite DLL
|
||||
// to verify that communication is working
|
||||
#define AB_MEMORY_MAPPED_FILE_OK_QUERY "OK?"
|
||||
#define AB_MEMORY_MAPPED_FILE_OK_ANSWER "OK!"
|
||||
|
||||
|
||||
BOOL initBroadcastMessageIDs();
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,175 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
#include "accessBridgeResource.h"
|
||||
|
||||
#define XSTR(x) STR(x)
|
||||
#define STR(x) #x
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "windows.h"
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
ACCESSBRIDGESTATUSWINDOW DIALOGEX 160, 78, 209, 163
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_CLIENTEDGE
|
||||
CAPTION "Access Bridge status"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
EDITTEXT cVMID,67,23,121,13,ES_READONLY
|
||||
EDITTEXT cStatusText,40,147,162,13,ES_READONLY
|
||||
LTEXT "Java VM ID:",IDC_STATIC,23,25,40,8
|
||||
LTEXT "Status:",IDC_STATIC,11,149,23,8
|
||||
EDITTEXT cWindowsID,67,39,121,13,ES_READONLY
|
||||
LTEXT "Windows ID:",IDC_STATIC,21,41,42,8
|
||||
EDITTEXT cCallInfo,12,65,184,75,ES_MULTILINE | ES_AUTOVSCROLL |
|
||||
ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL
|
||||
GROUPBOX "Call info",IDC_STATIC,4,55,197,90
|
||||
EDITTEXT cInvokedByText,67,1,121,13,ES_READONLY
|
||||
LTEXT "Invoked by:",IDC_STATIC,25,3,38,8
|
||||
END
|
||||
|
||||
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""windows.h""\r\n"
|
||||
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
"ACCESSBRIDGESTATUSWINDOW", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 4
|
||||
RIGHTMARGIN, 202
|
||||
BOTTOMMARGIN, 160
|
||||
END
|
||||
|
||||
"IDD_DIALOG1", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 179
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 88
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION JDK_FVER
|
||||
PRODUCTVERSION JDK_FVER
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE JDK_FTYPE
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "Java Access Bridge\0"
|
||||
VALUE "CompanyName", XSTR(JDK_COMPANY) "\0"
|
||||
VALUE "FileDescription", XSTR(JDK_COMPONENT) "\0"
|
||||
VALUE "FileVersion", XSTR(JDK_VER) "\0"
|
||||
VALUE "Full Version", XSTR(JDK_BUILD_ID) "\0"
|
||||
VALUE "InternalName", XSTR(JDK_INTERNAL_NAME) "\0"
|
||||
VALUE "LegalCopyright", XSTR(JDK_COPYRIGHT) "\0"
|
||||
VALUE "OriginalFilename", XSTR(JDK_FNAME) "\0"
|
||||
VALUE "ProductName", XSTR(JDK_NAME) "\0"
|
||||
VALUE "ProductVersion", XSTR(JDK_VER) "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#define cVMID 1001
|
||||
#define cWindowsID 1002
|
||||
#define cStatusText 1003
|
||||
#define cCallInfo 1004
|
||||
#define cInvokedByText 1005
|
||||
#define IDC_STATIC -1
|
||||
|
||||
#define cInstallAccessBridge 2001
|
||||
#define cRemindThereIsNewJVM 2005
|
||||
#define cDoNotRemindThereIsNewJVM 2005
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1032
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
42
jdk/src/jdk.accessibility/windows/native/common/resource.h
Normal file
42
jdk/src/jdk.accessibility/windows/native/common/resource.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by AccessBridgeStatusWindow.RC
|
||||
//
|
||||
//#define IDB_BITMAP1 102
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 103
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1032
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* AccessBridgeCallbacks.h 1.17 05/03/21
|
||||
*/
|
||||
|
||||
/*
|
||||
* Header file defining callback typedefs for Windows routines
|
||||
* which are called from Java (responding to events, etc.).
|
||||
*/
|
||||
|
||||
#ifndef __AccessBridgeCallbacks_H__
|
||||
#define __AccessBridgeCallbacks_H__
|
||||
|
||||
#include <jni.h>
|
||||
#include "AccessBridgePackages.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*AccessBridge_PropertyChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *property, wchar_t *oldValue, wchar_t *newValue);
|
||||
|
||||
typedef void (*AccessBridge_JavaShutdownFP) (long vmID);
|
||||
typedef void (*AccessBridge_JavaShutdownFP) (long vmID);
|
||||
|
||||
typedef void (*AccessBridge_FocusGainedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_FocusLostFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
|
||||
typedef void (*AccessBridge_CaretUpdateFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
|
||||
typedef void (*AccessBridge_MouseClickedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MouseEnteredFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MouseExitedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MousePressedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MouseReleasedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
|
||||
typedef void (*AccessBridge_MenuCanceledFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MenuDeselectedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MenuSelectedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PopupMenuCanceledFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PopupMenuWillBecomeInvisibleFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PopupMenuWillBecomeVisibleFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
|
||||
typedef void (*AccessBridge_PropertyNameChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldName, wchar_t *newName);
|
||||
typedef void (*AccessBridge_PropertyDescriptionChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldDescription, wchar_t *newDescription);
|
||||
typedef void (*AccessBridge_PropertyStateChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldState, wchar_t *newState);
|
||||
typedef void (*AccessBridge_PropertyValueChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldValue, wchar_t *newValue);
|
||||
typedef void (*AccessBridge_PropertySelectionChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PropertyTextChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PropertyCaretChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
int oldPosition, int newPosition);
|
||||
typedef void (*AccessBridge_PropertyVisibleDataChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PropertyChildChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
JOBJECT64 oldChild, JOBJECT64 newChild);
|
||||
typedef void (*AccessBridge_PropertyActiveDescendentChangeFP) (long vmID, JOBJECT64 event,
|
||||
JOBJECT64 source,
|
||||
JOBJECT64 oldActiveDescendent,
|
||||
JOBJECT64 newActiveDescendent);
|
||||
|
||||
typedef void (*AccessBridge_PropertyTableModelChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 src,
|
||||
wchar_t *oldValue, wchar_t *newValue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,706 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Wrapper functions around calls to the AccessBridge DLL
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <jni.h>
|
||||
#include "AccessBridgeCallbacks.h"
|
||||
#include "AccessBridgePackages.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define null NULL
|
||||
|
||||
typedef JOBJECT64 AccessibleContext;
|
||||
typedef JOBJECT64 AccessibleText;
|
||||
typedef JOBJECT64 AccessibleValue;
|
||||
typedef JOBJECT64 AccessibleSelection;
|
||||
typedef JOBJECT64 Java_Object;
|
||||
typedef JOBJECT64 PropertyChangeEvent;
|
||||
typedef JOBJECT64 FocusEvent;
|
||||
typedef JOBJECT64 CaretEvent;
|
||||
typedef JOBJECT64 MouseEvent;
|
||||
typedef JOBJECT64 MenuEvent;
|
||||
typedef JOBJECT64 AccessibleTable;
|
||||
typedef JOBJECT64 AccessibleHyperlink;
|
||||
typedef JOBJECT64 AccessibleHypertext;
|
||||
|
||||
|
||||
typedef void (*Windows_runFP) ();
|
||||
|
||||
typedef void (*SetPropertyChangeFP) (AccessBridge_PropertyChangeFP fp);
|
||||
|
||||
typedef void (*SetJavaShutdownFP) (AccessBridge_JavaShutdownFP fp);
|
||||
typedef void (*SetFocusGainedFP) (AccessBridge_FocusGainedFP fp);
|
||||
typedef void (*SetFocusLostFP) (AccessBridge_FocusLostFP fp);
|
||||
|
||||
typedef void (*SetCaretUpdateFP) (AccessBridge_CaretUpdateFP fp);
|
||||
|
||||
typedef void (*SetMouseClickedFP) (AccessBridge_MouseClickedFP fp);
|
||||
typedef void (*SetMouseEnteredFP) (AccessBridge_MouseEnteredFP fp);
|
||||
typedef void (*SetMouseExitedFP) (AccessBridge_MouseExitedFP fp);
|
||||
typedef void (*SetMousePressedFP) (AccessBridge_MousePressedFP fp);
|
||||
typedef void (*SetMouseReleasedFP) (AccessBridge_MouseReleasedFP fp);
|
||||
|
||||
typedef void (*SetMenuCanceledFP) (AccessBridge_MenuCanceledFP fp);
|
||||
typedef void (*SetMenuDeselectedFP) (AccessBridge_MenuDeselectedFP fp);
|
||||
typedef void (*SetMenuSelectedFP) (AccessBridge_MenuSelectedFP fp);
|
||||
typedef void (*SetPopupMenuCanceledFP) (AccessBridge_PopupMenuCanceledFP fp);
|
||||
typedef void (*SetPopupMenuWillBecomeInvisibleFP) (AccessBridge_PopupMenuWillBecomeInvisibleFP fp);
|
||||
typedef void (*SetPopupMenuWillBecomeVisibleFP) (AccessBridge_PopupMenuWillBecomeVisibleFP fp);
|
||||
|
||||
typedef void (*SetPropertyNameChangeFP) (AccessBridge_PropertyNameChangeFP fp);
|
||||
typedef void (*SetPropertyDescriptionChangeFP) (AccessBridge_PropertyDescriptionChangeFP fp);
|
||||
typedef void (*SetPropertyStateChangeFP) (AccessBridge_PropertyStateChangeFP fp);
|
||||
typedef void (*SetPropertyValueChangeFP) (AccessBridge_PropertyValueChangeFP fp);
|
||||
typedef void (*SetPropertySelectionChangeFP) (AccessBridge_PropertySelectionChangeFP fp);
|
||||
typedef void (*SetPropertyTextChangeFP) (AccessBridge_PropertyTextChangeFP fp);
|
||||
typedef void (*SetPropertyCaretChangeFP) (AccessBridge_PropertyCaretChangeFP fp);
|
||||
typedef void (*SetPropertyVisibleDataChangeFP) (AccessBridge_PropertyVisibleDataChangeFP fp);
|
||||
typedef void (*SetPropertyChildChangeFP) (AccessBridge_PropertyChildChangeFP fp);
|
||||
typedef void (*SetPropertyActiveDescendentChangeFP) (AccessBridge_PropertyActiveDescendentChangeFP fp);
|
||||
|
||||
typedef void (*SetPropertyTableModelChangeFP) (AccessBridge_PropertyTableModelChangeFP fp);
|
||||
|
||||
typedef void (*ReleaseJavaObjectFP) (long vmID, Java_Object object);
|
||||
|
||||
typedef BOOL (*GetVersionInfoFP) (long vmID, AccessBridgeVersionInfo *info);
|
||||
|
||||
typedef BOOL (*IsJavaWindowFP) (HWND window);
|
||||
typedef BOOL (*IsSameObjectFP) (long vmID, JOBJECT64 obj1, JOBJECT64 obj2);
|
||||
typedef BOOL (*GetAccessibleContextFromHWNDFP) (HWND window, long *vmID, AccessibleContext *ac);
|
||||
typedef HWND (*getHWNDFromAccessibleContextFP) (long vmID, AccessibleContext ac);
|
||||
|
||||
typedef BOOL (*GetAccessibleContextAtFP) (long vmID, AccessibleContext acParent,
|
||||
jint x, jint y, AccessibleContext *ac);
|
||||
typedef BOOL (*GetAccessibleContextWithFocusFP) (HWND window, long *vmID, AccessibleContext *ac);
|
||||
typedef BOOL (*GetAccessibleContextInfoFP) (long vmID, AccessibleContext ac, AccessibleContextInfo *info);
|
||||
typedef AccessibleContext (*GetAccessibleChildFromContextFP) (long vmID, AccessibleContext ac, jint i);
|
||||
typedef AccessibleContext (*GetAccessibleParentFromContextFP) (long vmID, AccessibleContext ac);
|
||||
|
||||
/* begin AccessibleTable */
|
||||
typedef BOOL (*getAccessibleTableInfoFP) (long vmID, AccessibleContext ac, AccessibleTableInfo *tableInfo);
|
||||
typedef BOOL (*getAccessibleTableCellInfoFP) (long vmID, AccessibleTable accessibleTable,
|
||||
jint row, jint column, AccessibleTableCellInfo *tableCellInfo);
|
||||
|
||||
typedef BOOL (*getAccessibleTableRowHeaderFP) (long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||
typedef BOOL (*getAccessibleTableColumnHeaderFP) (long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||
|
||||
typedef AccessibleContext (*getAccessibleTableRowDescriptionFP) (long vmID, AccessibleContext acParent, jint row);
|
||||
typedef AccessibleContext (*getAccessibleTableColumnDescriptionFP) (long vmID, AccessibleContext acParent, jint column);
|
||||
|
||||
typedef jint (*getAccessibleTableRowSelectionCountFP) (long vmID, AccessibleTable table);
|
||||
typedef BOOL (*isAccessibleTableRowSelectedFP) (long vmID, AccessibleTable table, jint row);
|
||||
typedef BOOL (*getAccessibleTableRowSelectionsFP) (long vmID, AccessibleTable table, jint count,
|
||||
jint *selections);
|
||||
|
||||
typedef jint (*getAccessibleTableColumnSelectionCountFP) (long vmID, AccessibleTable table);
|
||||
typedef BOOL (*isAccessibleTableColumnSelectedFP) (long vmID, AccessibleTable table, jint column);
|
||||
typedef BOOL (*getAccessibleTableColumnSelectionsFP) (long vmID, AccessibleTable table, jint count,
|
||||
jint *selections);
|
||||
|
||||
typedef jint (*getAccessibleTableRowFP) (long vmID, AccessibleTable table, jint index);
|
||||
typedef jint (*getAccessibleTableColumnFP) (long vmID, AccessibleTable table, jint index);
|
||||
typedef jint (*getAccessibleTableIndexFP) (long vmID, AccessibleTable table, jint row, jint column);
|
||||
/* end AccessibleTable */
|
||||
|
||||
/* AccessibleRelationSet */
|
||||
typedef BOOL (*getAccessibleRelationSetFP) (long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleRelationSetInfo *relationSetInfo);
|
||||
|
||||
/* AccessibleHypertext */
|
||||
typedef BOOL (*getAccessibleHypertextFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
typedef BOOL (*activateAccessibleHyperlinkFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleHyperlink accessibleHyperlink);
|
||||
|
||||
typedef jint (*getAccessibleHyperlinkCountFP)(const long vmID,
|
||||
const AccessibleContext accessibleContext);
|
||||
|
||||
typedef BOOL (*getAccessibleHypertextExtFP) (const long vmID,
|
||||
const AccessibleContext accessibleContext,
|
||||
const jint nStartIndex,
|
||||
AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
typedef jint (*getAccessibleHypertextLinkIndexFP)(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex);
|
||||
|
||||
typedef BOOL (*getAccessibleHyperlinkFP)(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex,
|
||||
AccessibleHyperlinkInfo *hyperlinkInfo);
|
||||
|
||||
|
||||
/* Accessible KeyBindings, Icons and Actions */
|
||||
typedef BOOL (*getAccessibleKeyBindingsFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleKeyBindings *keyBindings);
|
||||
|
||||
typedef BOOL (*getAccessibleIconsFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleIcons *icons);
|
||||
|
||||
typedef BOOL (*getAccessibleActionsFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleActions *actions);
|
||||
|
||||
typedef BOOL (*doAccessibleActionsFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleActionsToDo *actionsToDo, jint *failure);
|
||||
|
||||
|
||||
/* AccessibleText */
|
||||
|
||||
typedef BOOL (*GetAccessibleTextInfoFP) (long vmID, AccessibleText at, AccessibleTextInfo *textInfo, jint x, jint y);
|
||||
typedef BOOL (*GetAccessibleTextItemsFP) (long vmID, AccessibleText at, AccessibleTextItemsInfo *textItems, jint index);
|
||||
typedef BOOL (*GetAccessibleTextSelectionInfoFP) (long vmID, AccessibleText at, AccessibleTextSelectionInfo *textSelection);
|
||||
typedef BOOL (*GetAccessibleTextAttributesFP) (long vmID, AccessibleText at, jint index, AccessibleTextAttributesInfo *attributes);
|
||||
typedef BOOL (*GetAccessibleTextRectFP) (long vmID, AccessibleText at, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
typedef BOOL (*GetAccessibleTextLineBoundsFP) (long vmID, AccessibleText at, jint index, jint *startIndex, jint *endIndex);
|
||||
typedef BOOL (*GetAccessibleTextRangeFP) (long vmID, AccessibleText at, jint start, jint end, wchar_t *text, short len);
|
||||
|
||||
typedef BOOL (*GetCurrentAccessibleValueFromContextFP) (long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
typedef BOOL (*GetMaximumAccessibleValueFromContextFP) (long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
typedef BOOL (*GetMinimumAccessibleValueFromContextFP) (long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
|
||||
typedef void (*AddAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||
typedef void (*ClearAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as);
|
||||
typedef JOBJECT64 (*GetAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||
typedef int (*GetAccessibleSelectionCountFromContextFP) (long vmID, AccessibleSelection as);
|
||||
typedef BOOL (*IsAccessibleChildSelectedFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||
typedef void (*RemoveAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||
typedef void (*SelectAllAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as);
|
||||
|
||||
/* Utility methods */
|
||||
|
||||
typedef BOOL (*setTextContentsFP) (const long vmID, const AccessibleContext ac, const wchar_t *text);
|
||||
typedef AccessibleContext (*getParentWithRoleFP) (const long vmID, const AccessibleContext ac, const wchar_t *role);
|
||||
typedef AccessibleContext (*getParentWithRoleElseRootFP) (const long vmID, const AccessibleContext ac, const wchar_t *role);
|
||||
typedef AccessibleContext (*getTopLevelObjectFP) (const long vmID, const AccessibleContext ac);
|
||||
typedef int (*getObjectDepthFP) (const long vmID, const AccessibleContext ac);
|
||||
typedef AccessibleContext (*getActiveDescendentFP) (const long vmID, const AccessibleContext ac);
|
||||
|
||||
|
||||
typedef BOOL (*getVirtualAccessibleNameFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||
wchar_t *name, int len);
|
||||
|
||||
typedef BOOL (*requestFocusFP) (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
typedef BOOL (*selectTextRangeFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||
const int startIndex, const int endIndex);
|
||||
|
||||
typedef BOOL (*getTextAttributesInRangeFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||
const int startIndex, const int endIndex,
|
||||
AccessibleTextAttributesInfo *attributes, short *len);
|
||||
|
||||
typedef int (*getVisibleChildrenCountFP) (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
typedef BOOL (*getVisibleChildrenFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||
const int startIndex, VisibleChildrenInfo *children);
|
||||
|
||||
typedef BOOL (*setCaretPositionFP) (const long vmID, const AccessibleContext accessibleContext, const int position);
|
||||
|
||||
typedef BOOL (*getCaretLocationFP) (long vmID, AccessibleContext ac, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
|
||||
typedef int (*getEventsWaitingFP) ();
|
||||
|
||||
typedef struct AccessBridgeFPsTag {
|
||||
Windows_runFP Windows_run;
|
||||
|
||||
SetPropertyChangeFP SetPropertyChange;
|
||||
|
||||
SetJavaShutdownFP SetJavaShutdown;
|
||||
SetFocusGainedFP SetFocusGained;
|
||||
SetFocusLostFP SetFocusLost;
|
||||
|
||||
SetCaretUpdateFP SetCaretUpdate;
|
||||
|
||||
SetMouseClickedFP SetMouseClicked;
|
||||
SetMouseEnteredFP SetMouseEntered;
|
||||
SetMouseExitedFP SetMouseExited;
|
||||
SetMousePressedFP SetMousePressed;
|
||||
SetMouseReleasedFP SetMouseReleased;
|
||||
|
||||
SetMenuCanceledFP SetMenuCanceled;
|
||||
SetMenuDeselectedFP SetMenuDeselected;
|
||||
SetMenuSelectedFP SetMenuSelected;
|
||||
SetPopupMenuCanceledFP SetPopupMenuCanceled;
|
||||
SetPopupMenuWillBecomeInvisibleFP SetPopupMenuWillBecomeInvisible;
|
||||
SetPopupMenuWillBecomeVisibleFP SetPopupMenuWillBecomeVisible;
|
||||
|
||||
SetPropertyNameChangeFP SetPropertyNameChange;
|
||||
SetPropertyDescriptionChangeFP SetPropertyDescriptionChange;
|
||||
SetPropertyStateChangeFP SetPropertyStateChange;
|
||||
SetPropertyValueChangeFP SetPropertyValueChange;
|
||||
SetPropertySelectionChangeFP SetPropertySelectionChange;
|
||||
SetPropertyTextChangeFP SetPropertyTextChange;
|
||||
SetPropertyCaretChangeFP SetPropertyCaretChange;
|
||||
SetPropertyVisibleDataChangeFP SetPropertyVisibleDataChange;
|
||||
SetPropertyChildChangeFP SetPropertyChildChange;
|
||||
SetPropertyActiveDescendentChangeFP SetPropertyActiveDescendentChange;
|
||||
|
||||
SetPropertyTableModelChangeFP SetPropertyTableModelChange;
|
||||
|
||||
ReleaseJavaObjectFP ReleaseJavaObject;
|
||||
GetVersionInfoFP GetVersionInfo;
|
||||
|
||||
IsJavaWindowFP IsJavaWindow;
|
||||
IsSameObjectFP IsSameObject;
|
||||
GetAccessibleContextFromHWNDFP GetAccessibleContextFromHWND;
|
||||
getHWNDFromAccessibleContextFP getHWNDFromAccessibleContext;
|
||||
|
||||
GetAccessibleContextAtFP GetAccessibleContextAt;
|
||||
GetAccessibleContextWithFocusFP GetAccessibleContextWithFocus;
|
||||
GetAccessibleContextInfoFP GetAccessibleContextInfo;
|
||||
GetAccessibleChildFromContextFP GetAccessibleChildFromContext;
|
||||
GetAccessibleParentFromContextFP GetAccessibleParentFromContext;
|
||||
|
||||
getAccessibleTableInfoFP getAccessibleTableInfo;
|
||||
getAccessibleTableCellInfoFP getAccessibleTableCellInfo;
|
||||
|
||||
getAccessibleTableRowHeaderFP getAccessibleTableRowHeader;
|
||||
getAccessibleTableColumnHeaderFP getAccessibleTableColumnHeader;
|
||||
|
||||
getAccessibleTableRowDescriptionFP getAccessibleTableRowDescription;
|
||||
getAccessibleTableColumnDescriptionFP getAccessibleTableColumnDescription;
|
||||
|
||||
getAccessibleTableRowSelectionCountFP getAccessibleTableRowSelectionCount;
|
||||
isAccessibleTableRowSelectedFP isAccessibleTableRowSelected;
|
||||
getAccessibleTableRowSelectionsFP getAccessibleTableRowSelections;
|
||||
|
||||
getAccessibleTableColumnSelectionCountFP getAccessibleTableColumnSelectionCount;
|
||||
isAccessibleTableColumnSelectedFP isAccessibleTableColumnSelected;
|
||||
getAccessibleTableColumnSelectionsFP getAccessibleTableColumnSelections;
|
||||
|
||||
getAccessibleTableRowFP getAccessibleTableRow;
|
||||
getAccessibleTableColumnFP getAccessibleTableColumn;
|
||||
getAccessibleTableIndexFP getAccessibleTableIndex;
|
||||
|
||||
getAccessibleRelationSetFP getAccessibleRelationSet;
|
||||
|
||||
getAccessibleHypertextFP getAccessibleHypertext;
|
||||
activateAccessibleHyperlinkFP activateAccessibleHyperlink;
|
||||
getAccessibleHyperlinkCountFP getAccessibleHyperlinkCount;
|
||||
getAccessibleHypertextExtFP getAccessibleHypertextExt;
|
||||
getAccessibleHypertextLinkIndexFP getAccessibleHypertextLinkIndex;
|
||||
getAccessibleHyperlinkFP getAccessibleHyperlink;
|
||||
|
||||
getAccessibleKeyBindingsFP getAccessibleKeyBindings;
|
||||
getAccessibleIconsFP getAccessibleIcons;
|
||||
getAccessibleActionsFP getAccessibleActions;
|
||||
doAccessibleActionsFP doAccessibleActions;
|
||||
|
||||
GetAccessibleTextInfoFP GetAccessibleTextInfo;
|
||||
GetAccessibleTextItemsFP GetAccessibleTextItems;
|
||||
GetAccessibleTextSelectionInfoFP GetAccessibleTextSelectionInfo;
|
||||
GetAccessibleTextAttributesFP GetAccessibleTextAttributes;
|
||||
GetAccessibleTextRectFP GetAccessibleTextRect;
|
||||
GetAccessibleTextLineBoundsFP GetAccessibleTextLineBounds;
|
||||
GetAccessibleTextRangeFP GetAccessibleTextRange;
|
||||
|
||||
GetCurrentAccessibleValueFromContextFP GetCurrentAccessibleValueFromContext;
|
||||
GetMaximumAccessibleValueFromContextFP GetMaximumAccessibleValueFromContext;
|
||||
GetMinimumAccessibleValueFromContextFP GetMinimumAccessibleValueFromContext;
|
||||
|
||||
AddAccessibleSelectionFromContextFP AddAccessibleSelectionFromContext;
|
||||
ClearAccessibleSelectionFromContextFP ClearAccessibleSelectionFromContext;
|
||||
GetAccessibleSelectionFromContextFP GetAccessibleSelectionFromContext;
|
||||
GetAccessibleSelectionCountFromContextFP GetAccessibleSelectionCountFromContext;
|
||||
IsAccessibleChildSelectedFromContextFP IsAccessibleChildSelectedFromContext;
|
||||
RemoveAccessibleSelectionFromContextFP RemoveAccessibleSelectionFromContext;
|
||||
SelectAllAccessibleSelectionFromContextFP SelectAllAccessibleSelectionFromContext;
|
||||
|
||||
setTextContentsFP setTextContents;
|
||||
getParentWithRoleFP getParentWithRole;
|
||||
getTopLevelObjectFP getTopLevelObject;
|
||||
getParentWithRoleElseRootFP getParentWithRoleElseRoot;
|
||||
getObjectDepthFP getObjectDepth;
|
||||
getActiveDescendentFP getActiveDescendent;
|
||||
|
||||
getVirtualAccessibleNameFP getVirtualAccessibleName;
|
||||
requestFocusFP requestFocus;
|
||||
selectTextRangeFP selectTextRange;
|
||||
getTextAttributesInRangeFP getTextAttributesInRange;
|
||||
getVisibleChildrenCountFP getVisibleChildrenCount;
|
||||
getVisibleChildrenFP getVisibleChildren;
|
||||
setCaretPositionFP setCaretPosition;
|
||||
getCaretLocationFP getCaretLocation;
|
||||
|
||||
getEventsWaitingFP getEventsWaiting;
|
||||
|
||||
} AccessBridgeFPs;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the world
|
||||
*/
|
||||
BOOL initializeAccessBridge();
|
||||
BOOL shutdownAccessBridge();
|
||||
|
||||
/**
|
||||
* Window routines
|
||||
*/
|
||||
BOOL IsJavaWindow(HWND window);
|
||||
|
||||
// Returns the virtual machine ID and AccessibleContext for a top-level window
|
||||
BOOL GetAccessibleContextFromHWND(HWND target, long *vmID, AccessibleContext *ac);
|
||||
|
||||
// Returns the HWND from the AccessibleContext of a top-level window
|
||||
HWND getHWNDFromAccessibleContext(long vmID, AccessibleContext ac);
|
||||
|
||||
|
||||
/**
|
||||
* Event handling routines
|
||||
*/
|
||||
void SetJavaShutdown(AccessBridge_JavaShutdownFP fp);
|
||||
void SetFocusGained(AccessBridge_FocusGainedFP fp);
|
||||
void SetFocusLost(AccessBridge_FocusLostFP fp);
|
||||
|
||||
void SetCaretUpdate(AccessBridge_CaretUpdateFP fp);
|
||||
|
||||
void SetMouseClicked(AccessBridge_MouseClickedFP fp);
|
||||
void SetMouseEntered(AccessBridge_MouseEnteredFP fp);
|
||||
void SetMouseExited(AccessBridge_MouseExitedFP fp);
|
||||
void SetMousePressed(AccessBridge_MousePressedFP fp);
|
||||
void SetMouseReleased(AccessBridge_MouseReleasedFP fp);
|
||||
|
||||
void SetMenuCanceled(AccessBridge_MenuCanceledFP fp);
|
||||
void SetMenuDeselected(AccessBridge_MenuDeselectedFP fp);
|
||||
void SetMenuSelected(AccessBridge_MenuSelectedFP fp);
|
||||
void SetPopupMenuCanceled(AccessBridge_PopupMenuCanceledFP fp);
|
||||
void SetPopupMenuWillBecomeInvisible(AccessBridge_PopupMenuWillBecomeInvisibleFP fp);
|
||||
void SetPopupMenuWillBecomeVisible(AccessBridge_PopupMenuWillBecomeVisibleFP fp);
|
||||
|
||||
void SetPropertyNameChange(AccessBridge_PropertyNameChangeFP fp);
|
||||
void SetPropertyDescriptionChange(AccessBridge_PropertyDescriptionChangeFP fp);
|
||||
void SetPropertyStateChange(AccessBridge_PropertyStateChangeFP fp);
|
||||
void SetPropertyValueChange(AccessBridge_PropertyValueChangeFP fp);
|
||||
void SetPropertySelectionChange(AccessBridge_PropertySelectionChangeFP fp);
|
||||
void SetPropertyTextChange(AccessBridge_PropertyTextChangeFP fp);
|
||||
void SetPropertyCaretChange(AccessBridge_PropertyCaretChangeFP fp);
|
||||
void SetPropertyVisibleDataChange(AccessBridge_PropertyVisibleDataChangeFP fp);
|
||||
void SetPropertyChildChange(AccessBridge_PropertyChildChangeFP fp);
|
||||
void SetPropertyActiveDescendentChange(AccessBridge_PropertyActiveDescendentChangeFP fp);
|
||||
|
||||
void SetPropertyTableModelChange(AccessBridge_PropertyTableModelChangeFP fp);
|
||||
|
||||
|
||||
/**
|
||||
* General routines
|
||||
*/
|
||||
void ReleaseJavaObject(long vmID, Java_Object object);
|
||||
BOOL GetVersionInfo(long vmID, AccessBridgeVersionInfo *info);
|
||||
HWND GetHWNDFromAccessibleContext(long vmID, JOBJECT64 accesibleContext);
|
||||
|
||||
/**
|
||||
* Accessible Context routines
|
||||
*/
|
||||
BOOL GetAccessibleContextAt(long vmID, AccessibleContext acParent,
|
||||
jint x, jint y, AccessibleContext *ac);
|
||||
BOOL GetAccessibleContextWithFocus(HWND window, long *vmID, AccessibleContext *ac);
|
||||
BOOL GetAccessibleContextInfo(long vmID, AccessibleContext ac, AccessibleContextInfo *info);
|
||||
AccessibleContext GetAccessibleChildFromContext(long vmID, AccessibleContext ac, jint index);
|
||||
AccessibleContext GetAccessibleParentFromContext(long vmID, AccessibleContext ac);
|
||||
|
||||
/**
|
||||
* Accessible Text routines
|
||||
*/
|
||||
BOOL GetAccessibleTextInfo(long vmID, AccessibleText at, AccessibleTextInfo *textInfo, jint x, jint y);
|
||||
BOOL GetAccessibleTextItems(long vmID, AccessibleText at, AccessibleTextItemsInfo *textItems, jint index);
|
||||
BOOL GetAccessibleTextSelectionInfo(long vmID, AccessibleText at, AccessibleTextSelectionInfo *textSelection);
|
||||
BOOL GetAccessibleTextAttributes(long vmID, AccessibleText at, jint index, AccessibleTextAttributesInfo *attributes);
|
||||
BOOL GetAccessibleTextRect(long vmID, AccessibleText at, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
BOOL GetAccessibleTextLineBounds(long vmID, AccessibleText at, jint index, jint *startIndex, jint *endIndex);
|
||||
BOOL GetAccessibleTextRange(long vmID, AccessibleText at, jint start, jint end, wchar_t *text, short len);
|
||||
|
||||
/* begin AccessibleTable routines */
|
||||
BOOL getAccessibleTableInfo(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||
|
||||
BOOL getAccessibleTableCellInfo(long vmID, AccessibleTable accessibleTable, jint row, jint column,
|
||||
AccessibleTableCellInfo *tableCellInfo);
|
||||
|
||||
BOOL getAccessibleTableRowHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||
BOOL getAccessibleTableColumnHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||
|
||||
AccessibleContext getAccessibleTableRowDescription(long vmID, AccessibleContext acParent, jint row);
|
||||
AccessibleContext getAccessibleTableColumnDescription(long vmID, AccessibleContext acParent, jint column);
|
||||
|
||||
jint getAccessibleTableRowSelectionCount(long vmID, AccessibleTable table);
|
||||
BOOL isAccessibleTableRowSelected(long vmID, AccessibleTable table, jint row);
|
||||
BOOL getAccessibleTableRowSelections(long vmID, AccessibleTable table, jint count, jint *selections);
|
||||
|
||||
jint getAccessibleTableColumnSelectionCount(long vmID, AccessibleTable table);
|
||||
BOOL isAccessibleTableColumnSelected(long vmID, AccessibleTable table, jint column);
|
||||
BOOL getAccessibleTableColumnSelections(long vmID, AccessibleTable table, jint count, jint *selections);
|
||||
|
||||
jint getAccessibleTableRow(long vmID, AccessibleTable table, jint index);
|
||||
jint getAccessibleTableColumn(long vmID, AccessibleTable table, jint index);
|
||||
jint getAccessibleTableIndex(long vmID, AccessibleTable table, jint row, jint column);
|
||||
/* end AccessibleTable */
|
||||
|
||||
/* ----- AccessibleRelationSet routines */
|
||||
BOOL getAccessibleRelationSet(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleRelationSetInfo *relationSetInfo);
|
||||
|
||||
/* ----- AccessibleHypertext routines */
|
||||
|
||||
/*
|
||||
* Returns hypertext information associated with a component.
|
||||
*/
|
||||
BOOL getAccessibleHypertext(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
/*
|
||||
* Requests that a hyperlink be activated.
|
||||
*/
|
||||
BOOL activateAccessibleHyperlink(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleHyperlink accessibleHyperlink);
|
||||
|
||||
/*
|
||||
* Returns the number of hyperlinks in a component
|
||||
* Maps to AccessibleHypertext.getLinkCount.
|
||||
* Returns -1 on error.
|
||||
*/
|
||||
jint getAccessibleHyperlinkCount(const long vmID,
|
||||
const AccessibleHypertext hypertext);
|
||||
|
||||
/*
|
||||
* This method is used to iterate through the hyperlinks in a component. It
|
||||
* returns hypertext information for a component starting at hyperlink index
|
||||
* nStartIndex. No more than MAX_HYPERLINKS AccessibleHypertextInfo objects will
|
||||
* be returned for each call to this method.
|
||||
* Returns FALSE on error.
|
||||
*/
|
||||
BOOL getAccessibleHypertextExt(const long vmID,
|
||||
const AccessibleContext accessibleContext,
|
||||
const jint nStartIndex,
|
||||
/* OUT */ AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
/*
|
||||
* Returns the index into an array of hyperlinks that is associated with
|
||||
* a character index in document; maps to AccessibleHypertext.getLinkIndex
|
||||
* Returns -1 on error.
|
||||
*/
|
||||
jint getAccessibleHypertextLinkIndex(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex);
|
||||
|
||||
/*
|
||||
* Returns the nth hyperlink in a document
|
||||
* Maps to AccessibleHypertext.getLink.
|
||||
* Returns FALSE on error
|
||||
*/
|
||||
BOOL getAccessibleHyperlink(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex,
|
||||
/* OUT */ AccessibleHyperlinkInfo *hyperlinkInfo);
|
||||
|
||||
/* Accessible KeyBindings, Icons and Actions */
|
||||
|
||||
/*
|
||||
* Returns a list of key bindings associated with a component.
|
||||
*/
|
||||
BOOL getAccessibleKeyBindings(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleKeyBindings *keyBindings);
|
||||
|
||||
/*
|
||||
* Returns a list of icons associate with a component.
|
||||
*/
|
||||
BOOL getAccessibleIcons(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleIcons *icons);
|
||||
|
||||
/*
|
||||
* Returns a list of actions that a component can perform.
|
||||
*/
|
||||
BOOL getAccessibleActions(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleActions *actions);
|
||||
|
||||
/*
|
||||
* Request that a list of AccessibleActions be performed by a component.
|
||||
* Returns TRUE if all actions are performed. Returns FALSE
|
||||
* when the first requested action fails in which case "failure"
|
||||
* contains the index of the action that failed.
|
||||
*/
|
||||
BOOL doAccessibleActions(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleActionsToDo *actionsToDo, jint *failure);
|
||||
|
||||
|
||||
|
||||
/* Additional utility methods */
|
||||
|
||||
/*
|
||||
* Returns whether two object references refer to the same object.
|
||||
*/
|
||||
BOOL IsSameObject(long vmID, JOBJECT64 obj1, JOBJECT64 obj2);
|
||||
|
||||
/**
|
||||
* Sets editable text contents. The AccessibleContext must implement AccessibleEditableText and
|
||||
* be editable. The maximum text length that can be set is MAX_STRING_SIZE - 1.
|
||||
* Returns whether successful
|
||||
*/
|
||||
BOOL setTextContents (const long vmID, const AccessibleContext accessibleContext, const wchar_t *text);
|
||||
|
||||
/**
|
||||
* Returns the Accessible Context with the specified role that is the
|
||||
* ancestor of a given object. The role is one of the role strings
|
||||
* defined in AccessBridgePackages.h
|
||||
* If there is no ancestor object that has the specified role,
|
||||
* returns (AccessibleContext)0.
|
||||
*/
|
||||
AccessibleContext getParentWithRole (const long vmID, const AccessibleContext accessibleContext,
|
||||
const wchar_t *role);
|
||||
|
||||
/**
|
||||
* Returns the Accessible Context with the specified role that is the
|
||||
* ancestor of a given object. The role is one of the role strings
|
||||
* defined in AccessBridgePackages.h. If an object with the specified
|
||||
* role does not exist, returns the top level object for the Java Window.
|
||||
* Returns (AccessibleContext)0 on error.
|
||||
*/
|
||||
AccessibleContext getParentWithRoleElseRoot (const long vmID, const AccessibleContext accessibleContext,
|
||||
const wchar_t *role);
|
||||
|
||||
/**
|
||||
* Returns the Accessible Context for the top level object in
|
||||
* a Java Window. This is same Accessible Context that is obtained
|
||||
* from GetAccessibleContextFromHWND for that window. Returns
|
||||
* (AccessibleContext)0 on error.
|
||||
*/
|
||||
AccessibleContext getTopLevelObject (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Returns how deep in the object hierarchy a given object is.
|
||||
* The top most object in the object hierarchy has an object depth of 0.
|
||||
* Returns -1 on error.
|
||||
*/
|
||||
int getObjectDepth (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Returns the Accessible Context of the current ActiveDescendent of an object.
|
||||
* This method assumes the ActiveDescendent is the component that is currently
|
||||
* selected in a container object.
|
||||
* Returns (AccessibleContext)0 on error or if there is no selection.
|
||||
*/
|
||||
AccessibleContext getActiveDescendent (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Accessible Value routines
|
||||
*/
|
||||
BOOL GetCurrentAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
BOOL GetMaximumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
BOOL GetMinimumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
|
||||
/**
|
||||
* Accessible Selection routines
|
||||
*/
|
||||
void AddAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);
|
||||
void ClearAccessibleSelectionFromContext(long vmID, AccessibleSelection as);
|
||||
JOBJECT64 GetAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);
|
||||
int GetAccessibleSelectionCountFromContext(long vmID, AccessibleSelection as);
|
||||
BOOL IsAccessibleChildSelectedFromContext(long vmID, AccessibleSelection as, int i);
|
||||
void RemoveAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);
|
||||
void SelectAllAccessibleSelectionFromContext(long vmID, AccessibleSelection as);
|
||||
|
||||
/**
|
||||
* Additional methods for Teton
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the AccessibleName for a component based upon the JAWS algorithm. Returns
|
||||
* whether successful.
|
||||
*
|
||||
* Bug ID 4916682 - Implement JAWS AccessibleName policy
|
||||
*/
|
||||
BOOL getVirtualAccessibleName(const long vmID, const AccessibleContext accessibleContext,
|
||||
wchar_t *name, int len);
|
||||
|
||||
/**
|
||||
* Request focus for a component. Returns whether successful.
|
||||
*
|
||||
* Bug ID 4944757 - requestFocus method needed
|
||||
*/
|
||||
BOOL requestFocus(const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Selects text between two indices. Selection includes the text at the start index
|
||||
* and the text at the end index. Returns whether successful.
|
||||
*
|
||||
* Bug ID 4944758 - selectTextRange method needed
|
||||
*/
|
||||
BOOL selectTextRange(const long vmID, const AccessibleContext accessibleContext, const int startIndex,
|
||||
const int endIndex);
|
||||
|
||||
/**
|
||||
* Get text attributes between two indices. The attribute list includes the text at the
|
||||
* start index and the text at the end index. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944761 - getTextAttributes between two indices method needed
|
||||
*/
|
||||
BOOL getTextAttributesInRange(const long vmID, const AccessibleContext accessibleContext,
|
||||
const int startIndex, const int endIndex,
|
||||
AccessibleTextAttributesInfo *attributes, short *len);
|
||||
|
||||
/**
|
||||
* Returns the number of visible children of a component. Returns -1 on error.
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
int getVisibleChildrenCount(const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Gets the visible children of an AccessibleContext. Returns whether successful.
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
BOOL getVisibleChildren(const long vmID, const AccessibleContext accessibleContext,
|
||||
const int startIndex,
|
||||
VisibleChildrenInfo *visibleChildrenInfo);
|
||||
|
||||
/**
|
||||
* Set the caret to a text position. Returns whether successful.
|
||||
*
|
||||
* Bug ID 4944770 - setCaretPosition method needed
|
||||
*/
|
||||
BOOL setCaretPosition(const long vmID, const AccessibleContext accessibleContext,
|
||||
const int position);
|
||||
|
||||
/**
|
||||
* Gets the text caret location
|
||||
*/
|
||||
BOOL getCaretLocation(long vmID, AccessibleContext ac,
|
||||
AccessibleTextRectInfo *rectInfo, jint index);
|
||||
|
||||
/**
|
||||
* Gets the number of events waiting to fire
|
||||
*/
|
||||
int getEventsWaiting();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
475
jdk/src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp
Normal file
475
jdk/src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp
Normal file
@ -0,0 +1,475 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <Windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
// This is the default buffer size used for RegQueryValue values.
|
||||
#define DEFAULT_ALLOC MAX_PATH
|
||||
// only allocate a buffer as big as MAX_ALLOC for RegQueryValue values.
|
||||
#define MAX_ALLOC 262144
|
||||
|
||||
static LPCTSTR ACCESSIBILITY_USER_KEY =
|
||||
_T("Software\\Microsoft\\Windows NT\\CurrentVersion\\Accessibility");
|
||||
static LPCTSTR ACCESSIBILITY_SYSTEM_KEY =
|
||||
_T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Accessibility\\Session");
|
||||
static LPCTSTR ACCESSIBILITY_CONFIG =
|
||||
_T("Configuration");
|
||||
static LPCTSTR STR_ACCESSBRIDGE =
|
||||
_T("oracle_javaaccessbridge");
|
||||
|
||||
// Note: There are senarios where more than one extension can be specified on the
|
||||
// asssistive_technologies=
|
||||
// line but this code only deals with the case of
|
||||
// assistive_technologies=com.sun.java.accessibility.AccessBridge
|
||||
// assuming that if additional extensions are desired the user knows how edit the file.
|
||||
|
||||
FILE* origFile;
|
||||
FILE* tempFile;
|
||||
|
||||
bool isXP()
|
||||
{
|
||||
static bool isXPFlag = false;
|
||||
OSVERSIONINFO osvi;
|
||||
|
||||
// Initialize the OSVERSIONINFO structure.
|
||||
ZeroMemory( &osvi, sizeof( osvi ) );
|
||||
osvi.dwOSVersionInfoSize = sizeof( osvi );
|
||||
|
||||
GetVersionEx( &osvi );
|
||||
|
||||
if ( osvi.dwMajorVersion == 5 ) // For Windows XP and Windows 2000
|
||||
isXPFlag = true;
|
||||
|
||||
return isXPFlag ;
|
||||
}
|
||||
|
||||
void enableJAB() {
|
||||
// Copy lines from orig to temp modifying the line containing
|
||||
// assistive_technologies=
|
||||
// There are various scenarios:
|
||||
// 1) If the line exists exactly as
|
||||
// #assistive_technologies=com.sun.java.accessibility.AccessBridge
|
||||
// replace it with
|
||||
// assistive_technologies=com.sun.java.accessibility.AccessBridge
|
||||
// 2) else if the line exists exactly as
|
||||
// assistive_technologies=com.sun.java.accessibility.AccessBridge
|
||||
// use it as is
|
||||
// 3) else if a line containing "assistive_technologies" exits
|
||||
// a) if it's already commented out, us it as is (jab will be enabled in step 4)
|
||||
// b) else if it's not commented out, comment it out and add a new line with
|
||||
// assistive_technologies=com.sun.java.accessibility.AccessBridge
|
||||
// 4) If the line doesn't exist (or case 3a), add
|
||||
// assistive_technologies=com.sun.java.accessibility.AccessBridge
|
||||
// Do the same for screen_magnifier_present=
|
||||
char line[512];
|
||||
char commentLine[512] = "#";
|
||||
char jabLine[] = "assistive_technologies=com.sun.java.accessibility.AccessBridge\n";
|
||||
char magLine[] = "screen_magnifier_present=true\n";
|
||||
bool foundJabLine = false;
|
||||
bool foundMagLine = false;
|
||||
while (!feof(origFile)) {
|
||||
if (fgets(line, 512, origFile) != NULL) {
|
||||
if (_stricmp(line, "#assistive_technologies=com.sun.java.accessibility.AccessBridge\n") == 0) {
|
||||
fputs(jabLine, tempFile);
|
||||
foundJabLine = true;
|
||||
} else if (_stricmp(line, jabLine) == 0) {
|
||||
fputs(line, tempFile);
|
||||
foundJabLine = true;
|
||||
} else if (strstr(line, "assistive_technologies") != NULL) {
|
||||
char* context;
|
||||
char* firstNonSpaceChar = strtok_s(line, " ", &context);
|
||||
if (*firstNonSpaceChar == '#') {
|
||||
fputs(line, tempFile);
|
||||
} else {
|
||||
strcat_s(commentLine, line);
|
||||
fputs(commentLine, tempFile);
|
||||
fputs(jabLine, tempFile);
|
||||
foundJabLine = true;
|
||||
}
|
||||
} else if (_stricmp(line, "#screen_magnifier_present=true\n") == 0) {
|
||||
fputs(magLine, tempFile);
|
||||
foundMagLine = true;
|
||||
} else if (_stricmp(line, magLine) == 0) {
|
||||
fputs(line, tempFile);
|
||||
foundMagLine = true;
|
||||
} else if (strstr(line, "screen_magnifier_present") != NULL) {
|
||||
char* context;
|
||||
char* firstNonSpaceChar = strtok_s(line, " ", &context);
|
||||
if (*firstNonSpaceChar == '#') {
|
||||
fputs(line, tempFile);
|
||||
} else {
|
||||
strcat_s(commentLine, line);
|
||||
fputs(commentLine, tempFile);
|
||||
fputs(magLine, tempFile);
|
||||
foundMagLine = true;
|
||||
}
|
||||
} else {
|
||||
fputs(line, tempFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundJabLine) {
|
||||
fputs(jabLine, tempFile);
|
||||
}
|
||||
if (!foundMagLine) {
|
||||
fputs(magLine, tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
void disableJAB() {
|
||||
// Copy lines from orig to temp modifying the line containing
|
||||
// assistive_technologies=
|
||||
// There are various scenarios:
|
||||
// 1) If the uncommented line exists, comment it out
|
||||
// 2) If the line exists but is preceeded by a #, nothing to do
|
||||
// 3) If the line doesn't exist, nothing to do
|
||||
// Do the same for screen_magnifier_present=
|
||||
char line[512];
|
||||
char commentLine[512];
|
||||
while (!feof(origFile)) {
|
||||
if (fgets(line, 512, origFile) != NULL) {
|
||||
if (strstr(line, "assistive_technologies") != NULL) {
|
||||
char* context;
|
||||
char* firstNonSpaceChar = strtok_s(line, " ", &context);
|
||||
if (*firstNonSpaceChar != '#') {
|
||||
strcpy_s(commentLine, "#");
|
||||
strcat_s(commentLine, line);
|
||||
fputs(commentLine, tempFile);
|
||||
} else {
|
||||
fputs(line, tempFile);
|
||||
}
|
||||
} else if (strstr(line, "screen_magnifier_present") != NULL) {
|
||||
char* context;
|
||||
char* firstNonSpaceChar = strtok_s(line, " ", &context);
|
||||
if (*firstNonSpaceChar != '#') {
|
||||
strcpy_s(commentLine, "#");
|
||||
strcat_s(commentLine, line);
|
||||
fputs(commentLine, tempFile);
|
||||
} else {
|
||||
fputs(line, tempFile);
|
||||
}
|
||||
} else {
|
||||
fputs(line, tempFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int modify(bool enable) {
|
||||
errno_t error = 0;
|
||||
char path[512];
|
||||
char tempPath[512];
|
||||
// Get the path for %USERPROFILE%
|
||||
char *profilePath;
|
||||
size_t len;
|
||||
error = _dupenv_s(&profilePath, &len, "USERPROFILE" );
|
||||
if (error) {
|
||||
printf("Error fetching USERPROFILE.\n");
|
||||
perror("Error");
|
||||
return error;
|
||||
}
|
||||
strcpy_s(path, profilePath);
|
||||
strcat_s(path, "\\.accessibility.properties");
|
||||
strcpy_s(tempPath, profilePath);
|
||||
strcat_s(tempPath, "\\.acce$$ibility.properties");
|
||||
free(profilePath);
|
||||
// Open the original file. If it doesn't exist and this is an enable request then create it.
|
||||
error = fopen_s(&origFile, path, "r");
|
||||
if (error) {
|
||||
if (enable) {
|
||||
error = fopen_s(&origFile, path, "w");
|
||||
if (error) {
|
||||
printf("Couldn't create file: %s\n", path);
|
||||
perror("Error");
|
||||
} else {
|
||||
char str[100] = "assistive_technologies=com.sun.java.accessibility.AccessBridge\n";
|
||||
strcat_s(str, "screen_magnifier_present=true\n");
|
||||
fprintf(origFile, str);
|
||||
fclose(origFile);
|
||||
}
|
||||
} else {
|
||||
// It's OK if the file isn't there for a -disable
|
||||
error = 0;
|
||||
}
|
||||
} else {
|
||||
// open a temp file
|
||||
error = fopen_s(&tempFile, tempPath, "w");
|
||||
if (error) {
|
||||
printf("Couldn't open temp file: %s\n", tempPath);
|
||||
perror("Error");
|
||||
return error;
|
||||
}
|
||||
if (enable) {
|
||||
enableJAB();
|
||||
} else {
|
||||
disableJAB();
|
||||
}
|
||||
fclose(origFile);
|
||||
fclose(tempFile);
|
||||
// delete the orig file and rename the temp file
|
||||
if (remove(path) != 0) {
|
||||
printf("Couldn't remove file: %s\n", path);
|
||||
perror("Error");
|
||||
return errno;
|
||||
}
|
||||
if (rename(tempPath, path) != 0) {
|
||||
printf("Couldn't rename %s to %s.\n", tempPath, path);
|
||||
perror("Error");
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
void printUsage() {
|
||||
printf("\njabswitch [/enable | /disable | /version | /?]\n\n");
|
||||
printf("Description:\n");
|
||||
printf(" jabswitch enables or disables the Java Access Bridge.\n\n");
|
||||
printf("Parameters:\n");
|
||||
printf(" /enable Enable the Java Accessibility Bridge.\n");
|
||||
printf(" /disable Disable the Java Accessibility Bridge.\n");
|
||||
printf(" /version Display the version.\n");
|
||||
printf(" /? Display this usage information.\n");
|
||||
printf("\nNote:\n");
|
||||
printf(" The Java Access Bridge can also be enabled with the\n");
|
||||
printf(" Windows Ease of Access control panel (which can be\n");
|
||||
printf(" activated by pressing Windows + U). The Ease of Access\n");
|
||||
printf(" control panel has a Java Access Bridge checkbox. Please\n");
|
||||
printf(" be aware that unchecking the checkbox has no effect and\n");
|
||||
printf(" in order to disable the Java Access Bridge you must run\n");
|
||||
printf(" jabswitch.exe from the command line.\n");
|
||||
}
|
||||
|
||||
void printVersion() {
|
||||
TCHAR executableFileName[_MAX_PATH];
|
||||
if (!GetModuleFileName(0, executableFileName, _MAX_PATH)) {
|
||||
printf("Unable to get executable file name.\n");
|
||||
return;
|
||||
}
|
||||
DWORD nParam;
|
||||
DWORD nVersionSize = GetFileVersionInfoSize(executableFileName, &nParam);
|
||||
if (!nVersionSize) {
|
||||
printf("Unable to get version info size.\n");
|
||||
return;
|
||||
}
|
||||
char* pVersionData = new char[nVersionSize];
|
||||
if (!GetFileVersionInfo(executableFileName, 0, nVersionSize, pVersionData)) {
|
||||
printf("Unable to get version info.\n");
|
||||
return;
|
||||
}
|
||||
LPVOID pVersionInfo;
|
||||
UINT nSize;
|
||||
if (!VerQueryValue(pVersionData, _T("\\"), &pVersionInfo, &nSize)) {
|
||||
printf("Unable to query version value.\n");
|
||||
return;
|
||||
}
|
||||
VS_FIXEDFILEINFO *pVSInfo = (VS_FIXEDFILEINFO *)pVersionInfo;
|
||||
char versionString[100];
|
||||
sprintf_s( versionString, "version %i.%i.%i.%i",
|
||||
pVSInfo->dwProductVersionMS >> 16,
|
||||
pVSInfo->dwProductVersionMS & 0xFFFF,
|
||||
pVSInfo->dwProductVersionLS >> 16,
|
||||
pVSInfo->dwProductVersionLS & 0xFFFF );
|
||||
char outputString[100];
|
||||
strcpy_s(outputString, "jabswitch ");
|
||||
strcat_s(outputString, versionString);
|
||||
strcat_s(outputString, "\njabswitch enables or disables the Java Access Bridge.\n");
|
||||
printf(outputString);
|
||||
}
|
||||
|
||||
int regEnable() {
|
||||
HKEY hKey;
|
||||
DWORD retval = -1;
|
||||
LSTATUS err;
|
||||
err = RegOpenKeyEx(HKEY_CURRENT_USER, ACCESSIBILITY_USER_KEY, NULL, KEY_READ|KEY_WRITE, &hKey);
|
||||
if (err == ERROR_SUCCESS) {
|
||||
DWORD dataType = REG_SZ;
|
||||
DWORD dataLength = DEFAULT_ALLOC;
|
||||
TCHAR dataBuffer[DEFAULT_ALLOC];
|
||||
TCHAR *data = dataBuffer;
|
||||
bool freeData = false;
|
||||
err = RegQueryValueEx(hKey, ACCESSIBILITY_CONFIG, 0, &dataType, (BYTE *)data, &dataLength);
|
||||
if (err == ERROR_MORE_DATA) {
|
||||
if (dataLength > 0 && dataLength < MAX_ALLOC) {
|
||||
data = new TCHAR[dataLength];
|
||||
err = RegQueryValueEx(hKey, ACCESSIBILITY_CONFIG, 0, &dataType, (BYTE *)data, &dataLength);
|
||||
}
|
||||
}
|
||||
if (err == ERROR_SUCCESS) {
|
||||
err = _tcslwr_s(dataBuffer, DEFAULT_ALLOC);
|
||||
if (err) {
|
||||
return -1;
|
||||
}
|
||||
if (_tcsstr(dataBuffer, STR_ACCESSBRIDGE) != NULL) {
|
||||
return 0; // This is OK, e.g. ran enable twice and the value is there.
|
||||
} else {
|
||||
// add oracle_javaaccessbridge to Config key for HKCU
|
||||
dataLength = dataLength + (_tcslen(STR_ACCESSBRIDGE) + 1) * sizeof(TCHAR);
|
||||
TCHAR *newStr = new TCHAR[dataLength];
|
||||
if (newStr != NULL) {
|
||||
wsprintf(newStr, L"%s,%s", dataBuffer, STR_ACCESSBRIDGE);
|
||||
RegSetValueEx(hKey, ACCESSIBILITY_CONFIG, 0, REG_SZ, (BYTE *)newStr, dataLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int regDeleteValue(HKEY hFamilyKey, LPCWSTR lpSubKey)
|
||||
{
|
||||
HKEY hKey;
|
||||
DWORD retval = -1;
|
||||
LSTATUS err;
|
||||
err = RegOpenKeyEx(hFamilyKey, lpSubKey, NULL, KEY_READ|KEY_WRITE|KEY_WOW64_64KEY, &hKey);
|
||||
if (err != ERROR_SUCCESS)
|
||||
err = RegOpenKeyEx(hFamilyKey, lpSubKey, NULL, KEY_READ|KEY_WRITE, &hKey);
|
||||
|
||||
if (err == ERROR_SUCCESS) {
|
||||
DWORD dataType = REG_SZ;
|
||||
DWORD dataLength = DEFAULT_ALLOC;
|
||||
TCHAR dataBuffer[DEFAULT_ALLOC];
|
||||
TCHAR searchBuffer[DEFAULT_ALLOC];
|
||||
TCHAR *data = dataBuffer;
|
||||
bool freeData = false;
|
||||
err = RegQueryValueEx(hKey, ACCESSIBILITY_CONFIG, 0, &dataType, (BYTE *)data, &dataLength);
|
||||
if (err == ERROR_MORE_DATA) {
|
||||
if (dataLength > 0 && dataLength < MAX_ALLOC) {
|
||||
data = new TCHAR[dataLength];
|
||||
err = RegQueryValueEx(hKey, ACCESSIBILITY_CONFIG, 0, &dataType, (BYTE *)data, &dataLength);
|
||||
}
|
||||
}
|
||||
if (err == ERROR_SUCCESS) {
|
||||
err = _tcslwr_s(dataBuffer, DEFAULT_ALLOC);
|
||||
if (err) {
|
||||
return -1;
|
||||
}
|
||||
if (_tcsstr(dataBuffer, STR_ACCESSBRIDGE) == NULL) {
|
||||
return 0; // This is OK, e.g. ran disable twice and the value is not there.
|
||||
} else {
|
||||
// remove oracle_javaaccessbridge from Config key
|
||||
TCHAR *newStr = new TCHAR[dataLength];
|
||||
TCHAR *nextToken;
|
||||
LPTSTR tok, beg1 = dataBuffer;
|
||||
bool first = true;
|
||||
_tcscpy_s(newStr, dataLength, L"");
|
||||
tok = _tcstok_s(beg1, L",", &nextToken);
|
||||
while (tok != NULL) {
|
||||
_tcscpy_s(searchBuffer, DEFAULT_ALLOC, tok);
|
||||
err = _tcslwr_s(searchBuffer, DEFAULT_ALLOC);
|
||||
if (err) {
|
||||
return -1;
|
||||
}
|
||||
if (_tcsstr(searchBuffer, STR_ACCESSBRIDGE) == NULL) {
|
||||
if (!first) {
|
||||
_tcscat_s(newStr, dataLength, L",");
|
||||
}
|
||||
first = false;
|
||||
_tcscat_s(newStr, dataLength, tok);
|
||||
}
|
||||
tok = _tcstok_s(NULL, L",", &nextToken);
|
||||
}
|
||||
dataLength = (_tcslen(newStr) + 1) * sizeof(TCHAR);
|
||||
RegSetValueEx(hKey, ACCESSIBILITY_CONFIG, 0, REG_SZ, (BYTE *)newStr, dataLength);
|
||||
}
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int regDisable()
|
||||
{
|
||||
LSTATUS err;
|
||||
// Update value for HKCU
|
||||
err=regDeleteValue(HKEY_CURRENT_USER, ACCESSIBILITY_USER_KEY);
|
||||
// Update value for HKLM for Session
|
||||
TCHAR dataBuffer[DEFAULT_ALLOC];
|
||||
DWORD dwSessionId ;
|
||||
ProcessIdToSessionId(GetCurrentProcessId(),&dwSessionId ) ;
|
||||
if( dwSessionId >= 0 )
|
||||
{
|
||||
wsprintf(dataBuffer, L"%s%d", ACCESSIBILITY_SYSTEM_KEY, dwSessionId);
|
||||
err=regDeleteValue(HKEY_LOCAL_MACHINE, dataBuffer);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
void main(int argc, char* argv[]) {
|
||||
bool enableWasRequested = false;
|
||||
bool disableWasRequested = false;
|
||||
bool badParams = true;
|
||||
int error = 0;
|
||||
if (argc == 2) {
|
||||
if (_stricmp(argv[1], "-?") == 0 || _stricmp(argv[1], "/?") == 0) {
|
||||
printUsage();
|
||||
badParams = false;
|
||||
} else if (_stricmp(argv[1], "-version") == 0 || _stricmp(argv[1], "/version") == 0) {
|
||||
printVersion();
|
||||
badParams = false;
|
||||
} else {
|
||||
if (_stricmp(argv[1], "-enable") == 0 || _stricmp(argv[1], "/enable") == 0) {
|
||||
badParams = false;
|
||||
enableWasRequested = true;
|
||||
error = modify(true);
|
||||
if (error == 0) {
|
||||
if( !isXP() )
|
||||
regEnable();
|
||||
}
|
||||
} else if (_stricmp(argv[1], "-disable") == 0 || _stricmp(argv[1], "/disable") == 0) {
|
||||
badParams = false;
|
||||
disableWasRequested = true;
|
||||
error = modify(false);
|
||||
if (error == 0) {
|
||||
if( !isXP() )
|
||||
regDisable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (badParams) {
|
||||
printUsage();
|
||||
} else if (enableWasRequested || disableWasRequested) {
|
||||
if (error != 0) {
|
||||
printf("There was an error.\n\n");
|
||||
}
|
||||
printf("The Java Access Bridge has ");
|
||||
if (error != 0) {
|
||||
printf("not ");
|
||||
}
|
||||
printf("been ");
|
||||
if (enableWasRequested) {
|
||||
printf("enabled.\n");
|
||||
} else {
|
||||
printf("disabled.\n");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
@ -0,0 +1,4 @@
|
||||
#define XSTR(x) STR(x)
|
||||
#define STR(x) #x
|
||||
|
||||
1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ XSTR(JAB_MANIFEST_EMBED)
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <jni.h>
|
||||
#include <windows.h>
|
||||
#include <WinDef.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Determine bitness of Win OS
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_sun_java_accessibility_AccessBridge_isSysWow(JNIEnv *env, jobject callingObj) {
|
||||
BOOL bIsWow64 = FALSE;
|
||||
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
||||
|
||||
LPFN_ISWOW64PROCESS fnIsWow64Process =
|
||||
(LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
|
||||
|
||||
if (fnIsWow64Process != NULL) {
|
||||
if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64)) {
|
||||
throw std::runtime_error("fnIsWow64Process() failed");
|
||||
}
|
||||
}
|
||||
|
||||
return bIsWow64 ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,271 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A class to track key AT instance info from the JavaAccessBridge
|
||||
*/
|
||||
|
||||
#include "AccessBridgeDebug.h"
|
||||
#include "AccessBridgeATInstance.h"
|
||||
#include "AccessBridgeMessages.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
|
||||
|
||||
/**
|
||||
* AccessBridgeATInstance constructor
|
||||
*/
|
||||
AccessBridgeATInstance::AccessBridgeATInstance(HWND ourABWindow, HWND winABWindow,
|
||||
char *memoryFilename,
|
||||
AccessBridgeATInstance *next) {
|
||||
ourAccessBridgeWindow = ourABWindow;
|
||||
winAccessBridgeWindow = winABWindow;
|
||||
nextATInstance = next;
|
||||
javaEventMask = 0;
|
||||
accessibilityEventMask = 0;
|
||||
strncpy(memoryMappedFileName, memoryFilename, cMemoryMappedNameSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* AccessBridgeATInstance descructor
|
||||
*/
|
||||
AccessBridgeATInstance::~AccessBridgeATInstance() {
|
||||
PrintDebugString("\r\nin AccessBridgeATInstance::~AccessBridgeATInstance");
|
||||
|
||||
// if IPC memory mapped file view is valid, unmap it
|
||||
if (memoryMappedView != (char *) 0) {
|
||||
PrintDebugString(" unmapping memoryMappedView; view = %p", memoryMappedView);
|
||||
UnmapViewOfFile(memoryMappedView);
|
||||
memoryMappedView = (char *) 0;
|
||||
}
|
||||
// if IPC memory mapped file handle map is open, close it
|
||||
if (memoryMappedFileMapHandle != (HANDLE) 0) {
|
||||
PrintDebugString(" closing memoryMappedFileMapHandle; handle = %p", memoryMappedFileMapHandle);
|
||||
CloseHandle(memoryMappedFileMapHandle);
|
||||
memoryMappedFileMapHandle = (HANDLE) 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the memory-mapped file to do IPC messaging
|
||||
* 1 files is created: to handle requests for information
|
||||
* initiated from Windows AT. The package is placed into
|
||||
* the memory-mapped file (char *memoryMappedView),
|
||||
* and then a special SendMessage() is sent. When the
|
||||
* JavaDLL returns from SendMessage() processing, the
|
||||
* data will be in memoryMappedView. The SendMessage()
|
||||
* return value tells us if all is right with the world.
|
||||
*
|
||||
* The set-up proces involves creating the memory-mapped
|
||||
* file, and writing a special string to it so that the
|
||||
* WindowsDLL so it knows about it as well.
|
||||
*/
|
||||
LRESULT
|
||||
AccessBridgeATInstance::initiateIPC() {
|
||||
DWORD errorCode;
|
||||
|
||||
PrintDebugString("\r\nin AccessBridgeATInstance::initiateIPC()");
|
||||
|
||||
// open Windows-initiated IPC filemap & map it to a ptr
|
||||
|
||||
memoryMappedFileMapHandle = OpenFileMapping(FILE_MAP_READ | FILE_MAP_WRITE,
|
||||
FALSE, memoryMappedFileName);
|
||||
if (memoryMappedFileMapHandle == NULL) {
|
||||
errorCode = GetLastError();
|
||||
PrintDebugString(" Failed to CreateFileMapping for %s, error: %X", memoryMappedFileName, errorCode);
|
||||
return errorCode;
|
||||
} else {
|
||||
PrintDebugString(" CreateFileMapping worked - filename: %s", memoryMappedFileName);
|
||||
}
|
||||
|
||||
memoryMappedView = (char *) MapViewOfFile(memoryMappedFileMapHandle,
|
||||
FILE_MAP_READ | FILE_MAP_WRITE,
|
||||
0, 0, 0);
|
||||
if (memoryMappedView == NULL) {
|
||||
errorCode = GetLastError();
|
||||
PrintDebugString(" Failed to MapViewOfFile for %s, error: %X", memoryMappedFileName, errorCode);
|
||||
return errorCode;
|
||||
} else {
|
||||
PrintDebugString(" MapViewOfFile worked - view: %p", memoryMappedView);
|
||||
}
|
||||
|
||||
|
||||
// look for the JavaDLL's answer to see if it could read the file
|
||||
if (strcmp(memoryMappedView, AB_MEMORY_MAPPED_FILE_OK_QUERY) != 0) {
|
||||
PrintDebugString(" JavaVM failed to write to memory mapped file %s",
|
||||
memoryMappedFileName);
|
||||
return -1;
|
||||
} else {
|
||||
PrintDebugString(" JavaVM successfully wrote to file!");
|
||||
}
|
||||
|
||||
|
||||
// write some data to the memory mapped file for WindowsDLL to verify
|
||||
strcpy(memoryMappedView, AB_MEMORY_MAPPED_FILE_OK_ANSWER);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
typedef struct EVENT_STRUCT
|
||||
{
|
||||
char *buffer;
|
||||
int bufsize;
|
||||
ABHWND64 winAccessBridgeWindow;
|
||||
ABHWND64 ourAccessBridgeWindow;
|
||||
}EVENT_STRUCT;
|
||||
|
||||
|
||||
#include <process.h>
|
||||
#define THREAD_PROC unsigned int __stdcall
|
||||
typedef unsigned int (__stdcall *THREAD_ROUTINE)(LPVOID lpThreadParameter);
|
||||
|
||||
static HANDLE BeginThread(THREAD_ROUTINE thread_func,DWORD *id,DWORD param)
|
||||
{
|
||||
HANDLE ret;
|
||||
ret = (HANDLE) _beginthreadex(NULL,0,thread_func,(void *)param,0,(unsigned int *)id);
|
||||
if(ret == INVALID_HANDLE_VALUE)
|
||||
ret = NULL;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
DWORD JavaBridgeThreadId = 0;
|
||||
|
||||
static THREAD_PROC JavaBridgeThread(LPVOID param1)
|
||||
{
|
||||
MSG msg;
|
||||
DWORD rc = 0;
|
||||
while (GetMessage(&msg, // message structure
|
||||
NULL, // handle of window receiving the message
|
||||
0, // lowest message to examine
|
||||
0)) // highest message to examine
|
||||
{
|
||||
if(msg.message == WM_USER)
|
||||
{
|
||||
EVENT_STRUCT *event_struct = (EVENT_STRUCT *)msg.wParam;
|
||||
COPYDATASTRUCT toCopy;
|
||||
toCopy.dwData = 0; // 32-bits we could use for something...
|
||||
toCopy.cbData = event_struct->bufsize;
|
||||
toCopy.lpData = event_struct->buffer;
|
||||
|
||||
LRESULT ret = SendMessage((HWND)ABLongToHandle(event_struct->winAccessBridgeWindow), WM_COPYDATA,
|
||||
(WPARAM)event_struct->ourAccessBridgeWindow, (LPARAM) &toCopy);
|
||||
delete event_struct->buffer;
|
||||
delete event_struct;
|
||||
}
|
||||
if(msg.message == (WM_USER+1))
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
JavaBridgeThreadId = 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Handles one event
|
||||
*/
|
||||
static void do_event(char *buffer, int bufsize,HWND ourAccessBridgeWindow,HWND winAccessBridgeWindow)
|
||||
{
|
||||
EVENT_STRUCT *event_struct = new EVENT_STRUCT;
|
||||
event_struct->bufsize = bufsize;
|
||||
event_struct->buffer = new char[bufsize];
|
||||
memcpy(event_struct->buffer,buffer,bufsize);
|
||||
event_struct->ourAccessBridgeWindow = ABHandleToLong(ourAccessBridgeWindow);
|
||||
event_struct->winAccessBridgeWindow = ABHandleToLong(winAccessBridgeWindow);
|
||||
if(!JavaBridgeThreadId)
|
||||
{
|
||||
HANDLE JavaBridgeThreadHandle = BeginThread(JavaBridgeThread,&JavaBridgeThreadId,(DWORD)event_struct);
|
||||
CloseHandle(JavaBridgeThreadHandle);
|
||||
}
|
||||
PostThreadMessage(JavaBridgeThreadId,WM_USER,(WPARAM)event_struct,0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sendJavaEventPackage - uses SendMessage(WM_COPYDATA) to do
|
||||
* IPC messaging with the Java AccessBridge DLL
|
||||
* to propogate events to those ATs that want 'em
|
||||
*
|
||||
*/
|
||||
LRESULT
|
||||
AccessBridgeATInstance::sendJavaEventPackage(char *buffer, int bufsize, long eventID) {
|
||||
|
||||
PrintDebugString("AccessBridgeATInstance::sendJavaEventPackage() eventID = %X", eventID);
|
||||
PrintDebugString("AccessBridgeATInstance::sendJavaEventPackage() (using PostMessage) eventID = %X", eventID);
|
||||
|
||||
if (eventID & javaEventMask) {
|
||||
do_event(buffer,bufsize,ourAccessBridgeWindow,winAccessBridgeWindow);
|
||||
return(0);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* uses SendMessage(WM_COPYDATA) to do
|
||||
* IPC messaging with the Java AccessBridge DLL
|
||||
* to propogate events to those ATs that want 'em
|
||||
*
|
||||
*/
|
||||
LRESULT
|
||||
AccessBridgeATInstance::sendAccessibilityEventPackage(char *buffer, int bufsize, long eventID) {
|
||||
|
||||
PrintDebugString("AccessBridgeATInstance::sendAccessibilityEventPackage() eventID = %X", eventID);
|
||||
|
||||
if (eventID & accessibilityEventMask) {
|
||||
do_event(buffer,bufsize,ourAccessBridgeWindow,winAccessBridgeWindow);
|
||||
return(0);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* findABATInstanceFromATHWND - walk through linked list from
|
||||
* where we are. Return the
|
||||
* AccessBridgeATInstance
|
||||
* of the ABATInstance that
|
||||
* matches the passed in vmID;
|
||||
* no match: return 0
|
||||
*/
|
||||
AccessBridgeATInstance *
|
||||
AccessBridgeATInstance::findABATInstanceFromATHWND(HWND window) {
|
||||
// no need to recurse really
|
||||
if (winAccessBridgeWindow == window) {
|
||||
return this;
|
||||
} else {
|
||||
AccessBridgeATInstance *current = nextATInstance;
|
||||
while (current != (AccessBridgeATInstance *) 0) {
|
||||
if (current->winAccessBridgeWindow == window) {
|
||||
return current;
|
||||
}
|
||||
current = current->nextATInstance;
|
||||
}
|
||||
}
|
||||
return (AccessBridgeATInstance *) 0;
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A class to track key AT instance info from the JavaAccessBridge
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "AccessBridgePackages.h"
|
||||
|
||||
#ifndef __AccessBridgeATInstance_H__
|
||||
#define __AccessBridgeATInstance_H__
|
||||
|
||||
|
||||
/**
|
||||
* The AccessBridgeATInstance class.
|
||||
*/
|
||||
class AccessBridgeATInstance {
|
||||
friend class JavaAccessBridge;
|
||||
|
||||
AccessBridgeATInstance *nextATInstance;
|
||||
HWND ourAccessBridgeWindow;
|
||||
HWND winAccessBridgeWindow;
|
||||
long javaEventMask;
|
||||
long accessibilityEventMask;
|
||||
|
||||
// IPC variables
|
||||
HANDLE memoryMappedFileMapHandle; // handle to file map
|
||||
char *memoryMappedView; // ptr to shared memory
|
||||
char memoryMappedFileName[cMemoryMappedNameSize];
|
||||
|
||||
public:
|
||||
AccessBridgeATInstance(HWND ourABWindow, HWND winABWindow,
|
||||
char *memoryFilename,
|
||||
AccessBridgeATInstance *next);
|
||||
~AccessBridgeATInstance();
|
||||
LRESULT initiateIPC();
|
||||
LRESULT sendJavaEventPackage(char *buffer, int bufsize, long eventID);
|
||||
LRESULT sendAccessibilityEventPackage(char *buffer, int bufsize, long eventID);
|
||||
AccessBridgeATInstance *findABATInstanceFromATHWND(HWND window);
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,418 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A class to manage JNI calls into AccessBridge.java
|
||||
*/
|
||||
|
||||
#include "AccessBridgePackages.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <jni.h>
|
||||
|
||||
#ifndef __AccessBridgeJavaEntryPoints_H__
|
||||
#define __AccessBridgeJavaEntryPoints_H__
|
||||
|
||||
class AccessBridgeJavaEntryPoints {
|
||||
JNIEnv *jniEnv;
|
||||
|
||||
jobject accessBridgeObject;
|
||||
|
||||
jclass bridgeClass;
|
||||
jclass eventHandlerClass;
|
||||
|
||||
jmethodID decrementReferenceMethod;
|
||||
jmethodID getJavaVersionPropertyMethod;
|
||||
|
||||
jmethodID isJavaWindowMethod;
|
||||
jmethodID isSameObjectMethod;
|
||||
jmethodID getAccessibleContextFromHWNDMethod;
|
||||
jmethodID getHWNDFromAccessibleContextMethod;
|
||||
|
||||
jmethodID getAccessibleContextAtMethod;
|
||||
jmethodID getAccessibleContextWithFocusMethod;
|
||||
|
||||
jmethodID getAccessibleNameFromContextMethod;
|
||||
jmethodID getAccessibleDescriptionFromContextMethod;
|
||||
jmethodID getAccessibleRoleStringFromContextMethod;
|
||||
jmethodID getAccessibleRoleStringFromContext_en_USMethod;
|
||||
jmethodID getAccessibleStatesStringFromContextMethod;
|
||||
jmethodID getAccessibleStatesStringFromContext_en_USMethod;
|
||||
jmethodID getAccessibleParentFromContextMethod;
|
||||
jmethodID getAccessibleIndexInParentFromContextMethod;
|
||||
jmethodID getAccessibleChildrenCountFromContextMethod;
|
||||
jmethodID getAccessibleChildFromContextMethod;
|
||||
jmethodID getAccessibleBoundsOnScreenFromContextMethod;
|
||||
jmethodID getAccessibleXcoordFromContextMethod;
|
||||
jmethodID getAccessibleYcoordFromContextMethod;
|
||||
jmethodID getAccessibleHeightFromContextMethod;
|
||||
jmethodID getAccessibleWidthFromContextMethod;
|
||||
|
||||
jmethodID getAccessibleComponentFromContextMethod;
|
||||
jmethodID getAccessibleActionFromContextMethod;
|
||||
jmethodID getAccessibleSelectionFromContextMethod;
|
||||
jmethodID getAccessibleTextFromContextMethod;
|
||||
jmethodID getAccessibleValueFromContextMethod;
|
||||
|
||||
/* begin AccessibleTable */
|
||||
jmethodID getAccessibleTableFromContextMethod;
|
||||
jmethodID getAccessibleTableRowHeaderMethod;
|
||||
jmethodID getAccessibleTableColumnHeaderMethod;
|
||||
jmethodID getAccessibleTableRowCountMethod;
|
||||
jmethodID getAccessibleTableColumnCountMethod;
|
||||
jmethodID getAccessibleTableCaptionMethod;
|
||||
jmethodID getAccessibleTableSummaryMethod;
|
||||
|
||||
jmethodID getContextFromAccessibleTableMethod;
|
||||
jmethodID getAccessibleTableCellAccessibleContextMethod;
|
||||
jmethodID getAccessibleTableCellIndexMethod;
|
||||
jmethodID getAccessibleTableCellRowExtentMethod;
|
||||
jmethodID getAccessibleTableCellColumnExtentMethod;
|
||||
jmethodID isAccessibleTableCellSelectedMethod;
|
||||
|
||||
jmethodID getAccessibleTableRowHeaderRowCountMethod;
|
||||
jmethodID getAccessibleTableColumnHeaderRowCountMethod;
|
||||
|
||||
jmethodID getAccessibleTableRowHeaderColumnCountMethod;
|
||||
jmethodID getAccessibleTableColumnHeaderColumnCountMethod;
|
||||
|
||||
jmethodID getAccessibleTableRowDescriptionMethod;
|
||||
jmethodID getAccessibleTableColumnDescriptionMethod;
|
||||
|
||||
jmethodID getAccessibleTableRowSelectionCountMethod;
|
||||
jmethodID isAccessibleTableRowSelectedMethod;
|
||||
jmethodID getAccessibleTableRowSelectionsMethod;
|
||||
|
||||
jmethodID getAccessibleTableColumnSelectionCountMethod;
|
||||
jmethodID isAccessibleTableColumnSelectedMethod;
|
||||
jmethodID getAccessibleTableColumnSelectionsMethod;
|
||||
|
||||
jmethodID getAccessibleTableRowMethod;
|
||||
jmethodID getAccessibleTableColumnMethod;
|
||||
jmethodID getAccessibleTableIndexMethod;
|
||||
|
||||
/* end AccessibleTable */
|
||||
|
||||
/* begin AccessibleRelationSet */
|
||||
|
||||
jmethodID getAccessibleRelationSetMethod;
|
||||
jmethodID getAccessibleRelationCountMethod;
|
||||
jmethodID getAccessibleRelationKeyMethod;
|
||||
jmethodID getAccessibleRelationTargetCountMethod;
|
||||
jmethodID getAccessibleRelationTargetMethod;
|
||||
|
||||
/* end AccessibleRelationSet */
|
||||
|
||||
// AccessibleHypertext methods
|
||||
jmethodID getAccessibleHypertextMethod;
|
||||
jmethodID getAccessibleHyperlinkCountMethod;
|
||||
jmethodID getAccessibleHyperlinkTextMethod;
|
||||
jmethodID getAccessibleHyperlinkURLMethod;
|
||||
jmethodID getAccessibleHyperlinkStartIndexMethod;
|
||||
jmethodID getAccessibleHyperlinkEndIndexMethod;
|
||||
jmethodID getAccessibleHypertextLinkIndexMethod;
|
||||
jmethodID getAccessibleHyperlinkMethod;
|
||||
jmethodID activateAccessibleHyperlinkMethod;
|
||||
|
||||
// AccessibleKeyBinding
|
||||
jmethodID getAccessibleKeyBindingsCountMethod;
|
||||
jmethodID getAccessibleKeyBindingCharMethod;
|
||||
jmethodID getAccessibleKeyBindingModifiersMethod;
|
||||
|
||||
// AccessibleIcon
|
||||
jmethodID getAccessibleIconsCountMethod;
|
||||
jmethodID getAccessibleIconDescriptionMethod;
|
||||
jmethodID getAccessibleIconHeightMethod;
|
||||
jmethodID getAccessibleIconWidthMethod;
|
||||
|
||||
// AccessibleAction
|
||||
jmethodID getAccessibleActionsCountMethod;
|
||||
jmethodID getAccessibleActionNameMethod;
|
||||
jmethodID doAccessibleActionsMethod;
|
||||
|
||||
// AccessibleText
|
||||
jmethodID getAccessibleCharCountFromContextMethod;
|
||||
jmethodID getAccessibleCaretPositionFromContextMethod;
|
||||
jmethodID getAccessibleIndexAtPointFromContextMethod;
|
||||
|
||||
jmethodID getAccessibleLetterAtIndexFromContextMethod;
|
||||
jmethodID getAccessibleWordAtIndexFromContextMethod;
|
||||
jmethodID getAccessibleSentenceAtIndexFromContextMethod;
|
||||
|
||||
jmethodID getAccessibleTextSelectionStartFromContextMethod;
|
||||
jmethodID getAccessibleTextSelectionEndFromContextMethod;
|
||||
jmethodID getAccessibleTextSelectedTextFromContextMethod;
|
||||
jmethodID getAccessibleAttributesAtIndexFromContextMethod;
|
||||
jmethodID getAccessibleAttributeSetAtIndexFromContextMethod;
|
||||
jmethodID getAccessibleTextRectAtIndexFromContextMethod;
|
||||
jmethodID getAccessibleXcoordTextRectAtIndexFromContextMethod;
|
||||
jmethodID getAccessibleYcoordTextRectAtIndexFromContextMethod;
|
||||
jmethodID getAccessibleHeightTextRectAtIndexFromContextMethod;
|
||||
jmethodID getAccessibleWidthTextRectAtIndexFromContextMethod;
|
||||
jmethodID getAccessibleTextLineLeftBoundsFromContextMethod;
|
||||
jmethodID getAccessibleTextLineRightBoundsFromContextMethod;
|
||||
jmethodID getAccessibleTextRangeFromContextMethod;
|
||||
|
||||
jmethodID getCurrentAccessibleValueFromContextMethod;
|
||||
jmethodID getMaximumAccessibleValueFromContextMethod;
|
||||
jmethodID getMinimumAccessibleValueFromContextMethod;
|
||||
|
||||
jmethodID addAccessibleSelectionFromContextMethod;
|
||||
jmethodID clearAccessibleSelectionFromContextMethod;
|
||||
jmethodID getAccessibleSelectionContextFromContextMethod;
|
||||
jmethodID getAccessibleSelectionCountFromContextMethod;
|
||||
jmethodID isAccessibleChildSelectedFromContextMethod;
|
||||
jmethodID removeAccessibleSelectionFromContextMethod;
|
||||
jmethodID selectAllAccessibleSelectionFromContextMethod;
|
||||
|
||||
jmethodID addJavaEventNotificationMethod;
|
||||
jmethodID removeJavaEventNotificationMethod;
|
||||
jmethodID addAccessibilityEventNotificationMethod;
|
||||
jmethodID removeAccessibilityEventNotificationMethod;
|
||||
|
||||
jmethodID getBoldFromAttributeSetMethod;
|
||||
jmethodID getItalicFromAttributeSetMethod;
|
||||
jmethodID getUnderlineFromAttributeSetMethod;
|
||||
jmethodID getStrikethroughFromAttributeSetMethod;
|
||||
jmethodID getSuperscriptFromAttributeSetMethod;
|
||||
jmethodID getSubscriptFromAttributeSetMethod;
|
||||
jmethodID getBackgroundColorFromAttributeSetMethod;
|
||||
jmethodID getForegroundColorFromAttributeSetMethod;
|
||||
jmethodID getFontFamilyFromAttributeSetMethod;
|
||||
jmethodID getFontSizeFromAttributeSetMethod;
|
||||
jmethodID getAlignmentFromAttributeSetMethod;
|
||||
jmethodID getBidiLevelFromAttributeSetMethod;
|
||||
jmethodID getFirstLineIndentFromAttributeSetMethod;
|
||||
jmethodID getLeftIndentFromAttributeSetMethod;
|
||||
jmethodID getRightIndentFromAttributeSetMethod;
|
||||
jmethodID getLineSpacingFromAttributeSetMethod;
|
||||
jmethodID getSpaceAboveFromAttributeSetMethod;
|
||||
jmethodID getSpaceBelowFromAttributeSetMethod;
|
||||
|
||||
jmethodID setTextContentsMethod;
|
||||
jmethodID getParentWithRoleMethod;
|
||||
jmethodID getTopLevelObjectMethod;
|
||||
jmethodID getParentWithRoleElseRootMethod;
|
||||
jmethodID getObjectDepthMethod;
|
||||
jmethodID getActiveDescendentMethod;
|
||||
|
||||
/**
|
||||
* Additional methods for Teton
|
||||
*/
|
||||
jmethodID getVirtualAccessibleNameFromContextMethod; // Ben Key
|
||||
jmethodID requestFocusMethod;
|
||||
jmethodID selectTextRangeMethod;
|
||||
jmethodID getTextAttributesInRangeMethod;
|
||||
jmethodID getVisibleChildrenCountMethod;
|
||||
jmethodID getVisibleChildMethod;
|
||||
jmethodID setCaretPositionMethod;
|
||||
|
||||
jmethodID getCaretLocationMethod;
|
||||
jmethodID getCaretLocationXMethod;
|
||||
jmethodID getCaretLocationYMethod;
|
||||
jmethodID getCaretLocationHeightMethod;
|
||||
jmethodID getCaretLocationWidthMethod;
|
||||
|
||||
public:
|
||||
AccessBridgeJavaEntryPoints(JNIEnv *jniEnvironment, jobject bridgeObject);
|
||||
~AccessBridgeJavaEntryPoints();
|
||||
BOOL BuildJavaEntryPoints();
|
||||
|
||||
// HWND management methods
|
||||
BOOL isJavaWindow(jint window);
|
||||
jobject getAccessibleContextFromHWND(jint window);
|
||||
HWND getHWNDFromAccessibleContext(jobject accessibleContext);
|
||||
|
||||
// version methods
|
||||
BOOL getVersionInfo(AccessBridgeVersionInfo *info);
|
||||
|
||||
// verification methods
|
||||
BOOL verifyAccessibleText(jobject obj);
|
||||
|
||||
/* ===== utility methods ===== */
|
||||
BOOL isSameObject(jobject obj1, jobject obj2);
|
||||
BOOL setTextContents(const jobject accessibleContext, const wchar_t *text);
|
||||
jobject getParentWithRole (const jobject accessibleContext, const wchar_t *role);
|
||||
jobject getTopLevelObject (const jobject accessibleContext);
|
||||
jobject getParentWithRoleElseRoot (const jobject accessibleContext, const wchar_t *role);
|
||||
jint getObjectDepth (const jobject accessibleContext);
|
||||
jobject getActiveDescendent (const jobject accessibleContext);
|
||||
|
||||
// Accessible Context methods
|
||||
jobject getAccessibleContextAt(jint x, jint y, jobject AccessibleContext);
|
||||
jobject getAccessibleContextWithFocus();
|
||||
BOOL getAccessibleContextInfo(jobject AccessibleContext, AccessibleContextInfo *info);
|
||||
jobject getAccessibleChildFromContext(jobject AccessibleContext, jint childIndex);
|
||||
jobject getAccessibleParentFromContext(jobject AccessibleContext);
|
||||
|
||||
/* begin AccessibleTable methods */
|
||||
|
||||
BOOL getAccessibleTableInfo(jobject acParent, AccessibleTableInfo *tableInfo);
|
||||
BOOL getAccessibleTableCellInfo(jobject accessibleTable,jint row, jint column,
|
||||
AccessibleTableCellInfo *tableCellInfo);
|
||||
|
||||
BOOL getAccessibleTableRowHeader(jobject acParent, AccessibleTableInfo *tableInfo);
|
||||
BOOL getAccessibleTableColumnHeader(jobject acParent, AccessibleTableInfo *tableInfo);
|
||||
|
||||
jobject getAccessibleTableRowDescription(jobject acParent, jint row);
|
||||
jobject getAccessibleTableColumnDescription(jobject acParent, jint column);
|
||||
|
||||
jint getAccessibleTableRowSelectionCount(jobject accessibleTable);
|
||||
BOOL isAccessibleTableRowSelected(jobject accessibleTable, jint row);
|
||||
BOOL getAccessibleTableRowSelections(jobject accessibleTable, jint count, jint *selections);
|
||||
|
||||
jint getAccessibleTableColumnSelectionCount(jobject accessibleTable);
|
||||
BOOL isAccessibleTableColumnSelected(jobject accessibleTable, jint column);
|
||||
BOOL getAccessibleTableColumnSelections(jobject accessibleTable, jint count, jint *selections);
|
||||
|
||||
jint getAccessibleTableRow(jobject accessibleTable, jint index);
|
||||
jint getAccessibleTableColumn(jobject accessibleTable, jint index);
|
||||
jint getAccessibleTableIndex(jobject accessibleTable, jint row, jint column);
|
||||
|
||||
/* end AccessibleTable methods */
|
||||
|
||||
BOOL getAccessibleRelationSet(jobject accessibleContext, AccessibleRelationSetInfo *relationSetInfo);
|
||||
|
||||
// AccessibleHypertext methods
|
||||
BOOL getAccessibleHypertext(jobject accessibleContext, AccessibleHypertextInfo *hyperlink);
|
||||
|
||||
BOOL activateAccessibleHyperlink(jobject accessibleContext, jobject accessibleHyperlink);
|
||||
|
||||
BOOL getAccessibleHypertextExt(const jobject accessibleContext,
|
||||
const jint nStartIndex,
|
||||
/* OUT */ AccessibleHypertextInfo *hypertext);
|
||||
jint getAccessibleHyperlinkCount(const jobject accessibleContext);
|
||||
jint getAccessibleHypertextLinkIndex(const jobject accessibleContext,
|
||||
const jint nIndex);
|
||||
BOOL getAccessibleHyperlink(const jobject accessibleContext,
|
||||
const jint nIndex,
|
||||
/* OUT */ AccessibleHyperlinkInfo *hyperlinkInfo);
|
||||
|
||||
// Accessible Keybinding methods
|
||||
BOOL getAccessibleKeyBindings(jobject accessibleContext, AccessibleKeyBindings *keyBindings);
|
||||
|
||||
// AccessibleIcon methods
|
||||
BOOL getAccessibleIcons(jobject accessibleContext, AccessibleIcons *icons);
|
||||
|
||||
// AccessibleActionMethods
|
||||
BOOL getAccessibleActions(jobject accessibleContext, AccessibleActions *actions);
|
||||
BOOL doAccessibleActions(jobject accessibleContext, AccessibleActionsToDo *actionsToDo, jint *failure);
|
||||
|
||||
// Accessible Text methods
|
||||
BOOL getAccessibleTextInfo(jobject AccessibleContext, AccessibleTextInfo *textInfo, jint x, jint y);
|
||||
BOOL getAccessibleTextItems(jobject AccessibleContext, AccessibleTextItemsInfo *textItems, jint index);
|
||||
BOOL getAccessibleTextSelectionInfo(jobject AccessibleContext, AccessibleTextSelectionInfo *selectionInfo);
|
||||
BOOL getAccessibleTextAttributes(jobject AccessibleContext, jint index, AccessibleTextAttributesInfo *attributes);
|
||||
BOOL getAccessibleTextRect(jobject AccessibleContext, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
BOOL getAccessibleCaretRect(jobject AccessibleContext, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
BOOL getAccessibleTextLineBounds(jobject AccessibleContext, jint index, jint *startIndex, jint *endIndex);
|
||||
BOOL getAccessibleTextRange(jobject AccessibleContext, jint start, jint end, wchar_t *text, short len);
|
||||
|
||||
// Accessible Value methods
|
||||
BOOL getCurrentAccessibleValueFromContext(jobject AccessibleContext, wchar_t *value, short len);
|
||||
BOOL getMaximumAccessibleValueFromContext(jobject AccessibleContext, wchar_t *value, short len);
|
||||
BOOL getMinimumAccessibleValueFromContext(jobject AccessibleContext, wchar_t *value, short len);
|
||||
|
||||
// Accessible Selection methods
|
||||
void addAccessibleSelectionFromContext(jobject AccessibleContext, int i);
|
||||
void clearAccessibleSelectionFromContext(jobject AccessibleContext);
|
||||
jobject getAccessibleSelectionFromContext(jobject AccessibleContext, int i);
|
||||
int getAccessibleSelectionCountFromContext(jobject AccessibleContext);
|
||||
BOOL isAccessibleChildSelectedFromContext(jobject AccessibleContext, int i);
|
||||
void removeAccessibleSelectionFromContext(jobject AccessibleContext, int i);
|
||||
void selectAllAccessibleSelectionFromContext(jobject AccessibleContext);
|
||||
|
||||
// Event handling methods
|
||||
BOOL addJavaEventNotification(jlong type);
|
||||
BOOL removeJavaEventNotification(jlong type);
|
||||
BOOL addAccessibilityEventNotification(jlong type);
|
||||
BOOL removeAccessibilityEventNotification(jlong type);
|
||||
|
||||
/**
|
||||
* Additional methods for Teton
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the AccessibleName for a component based upon the JAWS algorithm. Returns
|
||||
* whether successful.
|
||||
*
|
||||
* Bug ID 4916682 - Implement JAWS AccessibleName policy
|
||||
*/
|
||||
BOOL getVirtualAccessibleName(const jobject accessibleContext, wchar_t *name, int len);
|
||||
|
||||
/**
|
||||
* Request focus for a component. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944757 - requestFocus method needed
|
||||
*/
|
||||
BOOL requestFocus(const jobject accessibleContext);
|
||||
|
||||
/**
|
||||
* Selects text between two indices. Selection includes the text at the start index
|
||||
* and the text at the end index. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944758 - selectTextRange method needed
|
||||
*/
|
||||
BOOL selectTextRange(const jobject accessibleContext, int startIndex, int endIndex);
|
||||
|
||||
/**
|
||||
* Get text attributes between two indices. The attribute list includes the text at the
|
||||
* start index and the text at the end index. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944761 - getTextAttributes between two indices method needed
|
||||
*/
|
||||
BOOL getTextAttributesInRange(const jobject accessibleContext, int startIndex, int endIndex,
|
||||
AccessibleTextAttributesInfo *attributes, short *len);
|
||||
|
||||
/**
|
||||
* Gets the number of visible children of a component. Returns -1 on error.
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
int getVisibleChildrenCount(const jobject accessibleContext);
|
||||
|
||||
/**
|
||||
* Gets the visible children of an AccessibleContext. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
BOOL getVisibleChildren(const jobject accessibleContext, const int startIndex,
|
||||
VisibleChildrenInfo *visibleChildrenInfo);
|
||||
|
||||
/**
|
||||
* Set the caret to a text position. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944770 - setCaretPosition method needed
|
||||
*/
|
||||
BOOL setCaretPosition(const jobject accessibleContext, int position);
|
||||
|
||||
/**
|
||||
* Gets the bounding rectangle for the text caret
|
||||
*/
|
||||
BOOL getCaretLocation(jobject AccessibleContext, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A DLL which is loaded by Java applications to handle communication
|
||||
* between Java VMs purposes of Accessbility.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <jni.h>
|
||||
|
||||
#include "AccessBridgePackages.h"
|
||||
#include "AccessBridgeATInstance.h"
|
||||
#include "AccessBridgeJavaEntryPoints.h"
|
||||
|
||||
#ifndef __JavaAccessBridge_H__
|
||||
#define __JavaAccessBridge_H__
|
||||
|
||||
|
||||
extern "C" {
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD fdwReason,
|
||||
LPVOID lpvReserved);
|
||||
void AppendToCallOutput(char *s);
|
||||
BOOL APIENTRY AccessBridgeDialogProc(HWND hDlg, UINT message,
|
||||
UINT wParam, LONG lParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* The JavaAccessBridge class. The core of the Windows AT AccessBridge dll
|
||||
*/
|
||||
class JavaAccessBridge {
|
||||
// for debugging
|
||||
public:
|
||||
// for debugging
|
||||
HINSTANCE windowsInstance;
|
||||
HWND dialogWindow;
|
||||
AccessBridgeATInstance *ATs;
|
||||
JavaVM *javaVM;
|
||||
JNIEnv *windowsThreadJNIEnv; // for calls initiated from Windows
|
||||
AccessBridgeJavaEntryPoints *javaThreadEntryPoints;
|
||||
AccessBridgeJavaEntryPoints *windowsThreadEntryPoints;
|
||||
jobject javaThreadABObject; // for calls initiated from Java
|
||||
jobject windowsThreadABObject; // for calls initiated from Windows
|
||||
|
||||
public:
|
||||
JavaAccessBridge(HINSTANCE hInstance);
|
||||
~JavaAccessBridge();
|
||||
void javaRun(JNIEnv *env, jobject obj);
|
||||
BOOL initWindow();
|
||||
|
||||
// IPC with the Java AccessBridge DLL
|
||||
void postHelloToWindowsDLLMsg(HWND destHwnd);
|
||||
LRESULT MemoryMappedFileCreated(HWND srcHwnd, char *filename);
|
||||
|
||||
void sendPackage(char *buffer, int bufsize, HWND destHwnd);
|
||||
void sendJavaEventPackage(char *buffer, int bufsize, long type);
|
||||
void sendAccessibilityEventPackage(char *buffer, int bufsize, long type);
|
||||
BOOL sendMemoryPackage(char *buffer, long bufsize, HWND destWindow);
|
||||
LRESULT processPackage(char *buffer, int bufsize);
|
||||
BOOL receiveMemoryPackage(HWND srcWindow, long bufsize);
|
||||
void WindowsATDestroyed(HWND ATBridgeDLLWindow);
|
||||
|
||||
// Java VM object memory management
|
||||
void releaseJavaObject(jobject object);
|
||||
|
||||
// Event handling methods
|
||||
void addJavaEventNotification(jlong type, HWND DLLwindow);
|
||||
void removeJavaEventNotification(jlong type, HWND DLLwindow);
|
||||
void addAccessibilityEventNotification(jlong type, HWND DLLwindow);
|
||||
void removeAccessibilityEventNotification(jlong type, HWND DLLwindow);
|
||||
|
||||
// Event firing methods
|
||||
/*
|
||||
void firePropertyChange(JNIEnv *env, jobject callingObj,
|
||||
jobject propertyChangeEvent,
|
||||
jobject source, jstring propertyName,
|
||||
jstring oldValue, jstring newValue);
|
||||
*/
|
||||
|
||||
void javaShutdown(JNIEnv *env, jobject callingObj);
|
||||
|
||||
void fireFocusGained(JNIEnv *env, jobject callingObj,
|
||||
jobject focusEvent, jobject source);
|
||||
void fireFocusLost(JNIEnv *env, jobject callingObj,
|
||||
jobject focusEvent,jobject source);
|
||||
void fireCaretUpdate(JNIEnv *env, jobject callingObj,
|
||||
jobject caretEvent, jobject source);
|
||||
void fireMouseClicked(JNIEnv *env, jobject callingObj,
|
||||
jobject mouseEvent, jobject source);
|
||||
void fireMouseEntered(JNIEnv *env, jobject callingObj,
|
||||
jobject mouseEvent, jobject source);
|
||||
void fireMouseExited(JNIEnv *env, jobject callingObj,
|
||||
jobject mouseEvent, jobject source);
|
||||
void fireMousePressed(JNIEnv *env, jobject callingObj,
|
||||
jobject mouseEvent, jobject source);
|
||||
void fireMouseReleased(JNIEnv *env, jobject callingObj,
|
||||
jobject mouseEvent, jobject source);
|
||||
void fireMenuCanceled(JNIEnv *env, jobject callingObj,
|
||||
jobject menuEvent, jobject source);
|
||||
void fireMenuDeselected(JNIEnv *env, jobject callingObj,
|
||||
jobject menuEvent, jobject source);
|
||||
void fireMenuSelected(JNIEnv *env, jobject callingObj,
|
||||
jobject menuEvent, jobject source);
|
||||
void firePopupMenuCanceled(JNIEnv *env, jobject callingObj,
|
||||
jobject popupMenuEvent, jobject source);
|
||||
void firePopupMenuWillBecomeInvisible(JNIEnv *env, jobject callingObj,
|
||||
jobject popupMenuEvent, jobject source);
|
||||
void firePopupMenuWillBecomeVisible(JNIEnv *env, jobject callingObj,
|
||||
jobject popupMenuEvent, jobject source);
|
||||
|
||||
void firePropertyCaretChange(JNIEnv *env, jobject callingObj,
|
||||
jobject event, jobject source,
|
||||
jint oldValue, jint newValue);
|
||||
void firePropertyDescriptionChange(JNIEnv *env, jobject callingObj,
|
||||
jobject event, jobject source,
|
||||
jstring oldValue, jstring newValue);
|
||||
void firePropertyNameChange(JNIEnv *env, jobject callingObj,
|
||||
jobject event, jobject source,
|
||||
jstring oldValue, jstring newValue);
|
||||
void firePropertySelectionChange(JNIEnv *env, jobject callingObj,
|
||||
jobject event, jobject source);
|
||||
void firePropertyStateChange(JNIEnv *env, jobject callingObj,
|
||||
jobject event, jobject source,
|
||||
jstring oldValue, jstring newValue);
|
||||
void firePropertyTextChange(JNIEnv *env, jobject callingObj,
|
||||
jobject event, jobject source);
|
||||
void firePropertyValueChange(JNIEnv *env, jobject callingObj,
|
||||
jobject event, jobject source,
|
||||
jstring oldValue, jstring newValue);
|
||||
void firePropertyVisibleDataChange(JNIEnv *env, jobject callingObj,
|
||||
jobject event, jobject source);
|
||||
void firePropertyChildChange(JNIEnv *env, jobject callingObj,
|
||||
jobject event, jobject source,
|
||||
jobject oldValue, jobject newValue);
|
||||
void firePropertyActiveDescendentChange(JNIEnv *env, jobject callingObj,
|
||||
jobject event, jobject source,
|
||||
jobject oldValue, jobject newValue);
|
||||
|
||||
void firePropertyTableModelChange(JNIEnv *env, jobject callingObj,
|
||||
jobject event, jobject source,
|
||||
jstring oldValue, jstring newValue);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,382 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A class to manage firing Accessibility events to Windows AT
|
||||
*/
|
||||
|
||||
#include "AccessBridgeDebug.h"
|
||||
#include "AccessBridgeEventHandler.h"
|
||||
#include "AccessBridgePackages.h"
|
||||
#include "WinAccessBridge.h"
|
||||
|
||||
DEBUG_CODE(extern HWND theDialogWindow);
|
||||
extern "C" {
|
||||
DEBUG_CODE(void AppendToCallInfo(char *s));
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------
|
||||
|
||||
/**
|
||||
* Initialization. Set all callbacks to null
|
||||
*/
|
||||
AccessBridgeEventHandler::AccessBridgeEventHandler() {
|
||||
javaEventMask = 0;
|
||||
accessibilityEventMask = 0;
|
||||
|
||||
propertyChangeFP = (AccessBridge_PropertyChangeFP) NULL;
|
||||
javaShutdownFP = (AccessBridge_JavaShutdownFP) NULL;
|
||||
focusGainedFP = (AccessBridge_FocusGainedFP) NULL;
|
||||
focusLostFP = (AccessBridge_FocusLostFP) NULL;
|
||||
caretUpdateFP = (AccessBridge_CaretUpdateFP) NULL;
|
||||
mouseClickedFP = (AccessBridge_MouseClickedFP) NULL;
|
||||
mouseEnteredFP = (AccessBridge_MouseEnteredFP) NULL;
|
||||
mouseExitedFP = (AccessBridge_MouseExitedFP) NULL;
|
||||
mousePressedFP = (AccessBridge_MousePressedFP) NULL;
|
||||
mouseReleasedFP = (AccessBridge_MouseReleasedFP) NULL;
|
||||
menuCanceledFP = (AccessBridge_MenuCanceledFP) NULL;
|
||||
menuDeselectedFP = (AccessBridge_MenuDeselectedFP) NULL;
|
||||
menuSelectedFP = (AccessBridge_MenuSelectedFP) NULL;
|
||||
popupMenuCanceledFP = (AccessBridge_PopupMenuCanceledFP) NULL;
|
||||
popupMenuWillBecomeInvisibleFP = (AccessBridge_PopupMenuWillBecomeInvisibleFP) NULL;
|
||||
popupMenuWillBecomeVisibleFP = (AccessBridge_PopupMenuWillBecomeVisibleFP) NULL;
|
||||
|
||||
propertyNameChangeFP = (AccessBridge_PropertyNameChangeFP) NULL;
|
||||
propertyDescriptionChangeFP = (AccessBridge_PropertyDescriptionChangeFP) NULL;
|
||||
propertyStateChangeFP = (AccessBridge_PropertyStateChangeFP) NULL;
|
||||
propertyValueChangeFP = (AccessBridge_PropertyValueChangeFP) NULL;
|
||||
propertySelectionChangeFP = (AccessBridge_PropertySelectionChangeFP) NULL;
|
||||
propertyTextChangeFP = (AccessBridge_PropertyTextChangeFP) NULL;
|
||||
propertyCaretChangeFP = (AccessBridge_PropertyCaretChangeFP) NULL;
|
||||
propertyVisibleDataChangeFP = (AccessBridge_PropertyVisibleDataChangeFP) NULL;
|
||||
propertyChildChangeFP = (AccessBridge_PropertyChildChangeFP) NULL;
|
||||
propertyActiveDescendentChangeFP = (AccessBridge_PropertyActiveDescendentChangeFP) NULL;
|
||||
|
||||
propertyTableModelChangeFP = (AccessBridge_PropertyTableModelChangeFP) NULL;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Destruction.
|
||||
*/
|
||||
AccessBridgeEventHandler::~AccessBridgeEventHandler() {
|
||||
}
|
||||
|
||||
|
||||
// ------------ Event handling methods
|
||||
|
||||
#define SET_JAVA_EVENT_FP(function, eventFP, callbackFP, eventConstant) \
|
||||
void AccessBridgeEventHandler::function(eventFP fp, WinAccessBridge *wab) { \
|
||||
callbackFP = fp; \
|
||||
if (fp != (eventFP) 0) { \
|
||||
javaEventMask |= eventConstant; \
|
||||
wab->addJavaEventNotification(eventConstant); \
|
||||
} else { \
|
||||
javaEventMask &= (0xFFFFFFFF - eventConstant); \
|
||||
wab->removeJavaEventNotification(eventConstant); \
|
||||
} \
|
||||
}
|
||||
|
||||
SET_JAVA_EVENT_FP(setPropertyChangeFP, AccessBridge_PropertyChangeFP, propertyChangeFP, cPropertyChangeEvent)
|
||||
SET_JAVA_EVENT_FP(setJavaShutdownFP, AccessBridge_JavaShutdownFP, javaShutdownFP, cJavaShutdownEvent)
|
||||
SET_JAVA_EVENT_FP(setFocusGainedFP, AccessBridge_FocusGainedFP, focusGainedFP, cFocusGainedEvent)
|
||||
SET_JAVA_EVENT_FP(setFocusLostFP, AccessBridge_FocusLostFP, focusLostFP, cFocusLostEvent)
|
||||
SET_JAVA_EVENT_FP(setCaretUpdateFP, AccessBridge_CaretUpdateFP, caretUpdateFP, cCaretUpdateEvent)
|
||||
SET_JAVA_EVENT_FP(setMouseClickedFP, AccessBridge_MouseClickedFP, mouseClickedFP, cMouseClickedEvent)
|
||||
SET_JAVA_EVENT_FP(setMouseEnteredFP, AccessBridge_MouseEnteredFP, mouseEnteredFP, cMouseEnteredEvent)
|
||||
SET_JAVA_EVENT_FP(setMouseExitedFP, AccessBridge_MouseExitedFP, mouseExitedFP, cMouseExitedEvent)
|
||||
SET_JAVA_EVENT_FP(setMousePressedFP, AccessBridge_MousePressedFP, mousePressedFP, cMousePressedEvent)
|
||||
SET_JAVA_EVENT_FP(setMouseReleasedFP, AccessBridge_MouseReleasedFP, mouseReleasedFP, cMouseReleasedEvent)
|
||||
SET_JAVA_EVENT_FP(setMenuCanceledFP, AccessBridge_MenuCanceledFP, menuCanceledFP, cMenuCanceledEvent)
|
||||
SET_JAVA_EVENT_FP(setMenuDeselectedFP, AccessBridge_MenuDeselectedFP, menuDeselectedFP, cMenuDeselectedEvent)
|
||||
SET_JAVA_EVENT_FP(setMenuSelectedFP, AccessBridge_MenuSelectedFP, menuSelectedFP, cMenuSelectedEvent)
|
||||
SET_JAVA_EVENT_FP(setPopupMenuCanceledFP, AccessBridge_PopupMenuCanceledFP, popupMenuCanceledFP, cPopupMenuCanceledEvent)
|
||||
SET_JAVA_EVENT_FP(setPopupMenuWillBecomeInvisibleFP, AccessBridge_PopupMenuWillBecomeInvisibleFP, popupMenuWillBecomeInvisibleFP, cPopupMenuWillBecomeInvisibleEvent)
|
||||
SET_JAVA_EVENT_FP(setPopupMenuWillBecomeVisibleFP, AccessBridge_PopupMenuWillBecomeVisibleFP, popupMenuWillBecomeVisibleFP, cPopupMenuWillBecomeVisibleEvent)
|
||||
|
||||
#define SET_ACCESSIBILITY_EVENT_FP(function, eventFP, callbackFP, eventConstant) \
|
||||
void AccessBridgeEventHandler::function(eventFP fp, WinAccessBridge *wab) { \
|
||||
callbackFP = fp; \
|
||||
if (fp != (eventFP) 0) { \
|
||||
accessibilityEventMask |= eventConstant; \
|
||||
wab->addAccessibilityEventNotification(eventConstant); \
|
||||
} else { \
|
||||
accessibilityEventMask &= (0xFFFFFFFF - eventConstant); \
|
||||
wab->removeAccessibilityEventNotification(eventConstant); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
SET_ACCESSIBILITY_EVENT_FP(setPropertyNameChangeFP, AccessBridge_PropertyNameChangeFP, propertyNameChangeFP, cPropertyNameChangeEvent)
|
||||
SET_ACCESSIBILITY_EVENT_FP(setPropertyDescriptionChangeFP, AccessBridge_PropertyDescriptionChangeFP, propertyDescriptionChangeFP, cPropertyDescriptionChangeEvent)
|
||||
SET_ACCESSIBILITY_EVENT_FP(setPropertyStateChangeFP, AccessBridge_PropertyStateChangeFP, propertyStateChangeFP, cPropertyStateChangeEvent)
|
||||
SET_ACCESSIBILITY_EVENT_FP(setPropertyValueChangeFP, AccessBridge_PropertyValueChangeFP, propertyValueChangeFP, cPropertyValueChangeEvent)
|
||||
SET_ACCESSIBILITY_EVENT_FP(setPropertySelectionChangeFP, AccessBridge_PropertySelectionChangeFP, propertySelectionChangeFP, cPropertySelectionChangeEvent)
|
||||
SET_ACCESSIBILITY_EVENT_FP(setPropertyTextChangeFP, AccessBridge_PropertyTextChangeFP, propertyTextChangeFP, cPropertyTextChangeEvent)
|
||||
SET_ACCESSIBILITY_EVENT_FP(setPropertyCaretChangeFP, AccessBridge_PropertyCaretChangeFP, propertyCaretChangeFP, cPropertyCaretChangeEvent)
|
||||
SET_ACCESSIBILITY_EVENT_FP(setPropertyVisibleDataChangeFP, AccessBridge_PropertyVisibleDataChangeFP, propertyVisibleDataChangeFP, cPropertyVisibleDataChangeEvent)
|
||||
SET_ACCESSIBILITY_EVENT_FP(setPropertyChildChangeFP, AccessBridge_PropertyChildChangeFP, propertyChildChangeFP, cPropertyChildChangeEvent)
|
||||
SET_ACCESSIBILITY_EVENT_FP(setPropertyActiveDescendentChangeFP, AccessBridge_PropertyActiveDescendentChangeFP, propertyActiveDescendentChangeFP, cPropertyActiveDescendentChangeEvent)
|
||||
|
||||
SET_ACCESSIBILITY_EVENT_FP(setPropertyTableModelChangeFP, AccessBridge_PropertyTableModelChangeFP, propertyTableModelChangeFP, cPropertyTableModelChangeEvent)
|
||||
|
||||
|
||||
/**
|
||||
* propertyChange - extends the Java method call to Windows:
|
||||
* propertyChange(PropertyChangeEvent e, )
|
||||
*
|
||||
* Note: PropertyChangeEvent object passed in is a globalReference;
|
||||
* It is critical that releaseJavaObject() be called
|
||||
* on the PropertyChangeEvent once it is no longer needed,
|
||||
* otherwise the JavaVM/JNI will suffer memory leaks
|
||||
*
|
||||
*/
|
||||
void
|
||||
AccessBridgeEventHandler::firePropertyChange(long vmID,
|
||||
JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *property, wchar_t *oldName,
|
||||
wchar_t *newName) {
|
||||
DEBUG_CODE(char debugBuf[255]);
|
||||
#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer)
|
||||
DEBUG_CODE(sprintf(debugBuf, "\r\nCalling firePropertyChange(%p, %p):\r\n", event, source));
|
||||
#else // JOBJECT64 is jlong (64 bit)
|
||||
DEBUG_CODE(sprintf(debugBuf, "\r\nCalling firePropertyChange(%016I64X, %016I64X):\r\n", event, source));
|
||||
#endif
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf));
|
||||
|
||||
if (propertyChangeFP != (AccessBridge_PropertyChangeFP) 0) {
|
||||
propertyChangeFP(vmID, event, source, property, oldName, newName);
|
||||
} else {
|
||||
DEBUG_CODE(AppendToCallInfo(" Error! propertyChangeFP == 0\r\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* FIRE_EVENT - macro for all fireXXX methods (which
|
||||
* all are basically identical to one another...)
|
||||
*
|
||||
* Note: the event and source objects passed in are globalReferences;
|
||||
* It is critical that releaseJavaObject() be called
|
||||
* on them once they are no longer needed, otherwise
|
||||
* the JavaVM/JNI will suffer memory leaks
|
||||
*
|
||||
*/
|
||||
#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer)
|
||||
const char fireEventDebugString[] = "\r\nIn AccessBridgeEventHandler::%s(%p, %p); vmID = %X\r\n";
|
||||
#else // JOBJECT64 is jlong (64 bit)
|
||||
const char fireEventDebugString[] = "\r\nIn AccessBridgeEventHandler::%s(%016I64X, %016I64X); vmID = %X\r\n";
|
||||
#endif
|
||||
|
||||
#define FIRE_EVENT(method, FPprototype, eventFP) \
|
||||
void AccessBridgeEventHandler::method(long vmID, JOBJECT64 event, JOBJECT64 source) { \
|
||||
DEBUG_CODE(char debugBuf[255]); \
|
||||
DEBUG_CODE(sprintf(debugBuf, fireEventDebugString, #method, event, source, vmID)); \
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf)); \
|
||||
if (eventFP != (FPprototype) 0) { \
|
||||
eventFP(vmID, event, source); \
|
||||
} else { \
|
||||
DEBUG_CODE(AppendToCallInfo(" Error! eventFP == 0\r\n")); \
|
||||
} \
|
||||
}
|
||||
|
||||
void AccessBridgeEventHandler::fireJavaShutdown(long vmID) {
|
||||
DEBUG_CODE(char debugBuf[255]);
|
||||
DEBUG_CODE(sprintf(debugBuf, "\r\nCalling fireJavaShutdown; vmID = %X\r\n", vmID));
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf));
|
||||
if (javaShutdownFP != (AccessBridge_JavaShutdownFP) 0) {
|
||||
javaShutdownFP(vmID);
|
||||
} else {
|
||||
DEBUG_CODE(AppendToCallInfo(" Error! javaShutdownFP == 0\r\n"));
|
||||
}
|
||||
}
|
||||
|
||||
FIRE_EVENT(fireFocusGained, AccessBridge_FocusGainedFP, focusGainedFP)
|
||||
FIRE_EVENT(fireFocusLost, AccessBridge_FocusLostFP, focusLostFP)
|
||||
FIRE_EVENT(fireCaretUpdate, AccessBridge_CaretUpdateFP, caretUpdateFP)
|
||||
FIRE_EVENT(fireMouseClicked, AccessBridge_MouseClickedFP, mouseClickedFP)
|
||||
FIRE_EVENT(fireMouseEntered, AccessBridge_MouseEnteredFP, mouseEnteredFP)
|
||||
FIRE_EVENT(fireMouseExited, AccessBridge_MouseExitedFP, mouseExitedFP)
|
||||
FIRE_EVENT(fireMousePressed, AccessBridge_MousePressedFP, mousePressedFP)
|
||||
FIRE_EVENT(fireMouseReleased, AccessBridge_MouseReleasedFP, mouseReleasedFP)
|
||||
FIRE_EVENT(fireMenuCanceled, AccessBridge_MenuCanceledFP, menuCanceledFP)
|
||||
FIRE_EVENT(fireMenuDeselected, AccessBridge_MenuDeselectedFP, menuDeselectedFP)
|
||||
FIRE_EVENT(fireMenuSelected, AccessBridge_MenuSelectedFP, menuSelectedFP)
|
||||
FIRE_EVENT(firePopupMenuCanceled, AccessBridge_PopupMenuCanceledFP, popupMenuCanceledFP)
|
||||
FIRE_EVENT(firePopupMenuWillBecomeInvisible, AccessBridge_PopupMenuWillBecomeInvisibleFP, popupMenuWillBecomeInvisibleFP)
|
||||
FIRE_EVENT(firePopupMenuWillBecomeVisible, AccessBridge_PopupMenuWillBecomeVisibleFP, popupMenuWillBecomeVisibleFP)
|
||||
|
||||
|
||||
/**
|
||||
* FIRE_PROPERTY_CHANGE - macro for all fireXXX methods (which
|
||||
* all are basically identical to one another...
|
||||
*
|
||||
* Note: the event and source objects passed in are globalReferences;
|
||||
* It is critical that releaseJavaObject() be called
|
||||
* on them once they are no longer needed, otherwise
|
||||
* the JavaVM/JNI will suffer memory leaks
|
||||
*
|
||||
*/
|
||||
#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer)
|
||||
const char firePropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing a no-param property change (%p, %p):\r\n";
|
||||
#else // JOBJECT64 is jlong (64 bit)
|
||||
const char firePropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing a no-param property change (%016I64X, %016I64X):\r\n";
|
||||
#endif
|
||||
|
||||
#define FIRE_PROPERTY_CHANGE(method, FPprototype, eventFP) \
|
||||
void AccessBridgeEventHandler::method(long vmID, JOBJECT64 event, JOBJECT64 source) { \
|
||||
DEBUG_CODE(char debugBuf[255]); \
|
||||
DEBUG_CODE(sprintf(debugBuf, firePropertyChangeDebugString, #method, event, source)); \
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf)); \
|
||||
if (eventFP != (FPprototype) 0) { \
|
||||
eventFP(vmID, event, source); \
|
||||
} else { \
|
||||
DEBUG_CODE(AppendToCallInfo(" Error! eventFP == 0\r\n")); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* FIRE_STRING_PROPERTY_CHANGE - macro for all firePropertyXXXChange methods
|
||||
* that have strings as the old/new values
|
||||
|
||||
* Note: the event and source objects passed in are globalReferences;
|
||||
* It is critical that releaseJavaObject() be called
|
||||
* on them once they are no longer needed, otherwise
|
||||
* the JavaVM/JNI will suffer memory leaks
|
||||
*
|
||||
*/
|
||||
#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer)
|
||||
const char fireStringPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing a string property change (%p, %p, %ls, %ls):\r\n";
|
||||
#else // JOBJECT64 is jlong (64 bit)
|
||||
const char fireStringPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing a string property change (%016I64X, %016I64X, %ls, %ls):\r\n";
|
||||
#endif
|
||||
|
||||
#define FIRE_STRING_PROPERTY_CHANGE(method, FPprototype, eventFP, oldValue, newValue) \
|
||||
void AccessBridgeEventHandler::method(long vmID, JOBJECT64 event, JOBJECT64 source, \
|
||||
wchar_t *oldValue, wchar_t *newValue) { \
|
||||
DEBUG_CODE(char debugBuf[255]); \
|
||||
DEBUG_CODE(sprintf(debugBuf, fireStringPropertyChangeDebugString, #method, event, source, oldValue, newValue)); \
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf)); \
|
||||
if (eventFP != (FPprototype) 0) { \
|
||||
eventFP(vmID, event, source, oldValue, newValue); \
|
||||
} else { \
|
||||
DEBUG_CODE(AppendToCallInfo(" Error! eventFP == 0\r\n")); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* FIRE_INT_PROPERTY_CHANGE - macro for all firePropertyXXXChange methods
|
||||
* that have ints as the old/new values
|
||||
*
|
||||
* Note: the event and source objects passed in are globalReferences;
|
||||
* It is critical that releaseJavaObject() be called
|
||||
* on them once they are no longer needed, otherwise
|
||||
* the JavaVM/JNI will suffer memory leaks
|
||||
*
|
||||
*/
|
||||
#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer)
|
||||
const char fireIntPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing an int property change (%p, %p, %d, %d):\r\n";
|
||||
#else // JOBJECT64 is jlong (64 bit)
|
||||
const char fireIntPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing an int property change (%016I64X, %016I64X, %d, %d):\r\n";
|
||||
#endif
|
||||
|
||||
#define FIRE_INT_PROPERTY_CHANGE(method, FPprototype, eventFP) \
|
||||
void AccessBridgeEventHandler::method(long vmID, JOBJECT64 event, JOBJECT64 source, \
|
||||
int oldValue, int newValue) { \
|
||||
DEBUG_CODE(char debugBuf[255]); \
|
||||
DEBUG_CODE(sprintf(debugBuf, fireIntPropertyChangeDebugString, #method, event, source, oldValue, newValue)); \
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf)); \
|
||||
if (eventFP != (FPprototype) 0) { \
|
||||
eventFP(vmID, event, source, oldValue, newValue); \
|
||||
} else { \
|
||||
DEBUG_CODE(AppendToCallInfo(" Error! eventFP == 0\r\n")); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* FIRE_AC_PROPERTY_CHANGE - macro for all firePropertyXXXChange methods
|
||||
* that have jobjects (AccessibleContexts) as the old/new values
|
||||
*
|
||||
* Note: the event and source objects passed in are globalReferences;
|
||||
* It is critical that releaseJavaObject() be called
|
||||
* on them once they are no longer needed, otherwise
|
||||
* the JavaVM/JNI will suffer memory leaks
|
||||
*
|
||||
*/
|
||||
#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer)
|
||||
const char fireACPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing an AC property change (%p, %p, %p, %p):\r\n";
|
||||
#else // JOBJECT64 is jlong (64 bit)
|
||||
const char fireACPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing an AC property change (%016I64X, %016I64X, %016I64X, %016I64X):\r\n";
|
||||
#endif
|
||||
|
||||
#define FIRE_AC_PROPERTY_CHANGE(method, FPprototype, eventFP) \
|
||||
void AccessBridgeEventHandler::method(long vmID, JOBJECT64 event, JOBJECT64 source, \
|
||||
JOBJECT64 oldValue, JOBJECT64 newValue) { \
|
||||
DEBUG_CODE(char debugBuf[255]); \
|
||||
DEBUG_CODE(sprintf(debugBuf, fireACPropertyChangeDebugString, #method, event, source, oldValue, newValue)); \
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf)); \
|
||||
if (eventFP != (FPprototype) 0) { \
|
||||
eventFP(vmID, event, source, oldValue, newValue); \
|
||||
} else { \
|
||||
DEBUG_CODE(AppendToCallInfo(" Error! eventFP == 0\r\n")); \
|
||||
} \
|
||||
}
|
||||
|
||||
FIRE_STRING_PROPERTY_CHANGE(firePropertyNameChange,
|
||||
AccessBridge_PropertyNameChangeFP,
|
||||
propertyNameChangeFP, oldName, newName)
|
||||
FIRE_STRING_PROPERTY_CHANGE(firePropertyDescriptionChange,
|
||||
AccessBridge_PropertyDescriptionChangeFP,
|
||||
propertyDescriptionChangeFP,
|
||||
oldDescription, newDescription)
|
||||
FIRE_STRING_PROPERTY_CHANGE(firePropertyStateChange,
|
||||
AccessBridge_PropertyStateChangeFP,
|
||||
propertyStateChangeFP, oldState, newState)
|
||||
FIRE_STRING_PROPERTY_CHANGE(firePropertyValueChange,
|
||||
AccessBridge_PropertyValueChangeFP,
|
||||
propertyValueChangeFP, oldValue, newValue)
|
||||
FIRE_PROPERTY_CHANGE(firePropertySelectionChange,
|
||||
AccessBridge_PropertySelectionChangeFP,
|
||||
propertySelectionChangeFP)
|
||||
FIRE_PROPERTY_CHANGE(firePropertyTextChange,
|
||||
AccessBridge_PropertyTextChangeFP,
|
||||
propertyTextChangeFP);
|
||||
FIRE_INT_PROPERTY_CHANGE(firePropertyCaretChange,
|
||||
AccessBridge_PropertyCaretChangeFP,
|
||||
propertyCaretChangeFP)
|
||||
FIRE_PROPERTY_CHANGE(firePropertyVisibleDataChange,
|
||||
AccessBridge_PropertyVisibleDataChangeFP,
|
||||
propertyVisibleDataChangeFP)
|
||||
FIRE_AC_PROPERTY_CHANGE(firePropertyChildChange,
|
||||
AccessBridge_PropertyChildChangeFP,
|
||||
propertyChildChangeFP)
|
||||
FIRE_AC_PROPERTY_CHANGE(firePropertyActiveDescendentChange,
|
||||
AccessBridge_PropertyActiveDescendentChangeFP,
|
||||
propertyActiveDescendentChangeFP)
|
||||
|
||||
FIRE_STRING_PROPERTY_CHANGE(firePropertyTableModelChange,
|
||||
AccessBridge_PropertyTableModelChangeFP,
|
||||
propertyTableModelChangeFP, oldValue, newValue)
|
@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A class to manage firing Accessibility events to Windows AT
|
||||
*/
|
||||
|
||||
#ifndef __AccessBridgeEventHandler_H__
|
||||
#define __AccessBridgeEventHandler_H__
|
||||
|
||||
#include "AccessBridgeCallbacks.h"
|
||||
#include "AccessBridgePackages.h"
|
||||
|
||||
class WinAccessBridge;
|
||||
|
||||
class AccessBridgeEventHandler {
|
||||
long javaEventMask;
|
||||
long accessibilityEventMask;
|
||||
|
||||
AccessBridge_PropertyChangeFP propertyChangeFP;
|
||||
AccessBridge_JavaShutdownFP javaShutdownFP;
|
||||
AccessBridge_FocusGainedFP focusGainedFP;
|
||||
AccessBridge_FocusLostFP focusLostFP;
|
||||
AccessBridge_CaretUpdateFP caretUpdateFP;
|
||||
AccessBridge_MouseClickedFP mouseClickedFP;
|
||||
AccessBridge_MouseEnteredFP mouseEnteredFP;
|
||||
AccessBridge_MouseExitedFP mouseExitedFP;
|
||||
AccessBridge_MousePressedFP mousePressedFP;
|
||||
AccessBridge_MouseReleasedFP mouseReleasedFP;
|
||||
AccessBridge_MenuCanceledFP menuCanceledFP;
|
||||
AccessBridge_MenuDeselectedFP menuDeselectedFP;
|
||||
AccessBridge_MenuSelectedFP menuSelectedFP;
|
||||
AccessBridge_PopupMenuCanceledFP popupMenuCanceledFP;
|
||||
AccessBridge_PopupMenuWillBecomeInvisibleFP popupMenuWillBecomeInvisibleFP;
|
||||
AccessBridge_PopupMenuWillBecomeVisibleFP popupMenuWillBecomeVisibleFP;
|
||||
|
||||
AccessBridge_PropertyNameChangeFP propertyNameChangeFP;
|
||||
AccessBridge_PropertyDescriptionChangeFP propertyDescriptionChangeFP;
|
||||
AccessBridge_PropertyStateChangeFP propertyStateChangeFP;
|
||||
AccessBridge_PropertyValueChangeFP propertyValueChangeFP;
|
||||
AccessBridge_PropertySelectionChangeFP propertySelectionChangeFP;
|
||||
AccessBridge_PropertyTextChangeFP propertyTextChangeFP;
|
||||
AccessBridge_PropertyCaretChangeFP propertyCaretChangeFP;
|
||||
AccessBridge_PropertyVisibleDataChangeFP propertyVisibleDataChangeFP;
|
||||
AccessBridge_PropertyChildChangeFP propertyChildChangeFP;
|
||||
AccessBridge_PropertyActiveDescendentChangeFP propertyActiveDescendentChangeFP;
|
||||
|
||||
AccessBridge_PropertyTableModelChangeFP propertyTableModelChangeFP;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
AccessBridgeEventHandler();
|
||||
~AccessBridgeEventHandler();
|
||||
long getJavaEventMask() {return javaEventMask;};
|
||||
long getAccessibilityEventMask() {return accessibilityEventMask;};
|
||||
|
||||
// ------- Registry methods
|
||||
void setPropertyChangeFP(AccessBridge_PropertyChangeFP fp, WinAccessBridge *wab);
|
||||
void setJavaShutdownFP(AccessBridge_JavaShutdownFP fp, WinAccessBridge *wab);
|
||||
void setFocusGainedFP(AccessBridge_FocusGainedFP fp, WinAccessBridge *wab);
|
||||
void setFocusLostFP(AccessBridge_FocusLostFP fp, WinAccessBridge *wab);
|
||||
void setCaretUpdateFP(AccessBridge_CaretUpdateFP fp, WinAccessBridge *wab);
|
||||
void setMouseClickedFP(AccessBridge_MouseClickedFP fp, WinAccessBridge *wab);
|
||||
void setMouseEnteredFP(AccessBridge_MouseEnteredFP fp, WinAccessBridge *wab);
|
||||
void setMouseExitedFP(AccessBridge_MouseExitedFP fp, WinAccessBridge *wab);
|
||||
void setMousePressedFP(AccessBridge_MousePressedFP fp, WinAccessBridge *wab);
|
||||
void setMouseReleasedFP(AccessBridge_MouseReleasedFP fp, WinAccessBridge *wab);
|
||||
void setMenuCanceledFP(AccessBridge_MenuCanceledFP fp, WinAccessBridge *wab);
|
||||
void setMenuDeselectedFP(AccessBridge_MenuDeselectedFP fp, WinAccessBridge *wab);
|
||||
void setMenuSelectedFP(AccessBridge_MenuSelectedFP fp, WinAccessBridge *wab);
|
||||
void setPopupMenuCanceledFP(AccessBridge_PopupMenuCanceledFP fp, WinAccessBridge *wab);
|
||||
void setPopupMenuWillBecomeInvisibleFP(AccessBridge_PopupMenuWillBecomeInvisibleFP fp,
|
||||
WinAccessBridge *wab);
|
||||
void setPopupMenuWillBecomeVisibleFP(AccessBridge_PopupMenuWillBecomeVisibleFP fp,
|
||||
WinAccessBridge *wab);
|
||||
|
||||
void setPropertyNameChangeFP(AccessBridge_PropertyNameChangeFP fp, WinAccessBridge *wab);
|
||||
void setPropertyDescriptionChangeFP(AccessBridge_PropertyDescriptionChangeFP fp,
|
||||
WinAccessBridge *wab);
|
||||
void setPropertyStateChangeFP(AccessBridge_PropertyStateChangeFP fp, WinAccessBridge *wab);
|
||||
void setPropertyValueChangeFP(AccessBridge_PropertyValueChangeFP fp, WinAccessBridge *wab);
|
||||
void setPropertySelectionChangeFP(AccessBridge_PropertySelectionChangeFP fp,
|
||||
WinAccessBridge *wab);
|
||||
void setPropertyTextChangeFP(AccessBridge_PropertyTextChangeFP fp, WinAccessBridge *wab);
|
||||
void setPropertyCaretChangeFP(AccessBridge_PropertyCaretChangeFP fp, WinAccessBridge *wab);
|
||||
void setPropertyVisibleDataChangeFP(AccessBridge_PropertyVisibleDataChangeFP fp,
|
||||
WinAccessBridge *wab);
|
||||
void setPropertyChildChangeFP(AccessBridge_PropertyChildChangeFP fp, WinAccessBridge *wab);
|
||||
void setPropertyActiveDescendentChangeFP(AccessBridge_PropertyActiveDescendentChangeFP fp,
|
||||
WinAccessBridge *wab);
|
||||
|
||||
void setPropertyTableModelChangeFP(AccessBridge_PropertyTableModelChangeFP fp,
|
||||
WinAccessBridge *wab);
|
||||
|
||||
// ------- Event notification methods
|
||||
void firePropertyChange(long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *property, wchar_t *oldName, wchar_t *newName);
|
||||
void fireJavaShutdown(long vmID);
|
||||
void fireFocusGained(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void fireFocusLost(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void fireCaretUpdate(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void fireMouseClicked(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void fireMouseEntered(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void fireMouseExited(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void fireMousePressed(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void fireMouseReleased(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void fireMenuCanceled(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void fireMenuDeselected(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void fireMenuSelected(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void firePopupMenuCanceled(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void firePopupMenuWillBecomeInvisible(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void firePopupMenuWillBecomeVisible(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
|
||||
void firePropertyNameChange(long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldName, wchar_t *newName);
|
||||
void firePropertyDescriptionChange(long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldDescription, wchar_t *newDescription);
|
||||
void firePropertyStateChange(long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldState, wchar_t *newState);
|
||||
void firePropertyValueChange(long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldValue, wchar_t *newValue);
|
||||
void firePropertySelectionChange(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void firePropertyTextChange(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void firePropertyCaretChange(long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
int oldPosition, int newPosition);
|
||||
void firePropertyVisibleDataChange(long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
void firePropertyChildChange(long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
JOBJECT64 oldChild, JOBJECT64 newChild);
|
||||
void firePropertyActiveDescendentChange(long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
JOBJECT64 oldActiveDescendent, JOBJECT64 newActiveDescendent);
|
||||
|
||||
void firePropertyTableModelChange(long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldValue, wchar_t *newValue);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,358 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A class to track key JVM instance info from the AT WinAccessBridge
|
||||
*/
|
||||
|
||||
#include "AccessBridgeDebug.h"
|
||||
#include "AccessBridgeJavaVMInstance.h"
|
||||
#include "AccessBridgeMessages.h"
|
||||
#include "AccessBridgePackages.h"
|
||||
#include "accessBridgeResource.h" // for debugging messages
|
||||
|
||||
#include <winbase.h>
|
||||
#include <jni.h>
|
||||
|
||||
// The initialization must only be done one time and to provide for that the initialization
|
||||
// is now done in WinAccessBridge and the CRITICAL_SECTION memory has been moved to there.
|
||||
// send memory lock
|
||||
//CRITICAL_SECTION sendMemoryIPCLock;
|
||||
extern CRITICAL_SECTION sendMemoryIPCLock;
|
||||
|
||||
// protects the javaVMs chain while in use
|
||||
extern bool isVMInstanceChainInUse;
|
||||
|
||||
DEBUG_CODE(extern HWND theDialogWindow);
|
||||
extern "C" {
|
||||
DEBUG_CODE(void AppendToCallInfo(char *s));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
AccessBridgeJavaVMInstance::AccessBridgeJavaVMInstance(HWND ourABWindow,
|
||||
HWND javaABWindow,
|
||||
long javaVMID,
|
||||
AccessBridgeJavaVMInstance *next) {
|
||||
goingAway = FALSE;
|
||||
// This should be called once. Moved to WinAccessBridge c'tor
|
||||
//InitializeCriticalSection(&sendMemoryIPCLock);
|
||||
ourAccessBridgeWindow = ourABWindow;
|
||||
javaAccessBridgeWindow = javaABWindow;
|
||||
vmID = javaVMID;
|
||||
nextJVMInstance = next;
|
||||
memoryMappedFileMapHandle = (HANDLE) 0;
|
||||
memoryMappedView = (char *) 0;
|
||||
sprintf(memoryMappedFileName, "AccessBridge-%p-%p.mmf",
|
||||
ourAccessBridgeWindow, javaAccessBridgeWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
AccessBridgeJavaVMInstance::~AccessBridgeJavaVMInstance() {
|
||||
DEBUG_CODE(char buffer[256]);
|
||||
|
||||
DEBUG_CODE(AppendToCallInfo("***** in AccessBridgeJavaVMInstance::~AccessBridgeJavaVMInstance\r\n"));
|
||||
EnterCriticalSection(&sendMemoryIPCLock);
|
||||
|
||||
// if IPC memory mapped file view is valid, unmap it
|
||||
goingAway = TRUE;
|
||||
if (memoryMappedView != (char *) 0) {
|
||||
DEBUG_CODE(sprintf(buffer, " unmapping memoryMappedView; view = %p\r\n", memoryMappedView));
|
||||
DEBUG_CODE(AppendToCallInfo(buffer));
|
||||
UnmapViewOfFile(memoryMappedView);
|
||||
memoryMappedView = (char *) 0;
|
||||
}
|
||||
// if IPC memory mapped file handle map is open, close it
|
||||
if (memoryMappedFileMapHandle != (HANDLE) 0) {
|
||||
DEBUG_CODE(sprintf(buffer, " closing memoryMappedFileMapHandle; handle = %p\r\n", memoryMappedFileMapHandle));
|
||||
DEBUG_CODE(AppendToCallInfo(buffer));
|
||||
CloseHandle(memoryMappedFileMapHandle);
|
||||
memoryMappedFileMapHandle = (HANDLE) 0;
|
||||
}
|
||||
LeaveCriticalSection(&sendMemoryIPCLock);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* initiateIPC - sets up the memory-mapped file to do IPC messaging
|
||||
* 1 file is created: to handle requests for information
|
||||
* initiated from Windows AT. The package is placed into
|
||||
* the memory-mapped file (char *memoryMappedView),
|
||||
* and then a special SendMessage() is sent. When the
|
||||
* JavaDLL returns from SendMessage() processing, the
|
||||
* data will be in memoryMappedView. The SendMessage()
|
||||
* return value tells us if all is right with the world.
|
||||
*
|
||||
* The set-up proces involves creating the memory-mapped
|
||||
* file, and handshaking with the JavaDLL so it knows
|
||||
* about it as well.
|
||||
*
|
||||
*/
|
||||
LRESULT
|
||||
AccessBridgeJavaVMInstance::initiateIPC() {
|
||||
DEBUG_CODE(char debugBuf[256]);
|
||||
DWORD errorCode;
|
||||
|
||||
DEBUG_CODE(AppendToCallInfo(" in AccessBridgeJavaVMInstance::initiateIPC()\r\n"));
|
||||
|
||||
// create Windows-initiated IPC file & map it to a ptr
|
||||
memoryMappedFileMapHandle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL,
|
||||
PAGE_READWRITE, 0,
|
||||
// 8 bytes for return code
|
||||
sizeof(WindowsInitiatedPackages) + 8,
|
||||
memoryMappedFileName);
|
||||
if (memoryMappedFileMapHandle == NULL) {
|
||||
errorCode = GetLastError();
|
||||
DEBUG_CODE(sprintf(debugBuf, " Failed to CreateFileMapping for %s, error: %X", memoryMappedFileName, errorCode));
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf));
|
||||
return errorCode;
|
||||
} else {
|
||||
DEBUG_CODE(sprintf(debugBuf, " CreateFileMapping worked - filename: %s\r\n", memoryMappedFileName));
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf));
|
||||
}
|
||||
|
||||
memoryMappedView = (char *) MapViewOfFile(memoryMappedFileMapHandle,
|
||||
FILE_MAP_READ | FILE_MAP_WRITE,
|
||||
0, 0, 0);
|
||||
if (memoryMappedView == NULL) {
|
||||
errorCode = GetLastError();
|
||||
DEBUG_CODE(sprintf(debugBuf, " Failed to MapViewOfFile for %s, error: %X", memoryMappedFileName, errorCode));
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf));
|
||||
return errorCode;
|
||||
} else {
|
||||
DEBUG_CODE(sprintf(debugBuf, " MapViewOfFile worked - view: %p\r\n", memoryMappedView));
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf));
|
||||
}
|
||||
|
||||
|
||||
// write some data to the memory mapped file
|
||||
strcpy(memoryMappedView, AB_MEMORY_MAPPED_FILE_OK_QUERY);
|
||||
|
||||
|
||||
// inform the JavaDLL that we've a memory mapped file ready for it
|
||||
char buffer[sizeof(PackageType) + sizeof(MemoryMappedFileCreatedPackage)];
|
||||
PackageType *type = (PackageType *) buffer;
|
||||
MemoryMappedFileCreatedPackage *pkg = (MemoryMappedFileCreatedPackage *) (buffer + sizeof(PackageType));
|
||||
*type = cMemoryMappedFileCreatedPackage;
|
||||
pkg->bridgeWindow = ABHandleToLong(ourAccessBridgeWindow);
|
||||
strncpy(pkg->filename, memoryMappedFileName, cMemoryMappedNameSize);
|
||||
sendPackage(buffer, sizeof(buffer));
|
||||
|
||||
|
||||
// look for the JavaDLL's answer to see if it could read the file
|
||||
if (strcmp(memoryMappedView, AB_MEMORY_MAPPED_FILE_OK_ANSWER) != 0) {
|
||||
DEBUG_CODE(sprintf(debugBuf, " JavaVM failed to deal with memory mapped file %s\r\n",
|
||||
memoryMappedFileName));
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf));
|
||||
return -1;
|
||||
} else {
|
||||
DEBUG_CODE(sprintf(debugBuf, " Success! JavaVM accpeted our file\r\n"));
|
||||
DEBUG_CODE(AppendToCallInfo(debugBuf));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
|
||||
/**
|
||||
* sendPackage - uses SendMessage(WM_COPYDATA) to do IPC messaging
|
||||
* with the Java AccessBridge DLL
|
||||
*
|
||||
* NOTE: WM_COPYDATA is only for one-way IPC; there
|
||||
* is now way to return parameters (especially big ones)
|
||||
* Use sendMemoryPackage() to do that!
|
||||
*/
|
||||
LRESULT
|
||||
AccessBridgeJavaVMInstance::sendPackage(char *buffer, long bufsize) {
|
||||
COPYDATASTRUCT toCopy;
|
||||
toCopy.dwData = 0; // 32-bits we could use for something...
|
||||
toCopy.cbData = bufsize;
|
||||
toCopy.lpData = buffer;
|
||||
|
||||
PrintDebugString("In AccessBridgeVMInstance::sendPackage");
|
||||
PrintDebugString(" javaAccessBridgeWindow: %p", javaAccessBridgeWindow);
|
||||
/* This was SendMessage. Normally that is a blocking call. However, if
|
||||
* SendMessage is sent to another process, e.g. another JVM and an incoming
|
||||
* SendMessage is pending, control will be passed to the DialogProc to handle
|
||||
* the incoming message. A bug occurred where this allowed an AB_DLL_GOING_AWAY
|
||||
* message to be processed deleting an AccessBridgeJavaVMInstance object in
|
||||
* the javaVMs chain. SendMessageTimeout with SMTO_BLOCK set will prevent the
|
||||
* calling thread from processing other requests while waiting, i.e control
|
||||
* will not be passed to the DialogProc. Also note that PostMessage or
|
||||
* SendNotifyMessage can't be used. Although they don't allow transfer to
|
||||
* the DialogProc they can't be used in cases where pointers are passed. This
|
||||
* is because the referenced memory needs to be available when the other thread
|
||||
* gets control.
|
||||
*/
|
||||
UINT flags = SMTO_BLOCK | SMTO_NOTIMEOUTIFNOTHUNG;
|
||||
DWORD_PTR out; // not used
|
||||
LRESULT lr = SendMessageTimeout( javaAccessBridgeWindow, WM_COPYDATA,
|
||||
(WPARAM)ourAccessBridgeWindow, (LPARAM)&toCopy,
|
||||
flags, 4000, &out );
|
||||
return lr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sendMemoryPackage - uses Memory-Mapped files to do IPC messaging
|
||||
* with the Java AccessBridge DLL, informing the
|
||||
* Java AccessBridge DLL via SendMessage that something
|
||||
* is waiting for it in the shared file...
|
||||
*
|
||||
* In the SendMessage call, the third param (WPARAM) is
|
||||
* the source HWND (ourAccessBridgeWindow in this case),
|
||||
* and the fourth param (LPARAM) is the size in bytes of
|
||||
* the package put into shared memory.
|
||||
*
|
||||
*/
|
||||
BOOL
|
||||
AccessBridgeJavaVMInstance::sendMemoryPackage(char *buffer, long bufsize) {
|
||||
|
||||
// Protect against race condition where the memory mapped file is
|
||||
// deallocated before the memory package is being sent
|
||||
if (goingAway) {
|
||||
return FALSE;
|
||||
}
|
||||
BOOL retval = FALSE;
|
||||
|
||||
DEBUG_CODE(char outputBuf[256]);
|
||||
DEBUG_CODE(sprintf(outputBuf, "AccessBridgeJavaVMInstance::sendMemoryPackage(, %d)", bufsize));
|
||||
DEBUG_CODE(AppendToCallInfo(outputBuf));
|
||||
|
||||
DEBUG_CODE(PackageType *type = (PackageType *) buffer);
|
||||
DEBUG_CODE(if (*type == cGetAccessibleTextRangePackage) {)
|
||||
DEBUG_CODE(AppendToCallInfo(" 'buffer' contains:"));
|
||||
DEBUG_CODE(GetAccessibleTextRangePackage *pkg = (GetAccessibleTextRangePackage *) (buffer + sizeof(PackageType)));
|
||||
DEBUG_CODE(sprintf(outputBuf, " PackageType = %X", *type));
|
||||
DEBUG_CODE(AppendToCallInfo(outputBuf));
|
||||
DEBUG_CODE(sprintf(outputBuf, " GetAccessibleTextRange: start = %d, end = %d, rText = %ls",
|
||||
pkg->start, pkg->end, pkg->rText));
|
||||
DEBUG_CODE(AppendToCallInfo(outputBuf));
|
||||
DEBUG_CODE(})
|
||||
|
||||
EnterCriticalSection(&sendMemoryIPCLock);
|
||||
{
|
||||
// copy the package into shared memory
|
||||
if (!goingAway) {
|
||||
memcpy(memoryMappedView, buffer, bufsize);
|
||||
|
||||
DEBUG_CODE(PackageType *type = (PackageType *) memoryMappedView);
|
||||
DEBUG_CODE(if (*type == cGetAccessibleTextItemsPackage) {)
|
||||
DEBUG_CODE(AppendToCallInfo(" 'memoryMappedView' now contains:"));
|
||||
DEBUG_CODE(GetAccessibleTextItemsPackage *pkg = (GetAccessibleTextItemsPackage *) (buffer + sizeof(PackageType)));
|
||||
DEBUG_CODE(sprintf(outputBuf, " PackageType = %X", *type));
|
||||
DEBUG_CODE(AppendToCallInfo(outputBuf));
|
||||
DEBUG_CODE(})
|
||||
}
|
||||
|
||||
if (!goingAway) {
|
||||
// Let the recipient know there is a package waiting for them. The unset byte
|
||||
// at end of buffer which will only be set if message is properly received
|
||||
char *done = &memoryMappedView[bufsize];
|
||||
*done = 0;
|
||||
|
||||
PrintDebugString(" javaAccessBridgeWindow: %p", javaAccessBridgeWindow);
|
||||
// See the comment above the call to SendMessageTimeout in SendPackage method above.
|
||||
UINT flags = SMTO_BLOCK | SMTO_NOTIMEOUTIFNOTHUNG;
|
||||
DWORD_PTR out; // not used
|
||||
SendMessageTimeout( javaAccessBridgeWindow, AB_MESSAGE_WAITING, (WPARAM)ourAccessBridgeWindow, (LPARAM)bufsize,
|
||||
flags, 4000, &out );
|
||||
|
||||
// only succeed if message has been properly received
|
||||
if(!goingAway) retval = (*done == 1);
|
||||
}
|
||||
|
||||
// copy the package back from shared memory
|
||||
if (!goingAway) {
|
||||
memcpy(buffer, memoryMappedView, bufsize);
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection(&sendMemoryIPCLock);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* findAccessBridgeWindow - walk through linked list from where we are,
|
||||
* return the HWND of the ABJavaVMInstance that
|
||||
* matches the passed in vmID; no match: return 0
|
||||
*
|
||||
*/
|
||||
HWND
|
||||
AccessBridgeJavaVMInstance::findAccessBridgeWindow(long javaVMID) {
|
||||
PrintDebugString("In findAccessBridgeWindow");
|
||||
// no need to recurse really
|
||||
if (vmID == javaVMID) {
|
||||
return javaAccessBridgeWindow;
|
||||
} else {
|
||||
isVMInstanceChainInUse = true;
|
||||
AccessBridgeJavaVMInstance *current = nextJVMInstance;
|
||||
while (current != (AccessBridgeJavaVMInstance *) 0) {
|
||||
if (current->vmID == javaVMID) {
|
||||
isVMInstanceChainInUse = false;
|
||||
return current->javaAccessBridgeWindow;
|
||||
}
|
||||
current = current->nextJVMInstance;
|
||||
}
|
||||
isVMInstanceChainInUse = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* findABJavaVMInstanceFromJavaHWND - walk through linked list from
|
||||
* where we are. Return the
|
||||
* AccessBridgeJavaVMInstance
|
||||
* of the ABJavaVMInstance that
|
||||
* matches the passed in vmID;
|
||||
* no match: return 0
|
||||
*/
|
||||
AccessBridgeJavaVMInstance *
|
||||
AccessBridgeJavaVMInstance::findABJavaVMInstanceFromJavaHWND(HWND window) {
|
||||
PrintDebugString("In findABJavaInstanceFromJavaHWND");
|
||||
// no need to recurse really
|
||||
if (javaAccessBridgeWindow == window) {
|
||||
return this;
|
||||
} else {
|
||||
isVMInstanceChainInUse = true;
|
||||
AccessBridgeJavaVMInstance *current = nextJVMInstance;
|
||||
while (current != (AccessBridgeJavaVMInstance *) 0) {
|
||||
if (current->javaAccessBridgeWindow == window) {
|
||||
isVMInstanceChainInUse = false;
|
||||
return current;
|
||||
}
|
||||
current = current->nextJVMInstance;
|
||||
}
|
||||
}
|
||||
isVMInstanceChainInUse = false;
|
||||
return (AccessBridgeJavaVMInstance *) 0;
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A class to track key JVM instance info from the AT WinAccessBridge
|
||||
*/
|
||||
|
||||
#ifndef __AccessBridgeJavaVMInstance_H__
|
||||
#define __AccessBridgeJavaVMInstance_H__
|
||||
|
||||
#include "AccessBridgePackages.h"
|
||||
|
||||
#include <jni.h>
|
||||
#include <windows.h>
|
||||
|
||||
/**
|
||||
* The AccessBridgeJavaVMInstance class.
|
||||
*/
|
||||
class AccessBridgeJavaVMInstance {
|
||||
friend class WinAccessBridge;
|
||||
|
||||
AccessBridgeJavaVMInstance *nextJVMInstance;
|
||||
HWND ourAccessBridgeWindow;
|
||||
HWND javaAccessBridgeWindow;
|
||||
long vmID;
|
||||
|
||||
// IPC variables
|
||||
HANDLE memoryMappedFileMapHandle; // handle to file map
|
||||
char *memoryMappedView; // ptr to shared memory
|
||||
char memoryMappedFileName[cMemoryMappedNameSize];
|
||||
BOOL goingAway;
|
||||
|
||||
|
||||
public:
|
||||
AccessBridgeJavaVMInstance(HWND ourABWindow, HWND javaABWindow,
|
||||
long javaVMID,
|
||||
AccessBridgeJavaVMInstance *next);
|
||||
~AccessBridgeJavaVMInstance();
|
||||
LRESULT initiateIPC();
|
||||
LRESULT sendPackage(char *buffer, long bufsize);
|
||||
BOOL sendMemoryPackage(char *buffer, long bufsize);
|
||||
HWND findAccessBridgeWindow(long javaVMID);
|
||||
AccessBridgeJavaVMInstance *findABJavaVMInstanceFromJavaHWND(HWND window);
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A class to manage queueing of messages for IPC
|
||||
*/
|
||||
|
||||
#include "AccessBridgeDebug.h"
|
||||
#include "AccessBridgeMessageQueue.h"
|
||||
#include "AccessBridgePackages.h" // for debugging only
|
||||
#include <windows.h>
|
||||
#include <malloc.h>
|
||||
|
||||
DEBUG_CODE(extern HWND theDialogWindow);
|
||||
extern "C" {
|
||||
DEBUG_CODE(void AppendToCallInfo(char *s));
|
||||
}
|
||||
|
||||
// -------------------
|
||||
|
||||
|
||||
AccessBridgeQueueElement::AccessBridgeQueueElement(char *buf, int size) {
|
||||
bufsize = size;
|
||||
next = (AccessBridgeQueueElement *) 0;
|
||||
previous = (AccessBridgeQueueElement *) 0;
|
||||
buffer = (char *) malloc(bufsize);
|
||||
memcpy(buffer, buf, bufsize);
|
||||
}
|
||||
|
||||
AccessBridgeQueueElement::~AccessBridgeQueueElement() {
|
||||
// delete buffer;
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
|
||||
// -------------------
|
||||
|
||||
|
||||
AccessBridgeMessageQueue::AccessBridgeMessageQueue() {
|
||||
queueLocked = FALSE;
|
||||
queueRemoveLocked = FALSE;
|
||||
start = (AccessBridgeQueueElement *) 0;
|
||||
end = (AccessBridgeQueueElement *) 0;
|
||||
size = 0;
|
||||
}
|
||||
|
||||
AccessBridgeMessageQueue::~AccessBridgeMessageQueue() {
|
||||
// empty queue, then exit
|
||||
}
|
||||
|
||||
/**
|
||||
* getEventsWaiting - gets the number of events waiting to fire
|
||||
*/
|
||||
int
|
||||
AccessBridgeMessageQueue::getEventsWaiting() {
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* add - add an element to the queue, which is locked with semaphores
|
||||
*
|
||||
*/
|
||||
QueueReturns
|
||||
AccessBridgeMessageQueue::add(AccessBridgeQueueElement *element) {
|
||||
PrintDebugString(" in AccessBridgeMessageQueue::add()");
|
||||
PrintDebugString(" queue size = %d", size);
|
||||
|
||||
QueueReturns returnVal = cElementPushedOK;
|
||||
if (queueLocked) {
|
||||
PrintDebugString(" queue was locked; returning cQueueInUse!");
|
||||
return cQueueInUse;
|
||||
}
|
||||
queueLocked = TRUE;
|
||||
{
|
||||
PrintDebugString(" adding element to queue!");
|
||||
if (end == (AccessBridgeQueueElement *) 0) {
|
||||
if (start == (AccessBridgeQueueElement *) 0 && size == 0) {
|
||||
start = element;
|
||||
end = element;
|
||||
element->previous = (AccessBridgeQueueElement *) 0;
|
||||
element->next = (AccessBridgeQueueElement *) 0;
|
||||
size++;
|
||||
} else {
|
||||
returnVal = cQueueBroken; // bad voodo!
|
||||
}
|
||||
} else {
|
||||
element->previous = end;
|
||||
element->next = (AccessBridgeQueueElement *) 0;
|
||||
end->next = element;
|
||||
end = element;
|
||||
size++;
|
||||
}
|
||||
}
|
||||
queueLocked = FALSE;
|
||||
PrintDebugString(" returning from AccessBridgeMessageQueue::add()");
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* remove - remove an element from the queue, which is locked with semaphores
|
||||
*
|
||||
*/
|
||||
QueueReturns
|
||||
AccessBridgeMessageQueue::remove(AccessBridgeQueueElement **element) {
|
||||
PrintDebugString(" in AccessBridgeMessageQueue::remove()");
|
||||
PrintDebugString(" queue size = %d", size);
|
||||
|
||||
QueueReturns returnVal = cMoreMessages;
|
||||
if (queueLocked) {
|
||||
PrintDebugString(" queue was locked; returning cQueueInUse!");
|
||||
return cQueueInUse;
|
||||
}
|
||||
queueLocked = TRUE;
|
||||
{
|
||||
PrintDebugString(" removing element from queue!");
|
||||
if (size > 0) {
|
||||
if (start != (AccessBridgeQueueElement *) 0) {
|
||||
*element = start;
|
||||
start = start->next;
|
||||
if (start != (AccessBridgeQueueElement *) 0) {
|
||||
start->previous = (AccessBridgeQueueElement *) 0;
|
||||
} else {
|
||||
end = (AccessBridgeQueueElement *) 0;
|
||||
if (size != 1) {
|
||||
returnVal = cQueueBroken; // bad voodo, should only be 1 in this situation
|
||||
}
|
||||
}
|
||||
size--;
|
||||
} else {
|
||||
returnVal = cQueueBroken; // bad voodo!
|
||||
}
|
||||
} else {
|
||||
returnVal = cQueueEmpty;
|
||||
}
|
||||
}
|
||||
queueLocked = FALSE;
|
||||
PrintDebugString(" returning from AccessBridgeMessageQueue::remove()");
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setRemoveLock - set the state of the removeLock (TRUE or FALSE)
|
||||
*
|
||||
*/
|
||||
QueueReturns
|
||||
AccessBridgeMessageQueue::setRemoveLock(BOOL removeLockSetting) {
|
||||
if (queueLocked) {
|
||||
return cQueueInUse;
|
||||
}
|
||||
queueRemoveLocked = removeLockSetting;
|
||||
|
||||
return cQueueOK;
|
||||
}
|
||||
|
||||
/**
|
||||
* setRemoveLock - set the state of the removeLock (TRUE or FALSE)
|
||||
*
|
||||
*/
|
||||
BOOL
|
||||
AccessBridgeMessageQueue::getRemoveLockSetting() {
|
||||
return queueRemoveLocked;
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A class to manage queueing of messages for IPC
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef __AccessBridgeMessageQueue_H__
|
||||
#define __AccessBridgeMessageQueue_H__
|
||||
|
||||
|
||||
enum QueueReturns {
|
||||
cQueueEmpty = 0,
|
||||
cMoreMessages = 1,
|
||||
cQueueInUse,
|
||||
cElementPushedOK,
|
||||
cQueueFull,
|
||||
cQueueOK,
|
||||
cQueueBroken // shouldn't ever happen!
|
||||
};
|
||||
|
||||
class AccessBridgeQueueElement {
|
||||
friend class AccessBridgeMessageQueue;
|
||||
friend class WinAccessBridge;
|
||||
char *buffer;
|
||||
int bufsize;
|
||||
AccessBridgeQueueElement *next;
|
||||
AccessBridgeQueueElement *previous;
|
||||
|
||||
public:
|
||||
AccessBridgeQueueElement(char *buf, int size);
|
||||
~AccessBridgeQueueElement();
|
||||
};
|
||||
|
||||
class AccessBridgeMessageQueue {
|
||||
BOOL queueLocked;
|
||||
BOOL queueRemoveLocked;
|
||||
AccessBridgeQueueElement *start;
|
||||
AccessBridgeQueueElement *end;
|
||||
int size;
|
||||
|
||||
public:
|
||||
AccessBridgeMessageQueue();
|
||||
~AccessBridgeMessageQueue();
|
||||
|
||||
int getEventsWaiting();
|
||||
|
||||
QueueReturns add(AccessBridgeQueueElement *element);
|
||||
QueueReturns remove(AccessBridgeQueueElement **element);
|
||||
QueueReturns setRemoveLock(BOOL removeLockSetting);
|
||||
BOOL getRemoveLockSetting();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,856 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Glue routines called by Windows AT into the WindowsAccessBridge dll
|
||||
*/
|
||||
|
||||
#include "AccessBridgeDebug.h"
|
||||
#include "AccessBridgeWindowsEntryPoints.h"
|
||||
#include "WinAccessBridge.h"
|
||||
#include "accessBridgeResource.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <jni.h>
|
||||
|
||||
|
||||
extern WinAccessBridge *theWindowsAccessBridge;
|
||||
extern HWND theDialogWindow;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Windows_run - where Windows executables will load/unload us
|
||||
*
|
||||
*/
|
||||
void Windows_run() {
|
||||
// open our window
|
||||
if (theWindowsAccessBridge != (WinAccessBridge *) 0) {
|
||||
theWindowsAccessBridge->initWindow();
|
||||
DEBUG_CODE(SetDlgItemText(theDialogWindow, cInvokedByText, "Windows"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Windows_shutdown - where Windows executables will load/unload us
|
||||
*
|
||||
*
|
||||
void Windows_shutdown() {
|
||||
if (theWindowsAccessBridge != (WinAccessBridge *) 0) {
|
||||
theWindowsAccessBridge->initWindow();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* getTopLevelHWND - returns the top-level window parent of the descendent
|
||||
*
|
||||
*/
|
||||
HWND getTopLevelHWND(HWND descendent) {
|
||||
HWND hwnd;
|
||||
if (descendent == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!IsWindow(descendent)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hwnd = descendent;
|
||||
for(;;) {
|
||||
LONG style = GetWindowLong(hwnd, GWL_STYLE);
|
||||
if ( (style & WS_CHILD) == 0 ) {
|
||||
// found a non-child window so terminate
|
||||
break;
|
||||
}
|
||||
hwnd = GetParent(hwnd);
|
||||
}
|
||||
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
void releaseJavaObject(long vmID, JOBJECT64 object) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
theWindowsAccessBridge->releaseJavaObject(vmID, object);
|
||||
}
|
||||
}
|
||||
|
||||
void getVersionInfo(long vmID, AccessBridgeVersionInfo *info) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
theWindowsAccessBridge->getVersionInfo(vmID, info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL isJavaWindow(HWND window) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->isJavaWindow(window);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns whether two object references refer to the same object
|
||||
*/
|
||||
BOOL isSameObject(long vmID, JOBJECT64 obj1, JOBJECT64 obj2) {
|
||||
#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer)
|
||||
PrintDebugString("\r\nAccessBridgeWindowsEntryPoints::isSameObject(%p %p)", obj1, obj2);
|
||||
#else // JOBJECT64 is jlong (64 bit)
|
||||
PrintDebugString("\r\nAccessBridgeWindowsEntryPoints::isSameObject(%016I64X %016I64X)", obj1, obj2);
|
||||
#endif
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->isSameObject(vmID, obj1, obj2);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a text field to the specified string. Returns whether successful
|
||||
*/
|
||||
BOOL setTextContents (const long vmID, const AccessibleContext accessibleContext,const wchar_t *text) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->setTextContents(vmID, accessibleContext, text);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Accessible Context of an object of the specified role that is the
|
||||
* ancestor of a given object. If the object is of the specified role
|
||||
* or an ancestor object of the specified role was found, returns the object's
|
||||
* AccessibleContext.
|
||||
* If there is no ancestor object of the specified role,
|
||||
* returns (AccessibleContext)0.
|
||||
*/
|
||||
AccessibleContext getParentWithRole (const long vmID, const AccessibleContext accessibleContext, const wchar_t *role) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getParentWithRole(vmID, accessibleContext, role);
|
||||
}
|
||||
return (AccessibleContext)0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the Accessible Context for the top level object in
|
||||
* a Java Window. This is same Accessible Context that is obtained
|
||||
* from GetAccessibleContextFromHWND for that window. Returns
|
||||
* (AccessibleContext)0 on error.
|
||||
*/
|
||||
AccessibleContext getTopLevelObject (const long vmID, const AccessibleContext accessibleContext) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getTopLevelObject(vmID, accessibleContext);
|
||||
}
|
||||
return (AccessibleContext)0;
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is an Ancestor object of the specified role,
|
||||
* returns the Accessible Context of the found object.
|
||||
* Otherwise, returns the top level object for that
|
||||
* Java Window. Returns (AccessibleContext)0 on error.
|
||||
*/
|
||||
AccessibleContext getParentWithRoleElseRoot (const long vmID, const AccessibleContext accessibleContext, const wchar_t *role) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getParentWithRoleElseRoot(vmID, accessibleContext, role);
|
||||
}
|
||||
return (AccessibleContext)0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns how deep in the object hierarchy a given object is.
|
||||
* The top most object in the object hierarchy has an object depth of 0.
|
||||
* Returns -1 on error.
|
||||
*/
|
||||
int getObjectDepth (const long vmID, const AccessibleContext accessibleContext) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getObjectDepth(vmID, accessibleContext);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Accessible Context of the currently ActiveDescendent of an object.
|
||||
* Returns (AccessibleContext)0 on error.
|
||||
*/
|
||||
AccessibleContext getActiveDescendent (const long vmID, const AccessibleContext accessibleContext) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getActiveDescendent(vmID, accessibleContext);
|
||||
}
|
||||
return (AccessibleContext)0;
|
||||
}
|
||||
|
||||
// -------- Accessible Context methods -------------
|
||||
|
||||
BOOL getAccessibleContextFromHWND(HWND window, long *vmID, JOBJECT64 *AccessibleContext) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleContextFromHWND(window, vmID, AccessibleContext);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HWND getHWNDFromAccessibleContext(long vmID, JOBJECT64 accessibleContext) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getHWNDFromAccessibleContext(vmID, accessibleContext);
|
||||
}
|
||||
return (HWND)0;
|
||||
}
|
||||
|
||||
BOOL getAccessibleContextAt(long vmID, JOBJECT64 AccessibleContextParent,
|
||||
jint x, jint y, JOBJECT64 *AccessibleContext) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleContextAt(vmID, AccessibleContextParent,
|
||||
x, y, AccessibleContext);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleContextWithFocus(HWND window, long *vmID, JOBJECT64 *AccessibleContext) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleContextWithFocus(window, vmID, AccessibleContext);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleContextInfo(long vmID,
|
||||
JOBJECT64 AccessibleContext,
|
||||
AccessibleContextInfo *info) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleContextInfo(
|
||||
vmID,
|
||||
AccessibleContext,
|
||||
info);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
JOBJECT64 getAccessibleChildFromContext(long vmID,
|
||||
JOBJECT64 AccessibleContext,
|
||||
jint childIndex) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleChildFromContext(
|
||||
vmID,
|
||||
AccessibleContext,
|
||||
childIndex);
|
||||
}
|
||||
return (JOBJECT64) 0;
|
||||
}
|
||||
|
||||
JOBJECT64 getAccessibleParentFromContext(long vmID,
|
||||
JOBJECT64 AccessibleContext) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleParentFromContext(
|
||||
vmID,
|
||||
AccessibleContext);
|
||||
}
|
||||
return (JOBJECT64) 0;
|
||||
}
|
||||
|
||||
// -------- begin AccessibleTable routines -------------
|
||||
|
||||
BOOL getAccessibleTableInfo(long vmID, JOBJECT64 ac,
|
||||
AccessibleTableInfo *tableInfo) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTableInfo(
|
||||
vmID,
|
||||
ac,
|
||||
tableInfo);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleTableCellInfo(long vmID, JOBJECT64 accessibleTable,
|
||||
jint row, jint column, AccessibleTableCellInfo *tableCellInfo) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTableCellInfo(
|
||||
vmID,
|
||||
accessibleTable,
|
||||
row, column, tableCellInfo);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleTableRowHeader(long vmID, JOBJECT64 acParent, AccessibleTableInfo *tableInfo) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTableRowHeader(
|
||||
vmID,
|
||||
acParent,
|
||||
tableInfo);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleTableColumnHeader(long vmID, JOBJECT64 acParent, AccessibleTableInfo *tableInfo) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTableColumnHeader(
|
||||
vmID,
|
||||
acParent,
|
||||
tableInfo);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
JOBJECT64 getAccessibleTableRowDescription(long vmID, JOBJECT64 acParent, jint row) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return (JOBJECT64)theWindowsAccessBridge->getAccessibleTableRowDescription(
|
||||
vmID,
|
||||
acParent,
|
||||
row);
|
||||
}
|
||||
return (JOBJECT64)0;
|
||||
}
|
||||
|
||||
JOBJECT64 getAccessibleTableColumnDescription(long vmID, JOBJECT64 acParent, jint column) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return (JOBJECT64)theWindowsAccessBridge->getAccessibleTableColumnDescription(
|
||||
vmID,
|
||||
acParent,
|
||||
column);
|
||||
}
|
||||
return (JOBJECT64)0;
|
||||
}
|
||||
|
||||
jint getAccessibleTableRowSelectionCount(long vmID, JOBJECT64 accessibleTable) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTableRowSelectionCount(vmID, accessibleTable);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
BOOL isAccessibleTableRowSelected(long vmID, JOBJECT64 accessibleTable, jint row) {
|
||||
if (theWindowsAccessBridge != 0 ) {
|
||||
return theWindowsAccessBridge->isAccessibleTableRowSelected(vmID, accessibleTable, row);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleTableRowSelections(long vmID, JOBJECT64 accessibleTable, jint count, jint *selections) {
|
||||
if (theWindowsAccessBridge != 0 ) {
|
||||
return theWindowsAccessBridge->getAccessibleTableRowSelections(vmID, accessibleTable, count,
|
||||
selections);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
jint getAccessibleTableColumnSelectionCount(long vmID, JOBJECT64 accessibleTable) {
|
||||
if (theWindowsAccessBridge != 0 ) {
|
||||
return theWindowsAccessBridge->getAccessibleTableColumnSelectionCount(vmID, accessibleTable);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
BOOL isAccessibleTableColumnSelected(long vmID, JOBJECT64 accessibleTable, jint column) {
|
||||
if (theWindowsAccessBridge != 0 ) {
|
||||
return theWindowsAccessBridge->isAccessibleTableColumnSelected(vmID, accessibleTable, column);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleTableColumnSelections(long vmID, JOBJECT64 accessibleTable, jint count, jint *selections) {
|
||||
if (theWindowsAccessBridge != 0 ) {
|
||||
return theWindowsAccessBridge->getAccessibleTableColumnSelections(vmID, accessibleTable, count,
|
||||
selections);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
jint getAccessibleTableRow(long vmID, JOBJECT64 accessibleTable, jint index) {
|
||||
if (theWindowsAccessBridge != 0 ) {
|
||||
return theWindowsAccessBridge->getAccessibleTableRow(vmID, accessibleTable, index);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
jint getAccessibleTableColumn(long vmID, JOBJECT64 accessibleTable, jint index) {
|
||||
if (theWindowsAccessBridge != 0 ) {
|
||||
return theWindowsAccessBridge->getAccessibleTableColumn(vmID, accessibleTable, index);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
jint getAccessibleTableIndex(long vmID, JOBJECT64 accessibleTable, jint row, jint column) {
|
||||
if (theWindowsAccessBridge != 0 ) {
|
||||
return theWindowsAccessBridge->getAccessibleTableIndex(vmID, accessibleTable, row, column);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* --------- end AccessibleTable routines ------- */
|
||||
|
||||
// --------- AccessibleRelationSet methods
|
||||
|
||||
BOOL getAccessibleRelationSet(long vmID, JOBJECT64 accessibleContext,
|
||||
AccessibleRelationSetInfo *relationSetInfo) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleRelationSet(vmID, accessibleContext, relationSetInfo);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------- AccessibleHypertext methods
|
||||
|
||||
BOOL getAccessibleHypertext(long vmID, JOBJECT64 accessibleContext,
|
||||
AccessibleHypertextInfo *accessibleHypertextInfo) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleHypertext(vmID, accessibleContext,
|
||||
accessibleHypertextInfo);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL activateAccessibleHyperlink(long vmID, JOBJECT64 accessibleContext, JOBJECT64 accessibleHyperlink) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->activateAccessibleHyperlink(vmID, accessibleContext,
|
||||
accessibleHyperlink);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
jint getAccessibleHyperlinkCount(const long vmID,
|
||||
const AccessibleContext accessibleContext) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleHyperlinkCount(vmID, accessibleContext);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
BOOL getAccessibleHypertextExt(const long vmID,
|
||||
const AccessibleContext accessibleContext,
|
||||
const jint nStartIndex,
|
||||
/* OUT */ AccessibleHypertextInfo *hypertextInfo) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleHypertextExt(vmID,
|
||||
accessibleContext,
|
||||
nStartIndex,
|
||||
hypertextInfo);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
jint getAccessibleHypertextLinkIndex(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleHypertextLinkIndex(vmID,
|
||||
hypertext,
|
||||
nIndex);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
BOOL getAccessibleHyperlink(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex,
|
||||
/* OUT */ AccessibleHyperlinkInfo *hyperlinkInfo) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleHyperlink(vmID,
|
||||
hypertext,
|
||||
nIndex,
|
||||
hyperlinkInfo);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Accessible KeyBindings, Icons and Actions */
|
||||
BOOL getAccessibleKeyBindings(long vmID, JOBJECT64 accessibleContext, AccessibleKeyBindings *keyBindings) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleKeyBindings(vmID, accessibleContext, keyBindings);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleIcons(long vmID, JOBJECT64 accessibleContext, AccessibleIcons *icons) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleIcons(vmID, accessibleContext, icons);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleActions(long vmID, JOBJECT64 accessibleContext, AccessibleActions *actions) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleActions(vmID, accessibleContext, actions);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL doAccessibleActions(long vmID, JOBJECT64 accessibleContext, AccessibleActionsToDo *actionsToDo,
|
||||
jint *failure) {
|
||||
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->doAccessibleActions(vmID, accessibleContext, actionsToDo,
|
||||
failure);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional methods for Teton
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the AccessibleName for a component based upon the JAWS algorithm. Returns
|
||||
* whether successful.
|
||||
*
|
||||
* Bug ID 4916682 - Implement JAWS AccessibleName policy
|
||||
*/
|
||||
BOOL getVirtualAccessibleName(long vmID, AccessibleContext accessibleContext, wchar_t *name, int len) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getVirtualAccessibleName(vmID, accessibleContext, name, len);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request focus for a component. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944757 - requestFocus method needed
|
||||
*/
|
||||
BOOL requestFocus(long vmID, AccessibleContext accessibleContext) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->requestFocus(vmID, accessibleContext);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects text between two indices. Selection includes the text at the start index
|
||||
* and the text at the end index. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944758 - selectTextRange method needed
|
||||
*/
|
||||
BOOL selectTextRange(long vmID, AccessibleContext accessibleContext, int startIndex, int endIndex) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->selectTextRange(vmID, accessibleContext, startIndex, endIndex);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text attributes between two indices. The attribute list includes the text at the
|
||||
* start index and the text at the end index. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944761 - getTextAttributes between two indices method needed
|
||||
*/
|
||||
BOOL getTextAttributesInRange(long vmID, AccessibleContext accessibleContext, int startIndex, int endIndex,
|
||||
AccessibleTextAttributesInfo *attributes, short *len) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getTextAttributesInRange(vmID, accessibleContext,
|
||||
startIndex, endIndex, attributes, len);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of visible children of a component. Returns -1 on error.
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
int getVisibleChildrenCount(long vmID, AccessibleContext accessibleContext) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getVisibleChildrenCount(vmID, accessibleContext);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the visible children of an AccessibleContext. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
BOOL getVisibleChildren(long vmID, AccessibleContext accessibleContext, int startIndex,
|
||||
VisibleChildrenInfo *visibleChildrenInfo) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getVisibleChildren(vmID, accessibleContext, startIndex,
|
||||
visibleChildrenInfo);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the caret to a text position. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944770 - setCaretPosition method needed
|
||||
*/
|
||||
BOOL setCaretPosition(const long vmID, const AccessibleContext accessibleContext,
|
||||
const int position) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->setCaretPosition(vmID, accessibleContext, position);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// -------- Accessible Text methods -------------
|
||||
|
||||
BOOL getAccessibleTextInfo(long vmID, JOBJECT64 AccessibleContext,
|
||||
AccessibleTextInfo *textInfo, jint x, jint y) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTextInfo(
|
||||
vmID,
|
||||
AccessibleContext,
|
||||
textInfo, x, y);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleTextItems(long vmID, JOBJECT64 AccessibleContext,
|
||||
AccessibleTextItemsInfo *textItems, jint index) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTextItems(
|
||||
vmID,
|
||||
AccessibleContext,
|
||||
textItems, index);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleTextSelectionInfo(long vmID, JOBJECT64 AccessibleContext,
|
||||
AccessibleTextSelectionInfo *selectionInfo) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTextSelectionInfo(
|
||||
vmID,
|
||||
AccessibleContext,
|
||||
selectionInfo);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleTextAttributes(long vmID, JOBJECT64 AccessibleContext,
|
||||
jint index, AccessibleTextAttributesInfo *attributes) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTextAttributes(
|
||||
vmID,
|
||||
AccessibleContext,
|
||||
index, attributes);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleTextRect(long vmID, JOBJECT64 AccessibleContext,
|
||||
AccessibleTextRectInfo *rectInfo, jint index) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTextRect(
|
||||
vmID,
|
||||
AccessibleContext,
|
||||
rectInfo, index);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getCaretLocation(long vmID, JOBJECT64 AccessibleContext,
|
||||
AccessibleTextRectInfo *rectInfo, jint index) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getCaretLocation(vmID,
|
||||
AccessibleContext,
|
||||
rectInfo, index);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int getEventsWaiting() {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getEventsWaiting();
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleTextLineBounds(long vmID, JOBJECT64 AccessibleContext,
|
||||
jint index, jint *startIndex, jint *endIndex) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTextLineBounds(
|
||||
vmID,
|
||||
AccessibleContext,
|
||||
index, startIndex, endIndex);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getAccessibleTextRange(long vmID, JOBJECT64 AccessibleContext,
|
||||
jint start, jint end, wchar_t *text, short len) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleTextRange(
|
||||
vmID,
|
||||
AccessibleContext,
|
||||
start, end, text, len);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
// -------- Accessible Value methods -------------
|
||||
|
||||
BOOL getCurrentAccessibleValueFromContext(long vmID, JOBJECT64 AccessibleContext,
|
||||
wchar_t *value, short len) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getCurrentAccessibleValueFromContext(
|
||||
vmID, AccessibleContext, value, len);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getMaximumAccessibleValueFromContext(long vmID, JOBJECT64 AccessibleContext,
|
||||
wchar_t *value, short len) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getMaximumAccessibleValueFromContext(
|
||||
vmID, AccessibleContext, value, len);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getMinimumAccessibleValueFromContext(long vmID, JOBJECT64 AccessibleContext,
|
||||
wchar_t *value, short len) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getMinimumAccessibleValueFromContext(
|
||||
vmID, AccessibleContext, value, len);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// -------- Accessible Selection methods -------------
|
||||
|
||||
void addAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext, int i) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
theWindowsAccessBridge->addAccessibleSelectionFromContext(
|
||||
vmID, AccessibleContext, i);
|
||||
}
|
||||
}
|
||||
|
||||
void clearAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
theWindowsAccessBridge->clearAccessibleSelectionFromContext(
|
||||
vmID, AccessibleContext);
|
||||
}
|
||||
}
|
||||
|
||||
JOBJECT64 getAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext, int i) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleSelectionFromContext(
|
||||
vmID, AccessibleContext, i);
|
||||
}
|
||||
return (JOBJECT64) 0;
|
||||
}
|
||||
|
||||
int getAccessibleSelectionCountFromContext(long vmID, JOBJECT64 AccessibleContext) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->getAccessibleSelectionCountFromContext(
|
||||
vmID, AccessibleContext);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
BOOL isAccessibleChildSelectedFromContext(long vmID, JOBJECT64 AccessibleContext, int i) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
return theWindowsAccessBridge->isAccessibleChildSelectedFromContext(
|
||||
vmID, AccessibleContext, i);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void removeAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext, int i) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
theWindowsAccessBridge->removeAccessibleSelectionFromContext(
|
||||
vmID, AccessibleContext, i);
|
||||
}
|
||||
}
|
||||
|
||||
void selectAllAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
theWindowsAccessBridge->selectAllAccessibleSelectionFromContext(
|
||||
vmID, AccessibleContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -------- Event Handler methods -------------
|
||||
|
||||
#define SET_EVENT_FP(function, callbackFP) \
|
||||
void function(callbackFP fp) { \
|
||||
if (theWindowsAccessBridge != 0) { \
|
||||
theWindowsAccessBridge->function(fp); \
|
||||
} \
|
||||
}
|
||||
|
||||
void setJavaShutdownFP(AccessBridge_JavaShutdownFP fp) {
|
||||
if (theWindowsAccessBridge != 0) {
|
||||
theWindowsAccessBridge->setJavaShutdownFP(fp);
|
||||
}
|
||||
}
|
||||
|
||||
SET_EVENT_FP(setPropertyChangeFP, AccessBridge_PropertyChangeFP)
|
||||
SET_EVENT_FP(setFocusGainedFP, AccessBridge_FocusGainedFP)
|
||||
SET_EVENT_FP(setFocusLostFP, AccessBridge_FocusLostFP)
|
||||
SET_EVENT_FP(setCaretUpdateFP, AccessBridge_CaretUpdateFP)
|
||||
SET_EVENT_FP(setMouseClickedFP, AccessBridge_MouseClickedFP)
|
||||
SET_EVENT_FP(setMouseEnteredFP, AccessBridge_MouseEnteredFP)
|
||||
SET_EVENT_FP(setMouseExitedFP, AccessBridge_MouseExitedFP)
|
||||
SET_EVENT_FP(setMousePressedFP, AccessBridge_MousePressedFP)
|
||||
SET_EVENT_FP(setMouseReleasedFP, AccessBridge_MouseReleasedFP)
|
||||
SET_EVENT_FP(setMenuCanceledFP, AccessBridge_MenuCanceledFP)
|
||||
SET_EVENT_FP(setMenuDeselectedFP, AccessBridge_MenuDeselectedFP)
|
||||
SET_EVENT_FP(setMenuSelectedFP, AccessBridge_MenuSelectedFP)
|
||||
SET_EVENT_FP(setPopupMenuCanceledFP, AccessBridge_PopupMenuCanceledFP)
|
||||
SET_EVENT_FP(setPopupMenuWillBecomeInvisibleFP, AccessBridge_PopupMenuWillBecomeInvisibleFP)
|
||||
SET_EVENT_FP(setPopupMenuWillBecomeVisibleFP, AccessBridge_PopupMenuWillBecomeVisibleFP)
|
||||
|
||||
SET_EVENT_FP(setPropertyNameChangeFP, AccessBridge_PropertyNameChangeFP)
|
||||
SET_EVENT_FP(setPropertyDescriptionChangeFP, AccessBridge_PropertyDescriptionChangeFP)
|
||||
SET_EVENT_FP(setPropertyStateChangeFP, AccessBridge_PropertyStateChangeFP)
|
||||
SET_EVENT_FP(setPropertyValueChangeFP, AccessBridge_PropertyValueChangeFP)
|
||||
SET_EVENT_FP(setPropertySelectionChangeFP, AccessBridge_PropertySelectionChangeFP)
|
||||
SET_EVENT_FP(setPropertyTextChangeFP, AccessBridge_PropertyTextChangeFP)
|
||||
SET_EVENT_FP(setPropertyCaretChangeFP, AccessBridge_PropertyCaretChangeFP)
|
||||
SET_EVENT_FP(setPropertyVisibleDataChangeFP, AccessBridge_PropertyVisibleDataChangeFP)
|
||||
SET_EVENT_FP(setPropertyChildChangeFP, AccessBridge_PropertyChildChangeFP)
|
||||
SET_EVENT_FP(setPropertyActiveDescendentChangeFP, AccessBridge_PropertyActiveDescendentChangeFP)
|
||||
|
||||
SET_EVENT_FP(setPropertyTableModelChangeFP, AccessBridge_PropertyTableModelChangeFP)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -0,0 +1,300 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Glue routines called by Windows AT into the WindowsAccessBridge dll
|
||||
*/
|
||||
|
||||
#ifndef __AccessBridgeWindowsEntryPoints_H__
|
||||
#define __AccessBridgeWindowsEntryPoints_H__
|
||||
|
||||
#include <windows.h>
|
||||
#include <jni.h>
|
||||
|
||||
#include "AccessBridgePackages.h"
|
||||
#include "AccessBridgeCallbacks.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void Windows_run();
|
||||
|
||||
void releaseJavaObject(long vmID, JOBJECT64 object);
|
||||
void getVersionInfo(long vmID, AccessBridgeVersionInfo *info);
|
||||
|
||||
// Window related functions
|
||||
HWND getTopLevelHWND(HWND descendent);
|
||||
BOOL isJavaWindow(HWND window);
|
||||
BOOL getAccessibleContextFromHWND(HWND window, long *vmID, JOBJECT64 *AccessibleContext);
|
||||
HWND getHWNDFromAccessibleContext(long vmID, JOBJECT64 accessibleContext);
|
||||
|
||||
// returns whether two objects are the same
|
||||
BOOL isSameObject(long vmID, JOBJECT64 obj1, JOBJECT64 obj2);
|
||||
|
||||
// Accessible Context functions
|
||||
BOOL getAccessibleContextAt(long vmID, JOBJECT64 AccessibleContextParent,
|
||||
jint x, jint y, JOBJECT64 *AccessibleContext);
|
||||
BOOL getAccessibleContextWithFocus(HWND window, long *vmID, JOBJECT64 *AccessibleContext);
|
||||
BOOL getAccessibleContextInfo(long vmID, JOBJECT64 AccessibleContext, AccessibleContextInfo *info);
|
||||
JOBJECT64 getAccessibleChildFromContext(long vmID, JOBJECT64 AccessibleContext, jint childIndex);
|
||||
JOBJECT64 getAccessibleParentFromContext(long vmID, JOBJECT64 AccessibleContext);
|
||||
|
||||
/* begin AccessibleTable */
|
||||
BOOL getAccessibleTableInfo(long vmID, JOBJECT64 acParent, AccessibleTableInfo *tableInfo);
|
||||
BOOL getAccessibleTableCellInfo(long vmID, JOBJECT64 accessibleTable, jint row, jint column,
|
||||
AccessibleTableCellInfo *tableCellInfo);
|
||||
|
||||
BOOL getAccessibleTableRowHeader(long vmID, JOBJECT64 acParent, AccessibleTableInfo *tableInfo);
|
||||
BOOL getAccessibleTableColumnHeader(long vmID, JOBJECT64 acParent, AccessibleTableInfo *tableInfo);
|
||||
|
||||
JOBJECT64 getAccessibleTableRowDescription(long vmID, JOBJECT64 acParent, jint row);
|
||||
JOBJECT64 getAccessibleTableColumnDescription(long vmID, JOBJECT64 acParent, jint column);
|
||||
|
||||
jint getAccessibleTableRowSelectionCount(long vmID, JOBJECT64 accessibleTable);
|
||||
BOOL isAccessibleTableRowSelected(long vmID, JOBJECT64 accessibleTable, jint row);
|
||||
BOOL getAccessibleTableRowSelections(long vmID, JOBJECT64 accessibleTable, jint count,
|
||||
jint *selections);
|
||||
|
||||
jint getAccessibleTableColumnSelectionCount(long vmID, JOBJECT64 accessibleTable);
|
||||
BOOL isAccessibleTableColumnSelected(long vmID, JOBJECT64 accessibleTable, jint column);
|
||||
BOOL getAccessibleTableColumnSelections(long vmID, JOBJECT64 accessibleTable, jint count,
|
||||
jint *selections);
|
||||
|
||||
jint getAccessibleTableRow(long vmID, JOBJECT64 accessibleTable, jint index);
|
||||
jint getAccessibleTableColumn(long vmID, JOBJECT64 accessibleTable, jint index);
|
||||
jint getAccessibleTableIndex(long vmID, JOBJECT64 accessibleTable, jint row, jint column);
|
||||
|
||||
/* end AccessibleTable */
|
||||
|
||||
BOOL getAccessibleRelationSet(long vmID, JOBJECT64 accessibleContext,
|
||||
AccessibleRelationSetInfo *relationSetInfo);
|
||||
|
||||
// AccessibleHypertext methods
|
||||
BOOL getAccessibleHypertext(long vmID, JOBJECT64 accessibleContext, AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
BOOL activateAccessibleHyperlink(long vmID, JOBJECT64 accessibleContext, JOBJECT64 accessibleHyperlink);
|
||||
|
||||
jint getAccessibleHyperlinkCount(const long vmID,
|
||||
const AccessibleContext accessibleContext);
|
||||
|
||||
BOOL getAccessibleHypertextExt(const long vmID,
|
||||
const AccessibleContext accessibleContext,
|
||||
const jint nStartIndex,
|
||||
/* OUT */ AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
jint getAccessibleHypertextLinkIndex(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex);
|
||||
|
||||
BOOL getAccessibleHyperlink(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex,
|
||||
/* OUT */ AccessibleHyperlinkInfo *hyperlinkInfo);
|
||||
|
||||
|
||||
/* Accessible KeyBindings, Icons and Actions */
|
||||
BOOL getAccessibleKeyBindings(long vmID, JOBJECT64 accessibleContext,
|
||||
AccessibleKeyBindings *keyBindings);
|
||||
|
||||
BOOL getAccessibleIcons(long vmID, JOBJECT64 accessibleContext,
|
||||
AccessibleIcons *icons);
|
||||
|
||||
BOOL getAccessibleActions(long vmID, JOBJECT64 accessibleContext,
|
||||
AccessibleActions *actions);
|
||||
|
||||
BOOL doAccessibleActions(long vmID, JOBJECT64 accessibleContext,
|
||||
AccessibleActionsToDo *actionsToDo, jint *failure);
|
||||
|
||||
/* ----- Additional AccessibleHypertext methods for Teton */
|
||||
|
||||
|
||||
jint getAccessibleHypertextLinkCount(const long vmID,
|
||||
const AccessibleContext accessibleContext);
|
||||
|
||||
BOOL getAccessibleHypertextExt(const long vmID,
|
||||
const AccessibleContext accessibleContext,
|
||||
const jint nStartIndex,
|
||||
/* OUT */ AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
jint getAccessibleHypertextLinkIndex(const long vmID,
|
||||
const AccessibleContext accessibleContext,
|
||||
const jint nIndex);
|
||||
|
||||
BOOL getAccessibleHyperlink(const long vmID,
|
||||
const AccessibleContext accessibleContext,
|
||||
const jint nIndex,
|
||||
/* OUT */ AccessibleHyperlinkInfo *hyperlinkInfo);
|
||||
|
||||
|
||||
/* Additional utility methods */
|
||||
BOOL setTextContents (const long vmID, const AccessibleContext accessibleContext, const wchar_t *text);
|
||||
|
||||
AccessibleContext getParentWithRole (const long vmID, const AccessibleContext accessibleContext, const wchar_t *role);
|
||||
|
||||
AccessibleContext getTopLevelObject (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
AccessibleContext getParentWithRoleElseRoot (const long vmID, const AccessibleContext accessibleContext, const wchar_t *role);
|
||||
|
||||
int getObjectDepth (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
AccessibleContext getActiveDescendent (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Additional methods for Teton
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the AccessibleName for a component based upon the JAWS algorithm. Returns
|
||||
* whether successful.
|
||||
*
|
||||
* Bug ID 4916682 - Implement JAWS AccessibleName policy
|
||||
*/
|
||||
BOOL getVirtualAccessibleName(long vmID, AccessibleContext accessibleContext, wchar_t *name, int len);
|
||||
|
||||
/**
|
||||
* Request focus for a component. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944757 - requestFocus method needed
|
||||
*/
|
||||
BOOL requestFocus(long vmID, AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Selects text between two indices. Selection includes the text at the start index
|
||||
* and the text at the end index. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944758 - selectTextRange method needed
|
||||
*/
|
||||
BOOL selectTextRange(long vmID, AccessibleContext accessibleContext, int startIndex, int endIndex);
|
||||
|
||||
/**
|
||||
* Get text attributes between two indices. The attribute list includes the text at the
|
||||
* start index and the text at the end index. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944761 - getTextAttributes between two indices method needed
|
||||
*/
|
||||
BOOL getTextAttributesInRange(long vmID, AccessibleContext accessibleContext, int startIndex, int endIndex,
|
||||
AccessibleTextAttributesInfo *attributes, short *len);
|
||||
|
||||
/**
|
||||
* Returns the number of visible children of a component. Returns -1 on error.
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
int getVisibleChildrenCount(long vmID, AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Gets the visible children of an AccessibleContext. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
BOOL getVisibleChildren(long vmID, AccessibleContext accessibleContext, int startIndex,
|
||||
VisibleChildrenInfo *visibleChildrenInfo);
|
||||
|
||||
/**
|
||||
* Set the caret to a text position. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944770 - setCaretPosition method needed
|
||||
*/
|
||||
BOOL setCaretPosition(long vmID, AccessibleContext accessibleContext, int position);
|
||||
|
||||
/**
|
||||
* Gets the text caret bounding rectangle
|
||||
*/
|
||||
BOOL getCaretLocation(long vmID, JOBJECT64 AccessibleContext, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
|
||||
// Accessible Text functions
|
||||
BOOL getAccessibleTextInfo(long vmID, JOBJECT64 AccessibleContext, AccessibleTextInfo *textInfo, jint x, jint y);
|
||||
BOOL getAccessibleTextItems(long vmID, JOBJECT64 AccessibleContext, AccessibleTextItemsInfo *textItems, jint index);
|
||||
BOOL getAccessibleTextSelectionInfo(long vmID, JOBJECT64 AccessibleContext, AccessibleTextSelectionInfo *selectionInfo);
|
||||
BOOL getAccessibleTextAttributes(long vmID, JOBJECT64 AccessibleContext, jint index, AccessibleTextAttributesInfo *attributes);
|
||||
BOOL getAccessibleTextRect(long vmID, JOBJECT64 AccessibleContext, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
BOOL getAccessibleTextLineBounds(long vmID, JOBJECT64 AccessibleContext, jint index, jint *startIndex, jint *endIndex);
|
||||
BOOL getAccessibleTextRange(long vmID, JOBJECT64 AccessibleContext, jint start, jint end, wchar_t *text, short len);
|
||||
|
||||
// Accessible Value methods
|
||||
BOOL getCurrentAccessibleValueFromContext(long vmID,JOBJECT64 AccessibleContext, wchar_t *value, short len);
|
||||
BOOL getMaximumAccessibleValueFromContext(long vmID,JOBJECT64 AccessibleContext, wchar_t *value, short len);
|
||||
BOOL getMinimumAccessibleValueFromContext(long vmID,JOBJECT64 AccessibleContext, wchar_t *value, short len);
|
||||
|
||||
// Accessible Selection methods
|
||||
void addAccessibleSelectionFromContext(long vmID,JOBJECT64 AccessibleContext, int i);
|
||||
void clearAccessibleSelectionFromContext(long vmID,JOBJECT64 AccessibleContext);
|
||||
JOBJECT64 getAccessibleSelectionFromContext(long vmID,JOBJECT64 AccessibleContext, int i);
|
||||
int getAccessibleSelectionCountFromContext(long vmID,JOBJECT64 AccessibleContext);
|
||||
BOOL isAccessibleChildSelectedFromContext(long vmID,JOBJECT64 AccessibleContext, int i);
|
||||
void removeAccessibleSelectionFromContext(long vmID,JOBJECT64 AccessibleContext, int i);
|
||||
void selectAllAccessibleSelectionFromContext(long vmID,JOBJECT64 AccessibleContext);
|
||||
|
||||
|
||||
// PropertyChange Event registry routines
|
||||
void setPropertyChangeFP(AccessBridge_PropertyChangeFP fp);
|
||||
|
||||
// Java application shutdown
|
||||
void setJavaShutdownFP(AccessBridge_JavaShutdownFP fp);
|
||||
|
||||
// Focus Event registry routines
|
||||
void setFocusGainedFP(AccessBridge_FocusGainedFP fp);
|
||||
void setFocusLostFP(AccessBridge_FocusLostFP fp);
|
||||
|
||||
// Caret Event registry routines
|
||||
void setCaretUpdateFP(AccessBridge_CaretUpdateFP fp);
|
||||
|
||||
// Mouse Event registry routines
|
||||
void setMouseClickedFP(AccessBridge_MouseClickedFP fp);
|
||||
void setMouseEnteredFP(AccessBridge_MouseEnteredFP fp);
|
||||
void setMouseExitedFP(AccessBridge_MouseExitedFP fp);
|
||||
void setMousePressedFP(AccessBridge_MousePressedFP fp);
|
||||
void setMouseReleasedFP(AccessBridge_MouseReleasedFP fp);
|
||||
|
||||
// Menu/PopupMenu Event registry routines
|
||||
void setMenuCanceledFP(AccessBridge_MenuCanceledFP fp);
|
||||
void setMenuDeselectedFP(AccessBridge_MenuDeselectedFP fp);
|
||||
void setMenuSelectedFP(AccessBridge_MenuSelectedFP fp);
|
||||
void setPopupMenuCanceledFP(AccessBridge_PopupMenuCanceledFP fp);
|
||||
void setPopupMenuWillBecomeInvisibleFP(AccessBridge_PopupMenuWillBecomeInvisibleFP fp);
|
||||
void setPopupMenuWillBecomeVisibleFP(AccessBridge_PopupMenuWillBecomeVisibleFP fp);
|
||||
|
||||
// Accessibility PropertyChange Event registry routines
|
||||
void setPropertyNameChangeFP(AccessBridge_PropertyNameChangeFP fp);
|
||||
void setPropertyDescriptionChangeFP(AccessBridge_PropertyDescriptionChangeFP fp);
|
||||
void setPropertyStateChangeFP(AccessBridge_PropertyStateChangeFP fp);
|
||||
void setPropertyValueChangeFP(AccessBridge_PropertyValueChangeFP fp);
|
||||
void setPropertySelectionChangeFP(AccessBridge_PropertySelectionChangeFP fp);
|
||||
void setPropertyTextChangeFP(AccessBridge_PropertyTextChangeFP fp);
|
||||
void setPropertyCaretChangeFP(AccessBridge_PropertyCaretChangeFP fp);
|
||||
void setPropertyVisibleDataChangeFP(AccessBridge_PropertyVisibleDataChangeFP fp);
|
||||
void setPropertyChildChangeFP(AccessBridge_PropertyChildChangeFP fp);
|
||||
void setPropertyActiveDescendentChangeFP(AccessBridge_PropertyActiveDescendentChangeFP fp);
|
||||
|
||||
void setPropertyTableModelChangeFP(AccessBridge_PropertyTableModelChangeFP fp);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,154 @@
|
||||
;
|
||||
; Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
;
|
||||
; This code is free software; you can redistribute it and/or modify it
|
||||
; under the terms of the GNU General Public License version 2 only, as
|
||||
; published by the Free Software Foundation. Oracle designates this
|
||||
; particular file as subject to the "Classpath" exception as provided
|
||||
; by Oracle in the LICENSE file that accompanied this code.
|
||||
;
|
||||
; This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
; version 2 for more details (a copy is included in the LICENSE file that
|
||||
; accompanied this code).
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License version
|
||||
; 2 along with this work; if not, write to the Free Software Foundation,
|
||||
; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
;
|
||||
; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
; or visit www.oracle.com if you need additional information or have any
|
||||
; questions.
|
||||
;
|
||||
;
|
||||
;LIBRARY WINDOWSACCESSBRIDGE
|
||||
|
||||
;DESCRIPTION 'WINDOWSACCESSBRIDGE.DLL'
|
||||
HEAPSIZE 4096
|
||||
EXPORTS
|
||||
|
||||
addJavaEventNotification
|
||||
removeJavaEventNotification
|
||||
addAccessibilityEventNotification
|
||||
removeAccessibilityEventNotification
|
||||
|
||||
Windows_run
|
||||
|
||||
getAccessibleTableInfo
|
||||
getAccessibleTableCellInfo
|
||||
|
||||
getAccessibleTableRowHeader
|
||||
getAccessibleTableColumnHeader
|
||||
|
||||
getAccessibleTableRowDescription
|
||||
getAccessibleTableColumnDescription
|
||||
|
||||
isAccessibleTableRowSelected
|
||||
isAccessibleTableColumnSelected
|
||||
|
||||
getAccessibleTableColumnSelectionCount
|
||||
getAccessibleTableRowSelectionCount
|
||||
|
||||
getAccessibleTableColumnSelections
|
||||
getAccessibleTableRowSelections
|
||||
|
||||
getAccessibleTableRow
|
||||
getAccessibleTableColumn
|
||||
getAccessibleTableIndex
|
||||
|
||||
getAccessibleRelationSet
|
||||
|
||||
getAccessibleHypertext
|
||||
activateAccessibleHyperlink
|
||||
getAccessibleHyperlinkCount
|
||||
getAccessibleHypertextExt
|
||||
getAccessibleHypertextLinkIndex
|
||||
getAccessibleHyperlink
|
||||
|
||||
getAccessibleKeyBindings
|
||||
getAccessibleIcons
|
||||
getAccessibleActions
|
||||
doAccessibleActions
|
||||
|
||||
setTextContents
|
||||
getParentWithRole
|
||||
getParentWithRoleElseRoot
|
||||
getTopLevelObject
|
||||
getObjectDepth
|
||||
getActiveDescendent
|
||||
|
||||
getVirtualAccessibleName
|
||||
requestFocus
|
||||
selectTextRange
|
||||
getTextAttributesInRange
|
||||
getVisibleChildrenCount
|
||||
getVisibleChildren
|
||||
setCaretPosition
|
||||
getCaretLocation
|
||||
|
||||
getEventsWaiting
|
||||
|
||||
releaseJavaObject
|
||||
getVersionInfo
|
||||
|
||||
isJavaWindow
|
||||
isSameObject
|
||||
getAccessibleContextFromHWND
|
||||
getHWNDFromAccessibleContext
|
||||
|
||||
getAccessibleContextAt
|
||||
getAccessibleContextWithFocus
|
||||
getAccessibleContextInfo
|
||||
getAccessibleChildFromContext
|
||||
getAccessibleParentFromContext
|
||||
|
||||
getAccessibleTextInfo
|
||||
getAccessibleTextItems
|
||||
getAccessibleTextSelectionInfo
|
||||
getAccessibleTextAttributes
|
||||
getAccessibleTextRect
|
||||
getAccessibleTextLineBounds
|
||||
getAccessibleTextRange
|
||||
|
||||
getCurrentAccessibleValueFromContext
|
||||
getMaximumAccessibleValueFromContext
|
||||
getMinimumAccessibleValueFromContext
|
||||
|
||||
addAccessibleSelectionFromContext
|
||||
clearAccessibleSelectionFromContext
|
||||
getAccessibleSelectionFromContext
|
||||
getAccessibleSelectionCountFromContext
|
||||
isAccessibleChildSelectedFromContext
|
||||
removeAccessibleSelectionFromContext
|
||||
selectAllAccessibleSelectionFromContext
|
||||
|
||||
setPropertyChangeFP
|
||||
setJavaShutdownFP
|
||||
setFocusGainedFP
|
||||
setFocusLostFP
|
||||
setCaretUpdateFP
|
||||
setMouseClickedFP
|
||||
setMouseEnteredFP
|
||||
setMouseExitedFP
|
||||
setMousePressedFP
|
||||
setMouseReleasedFP
|
||||
setMenuCanceledFP
|
||||
setMenuDeselectedFP
|
||||
setMenuSelectedFP
|
||||
setPopupMenuCanceledFP
|
||||
setPopupMenuWillBecomeInvisibleFP
|
||||
setPopupMenuWillBecomeVisibleFP
|
||||
|
||||
setPropertyNameChangeFP
|
||||
setPropertyDescriptionChangeFP
|
||||
setPropertyStateChangeFP
|
||||
setPropertyValueChangeFP
|
||||
setPropertySelectionChangeFP
|
||||
setPropertyTextChangeFP
|
||||
setPropertyCaretChangeFP
|
||||
setPropertyVisibleDataChangeFP
|
||||
setPropertyChildChangeFP
|
||||
setPropertyActiveDescendentChangeFP
|
||||
setPropertyTableModelChangeFP
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,317 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A DLL which is loaded by Windows executables to handle communication
|
||||
* between Java VMs purposes of Accessbility.
|
||||
*/
|
||||
|
||||
#ifndef __WinAccessBridge_H__
|
||||
#define __WinAccessBridge_H__
|
||||
|
||||
#include <windows.h>
|
||||
#include "AccessBridgePackages.h"
|
||||
#include "AccessBridgeEventHandler.h"
|
||||
#include "AccessBridgeJavaVMInstance.h"
|
||||
#include "AccessBridgeMessageQueue.h"
|
||||
|
||||
|
||||
extern "C" {
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD fdwReason,
|
||||
LPVOID lpvReserved);
|
||||
void AppendToCallOutput(char *s);
|
||||
BOOL CALLBACK AccessBridgeDialogProc(HWND hDlg, UINT message,
|
||||
UINT wParam, LONG lParam);
|
||||
HWND getTopLevelHWND(HWND descendent);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WinAccessBridgeWindowProc(HWND hWnd, UINT message,
|
||||
UINT wParam, LONG lParam);
|
||||
|
||||
BOOL CALLBACK DeleteItemProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/**
|
||||
* The WinAccessBridge class. The core of the Windows AT AccessBridge dll
|
||||
*/
|
||||
class WinAccessBridge {
|
||||
HINSTANCE windowsInstance;
|
||||
HWND dialogWindow;
|
||||
AccessBridgeJavaVMInstance *javaVMs;
|
||||
AccessBridgeEventHandler *eventHandler;
|
||||
AccessBridgeMessageQueue *messageQueue;
|
||||
|
||||
public:
|
||||
WinAccessBridge(HINSTANCE hInstance);
|
||||
~WinAccessBridge();
|
||||
BOOL initWindow();
|
||||
|
||||
HWND showWinAccessBridgeGUI(int showCommand);
|
||||
|
||||
// IPC with the Java AccessBridge DLL
|
||||
LRESULT rendezvousWithNewJavaDLL(HWND JavaBridgeDLLwindow, long vmID);
|
||||
|
||||
void sendPackage(char *buffer, long bufsize, HWND destWindow);
|
||||
BOOL sendMemoryPackage(char *buffer, long bufsize, HWND destWindow);
|
||||
BOOL queuePackage(char *buffer, long bufsize);
|
||||
BOOL receiveAQueuedPackage();
|
||||
void preProcessPackage(char *buffer, long bufsize);
|
||||
void processPackage(char *buffer, long bufsize);
|
||||
void JavaVMDestroyed(HWND VMBridgeDLLWindow);
|
||||
|
||||
// Java VM object memory management
|
||||
void releaseJavaObject(long vmID, JOBJECT64 object);
|
||||
|
||||
// Version info
|
||||
BOOL getVersionInfo(long vmID, AccessBridgeVersionInfo *info);
|
||||
|
||||
// HWND management methods
|
||||
HWND getNextJavaWindow(HWND previous);
|
||||
BOOL isJavaWindow(HWND window);
|
||||
BOOL getAccessibleContextFromHWND(HWND window, long *vmID, JOBJECT64 *AccessibleContext);
|
||||
HWND getHWNDFromAccessibleContext(long vmID, JOBJECT64 accessibleContext);
|
||||
|
||||
/* Additional utility methods */
|
||||
BOOL isSameObject(long vmID, JOBJECT64 obj1, JOBJECT64 obj2);
|
||||
|
||||
BOOL setTextContents (const long vmID, const AccessibleContext accessibleContext, const wchar_t *text);
|
||||
|
||||
AccessibleContext getParentWithRole (const long vmID, const AccessibleContext accessibleContext,
|
||||
const wchar_t *role);
|
||||
|
||||
AccessibleContext getTopLevelObject (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
AccessibleContext getParentWithRoleElseRoot (const long vmID, const AccessibleContext accessibleContext,
|
||||
const wchar_t *role);
|
||||
|
||||
int getObjectDepth (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
AccessibleContext getActiveDescendent (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
|
||||
// Accessible Context methods
|
||||
BOOL getAccessibleContextAt(long vmID, JOBJECT64 AccessibleContextParent,
|
||||
jint x, jint y, JOBJECT64 *AccessibleContext);
|
||||
BOOL getAccessibleContextWithFocus(HWND window, long *vmID, JOBJECT64 *AccessibleContext);
|
||||
BOOL getAccessibleContextInfo(long vmID, JOBJECT64 AccessibleContext, AccessibleContextInfo *info);
|
||||
JOBJECT64 getAccessibleChildFromContext(long vmID, JOBJECT64 AccessibleContext, jint childIndex);
|
||||
JOBJECT64 getAccessibleParentFromContext(long vmID, JOBJECT64 AccessibleContext);
|
||||
|
||||
/* begin AccessibleTable methods */
|
||||
BOOL getAccessibleTableInfo(long vmID, JOBJECT64 acParent, AccessibleTableInfo *tableInfo);
|
||||
BOOL getAccessibleTableCellInfo(long vmID, JOBJECT64 accessibleTable, jint row, jint column,
|
||||
AccessibleTableCellInfo *tableCellInfo);
|
||||
|
||||
BOOL getAccessibleTableRowHeader(long vmID, JOBJECT64 acParent, AccessibleTableInfo *tableInfo);
|
||||
BOOL getAccessibleTableColumnHeader(long vmID, JOBJECT64 acParent, AccessibleTableInfo *tableInfo);
|
||||
|
||||
JOBJECT64 getAccessibleTableRowDescription(long vmID, JOBJECT64 acParent, jint row);
|
||||
JOBJECT64 getAccessibleTableColumnDescription(long vmID, JOBJECT64 acParent, jint column);
|
||||
|
||||
jint getAccessibleTableRowSelectionCount(long vmID, JOBJECT64 accessibleTable);
|
||||
BOOL isAccessibleTableRowSelected(long vmID, JOBJECT64 accessibleTable, jint row);
|
||||
BOOL getAccessibleTableRowSelections(long vmID, JOBJECT64 accessibleTable, jint count,
|
||||
jint *selections);
|
||||
|
||||
jint getAccessibleTableColumnSelectionCount(long vmID, JOBJECT64 accessibleTable);
|
||||
BOOL isAccessibleTableColumnSelected(long vmID, JOBJECT64 accessibleTable, jint column);
|
||||
BOOL getAccessibleTableColumnSelections(long vmID, JOBJECT64 accessibleTable, jint count,
|
||||
jint *selections);
|
||||
|
||||
jint getAccessibleTableRow(long vmID, JOBJECT64 accessibleTable, jint index);
|
||||
jint getAccessibleTableColumn(long vmID, JOBJECT64 accessibleTable, jint index);
|
||||
jint getAccessibleTableIndex(long vmID, JOBJECT64 accessibleTable, jint row, jint column);
|
||||
|
||||
/* end AccessibleTable methods */
|
||||
|
||||
// --------- AccessibleRelationSet methods
|
||||
BOOL getAccessibleRelationSet(long vmID, JOBJECT64 accessibleContext, AccessibleRelationSetInfo *relationSet);
|
||||
|
||||
// --------- AccessibleHypertext methods
|
||||
BOOL getAccessibleHypertext(long vmID, JOBJECT64 accessibleContext, AccessibleHypertextInfo *hypertextInfo);
|
||||
BOOL activateAccessibleHyperlink(long vmID, JOBJECT64 accessibleContext, JOBJECT64 accessibleHyperlink);
|
||||
|
||||
jint getAccessibleHyperlinkCount(const long vmID,
|
||||
const AccessibleContext accessibleContext);
|
||||
|
||||
BOOL getAccessibleHypertextExt(const long vmID,
|
||||
const AccessibleContext accessibleContext,
|
||||
const jint nStartIndex,
|
||||
/* OUT */ AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
jint getAccessibleHypertextLinkIndex(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex);
|
||||
|
||||
BOOL getAccessibleHyperlink(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex,
|
||||
/* OUT */ AccessibleHyperlinkInfo *hyperlinkInfo);
|
||||
|
||||
|
||||
/* Accessible KeyBindings, Icons and Actions */
|
||||
BOOL getAccessibleKeyBindings(long vmID, JOBJECT64 accessibleContext,
|
||||
AccessibleKeyBindings *keyBindings);
|
||||
|
||||
BOOL getAccessibleIcons(long vmID, JOBJECT64 accessibleContext,
|
||||
AccessibleIcons *icons);
|
||||
|
||||
BOOL getAccessibleActions(long vmID, JOBJECT64 accessibleContext,
|
||||
AccessibleActions *actions);
|
||||
|
||||
BOOL doAccessibleActions(long vmID, JOBJECT64 accessibleContext,
|
||||
AccessibleActionsToDo *actionsToDo, jint *failure);
|
||||
|
||||
|
||||
// Accessible Text methods
|
||||
BOOL getAccessibleTextInfo(long vmID, JOBJECT64 AccessibleContext, AccessibleTextInfo *textInfo, jint x, jint y);
|
||||
BOOL getAccessibleTextItems(long vmID, JOBJECT64 AccessibleContext, AccessibleTextItemsInfo *textItems, jint index);
|
||||
BOOL getAccessibleTextSelectionInfo(long vmID, JOBJECT64 AccessibleContext, AccessibleTextSelectionInfo *selectionInfo);
|
||||
BOOL getAccessibleTextAttributes(long vmID, JOBJECT64 AccessibleContext, jint index, AccessibleTextAttributesInfo *attributes);
|
||||
BOOL getAccessibleTextRect(long vmID, JOBJECT64 AccessibleContext, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
BOOL getAccessibleTextLineBounds(long vmID, JOBJECT64 AccessibleContext, jint index, jint *startIndex, jint *endIndex);
|
||||
BOOL getAccessibleTextRange(long vmID, JOBJECT64 AccessibleContext, jint start, jint end, wchar_t *text, short len);
|
||||
|
||||
// Accessible Value methods
|
||||
BOOL getCurrentAccessibleValueFromContext(long vmID, JOBJECT64 AccessibleContext, wchar_t *value, short len);
|
||||
BOOL getMaximumAccessibleValueFromContext(long vmID, JOBJECT64 AccessibleContext, wchar_t *value, short len);
|
||||
BOOL getMinimumAccessibleValueFromContext(long vmID, JOBJECT64 AccessibleContext, wchar_t *value, short len);
|
||||
|
||||
// Accessible Selection methods
|
||||
void addAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext, int i);
|
||||
void clearAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext);
|
||||
JOBJECT64 getAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext, int i);
|
||||
int getAccessibleSelectionCountFromContext(long vmID, JOBJECT64 AccessibleContext);
|
||||
BOOL isAccessibleChildSelectedFromContext(long vmID, JOBJECT64 AccessibleContext, int i);
|
||||
void removeAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext, int i);
|
||||
void selectAllAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext);
|
||||
|
||||
// Event handling methods
|
||||
void addJavaEventNotification(jlong type);
|
||||
void removeJavaEventNotification(jlong type);
|
||||
void addAccessibilityEventNotification(jlong type);
|
||||
void removeAccessibilityEventNotification(jlong type);
|
||||
|
||||
void setPropertyChangeFP(AccessBridge_PropertyChangeFP fp);
|
||||
void setJavaShutdownFP(AccessBridge_JavaShutdownFP fp);
|
||||
void setFocusGainedFP(AccessBridge_FocusGainedFP fp);
|
||||
void setFocusLostFP(AccessBridge_FocusLostFP fp);
|
||||
void setCaretUpdateFP(AccessBridge_CaretUpdateFP fp);
|
||||
void setMouseClickedFP(AccessBridge_MouseClickedFP fp);
|
||||
void setMouseEnteredFP(AccessBridge_MouseEnteredFP fp);
|
||||
void setMouseExitedFP(AccessBridge_MouseExitedFP fp);
|
||||
void setMousePressedFP(AccessBridge_MousePressedFP fp);
|
||||
void setMouseReleasedFP(AccessBridge_MouseReleasedFP fp);
|
||||
void setMenuCanceledFP(AccessBridge_MenuCanceledFP fp);
|
||||
void setMenuDeselectedFP(AccessBridge_MenuDeselectedFP fp);
|
||||
void setMenuSelectedFP(AccessBridge_MenuSelectedFP fp);
|
||||
void setPopupMenuCanceledFP(AccessBridge_PopupMenuCanceledFP fp);
|
||||
void setPopupMenuWillBecomeInvisibleFP(AccessBridge_PopupMenuWillBecomeInvisibleFP fp);
|
||||
void setPopupMenuWillBecomeVisibleFP(AccessBridge_PopupMenuWillBecomeVisibleFP fp);
|
||||
|
||||
void setPropertyNameChangeFP(AccessBridge_PropertyNameChangeFP fp);
|
||||
void setPropertyDescriptionChangeFP(AccessBridge_PropertyDescriptionChangeFP fp);
|
||||
void setPropertyStateChangeFP(AccessBridge_PropertyStateChangeFP fp);
|
||||
void setPropertyValueChangeFP(AccessBridge_PropertyValueChangeFP fp);
|
||||
void setPropertySelectionChangeFP(AccessBridge_PropertySelectionChangeFP fp);
|
||||
void setPropertyTextChangeFP(AccessBridge_PropertyTextChangeFP fp);
|
||||
void setPropertyCaretChangeFP(AccessBridge_PropertyCaretChangeFP fp);
|
||||
void setPropertyVisibleDataChangeFP(AccessBridge_PropertyVisibleDataChangeFP fp);
|
||||
void setPropertyChildChangeFP(AccessBridge_PropertyChildChangeFP fp);
|
||||
void setPropertyActiveDescendentChangeFP(AccessBridge_PropertyActiveDescendentChangeFP fp);
|
||||
|
||||
void setPropertyTableModelChangeFP(AccessBridge_PropertyTableModelChangeFP fp);
|
||||
|
||||
/**
|
||||
* Additional methods for Teton
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the AccessibleName for a component based upon the JAWS algorithm. Returns
|
||||
* whether successful.
|
||||
*
|
||||
* Bug ID 4916682 - Implement JAWS AccessibleName policy
|
||||
*/
|
||||
BOOL getVirtualAccessibleName(long vmID, AccessibleContext accessibleContext, wchar_t *name, int len);
|
||||
|
||||
/**
|
||||
* Request focus for a component. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944757 - requestFocus method needed
|
||||
*/
|
||||
BOOL requestFocus(long vmID, AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Selects text between two indices. Selection includes the text at the start index
|
||||
* and the text at the end index. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944758 - selectTextRange method needed
|
||||
*/
|
||||
BOOL selectTextRange(long vmID, AccessibleContext accessibleContext, int startIndex, int endIndex);
|
||||
|
||||
/**
|
||||
* Get text attributes between two indices. The attribute list includes the text at the
|
||||
* start index and the text at the end index. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944761 - getTextAttributes between two indices method needed
|
||||
*/
|
||||
BOOL getTextAttributesInRange(long vmID, AccessibleContext accessibleContext, int startIndex, int endIndex,
|
||||
AccessibleTextAttributesInfo *attributes, short *len);
|
||||
|
||||
/**
|
||||
* Gets number of visible children of a component. Returns -1 on error.
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
int getVisibleChildrenCount(long vmID, AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Gets the visible children of an AccessibleContext. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
BOOL getVisibleChildren(long vmID, AccessibleContext accessibleContext, int startIndex,
|
||||
VisibleChildrenInfo *visibleChildrenInfo);
|
||||
|
||||
/**
|
||||
* Set the caret to a text position. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944770 - setCaretPosition method needed
|
||||
*/
|
||||
BOOL setCaretPosition(long vmID, AccessibleContext accessibleContext, int position);
|
||||
|
||||
|
||||
/**
|
||||
* Gets the text caret bounding rectangle
|
||||
*/
|
||||
BOOL getCaretLocation(long vmID, JOBJECT64 AccessibleContext, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
|
||||
/**
|
||||
* Gets number of events waiting in the message queue
|
||||
*/
|
||||
int getEventsWaiting();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user