TIC-80 icon indicating copy to clipboard operation
TIC-80 copied to clipboard

Tic80 integrated editor not fully usable with Neo keyboard layout

Open dvdkhlng opened this issue 3 years ago • 4 comments

Hi,

for German keyboards there exists an ergonomically optimized keyboard layout called Neo [1]. It's something like Dvorak but optimized for german language and programming. E.g. on X-Windows you can activate it via

setxkbmap de neo

Neo defines additional shift-keys named Mod3 and Mod4 to make special characters and command keys more reachable from the home row. Unfortunately keys on "Layer 4" do not seem to work in the Tic-80 editor. E.g. pressing Right_Alt+W should produce a Backpace, but for some reason that does not work in Tic-80.

xev shows the following event sequence for the Neo version of Backspace:

KeyPress event, serial 38, synthetic NO, window 0x4a00001,
    root 0x22f, subw 0x0, time 22043892, (79,64), root:(84,262),
    state 0x0, keycode 108 (keysym 0xfe11, ISO_Level5_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 94
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x4a00001,
    root 0x22f, subw 0x0, time 22045139, (79,64), root:(84,262),
    state 0x20, keycode 25 (keysym 0xff08, BackSpace), same_screen YES,
    XKeysymToKeycode returns keycode: 22
    XLookupString gives 1 bytes: (08) "
    XmbLookupString gives 1 bytes: (08) "
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x4a00001,
    root 0x22f, subw 0x0, time 22045628, (79,64), root:(84,262),
    state 0x20, keycode 25 (keysym 0xff08, BackSpace), same_screen YES,
    XKeysymToKeycode returns keycode: 22
    XLookupString gives 1 bytes: (08) "
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x4a00001,
    root 0x22f, subw 0x0, time 22046346, (79,64), root:(84,262),
    state 0x20, keycode 108 (keysym 0xfe13, ISO_Level5_Lock), same_screen YES,
    XKeysymToKeycode returns keycode: 23
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

Testing this now on version 0.90.1723 Pro (9c38a80) (tic80-v0.90-linux-pro.zip), and all the Neo keys that need Mod4 (ISO_Level5_Shift) seem to be fully ignored by Tic80.

cheers,

David

[1] https://neo-layout.org/

dvdkhlng avatar Dec 22 '21 13:12 dvdkhlng

Oh well...

tic-80 seems to use libsdl2. And running the libsdl2 event tester here [2] produces the following output for Neo backspace:

SDL_KEYDOWN: Keycode:  (1073741824) Scancode: Right Alt (230)
SDL_KEYDOWN: Keycode: V (118) Scancode: W (26)
SDL_KEYUP: Keycode: V (118) Scancode: W (26)
SDL_KEYUP: Keycode:  (1073741824) Scancode: Right Alt (230)

This seems to indicate a rather non-trivial problem WRT how libsdl2 maps X-windows keyboard events, which maybe cannot be worked around from inside tic-80...

[2] https://gist.github.com/DanielGibson/12041b57a540cbbfbaf9

dvdkhlng avatar Dec 22 '21 14:12 dvdkhlng

Yeah, TIC-80 seems to be getting RAW keyboard input, not remapped... so it seems Right_Alt+W, which means nothing.

joshgoebel avatar Jan 08 '22 20:01 joshgoebel

Any news on this? Really struggling with it :/

MartiniMoe avatar May 09 '24 15:05 MartiniMoe

Related to https://github.com/nesbox/TIC-80/issues/2520

Skeptim avatar May 09 '24 16:05 Skeptim