mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-10 01:01:30 +00:00
[client] input: send reports over LGMP
Use the LGMP input queue when the host advertises transport input, while preserving SPICE fallback through the existing input abstraction. Claim input lazily, publish ordered full-state keyboard and mouse reports without blocking rendering, and keep the owner lease alive. Reserve queue capacity for discrete transitions, coalesce only motion under pressure, and release ownership safely during idle and disconnect. Keep the Linux-to-HID map in the client and update LGMP to the nonblocking data-send API required by the input worker.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#define PS2_VOLUME_DOWN 0xE02E
|
||||
|
||||
extern const uint32_t linux_to_ps2[KEY_MAX];
|
||||
extern const uint8_t linux_to_hid[KEY_MAX];
|
||||
extern const char * linux_to_str[KEY_MAX];
|
||||
extern const char * linux_to_display[KEY_MAX];
|
||||
extern const int linux_to_imgui[KEY_MAX];
|
||||
|
||||
171
client/src/kb_hid.c
Normal file
171
client/src/kb_hid.c
Normal file
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
* Looking Glass
|
||||
* Copyright © 2017-2026 The Looking Glass Authors
|
||||
* https://looking-glass.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "kb.h"
|
||||
|
||||
const uint8_t linux_to_hid[KEY_MAX] =
|
||||
{
|
||||
[KEY_ESC] = 41,
|
||||
[KEY_1] = 30,
|
||||
[KEY_2] = 31,
|
||||
[KEY_3] = 32,
|
||||
[KEY_4] = 33,
|
||||
[KEY_5] = 34,
|
||||
[KEY_6] = 35,
|
||||
[KEY_7] = 36,
|
||||
[KEY_8] = 37,
|
||||
[KEY_9] = 38,
|
||||
[KEY_0] = 39,
|
||||
[KEY_MINUS] = 45,
|
||||
[KEY_EQUAL] = 46,
|
||||
[KEY_BACKSPACE] = 42,
|
||||
[KEY_TAB] = 43,
|
||||
[KEY_Q] = 20,
|
||||
[KEY_W] = 26,
|
||||
[KEY_E] = 8,
|
||||
[KEY_R] = 21,
|
||||
[KEY_T] = 23,
|
||||
[KEY_Y] = 28,
|
||||
[KEY_U] = 24,
|
||||
[KEY_I] = 12,
|
||||
[KEY_O] = 18,
|
||||
[KEY_P] = 19,
|
||||
[KEY_LEFTBRACE] = 47,
|
||||
[KEY_RIGHTBRACE] = 48,
|
||||
[KEY_ENTER] = 40,
|
||||
[KEY_LEFTCTRL] = 224,
|
||||
[KEY_A] = 4,
|
||||
[KEY_S] = 22,
|
||||
[KEY_D] = 7,
|
||||
[KEY_F] = 9,
|
||||
[KEY_G] = 10,
|
||||
[KEY_H] = 11,
|
||||
[KEY_J] = 13,
|
||||
[KEY_K] = 14,
|
||||
[KEY_L] = 15,
|
||||
[KEY_SEMICOLON] = 51,
|
||||
[KEY_APOSTROPHE] = 52,
|
||||
[KEY_GRAVE] = 53,
|
||||
[KEY_LEFTSHIFT] = 225,
|
||||
[KEY_BACKSLASH] = 49,
|
||||
[KEY_Z] = 29,
|
||||
[KEY_X] = 27,
|
||||
[KEY_C] = 6,
|
||||
[KEY_V] = 25,
|
||||
[KEY_B] = 5,
|
||||
[KEY_N] = 17,
|
||||
[KEY_M] = 16,
|
||||
[KEY_COMMA] = 54,
|
||||
[KEY_DOT] = 55,
|
||||
[KEY_SLASH] = 56,
|
||||
[KEY_RIGHTSHIFT] = 229,
|
||||
[KEY_KPASTERISK] = 85,
|
||||
[KEY_LEFTALT] = 226,
|
||||
[KEY_SPACE] = 44,
|
||||
[KEY_CAPSLOCK] = 57,
|
||||
[KEY_F1] = 58,
|
||||
[KEY_F2] = 59,
|
||||
[KEY_F3] = 60,
|
||||
[KEY_F4] = 61,
|
||||
[KEY_F5] = 62,
|
||||
[KEY_F6] = 63,
|
||||
[KEY_F7] = 64,
|
||||
[KEY_F8] = 65,
|
||||
[KEY_F9] = 66,
|
||||
[KEY_F10] = 67,
|
||||
[KEY_NUMLOCK] = 83,
|
||||
[KEY_SCROLLLOCK] = 71,
|
||||
[KEY_KP7] = 95,
|
||||
[KEY_KP8] = 96,
|
||||
[KEY_KP9] = 97,
|
||||
[KEY_KPMINUS] = 86,
|
||||
[KEY_KP4] = 92,
|
||||
[KEY_KP5] = 93,
|
||||
[KEY_KP6] = 94,
|
||||
[KEY_KPPLUS] = 87,
|
||||
[KEY_KP1] = 89,
|
||||
[KEY_KP2] = 90,
|
||||
[KEY_KP3] = 91,
|
||||
[KEY_KP0] = 98,
|
||||
[KEY_KPDOT] = 99,
|
||||
[KEY_102ND] = 100,
|
||||
[KEY_F11] = 68,
|
||||
[KEY_F12] = 69,
|
||||
[KEY_RO] = 135,
|
||||
[KEY_HENKAN] = 138,
|
||||
[KEY_KATAKANAHIRAGANA] = 136,
|
||||
[KEY_MUHENKAN] = 139,
|
||||
[KEY_KPENTER] = 88,
|
||||
[KEY_RIGHTCTRL] = 228,
|
||||
[KEY_KPSLASH] = 84,
|
||||
[KEY_SYSRQ] = 70,
|
||||
[KEY_RIGHTALT] = 230,
|
||||
[KEY_HOME] = 74,
|
||||
[KEY_UP] = 82,
|
||||
[KEY_PAGEUP] = 75,
|
||||
[KEY_LEFT] = 80,
|
||||
[KEY_RIGHT] = 79,
|
||||
[KEY_END] = 77,
|
||||
[KEY_DOWN] = 81,
|
||||
[KEY_PAGEDOWN] = 78,
|
||||
[KEY_INSERT] = 73,
|
||||
[KEY_DELETE] = 76,
|
||||
[KEY_KPEQUAL] = 103,
|
||||
[KEY_PAUSE] = 72,
|
||||
[KEY_KPCOMMA] = 133,
|
||||
[KEY_HANGEUL] = 144,
|
||||
[KEY_HANJA] = 145,
|
||||
[KEY_YEN] = 137,
|
||||
[KEY_LEFTMETA] = 227,
|
||||
[KEY_RIGHTMETA] = 231,
|
||||
[KEY_COMPOSE] = 101,
|
||||
[KEY_POWER] = 102,
|
||||
[KEY_F13] = 104,
|
||||
[KEY_F14] = 105,
|
||||
[KEY_F15] = 106,
|
||||
[KEY_F16] = 107,
|
||||
[KEY_F17] = 108,
|
||||
[KEY_F18] = 109,
|
||||
[KEY_F19] = 110,
|
||||
[KEY_F20] = 111,
|
||||
[KEY_F21] = 112,
|
||||
[KEY_F22] = 113,
|
||||
[KEY_F23] = 114,
|
||||
[KEY_F24] = 115,
|
||||
[KEY_OPEN] = 116,
|
||||
[KEY_HELP] = 117,
|
||||
[KEY_MENU] = 118,
|
||||
[KEY_FRONT] = 119,
|
||||
[KEY_AGAIN] = 121,
|
||||
[KEY_UNDO] = 122,
|
||||
[KEY_CUT] = 123,
|
||||
[KEY_COPY] = 124,
|
||||
[KEY_PASTE] = 125,
|
||||
[KEY_KPJPCOMMA] = 140,
|
||||
[KEY_KATAKANA] = 146,
|
||||
[KEY_HIRAGANA] = 147,
|
||||
[KEY_ZENKAKUHANKAKU] = 148,
|
||||
[KEY_KPLEFTPAREN] = 182,
|
||||
[KEY_KPRIGHTPAREN] = 183,
|
||||
[KEY_PRINT] = 70,
|
||||
[KEY_MUTE] = 127,
|
||||
[KEY_VOLUMEUP] = 128,
|
||||
[KEY_VOLUMEDOWN] = 129,
|
||||
};
|
||||
Reference in New Issue
Block a user