DPF icon indicating copy to clipboard operation
DPF copied to clipboard

Add keycodes support

Open pdesaulniers opened this issue 5 years ago • 2 comments

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.

pdesaulniers avatar Jul 29 '19 18:07 pdesaulniers

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 :)

falkTX avatar Jul 30 '19 17:07 falkTX

OK, I've made the changes.

pdesaulniers avatar Aug 26 '19 22:08 pdesaulniers