lib: Add missing Sun keyboard keys

This commit is contained in:
Felix Schmidt 2020-07-08 11:44:33 +02:00 committed by Povilas Kanapickas
parent bcdeee1f00
commit 0c86f1fbf9
4 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1 @@
Added support for additional keys on Sun Microsystems USB keyboards (https://github.com/debauchee/barrier/issues/784).

View File

@ -194,6 +194,12 @@ const KeyNameMapEntry kKeyNameMap[] = {
{ "Bar", 0x007c },
{ "BraceR", 0x007d },
{ "Tilde", 0x007e },
{ "Copy", kKeyCopy },
{ "Cut", kKeyCut },
{ "Open", kKeyOpen },
{ "Paste", kKeyPaste },
{ "Props", kKeyProps },
{ "Front", kKeyFront },
{ NULL, 0 },
};

View File

@ -236,6 +236,13 @@ static const KeyID kKeySuper_R = 0xEFEC; /* Right super */
static const KeyID kKeyHyper_L = 0xEFED; /* Left hyper */
static const KeyID kKeyHyper_R = 0xEFEE; /* Right hyper */
static const KeyID kKeyCopy = 0x1008EF57;
static const KeyID kKeyCut = 0x1008EF58;
static const KeyID kKeyOpen = 0x1008EF6b;
static const KeyID kKeyPaste = 0x1008EF6d;
static const KeyID kKeyProps = 0x1005EF70;
static const KeyID kKeyFront = 0x1005EF71;
// multi-key character composition
static const KeyID kKeyCompose = 0xEF20;
static const KeyID kKeyDeadGrave = 0x0300;

View File

@ -1285,6 +1285,45 @@ static const KeySym s_map1008FF[] =
/* 0xf8 */ 0, 0, 0, 0, 0, 0, 0, 0
};
// map Sun keyboard keys to KeyIDs
// This is based on the the "Internet" keymap plus the missing keys
// Copy/Cut/Open/Paste/Props/Front
static const KeySym s_map1009FF[] =
{
/* 0x00 */ 0, 0, kKeyBrightnessUp, kKeyBrightnessDown, 0, 0, 0, 0,
/* 0x08 */ 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x10 */ 0, kKeyAudioDown, kKeyAudioMute, kKeyAudioUp,
/* 0x14 */ kKeyAudioPlay, kKeyAudioStop, kKeyAudioPrev, kKeyAudioNext,
/* 0x18 */ kKeyWWW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0, 0, 0, 0, 0,
/* 0xf0 */ 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xf8 */ 0, 0, 0, 0, 0, 0, 0, 0
};
//
// XWindowsUtil
@ -1546,6 +1585,10 @@ XWindowsUtil::mapKeySymToKeyID(KeySym k)
// "Internet" keys
return s_map1008FF[k & 0xff];
case 0x1009ff00:
// Additional Left-side keys provided by Sun Microsystems USB keyboards
return s_map1009FF[k & 0xff];
default: {
// lookup character in table
KeySymMap::const_iterator index = s_keySymToUCS4.find(k);