keyboard modifiers

Started by raft, February 13, 2008, 12:42:03 AM

Previous topic - Next topic

raft

i'm trying to map KeyState to awt.KeyEvent with the following code piece:

                int modifiers = 0;
                if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) ||  Keyboard.isKeyDown(Keyboard.KEY_RCONTROL))
                    modifiers |= KeyEvent.CTRL_DOWN_MASK;
                if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ||  Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))
                    modifiers |= KeyEvent.SHIFT_DOWN_MASK;

                final KeyEvent keyEvent;
                if (state.getState()) // pressed
                    keyEvent = new KeyEvent(EVENT_SOURCE, KeyEvent.KEY_PRESSED, 0, modifiers, state.getKeyCode(), KeyEvent.CHAR_UNDEFINED);
                else keyEvent = new KeyEvent(EVENT_SOURCE, KeyEvent.KEY_RELEASED, 0, modifiers, state.getKeyCode(), KeyEvent.CHAR_UNDEFINED);


but unfortunately Keyboard.isKeyDown(left-right control) never returns true. pressing/releasing control key never generates an event either. any ideas why this may happen ?

this is a fedora 4 linux laptop, with only left control key. awt itself properly generates control key events

btw, it may be handy to include modifiers in KeyState class.

r a f t

EgonOlsen


raft


EgonOlsen

Obviously an LWJGL and/or Linux problem. I have no idea... ???

raft

i guess i'd better post it to lwjgl forums  ::)

EgonOlsen

Yes, there's already a thread from 2 days ago dealing with LWJGL/Linux/jPCT: http://lwjgl.org/forum/index.php/topic,2555.0.html