< prev index next >

src/jdk.accessibility/windows/native/libjavaaccessbridge/JavaAccessBridge.cpp

Print this page




 148                 PrintDebugString("In AccessBridgeDialog - Got theFromWindowsHelloMsgID message");
 149                 theJavaAccessBridge->postHelloToWindowsDLLMsg((HWND) wParam);
 150             }
 151         }
 152         return FALSE;
 153     }
 154 
 155 }
 156 
 157 
 158 // -----------------------------
 159 
 160 
 161 /**
 162  * Initialize the JavaAccessBridge
 163  *
 164  */
 165 JavaAccessBridge::JavaAccessBridge(HINSTANCE hInstance) {
 166     windowsInstance = hInstance;
 167     ATs = (AccessBridgeATInstance *) 0;

 168     initBroadcastMessageIDs();          // get the unique to us broadcast msg. IDs
 169 }
 170 
 171 extern DWORD JavaBridgeThreadId;
 172 
 173 /**
 174  * Destroy the JavaAccessBridge
 175  *
 176  */
 177 JavaAccessBridge::~JavaAccessBridge() {
 178     // inform all other AccessBridges that we're going away
 179 
 180     PrintDebugString("\r\nin JavaAccessBridge::~JavaAccessBridge()");
 181 
 182     // Send a shutdown message for those applications like StarOffice that do
 183     // send a shutdown message themselves.
 184     javaShutdown(NULL, 0);
 185 
 186     AccessBridgeATInstance *current = ATs;
 187     while (current != (AccessBridgeATInstance *) 0) {
 188         PrintDebugString("  telling %p we're going away", current->winAccessBridgeWindow);
 189                 SendMessage(current->winAccessBridgeWindow,
 190                     AB_DLL_GOING_AWAY, (WPARAM) dialogWindow, (LPARAM) 0);
 191         current = current->nextATInstance;
 192     }
 193 
 194     PrintDebugString("  finished telling ATs about our demise");
 195 
 196         if(JavaBridgeThreadId)
 197                 {
 198                 PostThreadMessage(JavaBridgeThreadId,WM_USER+1,0,0);
 199                 Sleep(100);
 200                 }
 201 
 202     delete ATs;
 203 
 204     PrintDebugString("  finished deleting ATs");
 205     PrintDebugString("GOODBYE CRUEL WORLD...");

 206 }
 207 
 208 
 209 void
 210 JavaAccessBridge::javaRun(JNIEnv *env, jobject obj) {
 211     MSG msg;
 212 
 213     PrintDebugString("JavaAccessBridge::javaRun(%p, %p) called", env, obj);
 214 
 215     if (env->GetJavaVM(&javaVM) != 0) {
 216         return; // huh!?!?!
 217     }
 218     PrintDebugString("  -> javaVM = %p", javaVM);
 219 
 220     if (javaVM->AttachCurrentThread((void **) &windowsThreadJNIEnv, NULL) != 0) {
 221         return; // huh!?!?!
 222     }
 223     PrintDebugString("  -> windowsThreadJNIEnv = %p", windowsThreadJNIEnv);
 224 
 225     javaThreadABObject = env->NewGlobalRef(obj);




 148                 PrintDebugString("In AccessBridgeDialog - Got theFromWindowsHelloMsgID message");
 149                 theJavaAccessBridge->postHelloToWindowsDLLMsg((HWND) wParam);
 150             }
 151         }
 152         return FALSE;
 153     }
 154 
 155 }
 156 
 157 
 158 // -----------------------------
 159 
 160 
 161 /**
 162  * Initialize the JavaAccessBridge
 163  *
 164  */
 165 JavaAccessBridge::JavaAccessBridge(HINSTANCE hInstance) {
 166     windowsInstance = hInstance;
 167     ATs = (AccessBridgeATInstance *) 0;
 168     initializeFileLogger();
 169     initBroadcastMessageIDs();          // get the unique to us broadcast msg. IDs
 170 }
 171 
 172 extern DWORD JavaBridgeThreadId;
 173 
 174 /**
 175  * Destroy the JavaAccessBridge
 176  *
 177  */
 178 JavaAccessBridge::~JavaAccessBridge() {
 179     // inform all other AccessBridges that we're going away
 180 
 181     PrintDebugString("\r\nin JavaAccessBridge::~JavaAccessBridge()");
 182 
 183     // Send a shutdown message for those applications like StarOffice that do
 184     // send a shutdown message themselves.
 185     javaShutdown(NULL, 0);
 186 
 187     AccessBridgeATInstance *current = ATs;
 188     while (current != (AccessBridgeATInstance *) 0) {
 189         PrintDebugString("  telling %p we're going away", current->winAccessBridgeWindow);
 190                 SendMessage(current->winAccessBridgeWindow,
 191                     AB_DLL_GOING_AWAY, (WPARAM) dialogWindow, (LPARAM) 0);
 192         current = current->nextATInstance;
 193     }
 194 
 195     PrintDebugString("  finished telling ATs about our demise");
 196 
 197         if(JavaBridgeThreadId)
 198                 {
 199                 PostThreadMessage(JavaBridgeThreadId,WM_USER+1,0,0);
 200                 Sleep(100);
 201                 }
 202 
 203     delete ATs;
 204 
 205     PrintDebugString("  finished deleting ATs");
 206     PrintDebugString("GOODBYE CRUEL WORLD...");
 207     finalizeFileLogger();
 208 }
 209 
 210 
 211 void
 212 JavaAccessBridge::javaRun(JNIEnv *env, jobject obj) {
 213     MSG msg;
 214 
 215     PrintDebugString("JavaAccessBridge::javaRun(%p, %p) called", env, obj);
 216 
 217     if (env->GetJavaVM(&javaVM) != 0) {
 218         return; // huh!?!?!
 219     }
 220     PrintDebugString("  -> javaVM = %p", javaVM);
 221 
 222     if (javaVM->AttachCurrentThread((void **) &windowsThreadJNIEnv, NULL) != 0) {
 223         return; // huh!?!?!
 224     }
 225     PrintDebugString("  -> windowsThreadJNIEnv = %p", windowsThreadJNIEnv);
 226 
 227     javaThreadABObject = env->NewGlobalRef(obj);


< prev index next >