Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use xcb-xkb and xkbcommon for input event handling #6

Merged
merged 8 commits into from
Nov 6, 2020

Conversation

serenity4
Copy link
Collaborator

I added a generator for xcb-xkb (a header from Xorg_libxcb_jll that was not wrapped) and xkbcommon. I also improved the processing done to retrieve a character from an input event, by keeping track of the keymap state (modifiers pressed such as Shift or Caps lock) and of keymap changes (say, a user switches from AZERTY to QWERTY).

@serenity4
Copy link
Collaborator Author

serenity4 commented Oct 28, 2020

I detected a misconception when handling key events: I assumed that we only want a character out, along with the state of the keyboard (to detect, for example, a shortcut being pressed such as ctrl+z). However:

  • we may want to get a printable character, for example when filling a text field
  • we may also want to get non-printable keys to be processed as a shortcut, with a string representation of the key (preferably API agnostic)

In the current KeyEvent structure that is being generated upon a keystroke, there is only a field with a KeyCombination that holds a char and keyboard modifiers. We should have a field for a printable character (when inputting text), and also a name for the key itself (not for what it inputs). The KeyEvent struct from WindowAbstractions will have to be modified to take this into account.

EDIT: see serenity4/WindowAbstractions.jl#4
EDIT 2: we should also differentiate from the name of the symbol being processed (printable or not) such as "INSERT" for the insert key, and from the name of the physical key (considering its fixed position on the keyboard), which would be D30 in this case according to the ISO 9995

@serenity4
Copy link
Collaborator Author

I moved some event processing to the package itself, namely a function that returns the corresponding event upon receiving a xcb_generic_event_t struct, such as a xcb_key_press_event_t by comparing the looking up the event response type and matching it with possible response types.

@serenity4 serenity4 merged commit 902da36 into JuliaGL:master Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant