AccessBridgeEventHandler.cpp revision 11740:8c996a225c1b
1143535Spjd/* 2133978Spjd * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. 3133978Spjd * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4133978Spjd * 5133978Spjd * This code is free software; you can redistribute it and/or modify it 6133978Spjd * under the terms of the GNU General Public License version 2 only, as 7133978Spjd * published by the Free Software Foundation. Oracle designates this 8133978Spjd * particular file as subject to the "Classpath" exception as provided 9133978Spjd * by Oracle in the LICENSE file that accompanied this code. 10133978Spjd * 11133978Spjd * This code is distributed in the hope that it will be useful, but WITHOUT 12133978Spjd * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13133978Spjd * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14133978Spjd * version 2 for more details (a copy is included in the LICENSE file that 15133978Spjd * accompanied this code). 16133978Spjd * 17133978Spjd * You should have received a copy of the GNU General Public License version 18133978Spjd * 2 along with this work; if not, write to the Free Software Foundation, 19133978Spjd * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20133978Spjd * 21133978Spjd * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22133978Spjd * or visit www.oracle.com if you need additional information or have any 23133978Spjd * questions. 24133978Spjd */ 25133978Spjd 26133978Spjd/* 27245456Smav * A class to manage firing Accessibility events to Windows AT 28133978Spjd */ 29133978Spjd 30133978Spjd#include "AccessBridgeDebug.h" 31133978Spjd#include "AccessBridgeEventHandler.h" 32133978Spjd#include "AccessBridgePackages.h" 33133978Spjd#include "WinAccessBridge.h" 34133978Spjd 35133978SpjdDEBUG_CODE(extern HWND theDialogWindow); 36163888Spjdextern "C" { 37201578SmavDEBUG_CODE(void AppendToCallInfo(char *s)); 38133978Spjd} 39140298Spjd 40133978Spjd 41133978Spjd// ----------------------------- 42133978Spjd 43140298Spjd/** 44133978Spjd * Initialization. Set all callbacks to null 45133978Spjd */ 46163888SpjdAccessBridgeEventHandler::AccessBridgeEventHandler() { 47133978Spjd javaEventMask = 0; 48133978Spjd accessibilityEventMask = 0; 49133978Spjd 50133978Spjd propertyChangeFP = (AccessBridge_PropertyChangeFP) NULL; 51133978Spjd javaShutdownFP = (AccessBridge_JavaShutdownFP) NULL; 52133978Spjd focusGainedFP = (AccessBridge_FocusGainedFP) NULL; 53133978Spjd focusLostFP = (AccessBridge_FocusLostFP) NULL; 54133978Spjd caretUpdateFP = (AccessBridge_CaretUpdateFP) NULL; 55133978Spjd mouseClickedFP = (AccessBridge_MouseClickedFP) NULL; 56245456Smav mouseEnteredFP = (AccessBridge_MouseEnteredFP) NULL; 57133978Spjd mouseExitedFP = (AccessBridge_MouseExitedFP) NULL; 58133978Spjd mousePressedFP = (AccessBridge_MousePressedFP) NULL; 59133978Spjd mouseReleasedFP = (AccessBridge_MouseReleasedFP) NULL; 60133978Spjd menuCanceledFP = (AccessBridge_MenuCanceledFP) NULL; 61133978Spjd menuDeselectedFP = (AccessBridge_MenuDeselectedFP) NULL; 62133978Spjd menuSelectedFP = (AccessBridge_MenuSelectedFP) NULL; 63133978Spjd popupMenuCanceledFP = (AccessBridge_PopupMenuCanceledFP) NULL; 64133978Spjd popupMenuWillBecomeInvisibleFP = (AccessBridge_PopupMenuWillBecomeInvisibleFP) NULL; 65133978Spjd popupMenuWillBecomeVisibleFP = (AccessBridge_PopupMenuWillBecomeVisibleFP) NULL; 66133978Spjd 67140298Spjd propertyNameChangeFP = (AccessBridge_PropertyNameChangeFP) NULL; 68133978Spjd propertyDescriptionChangeFP = (AccessBridge_PropertyDescriptionChangeFP) NULL; 69133978Spjd propertyStateChangeFP = (AccessBridge_PropertyStateChangeFP) NULL; 70133978Spjd propertyValueChangeFP = (AccessBridge_PropertyValueChangeFP) NULL; 71143535Spjd propertySelectionChangeFP = (AccessBridge_PropertySelectionChangeFP) NULL; 72143535Spjd propertyTextChangeFP = (AccessBridge_PropertyTextChangeFP) NULL; 73133978Spjd propertyCaretChangeFP = (AccessBridge_PropertyCaretChangeFP) NULL; 74133978Spjd propertyVisibleDataChangeFP = (AccessBridge_PropertyVisibleDataChangeFP) NULL; 75133978Spjd propertyChildChangeFP = (AccessBridge_PropertyChildChangeFP) NULL; 76133978Spjd propertyActiveDescendentChangeFP = (AccessBridge_PropertyActiveDescendentChangeFP) NULL; 77133978Spjd 78133978Spjd propertyTableModelChangeFP = (AccessBridge_PropertyTableModelChangeFP) NULL; 79137221Sceri 80137221Sceri} 81133978Spjd 82137221Sceri/** 83137221Sceri * Destruction. 84133978Spjd */ 85133978SpjdAccessBridgeEventHandler::~AccessBridgeEventHandler() { 86137221Sceri} 87133978Spjd 88133978Spjd 89133978Spjd// ------------ Event handling methods 90133978Spjd 91133978Spjd#define SET_JAVA_EVENT_FP(function, eventFP, callbackFP, eventConstant) \ 92133978Spjd void AccessBridgeEventHandler::function(eventFP fp, WinAccessBridge *wab) { \ 93133978Spjd callbackFP = fp; \ 94133978Spjd if (fp != (eventFP) 0) { \ 95137221Sceri javaEventMask |= eventConstant; \ 96137221Sceri wab->addJavaEventNotification(eventConstant); \ 97140282Sru } else { \ 98133978Spjd javaEventMask &= (0xFFFFFFFF - eventConstant); \ 99133978Spjd wab->removeJavaEventNotification(eventConstant); \ 100133978Spjd } \ 101163888Spjd } 102163888Spjd 103163888SpjdSET_JAVA_EVENT_FP(setPropertyChangeFP, AccessBridge_PropertyChangeFP, propertyChangeFP, cPropertyChangeEvent) 104133978SpjdSET_JAVA_EVENT_FP(setJavaShutdownFP, AccessBridge_JavaShutdownFP, javaShutdownFP, cJavaShutdownEvent) 105133978SpjdSET_JAVA_EVENT_FP(setFocusGainedFP, AccessBridge_FocusGainedFP, focusGainedFP, cFocusGainedEvent) 106133978SpjdSET_JAVA_EVENT_FP(setFocusLostFP, AccessBridge_FocusLostFP, focusLostFP, cFocusLostEvent) 107133978SpjdSET_JAVA_EVENT_FP(setCaretUpdateFP, AccessBridge_CaretUpdateFP, caretUpdateFP, cCaretUpdateEvent) 108134124SpjdSET_JAVA_EVENT_FP(setMouseClickedFP, AccessBridge_MouseClickedFP, mouseClickedFP, cMouseClickedEvent) 109134124SpjdSET_JAVA_EVENT_FP(setMouseEnteredFP, AccessBridge_MouseEnteredFP, mouseEnteredFP, cMouseEnteredEvent) 110137221SceriSET_JAVA_EVENT_FP(setMouseExitedFP, AccessBridge_MouseExitedFP, mouseExitedFP, cMouseExitedEvent) 111137221SceriSET_JAVA_EVENT_FP(setMousePressedFP, AccessBridge_MousePressedFP, mousePressedFP, cMousePressedEvent) 112134124SpjdSET_JAVA_EVENT_FP(setMouseReleasedFP, AccessBridge_MouseReleasedFP, mouseReleasedFP, cMouseReleasedEvent) 113134124SpjdSET_JAVA_EVENT_FP(setMenuCanceledFP, AccessBridge_MenuCanceledFP, menuCanceledFP, cMenuCanceledEvent) 114137161SpjdSET_JAVA_EVENT_FP(setMenuDeselectedFP, AccessBridge_MenuDeselectedFP, menuDeselectedFP, cMenuDeselectedEvent) 115134168SpjdSET_JAVA_EVENT_FP(setMenuSelectedFP, AccessBridge_MenuSelectedFP, menuSelectedFP, cMenuSelectedEvent) 116134168SpjdSET_JAVA_EVENT_FP(setPopupMenuCanceledFP, AccessBridge_PopupMenuCanceledFP, popupMenuCanceledFP, cPopupMenuCanceledEvent) 117201578SmavSET_JAVA_EVENT_FP(setPopupMenuWillBecomeInvisibleFP, AccessBridge_PopupMenuWillBecomeInvisibleFP, popupMenuWillBecomeInvisibleFP, cPopupMenuWillBecomeInvisibleEvent) 118201578SmavSET_JAVA_EVENT_FP(setPopupMenuWillBecomeVisibleFP, AccessBridge_PopupMenuWillBecomeVisibleFP, popupMenuWillBecomeVisibleFP, cPopupMenuWillBecomeVisibleEvent) 119201578Smav 120201578Smav#define SET_ACCESSIBILITY_EVENT_FP(function, eventFP, callbackFP, eventConstant) \ 121201578Smav void AccessBridgeEventHandler::function(eventFP fp, WinAccessBridge *wab) { \ 122201578Smav callbackFP = fp; \ 123134168Spjd if (fp != (eventFP) 0) { \ 124134168Spjd accessibilityEventMask |= eventConstant; \ 125137221Sceri wab->addAccessibilityEventNotification(eventConstant); \ 126134168Spjd } else { \ 127137221Sceri accessibilityEventMask &= (0xFFFFFFFF - eventConstant); \ 128134168Spjd wab->removeAccessibilityEventNotification(eventConstant); \ 129137221Sceri } \ 130134169Spjd } 131137221Sceri 132137161Spjd 133134168SpjdSET_ACCESSIBILITY_EVENT_FP(setPropertyNameChangeFP, AccessBridge_PropertyNameChangeFP, propertyNameChangeFP, cPropertyNameChangeEvent) 134134168SpjdSET_ACCESSIBILITY_EVENT_FP(setPropertyDescriptionChangeFP, AccessBridge_PropertyDescriptionChangeFP, propertyDescriptionChangeFP, cPropertyDescriptionChangeEvent) 135133978SpjdSET_ACCESSIBILITY_EVENT_FP(setPropertyStateChangeFP, AccessBridge_PropertyStateChangeFP, propertyStateChangeFP, cPropertyStateChangeEvent) 136133978SpjdSET_ACCESSIBILITY_EVENT_FP(setPropertyValueChangeFP, AccessBridge_PropertyValueChangeFP, propertyValueChangeFP, cPropertyValueChangeEvent) 137133978SpjdSET_ACCESSIBILITY_EVENT_FP(setPropertySelectionChangeFP, AccessBridge_PropertySelectionChangeFP, propertySelectionChangeFP, cPropertySelectionChangeEvent) 138133978SpjdSET_ACCESSIBILITY_EVENT_FP(setPropertyTextChangeFP, AccessBridge_PropertyTextChangeFP, propertyTextChangeFP, cPropertyTextChangeEvent) 139133978SpjdSET_ACCESSIBILITY_EVENT_FP(setPropertyCaretChangeFP, AccessBridge_PropertyCaretChangeFP, propertyCaretChangeFP, cPropertyCaretChangeEvent) 140133978SpjdSET_ACCESSIBILITY_EVENT_FP(setPropertyVisibleDataChangeFP, AccessBridge_PropertyVisibleDataChangeFP, propertyVisibleDataChangeFP, cPropertyVisibleDataChangeEvent) 141133978SpjdSET_ACCESSIBILITY_EVENT_FP(setPropertyChildChangeFP, AccessBridge_PropertyChildChangeFP, propertyChildChangeFP, cPropertyChildChangeEvent) 142133978SpjdSET_ACCESSIBILITY_EVENT_FP(setPropertyActiveDescendentChangeFP, AccessBridge_PropertyActiveDescendentChangeFP, propertyActiveDescendentChangeFP, cPropertyActiveDescendentChangeEvent) 143133978Spjd 144133978SpjdSET_ACCESSIBILITY_EVENT_FP(setPropertyTableModelChangeFP, AccessBridge_PropertyTableModelChangeFP, propertyTableModelChangeFP, cPropertyTableModelChangeEvent) 145133978Spjd 146133978Spjd 147163888Spjd/** 148163888Spjd * propertyChange - extends the Java method call to Windows: 149163888Spjd * propertyChange(PropertyChangeEvent e, ) 150163888Spjd * 151163888Spjd * Note: PropertyChangeEvent object passed in is a globalReference; 152133978Spjd * It is critical that releaseJavaObject() be called 153133978Spjd * on the PropertyChangeEvent once it is no longer needed, 154133978Spjd * otherwise the JavaVM/JNI will suffer memory leaks 155133978Spjd * 156134124Spjd */ 157134124Spjdvoid 158134124SpjdAccessBridgeEventHandler::firePropertyChange(long vmID, 159134124Spjd JOBJECT64 event, JOBJECT64 source, 160134168Spjd wchar_t *property, wchar_t *oldName, 161134168Spjd wchar_t *newName) { 162134168Spjd DEBUG_CODE(char debugBuf[255]); 163134168Spjd#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer) 164133978Spjd DEBUG_CODE(sprintf(debugBuf, "\r\nCalling firePropertyChange(%p, %p):\r\n", event, source)); 165133978Spjd#else // JOBJECT64 is jlong (64 bit) 166133978Spjd DEBUG_CODE(sprintf(debugBuf, "\r\nCalling firePropertyChange(%016I64X, %016I64X):\r\n", event, source)); 167137221Sceri#endif 168137221Sceri DEBUG_CODE(AppendToCallInfo(debugBuf)); 169133978Spjd 170137221Sceri if (propertyChangeFP != (AccessBridge_PropertyChangeFP) 0) { 171133978Spjd propertyChangeFP(vmID, event, source, property, oldName, newName); 172133978Spjd } else { 173137221Sceri DEBUG_CODE(AppendToCallInfo(" Error! propertyChangeFP == 0\r\n")); 174245456Smav } 175245456Smav} 176133978Spjd 177133978Spjd 178133978Spjd/** 179133978Spjd * FIRE_EVENT - macro for all fireXXX methods (which 180133978Spjd * all are basically identical to one another...) 181133978Spjd * 182133978Spjd * Note: the event and source objects passed in are globalReferences; 183133978Spjd * It is critical that releaseJavaObject() be called 184133978Spjd * on them once they are no longer needed, otherwise 185133978Spjd * the JavaVM/JNI will suffer memory leaks 186133978Spjd * 187133978Spjd */ 188133978Spjd#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer) 189133978Spjdconst char fireEventDebugString[] = "\r\nIn AccessBridgeEventHandler::%s(%p, %p); vmID = %X\r\n"; 190133978Spjd#else // JOBJECT64 is jlong (64 bit) 191133978Spjdconst char fireEventDebugString[] = "\r\nIn AccessBridgeEventHandler::%s(%016I64X, %016I64X); vmID = %X\r\n"; 192133978Spjd#endif 193143576Spjd 194143576Spjd#define FIRE_EVENT(method, FPprototype, eventFP) \ 195143535Spjd void AccessBridgeEventHandler::method(long vmID, JOBJECT64 event, JOBJECT64 source) { \ 196143576Spjd DEBUG_CODE(char debugBuf[255]); \ 197143576Spjd DEBUG_CODE(sprintf(debugBuf, fireEventDebugString, #method, event, source, vmID)); \ 198133978Spjd DEBUG_CODE(AppendToCallInfo(debugBuf)); \ 199143576Spjd if (eventFP != (FPprototype) 0) { \ 200143576Spjd eventFP(vmID, event, source); \ 201133978Spjd } else { \ 202143576Spjd DEBUG_CODE(AppendToCallInfo(" Error! eventFP == 0\r\n")); \ 203143576Spjd } \ 204133978Spjd } 205133978Spjd 206133978Spjd void AccessBridgeEventHandler::fireJavaShutdown(long vmID) { 207133978Spjd DEBUG_CODE(char debugBuf[255]); 208133978Spjd DEBUG_CODE(sprintf(debugBuf, "\r\nCalling fireJavaShutdown; vmID = %X\r\n", vmID)); 209133978Spjd DEBUG_CODE(AppendToCallInfo(debugBuf)); 210133978Spjd if (javaShutdownFP != (AccessBridge_JavaShutdownFP) 0) { 211140415Sru javaShutdownFP(vmID); 212140415Sru } else { 213133978Spjd DEBUG_CODE(AppendToCallInfo(" Error! javaShutdownFP == 0\r\n")); 214137221Sceri } 215134124Spjd } 216133978Spjd 217134124SpjdFIRE_EVENT(fireFocusGained, AccessBridge_FocusGainedFP, focusGainedFP) 218133978SpjdFIRE_EVENT(fireFocusLost, AccessBridge_FocusLostFP, focusLostFP) 219133978SpjdFIRE_EVENT(fireCaretUpdate, AccessBridge_CaretUpdateFP, caretUpdateFP) 220140282SruFIRE_EVENT(fireMouseClicked, AccessBridge_MouseClickedFP, mouseClickedFP) 221133978SpjdFIRE_EVENT(fireMouseEntered, AccessBridge_MouseEnteredFP, mouseEnteredFP) 222133978SpjdFIRE_EVENT(fireMouseExited, AccessBridge_MouseExitedFP, mouseExitedFP) 223133978SpjdFIRE_EVENT(fireMousePressed, AccessBridge_MousePressedFP, mousePressedFP) 224133978SpjdFIRE_EVENT(fireMouseReleased, AccessBridge_MouseReleasedFP, mouseReleasedFP) 225133978SpjdFIRE_EVENT(fireMenuCanceled, AccessBridge_MenuCanceledFP, menuCanceledFP) 226137221SceriFIRE_EVENT(fireMenuDeselected, AccessBridge_MenuDeselectedFP, menuDeselectedFP) 227133978SpjdFIRE_EVENT(fireMenuSelected, AccessBridge_MenuSelectedFP, menuSelectedFP) 228133978SpjdFIRE_EVENT(firePopupMenuCanceled, AccessBridge_PopupMenuCanceledFP, popupMenuCanceledFP) 229133978SpjdFIRE_EVENT(firePopupMenuWillBecomeInvisible, AccessBridge_PopupMenuWillBecomeInvisibleFP, popupMenuWillBecomeInvisibleFP) 230133978SpjdFIRE_EVENT(firePopupMenuWillBecomeVisible, AccessBridge_PopupMenuWillBecomeVisibleFP, popupMenuWillBecomeVisibleFP) 231133978Spjd 232133978Spjd 233133978Spjd/** 234133978Spjd * FIRE_PROPERTY_CHANGE - macro for all fireXXX methods (which 235133978Spjd * all are basically identical to one another... 236133978Spjd * 237133978Spjd * Note: the event and source objects passed in are globalReferences; 238133978Spjd * It is critical that releaseJavaObject() be called 239133978Spjd * on them once they are no longer needed, otherwise 240133978Spjd * the JavaVM/JNI will suffer memory leaks 241217334Sbrucec * 242133978Spjd */ 243133978Spjd#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer) 244217334Sbrucecconst char firePropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing a no-param property change (%p, %p):\r\n"; 245133978Spjd#else // JOBJECT64 is jlong (64 bit) 246133978Spjdconst char firePropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing a no-param property change (%016I64X, %016I64X):\r\n"; 247133978Spjd#endif 248133978Spjd 249133978Spjd#define FIRE_PROPERTY_CHANGE(method, FPprototype, eventFP) \ 250133978Spjd void AccessBridgeEventHandler::method(long vmID, JOBJECT64 event, JOBJECT64 source) { \ 251133978Spjd DEBUG_CODE(char debugBuf[255]); \ 252133978Spjd DEBUG_CODE(sprintf(debugBuf, firePropertyChangeDebugString, #method, event, source)); \ 253137221Sceri DEBUG_CODE(AppendToCallInfo(debugBuf)); \ 254137280Spjd if (eventFP != (FPprototype) 0) { \ 255140282Sru eventFP(vmID, event, source); \ 256140282Sru } else { \ 257140282Sru DEBUG_CODE(AppendToCallInfo(" Error! eventFP == 0\r\n")); \ 258 } \ 259 } 260 261/** 262 * FIRE_STRING_PROPERTY_CHANGE - macro for all firePropertyXXXChange methods 263 * that have strings as the old/new values 264 265 * Note: the event and source objects passed in are globalReferences; 266 * It is critical that releaseJavaObject() be called 267 * on them once they are no longer needed, otherwise 268 * the JavaVM/JNI will suffer memory leaks 269 * 270 */ 271#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer) 272const char fireStringPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing a string property change (%p, %p, %ls, %ls):\r\n"; 273#else // JOBJECT64 is jlong (64 bit) 274const char fireStringPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing a string property change (%016I64X, %016I64X, %ls, %ls):\r\n"; 275#endif 276 277#define FIRE_STRING_PROPERTY_CHANGE(method, FPprototype, eventFP, oldValue, newValue) \ 278 void AccessBridgeEventHandler::method(long vmID, JOBJECT64 event, JOBJECT64 source, \ 279 wchar_t *oldValue, wchar_t *newValue) { \ 280 DEBUG_CODE(char debugBuf[255]); \ 281 DEBUG_CODE(sprintf(debugBuf, fireStringPropertyChangeDebugString, #method, event, source, oldValue, newValue)); \ 282 DEBUG_CODE(AppendToCallInfo(debugBuf)); \ 283 if (eventFP != (FPprototype) 0) { \ 284 eventFP(vmID, event, source, oldValue, newValue); \ 285 } else { \ 286 DEBUG_CODE(AppendToCallInfo(" Error! eventFP == 0\r\n")); \ 287 } \ 288 } 289 290/** 291 * FIRE_INT_PROPERTY_CHANGE - macro for all firePropertyXXXChange methods 292 * that have ints as the old/new values 293 * 294 * Note: the event and source objects passed in are globalReferences; 295 * It is critical that releaseJavaObject() be called 296 * on them once they are no longer needed, otherwise 297 * the JavaVM/JNI will suffer memory leaks 298 * 299 */ 300#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer) 301const char fireIntPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing an int property change (%p, %p, %d, %d):\r\n"; 302#else // JOBJECT64 is jlong (64 bit) 303const char fireIntPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing an int property change (%016I64X, %016I64X, %d, %d):\r\n"; 304#endif 305 306#define FIRE_INT_PROPERTY_CHANGE(method, FPprototype, eventFP) \ 307 void AccessBridgeEventHandler::method(long vmID, JOBJECT64 event, JOBJECT64 source, \ 308 int oldValue, int newValue) { \ 309 DEBUG_CODE(char debugBuf[255]); \ 310 DEBUG_CODE(sprintf(debugBuf, fireIntPropertyChangeDebugString, #method, event, source, oldValue, newValue)); \ 311 DEBUG_CODE(AppendToCallInfo(debugBuf)); \ 312 if (eventFP != (FPprototype) 0) { \ 313 eventFP(vmID, event, source, oldValue, newValue); \ 314 } else { \ 315 DEBUG_CODE(AppendToCallInfo(" Error! eventFP == 0\r\n")); \ 316 } \ 317 } 318 319/** 320 * FIRE_AC_PROPERTY_CHANGE - macro for all firePropertyXXXChange methods 321 * that have jobjects (AccessibleContexts) as the old/new values 322 * 323 * Note: the event and source objects passed in are globalReferences; 324 * It is critical that releaseJavaObject() be called 325 * on them once they are no longer needed, otherwise 326 * the JavaVM/JNI will suffer memory leaks 327 * 328 */ 329#ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer) 330const char fireACPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing an AC property change (%p, %p, %p, %p):\r\n"; 331#else // JOBJECT64 is jlong (64 bit) 332const char fireACPropertyChangeDebugString[] = "\r\nIn AccessBridgeEventHandler::%s, Firing an AC property change (%016I64X, %016I64X, %016I64X, %016I64X):\r\n"; 333#endif 334 335#define FIRE_AC_PROPERTY_CHANGE(method, FPprototype, eventFP) \ 336 void AccessBridgeEventHandler::method(long vmID, JOBJECT64 event, JOBJECT64 source, \ 337 JOBJECT64 oldValue, JOBJECT64 newValue) { \ 338 DEBUG_CODE(char debugBuf[255]); \ 339 DEBUG_CODE(sprintf(debugBuf, fireACPropertyChangeDebugString, #method, event, source, oldValue, newValue)); \ 340 DEBUG_CODE(AppendToCallInfo(debugBuf)); \ 341 if (eventFP != (FPprototype) 0) { \ 342 eventFP(vmID, event, source, oldValue, newValue); \ 343 } else { \ 344 DEBUG_CODE(AppendToCallInfo(" Error! eventFP == 0\r\n")); \ 345 } \ 346 } 347 348FIRE_STRING_PROPERTY_CHANGE(firePropertyNameChange, 349 AccessBridge_PropertyNameChangeFP, 350 propertyNameChangeFP, oldName, newName) 351FIRE_STRING_PROPERTY_CHANGE(firePropertyDescriptionChange, 352 AccessBridge_PropertyDescriptionChangeFP, 353 propertyDescriptionChangeFP, 354 oldDescription, newDescription) 355FIRE_STRING_PROPERTY_CHANGE(firePropertyStateChange, 356 AccessBridge_PropertyStateChangeFP, 357 propertyStateChangeFP, oldState, newState) 358FIRE_STRING_PROPERTY_CHANGE(firePropertyValueChange, 359 AccessBridge_PropertyValueChangeFP, 360 propertyValueChangeFP, oldValue, newValue) 361FIRE_PROPERTY_CHANGE(firePropertySelectionChange, 362 AccessBridge_PropertySelectionChangeFP, 363 propertySelectionChangeFP) 364FIRE_PROPERTY_CHANGE(firePropertyTextChange, 365 AccessBridge_PropertyTextChangeFP, 366 propertyTextChangeFP); 367FIRE_INT_PROPERTY_CHANGE(firePropertyCaretChange, 368 AccessBridge_PropertyCaretChangeFP, 369 propertyCaretChangeFP) 370FIRE_PROPERTY_CHANGE(firePropertyVisibleDataChange, 371 AccessBridge_PropertyVisibleDataChangeFP, 372 propertyVisibleDataChangeFP) 373FIRE_AC_PROPERTY_CHANGE(firePropertyChildChange, 374 AccessBridge_PropertyChildChangeFP, 375 propertyChildChangeFP) 376FIRE_AC_PROPERTY_CHANGE(firePropertyActiveDescendentChange, 377 AccessBridge_PropertyActiveDescendentChangeFP, 378 propertyActiveDescendentChangeFP) 379 380FIRE_STRING_PROPERTY_CHANGE(firePropertyTableModelChange, 381 AccessBridge_PropertyTableModelChangeFP, 382 propertyTableModelChangeFP, oldValue, newValue) 383