This now works as a standalone, but once you run it with something else (like your task!), it will crash, presumably due to some thread interactions that matlab dislikes. A possible solution is to have the C callback routine log events and not call any matlab functions and then have a separate function that then retrieves those events.
10 lines of code changed in 2 files:
This function can now install a matlab callback as a listener and send events to it. Problem is that it crashes when running testExperiment. I think the problem is due to having matlab run two pieces of code at once. Possibilites would be to try to block matlab from running other code while the listener is being called (no idea if this is possible) or to give up on the callback concept and have mglPrivateListenerInstall.c not call matlab but log events in c-memory and then provide another call that would release those events to matlab -- that way matlab wouldn't be called by a separate thread which appears to be the problem.
60 lines of code changed in 2 files:
Test function for mglInstallListener
16 lines of code changed in 1 file:
C function which installs a callback to listen for keyboard/mouse events
182 lines of code changed in 1 file:
M function entry point to install a keyboard listener
28 lines of code changed in 1 file:
thread is now working.
76 lines of code changed in 1 file:
This is a function that will replace the old mglGetKeyEvent. It uses "EventTaps" which tap into a low level event cue on Mac OS X, so that mgl get can key events regardless of where the window focus is. It also gets nanosecond time accuracy of the event. Right now, it runs its own event loop so it stops all other execution. Need to figure out a way to get it to run as a background process. Tried to set up a thread within the code to run it, but the thread creation always returns an error. (Could be compilation flags, but I've added -pthread). Can't find any reference to thread creation error 22.
64 lines of code changed in 1 file:
May 2008 »