I created a class to catch OS X events like mouse, tablet… Unfortunately the events are not dispatched to my class. I had a look in the Juce classes and it seems that Juce is catching the events before they are dispatched to me. In other environments the code is working. (OS X Native, Java JNI).
I try to add Tablet support to my app. For that I must catch the tablet driver events. As I mentioned before, under native OS X and from a Java virtual machine I can get them by overriding the sendEvent method.
Well, juce already creates MouseEvent objects - wouldn’t it make more sense to just extend the juce native code to add the tablet data that you need to the MouseEvent, rather than trying to bodge the same functionality as a parallel to what’s already there?
InstallEventHandler is an old carbon function - best avoided.
What’s the obsession with overriding sendEvent? The whole point of events is that you receive them in the object that they were sent to - you can’t globally intercept them all and do a big switch statement! Presumably these tablet events end up arriving at some kind of NSView callback, so that’s where you’d get their data and use it.
30 seconds searching through the docs for “tablet” and I see that NSResponder (and an NSView is an NSResponder) has a bunch of methods tabletPoint: tabletProximity:, etc. That’s clearly where you’re supposed to receive these things.
-Background Events:
InstallEventHandler does not work with the Base SDK 10.4 and Juce. Don’t know why. In OS X native I had no problems. So changing to SDK 10.5 solved the issue.
As I have seen, this function will also work with 64 bit and will not be deleted in further OS X releases. There is a new approach to get the background events in 10.6: