< prev index next >
src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m
Print this page
@@ -65,10 +65,11 @@
// Apparently, for mouse up/down events we have to set an event number
// that is incremented on each button press. Otherwise, strange things
// happen with z-order.
static int gsEventNumber;
static int* gsButtonEventNumber;
+static CRobotKeyCodeMapping *keyCodeMapping;
static inline CGKeyCode GetCGKeyCode(jint javaKeyCode);
static void PostMouseEvent(const CGPoint point, CGMouseButton button,
CGEventType type, int clickCount, int eventNumber);
@@ -128,10 +129,11 @@
for (i = 0; i < gNumberOfButtons; ++i) {
gsButtonEventNumber[i] = ROBOT_EVENT_NUMBER_START;
}
}
+ keyCodeMapping = [CRobotKeyCodeMapping sharedInstance];
}
/*
* Class: sun_lwawt_macosx_CRobot
* Method: mouseEvent
@@ -342,12 +344,14 @@
}
}
static inline CGKeyCode GetCGKeyCode(jint javaKeyCode)
{
- CRobotKeyCodeMapping *keyCodeMapping = [CRobotKeyCodeMapping sharedInstance];
+ if (keyCodeMapping) {
return [keyCodeMapping getOSXKeyCodeForJavaKey:javaKeyCode];
+ }
+ return OSX_Undefined;
}
static int GetClickCount(BOOL isDown) {
NSTimeInterval now = [[NSDate date] timeIntervalSinceReferenceDate];
NSTimeInterval clickInterval = now - gsLastClickTime;
< prev index next >