ListenChar(2) doesn't work on Windows in nodesktop or noawt modes?


I noticed in the History of ListenChar.m that:


05/31/09 mk    Add support for Octave and Matlab in noJVM mode.



However, according to http://docs.psychtoolbox.org/ListenChar


"The only feature that works in parallel with KbQueues

is the suppression of spilling of keystroke characters into the Matlab or

Octave window during ListenChar(2) - at least on Linux and OSX, on

Windows this can't be prevented at all in "matlab -nojvm" mode.'



Tangentially, what this means is that ListenChar (and GetChar, as well) won't work in Windows when using nojvm mode.


However, I thought, "that's okay, I'll just use nodesktop or noawt mode."

Well, it turns out that it also won't work under nodesktop mode, and noawt mode. :(


For reference, there was the following thread discussing this back in 2007 (before the nojvm fix had been implemented): https://groups.yahoo.com/neo/groups/psychtoolbox/conversations/topics/6865


So, my questions are:

Is there any workaround for getting ListenChar(2) to work in Windows other than using full desktop mode+JVM, maybe something that has come up in the last 5 to 7 years? :) 


Is there another way to block keyboard typing from appearing in the Command Window in nodesktop mode on Windows if there isn't any workaround?


If, in fact, there is no way to make it work in PsychToolbox on Windows, can this fact regarding nodesktop and noawt modes please be noted in the ListenChar and GetChar docs? The reason I ask is, it's not necessarily intuitive that if something doesn't work in nojvm mode that this will mean that it also won't work in nodesktop mode or noawt mode.


Thanks!

Suppressing keyboard input to the Matlab window requires a fully active java based desktop on Windows, so without desktop, or awt or the jvm active it is game over for that. GetChar() is normally implemented via Java, but falls back to (ab)use of keyboard queues if they aren't already used by the users code.

Essentially KbQueue functionality with the KbEventGet() function et al. are a more powerful and flexible GetChar() replacement, GetChar is only here for backwards compatibility. ListenChar(2) however always requires the full Java desktop on Matlab to work.


If you want more accurate help texts for this, please fork Psychtoolbox on GitHub, make the updates and then send me a pull-request with appropriate updates on GitHub.

-mario