2009-12-29 13:35:47 PST
Ok, I've made a little progress.
If the jpen native code is loaded *before* the awt libraries, I get the correct behavior:
public static void main(String[] args) {
CocoaAccess ca = new CocoaAccess() {
protected void postProximityEvent(double eventTimeSeconds,
int cocoaModifierFlags, int capabilityMask, int deviceID,
boolean enteringProximity, int pointingDeviceID,
int pointingDeviceSerialNumber, int pointingDeviceType,
int systemTabletID, int tabletID, long uniqueID,
int vendorID, int vendorPointingDeviceType) {
System.out.println("pointDeviceType = " + pointingDeviceType);
}
// do nothing...
protected void postEvent(int type, double eventTimeSeconds,
int cocoaModifierFlags, float screenX, float screenY,
boolean tabletEvent, int absoluteX, int absoluteY,
int absoluteZ, int buttonMask, float pressure,
float rotation, float tiltX, float tiltY,
float tangentialPressure) {
}
};
System.loadLibrary("jpen-2-2");
ca.start();
ca.enable();
JFrame frame = new JFrame("HELLO VORLD");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400,400);
frame.setLocationByPlatform(true);
frame.setVisible(true);
}
If I merely move the creation of the JFrame object up two lines above ca.start(), the event is lost:
...
System.loadLibrary("jpen-2-2");
JFrame frame = new JFrame("HELLO VORLD");
ca.start();
ca.enable();
...
While this solves the problem for Java applications, it's not great/elegant, plus it doesn't work for Applets (since there's no way to load jpen before jawt).
Marcello