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

Add keycodes support #156

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

pdesaulniers
Copy link
Contributor

This is an initial attempt at adding keycodes support to DPF.

These allow to deal with keyboard keys in a layout-independent manner. It's particularly useful for piano-style widgets, to map keyboard keys to piano notes in the correct order.

This code is based on https://github.com/depp/keycode, especially the <os>_tohid.c files and keycode.h in the src directory.

Tested with the piano widget on Linux, MacOS and Windows, with a couple of different layouts (Colemak, AZERTY, QWERTY).

The keycodes would be wrong when running the UI in Wine, but they would work fine on a real Windows 10 machine. I'm not sure if this is normal.

Perhaps it would be good to test this feature a little more before merging.

PUGL_KC_RightShift = 229,
PUGL_KC_RightAlt = 230,
PUGL_KC_RightGUI = 231
} PuglKeyCodes;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to expose this outside of pugl too. Otherwise, the users will have to include pugl.h to use these keycodes.

@falkTX
Copy link
Contributor

falkTX commented Jul 30, 2019

Looks good, but a few things to do:

  1. rename COPYING into COPYING.keycode
  2. make the keycode arrays static
  3. make KEYCODE_EVDEV_OFFSET static too, and check if opcode < KEYCODE_EVDEV_OFFSET before doing the -= operation (x11 code)

there are a little oddities regarding spaces vs tabs, but I can fix them later myself

also, exposing the keycode API would be nice yes :)

@pdesaulniers
Copy link
Contributor Author

OK, I've made the changes.

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.

2 participants