Browse Source

Adjustments to keycode support

pull/156/head
Patrick Desaulniers 6 years ago
parent
commit
07c65851ba
4 changed files with 7 additions and 4 deletions
  1. +0
    -0
      dgl/src/pugl/COPYING.keycode
  2. +1
    -1
      dgl/src/pugl/pugl_osx.m
  3. +1
    -1
      dgl/src/pugl/pugl_win.cpp
  4. +5
    -2
      dgl/src/pugl/pugl_x11.c

dgl/src/pugl/COPYING → dgl/src/pugl/COPYING.keycode View File


+ 1
- 1
dgl/src/pugl/pugl_osx.m View File

@@ -127,7 +127,7 @@ getModifiers(PuglView* view, NSEvent* ev)
static unsigned
scancodeToHID(unsigned scancode)
{
const unsigned char KEYCODE_MACOS_TO_HID[128] = {
static const unsigned char KEYCODE_MACOS_TO_HID[128] = {
4,22,7,9,11,10,29,27,6,25,0,5,20,26,8,21,28,23,30,31,32,33,35,34,46,38,36,
45,37,39,48,18,24,47,12,19,158,15,13,52,14,51,49,54,56,17,16,55,43,44,53,42,
0,41,231,227,225,57,226,224,229,230,228,0,108,220,0,85,0,87,0,216,0,0,127,


+ 1
- 1
dgl/src/pugl/pugl_win.cpp View File

@@ -383,7 +383,7 @@ setModifiers(PuglView* view)
static unsigned
keycodeToHID(unsigned keycode)
{
const unsigned char KEYCODE_WINDOWS_TO_HID[256] = {
static const unsigned char KEYCODE_WINDOWS_TO_HID[256] = {
0,41,30,31,32,33,34,35,36,37,38,39,45,46,42,43,20,26,8,21,23,28,24,12,18,19,
47,48,158,224,4,22,7,9,10,11,13,14,15,51,52,53,225,49,29,27,6,25,5,17,16,54,
55,56,229,0,226,0,57,58,59,60,61,62,63,64,65,66,67,72,71,0,0,0,0,0,0,0,0,0,


+ 5
- 2
dgl/src/pugl/pugl_x11.c View File

@@ -492,7 +492,7 @@ setModifiers(PuglView* view, unsigned xstate, unsigned xtime)
static unsigned
scancodeToHID(unsigned scancode)
{
const unsigned char KEYCODE_LINUX_TO_HID[256] = {
static const unsigned char KEYCODE_LINUX_TO_HID[256] = {
0,41,30,31,32,33,34,35,36,37,38,39,45,46,42,43,20,26,8,21,23,28,24,12,18,19,
47,48,158,224,4,22,7,9,10,11,13,14,15,51,52,53,225,49,29,27,6,25,5,17,16,54,
55,56,229,85,226,44,57,58,59,60,61,62,63,64,65,66,67,83,71,95,96,97,86,92,
@@ -505,8 +505,11 @@ scancodeToHID(unsigned scancode)
};

//On Linux, the keycodes are offset by KEYCODE_EVDEV_OFFSET when they are sent by evdev
const unsigned KEYCODE_EVDEV_OFFSET = 8;
static const unsigned KEYCODE_EVDEV_OFFSET = 8;

if (scancode < KEYCODE_EVDEV_OFFSET)
return 0;
scancode -= KEYCODE_EVDEV_OFFSET;

if (scancode >= 256)


Loading…
Cancel
Save