20 #include <winpr/config.h>
22 #include <winpr/crt.h>
24 #include <winpr/input.h>
34 static DWORD KEYCODE_TO_VKCODE_APPLE[256] = {
140 VK_SNAPSHOT | KBDEXT,
299 static DWORD KEYCODE_TO_VKCODE_EVDEV[256] = {
397 VK_RCONTROL | KBDEXT,
399 VK_SNAPSHOT | KBDEXT,
413 VK_VOLUME_MUTE | KBDEXT,
414 VK_VOLUME_DOWN | KBDEXT,
415 VK_VOLUME_UP | KBDEXT,
457 VK_LAUNCH_MAIL | KBDEXT,
458 VK_BROWSER_FAVORITES | KBDEXT,
460 VK_BROWSER_BACK | KBDEXT,
461 VK_BROWSER_FORWARD | KBDEXT,
465 VK_MEDIA_NEXT_TRACK | KBDEXT,
466 VK_MEDIA_PLAY_PAUSE | KBDEXT,
467 VK_MEDIA_PREV_TRACK | KBDEXT,
468 VK_MEDIA_STOP | KBDEXT,
474 VK_BROWSER_HOME | KBDEXT,
475 VK_BROWSER_REFRESH | KBDEXT,
520 VK_BROWSER_SEARCH | KBDEXT,
576 static DWORD KEYCODE_TO_VKCODE_XKB[256] = {
696 VK_RCONTROL | KBDEXT,
698 VK_SNAPSHOT | KBDEXT,
713 VK_VOLUME_MUTE | KBDEXT,
714 VK_VOLUME_DOWN | KBDEXT,
715 VK_VOLUME_UP | KBDEXT,
755 VK_LAUNCH_MAIL | KBDEXT,
756 VK_BROWSER_FAVORITES | KBDEXT,
758 VK_BROWSER_BACK | KBDEXT,
759 VK_BROWSER_FORWARD | KBDEXT,
763 VK_MEDIA_NEXT_TRACK | KBDEXT,
764 VK_MEDIA_PLAY_PAUSE | KBDEXT,
765 VK_MEDIA_PREV_TRACK | KBDEXT,
766 VK_MEDIA_STOP | KBDEXT,
772 VK_BROWSER_HOME | KBDEXT,
773 VK_BROWSER_REFRESH | KBDEXT,
817 VK_BROWSER_SEARCH | KBDEXT,
850 DWORD GetVirtualKeyCodeFromKeycode(DWORD keycode, WINPR_KEYCODE_TYPE type)
858 case WINPR_KEYCODE_TYPE_APPLE:
860 vkcode = KEYCODE_TO_VKCODE_APPLE[keycode & 0xFF];
862 case WINPR_KEYCODE_TYPE_EVDEV:
864 vkcode = KEYCODE_TO_VKCODE_EVDEV[keycode & 0xFF];
866 case WINPR_KEYCODE_TYPE_XKB:
868 vkcode = KEYCODE_TO_VKCODE_XKB[keycode & 0xFF];
880 DWORD GetKeycodeFromVirtualKeyCode(DWORD vkcode, WINPR_KEYCODE_TYPE type)
882 DWORD* targetArray = NULL;
883 size_t targetSize = 0;
887 case WINPR_KEYCODE_TYPE_APPLE:
888 targetArray = KEYCODE_TO_VKCODE_APPLE;
889 targetSize = ARRAYSIZE(KEYCODE_TO_VKCODE_APPLE);
891 case WINPR_KEYCODE_TYPE_EVDEV:
892 targetArray = KEYCODE_TO_VKCODE_EVDEV;
893 targetSize = ARRAYSIZE(KEYCODE_TO_VKCODE_EVDEV);
895 case WINPR_KEYCODE_TYPE_XKB:
896 targetArray = KEYCODE_TO_VKCODE_XKB;
897 targetSize = ARRAYSIZE(KEYCODE_TO_VKCODE_XKB);
903 for (DWORD index = 0; index < targetSize; index++)
905 if (vkcode == targetArray[index])