Giter Site home page Giter Site logo

[gemkeyboard] keycodes about gem HOT 2 OPEN

60-hz avatar 60-hz commented on August 16, 2024
[gemkeyboard] keycodes

from gem.

Comments (2)

umlaeute avatar umlaeute commented on August 16, 2024

what's worse is that the keycodes are highly dependent on the actual windowing backend.

here's a test with a german keyboard layout:

windowing backend key combination normal printout gemkeyboard
glfw3 A a 65
glfw3 Shift_L+A A 340 65
glfw3 Ö ö 59
glfw3 Shift_R+Ö Ö 344 59
glut A a 97
glut Shift_L+A A 112 65
glut Ö ö 246
glut Shift_R+Ö Ö 113 214
glx A a 38
glx Shift_L+A A 50 38
glx Ö ö 47
glx Shift_R+Ö Ö 62 47
sdl A a 38
sdl Shift_L+A A 50 38
sdl Ö ö 47
sdl Shift_R+Ö Ö 62 47
sdl2 A a 4
sdl2 Shift_L+A A 225 4
sdl2 Ö ö 51
sdl2 Shift_R+Ö Ö 229 51

as you can see

  • some backends will include capitalisation (glut), while others will not (glfw3, glx, sdl, sdl2`)
  • some backends will use unicode points (glut at least for the printable characters, but notably not for Shift), others will almost use ASCII (glfw3 where it works for A but not for Ö), some will use XKeyCodes (glx, sdl) and some will use their own (sdl2)

traditionally i've always been torn between exposing low-level functionality and normalizing the output so it is consistent across all windowing backends and platforms.
in practice, normalizing the output is a task that i have no hope of implementing.

the important takeaway is, that you should not consider the output of [gemkeyboard] to be an ASCII value (or unicode point).
it's a number that represents a given key, not a letter.

from gem.

umlaeute avatar umlaeute commented on August 16, 2024

see also #15

from gem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.