SFML community forums

Help => Window => Topic started by: Pol on August 13, 2009, 07:40:52 pm

Title: Bad Events
Post by: Pol on August 13, 2009, 07:40:52 pm
Hmm.. when I press Tilde or Numpad keys, they register as an event with Event.Type == Event.KeyPressed but their Key.Code == 0 ?

No matter which numpad I press, tab also.. all == 0 ?

This seems similar to a fault with GLUT I used to encounter.. basically, GLUT didn't register a keypress for numpad keys at all. At least SFML registers them but they are 0.. any idea why?
Title: Bad Events
Post by: Pol on August 13, 2009, 07:54:26 pm
Further note... if I have NumLk enabled then it registers the numpad keys, otherwise it doesn't. (Tilde always return 0)
Title: Bad Events
Post by: Laurent on August 13, 2009, 08:12:57 pm
What OS? Which version of SFML?
Title: Bad Events
Post by: Pol on August 13, 2009, 08:18:40 pm
Debian & 1.5
Title: Bad Events
Post by: Pol on August 13, 2009, 08:45:44 pm
Here are some results from the `xev` Event Tester...

Code: [Select]
KeyPress event, serial 30, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2549350, (272,477), root:(1556,583),
    state 0x0, keycode 49 (keysym 0x60, grave), same_screen YES,
    XLookupString gives 1 bytes: (60) "`"
    XmbLookupString gives 1 bytes: (60) "`"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2556537, (272,477), root:(1556,583),
    state 0x0, keycode 90 (keysym 0xff9e, KP_Insert), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2556896, (272,477), root:(1556,583),
    state 0x0, keycode 87 (keysym 0xff9c, KP_End), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2557177, (272,477), root:(1556,583),
    state 0x0, keycode 88 (keysym 0xff99, KP_Down), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2557556, (272,477), root:(1556,583),
    state 0x0, keycode 89 (keysym 0xff9b, KP_Next), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2558058, (272,477), root:(1556,583),
    state 0x0, keycode 83 (keysym 0xff96, KP_Left), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2558355, (272,477), root:(1556,583),
    state 0x0, keycode 84 (keysym 0xff9d, KP_Begin), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2558652, (272,477), root:(1556,583),
    state 0x0, keycode 85 (keysym 0xff98, KP_Right), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2559200, (272,477), root:(1556,583),
    state 0x0, keycode 79 (keysym 0xff95, KP_Home), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2559541, (272,477), root:(1556,583),
    state 0x0, keycode 80 (keysym 0xff97, KP_Up), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2559879, (272,477), root:(1556,583),
    state 0x0, keycode 81 (keysym 0xff9a, KP_Prior), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2563542, (272,477), root:(1556,583),
    state 0x0, keycode 77 (keysym 0xff7f, Num_Lock), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2564335, (272,477), root:(1556,583),
    state 0x10, keycode 49 (keysym 0x60, grave), same_screen YES,
    XLookupString gives 1 bytes: (60) "`"
    XmbLookupString gives 1 bytes: (60) "`"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2564950, (272,477), root:(1556,583),
    state 0x10, keycode 90 (keysym 0xffb0, KP_0), same_screen YES,
    XLookupString gives 1 bytes: (30) "0"
    XmbLookupString gives 1 bytes: (30) "0"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2565238, (272,477), root:(1556,583),
    state 0x10, keycode 87 (keysym 0xffb1, KP_1), same_screen YES,
    XLookupString gives 1 bytes: (31) "1"
    XmbLookupString gives 1 bytes: (31) "1"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2565515, (272,477), root:(1556,583),
    state 0x10, keycode 88 (keysym 0xffb2, KP_2), same_screen YES,
    XLookupString gives 1 bytes: (32) "2"
    XmbLookupString gives 1 bytes: (32) "2"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2565791, (272,477), root:(1556,583),
    state 0x10, keycode 89 (keysym 0xffb3, KP_3), same_screen YES,
    XLookupString gives 1 bytes: (33) "3"
    XmbLookupString gives 1 bytes: (33) "3"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2566160, (272,477), root:(1556,583),
    state 0x10, keycode 83 (keysym 0xffb4, KP_4), same_screen YES,
    XLookupString gives 1 bytes: (34) "4"
    XmbLookupString gives 1 bytes: (34) "4"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2566436, (272,477), root:(1556,583),
    state 0x10, keycode 84 (keysym 0xffb5, KP_5), same_screen YES,
    XLookupString gives 1 bytes: (35) "5"
    XmbLookupString gives 1 bytes: (35) "5"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2566728, (272,477), root:(1556,583),
    state 0x10, keycode 85 (keysym 0xffb6, KP_6), same_screen YES,
    XLookupString gives 1 bytes: (36) "6"
    XmbLookupString gives 1 bytes: (36) "6"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2567071, (272,477), root:(1556,583),
    state 0x10, keycode 79 (keysym 0xffb7, KP_7), same_screen YES,
    XLookupString gives 1 bytes: (37) "7"
    XmbLookupString gives 1 bytes: (37) "7"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2567343, (272,477), root:(1556,583),
    state 0x10, keycode 80 (keysym 0xffb8, KP_8), same_screen YES,
    XLookupString gives 1 bytes: (38) "8"
    XmbLookupString gives 1 bytes: (38) "8"
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4400001,
    root 0x1a6, subw 0x0, time 2567681, (272,477), root:(1556,583),
    state 0x10, keycode 81 (keysym 0xffb9, KP_9), same_screen YES,
    XLookupString gives 1 bytes: (39) "9"
    XmbLookupString gives 1 bytes: (39) "9"
    XFilterEvent returns: False


Basically, I hit the following keys in the following order (on the Numpad, plus Tilde and Num_lock):
Quote
Tilde,0,1,2,3,4,5,6,7,8,9,Num_lock,Tilde,0,1,2,3,4,5,6,7,8,9


Say if you need more info.

Also, I noticed there's no SFML Key definition for Num_Lock.
Title: Bad Events
Post by: Laurent on August 13, 2009, 09:46:35 pm
Thanks for these useful informations, I'll see if I can patch the code with it :)
Title: Bad Events
Post by: Pol on August 13, 2009, 11:20:10 pm
These might be helpful..

http://wiki.linuxquestions.org/wiki/List_of_keysyms

http://wiki.linuxquestions.org/wiki/List_of_Keysyms_Recognised_by_Xmodmap