de.jreality.toolsystem.raw
Class DeviceOldKeyboard
java.lang.Object
de.jreality.toolsystem.raw.DeviceOldKeyboard
- All Implemented Interfaces:
- RawDevice, java.awt.event.KeyListener, java.util.EventListener
public class DeviceOldKeyboard
- extends java.lang.Object
- implements RawDevice, java.awt.event.KeyListener
This class contains an ugly workaround for linux keyboard auto-repeat.
When a key released event arrives, it is noted and rescheduled,
whith a short sleep - so that there is time for the corresponding keyTyped
event to check in.
in the keyTyped method we mark a matching release event so that it is not executed.
so neither the keyPressed nor the keyReleased are processed.
This works for me much better than the previous version - anyway,
I guess one needs to tweak the sleep value depending on the machine...
TODO: use configuration attributes to configure raw devices if needed.
- Author:
- weissman
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DeviceOldKeyboard
public DeviceOldKeyboard()
initialize
public void initialize(Viewer viewer,
java.util.Map<java.lang.String,java.lang.Object> config)
- Specified by:
initialize
in interface RawDevice
keyPressed
public void keyPressed(java.awt.event.KeyEvent e)
- Specified by:
keyPressed
in interface java.awt.event.KeyListener
keyReleased
public void keyReleased(java.awt.event.KeyEvent e)
- Specified by:
keyReleased
in interface java.awt.event.KeyListener
mapRawDevice
public ToolEvent mapRawDevice(java.lang.String rawDeviceName,
InputSlot inputDevice)
- Specified by:
mapRawDevice
in interface RawDevice
- Returns:
- a ToolEvent representing a reasonable initial
value for the mapping - that means the source
must be the given input slot!
setEventQueue
public void setEventQueue(ToolEventQueue queue)
- Specified by:
setEventQueue
in interface RawDevice
dispose
public void dispose()
- Specified by:
dispose
in interface RawDevice
getName
public java.lang.String getName()
- Specified by:
getName
in interface RawDevice
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
keyTyped
public void keyTyped(java.awt.event.KeyEvent e)
- Specified by:
keyTyped
in interface java.awt.event.KeyListener