< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m

Print this page

        

@@ -256,30 +256,17 @@
  */
 JNIEXPORT void JNICALL
 Java_sun_lwawt_macosx_CRobot_keyEvent
 (JNIEnv *env, jobject peer, jint javaKeyCode, jboolean keyPressed)
 {
-    /*
-     * Well, using CGEventCreateKeyboardEvent/CGEventPost would have been
-     * a better solution, however, it gives me all kinds of trouble and I have
-     * no idea how to solve them without inserting delays between simulated
-     * events. So, I've ended up disabling it and opted for another approach
-     * that uses Accessibility API instead.
-     */
     CGKeyCode keyCode = GetCGKeyCode(javaKeyCode);
-    AXUIElementRef elem = AXUIElementCreateSystemWide();
-    AXUIElementPostKeyboardEvent(elem, (CGCharCode)0, keyCode, keyPressed);
-    CFRelease(elem);
-
 
-#if 0
     CGEventRef event = CGEventCreateKeyboardEvent(NULL, keyCode, keyPressed);
     if (event != NULL) {
         CGEventPost(kCGSessionEventTap, event);
         CFRelease(event);
     }
-#endif
 }
 
 /*
  * Class:     sun_lwawt_macosx_CRobot
  * Method:    nativeGetScreenPixels
< prev index next >