Issue: NEWT keyboard keys automatically released when repeated?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue: NEWT keyboard keys automatically released when repeated?

GiGurra
Is there any way to ask if a specific key is currently held down?

On Windows 7 jdk 1.7.0_07 64 bit with jogl rc-11 NEWT keyboard callbacks automatically send key released for such keys that are automatically repeated/typed.

How would I go about asking newt if a specific key is currently held down (as I due to the above cannot keep a record of it myself).

EDIT: Nevm. There was an "isAutoRepeat" method available :). Sry :).
Reply | Threaded
Open this post in threaded view
|

Re: Issue: NEWT keyboard keys automatically released when repeated?

Sven Gothel
Administrator
On 11/24/2012 01:33 PM, GiGurra [via jogamp] wrote:
> Is there any way to ask if a specific key is currently held down?
>
> On Windows 7 jdk 1.7.0_07 64 bit with jogl rc-11 NEWT keyboard callbacks
> automatically send key released for such keys that are automatically
> repeated/typed.
>
> How would I go about asking newt if a specific key is currently held down (as
> I due to the above cannot keep a record of it myself).

Yes, pls look at the following unit test, demonstrating how to suppress
auto-repeat keys.
  <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyPressReleaseUnmaskRepeatAWT.java;h=c275139058b3b1ce5eb3e5aa111ee2ed75053e01;hb=HEAD>

Here is the API doc describing how key event are being delivered, incl. auto-repeat:
  <http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/event/KeyEvent.html>

No - we don't provide a polling API gathering what keys are currently pressed,
since the API is event driven.

However, you can simply add this functionality while adding a KeyListener
and track PRESS/RELEASE events, while unmasking the auto-repeat keys.

~sven



signature.asc (909 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Issue: NEWT keyboard keys automatically released when repeated?

gouessej
Administrator
In reply to this post by GiGurra
Sven is right, you can implement polling above an event driven system.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Issue: NEWT keyboard keys automatically released when repeated?

GiGurra
Thanks.
I did so now and it works great :).