de.jreality.toolsystem.raw
Class DeviceOldKeyboard
java.lang.Object
de.jreality.toolsystem.raw.DeviceOldKeyboard
- All Implemented Interfaces:
- RawDevice, KeyListener, EventListener
public class DeviceOldKeyboard
- extends Object
- implements RawDevice, 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
DeviceOldKeyboard
public DeviceOldKeyboard()
initialize
public void initialize(Viewer viewer,
Map<String,Object> config)
- Specified by:
initialize
in interface RawDevice
keyPressed
public void keyPressed(KeyEvent e)
- Specified by:
keyPressed
in interface KeyListener
keyReleased
public void keyReleased(KeyEvent e)
- Specified by:
keyReleased
in interface KeyListener
mapRawDevice
public ToolEvent mapRawDevice(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 String getName()
- Specified by:
getName
in interface RawDevice
toString
public String toString()
- Overrides:
toString
in class Object
keyTyped
public void keyTyped(KeyEvent e)
- Specified by:
keyTyped
in interface KeyListener