mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 10:05:10 +00:00
Cleanup
This commit is contained in:
parent
acce7ec9cf
commit
e6a32db7b9
230
src/cocoa_init.m
230
src/cocoa_init.m
@ -74,129 +74,129 @@ static void createKeyTables(void)
|
|||||||
{
|
{
|
||||||
int scancode;
|
int scancode;
|
||||||
|
|
||||||
memset(_glfw.ns.publicKeys, -1, sizeof(_glfw.ns.publicKeys));
|
memset(_glfw.ns.keycodes, -1, sizeof(_glfw.ns.keycodes));
|
||||||
memset(_glfw.ns.nativeKeys, -1, sizeof(_glfw.ns.nativeKeys));
|
memset(_glfw.ns.scancodes, -1, sizeof(_glfw.ns.scancodes));
|
||||||
|
|
||||||
_glfw.ns.publicKeys[0x1D] = GLFW_KEY_0;
|
_glfw.ns.keycodes[0x1D] = GLFW_KEY_0;
|
||||||
_glfw.ns.publicKeys[0x12] = GLFW_KEY_1;
|
_glfw.ns.keycodes[0x12] = GLFW_KEY_1;
|
||||||
_glfw.ns.publicKeys[0x13] = GLFW_KEY_2;
|
_glfw.ns.keycodes[0x13] = GLFW_KEY_2;
|
||||||
_glfw.ns.publicKeys[0x14] = GLFW_KEY_3;
|
_glfw.ns.keycodes[0x14] = GLFW_KEY_3;
|
||||||
_glfw.ns.publicKeys[0x15] = GLFW_KEY_4;
|
_glfw.ns.keycodes[0x15] = GLFW_KEY_4;
|
||||||
_glfw.ns.publicKeys[0x17] = GLFW_KEY_5;
|
_glfw.ns.keycodes[0x17] = GLFW_KEY_5;
|
||||||
_glfw.ns.publicKeys[0x16] = GLFW_KEY_6;
|
_glfw.ns.keycodes[0x16] = GLFW_KEY_6;
|
||||||
_glfw.ns.publicKeys[0x1A] = GLFW_KEY_7;
|
_glfw.ns.keycodes[0x1A] = GLFW_KEY_7;
|
||||||
_glfw.ns.publicKeys[0x1C] = GLFW_KEY_8;
|
_glfw.ns.keycodes[0x1C] = GLFW_KEY_8;
|
||||||
_glfw.ns.publicKeys[0x19] = GLFW_KEY_9;
|
_glfw.ns.keycodes[0x19] = GLFW_KEY_9;
|
||||||
_glfw.ns.publicKeys[0x00] = GLFW_KEY_A;
|
_glfw.ns.keycodes[0x00] = GLFW_KEY_A;
|
||||||
_glfw.ns.publicKeys[0x0B] = GLFW_KEY_B;
|
_glfw.ns.keycodes[0x0B] = GLFW_KEY_B;
|
||||||
_glfw.ns.publicKeys[0x08] = GLFW_KEY_C;
|
_glfw.ns.keycodes[0x08] = GLFW_KEY_C;
|
||||||
_glfw.ns.publicKeys[0x02] = GLFW_KEY_D;
|
_glfw.ns.keycodes[0x02] = GLFW_KEY_D;
|
||||||
_glfw.ns.publicKeys[0x0E] = GLFW_KEY_E;
|
_glfw.ns.keycodes[0x0E] = GLFW_KEY_E;
|
||||||
_glfw.ns.publicKeys[0x03] = GLFW_KEY_F;
|
_glfw.ns.keycodes[0x03] = GLFW_KEY_F;
|
||||||
_glfw.ns.publicKeys[0x05] = GLFW_KEY_G;
|
_glfw.ns.keycodes[0x05] = GLFW_KEY_G;
|
||||||
_glfw.ns.publicKeys[0x04] = GLFW_KEY_H;
|
_glfw.ns.keycodes[0x04] = GLFW_KEY_H;
|
||||||
_glfw.ns.publicKeys[0x22] = GLFW_KEY_I;
|
_glfw.ns.keycodes[0x22] = GLFW_KEY_I;
|
||||||
_glfw.ns.publicKeys[0x26] = GLFW_KEY_J;
|
_glfw.ns.keycodes[0x26] = GLFW_KEY_J;
|
||||||
_glfw.ns.publicKeys[0x28] = GLFW_KEY_K;
|
_glfw.ns.keycodes[0x28] = GLFW_KEY_K;
|
||||||
_glfw.ns.publicKeys[0x25] = GLFW_KEY_L;
|
_glfw.ns.keycodes[0x25] = GLFW_KEY_L;
|
||||||
_glfw.ns.publicKeys[0x2E] = GLFW_KEY_M;
|
_glfw.ns.keycodes[0x2E] = GLFW_KEY_M;
|
||||||
_glfw.ns.publicKeys[0x2D] = GLFW_KEY_N;
|
_glfw.ns.keycodes[0x2D] = GLFW_KEY_N;
|
||||||
_glfw.ns.publicKeys[0x1F] = GLFW_KEY_O;
|
_glfw.ns.keycodes[0x1F] = GLFW_KEY_O;
|
||||||
_glfw.ns.publicKeys[0x23] = GLFW_KEY_P;
|
_glfw.ns.keycodes[0x23] = GLFW_KEY_P;
|
||||||
_glfw.ns.publicKeys[0x0C] = GLFW_KEY_Q;
|
_glfw.ns.keycodes[0x0C] = GLFW_KEY_Q;
|
||||||
_glfw.ns.publicKeys[0x0F] = GLFW_KEY_R;
|
_glfw.ns.keycodes[0x0F] = GLFW_KEY_R;
|
||||||
_glfw.ns.publicKeys[0x01] = GLFW_KEY_S;
|
_glfw.ns.keycodes[0x01] = GLFW_KEY_S;
|
||||||
_glfw.ns.publicKeys[0x11] = GLFW_KEY_T;
|
_glfw.ns.keycodes[0x11] = GLFW_KEY_T;
|
||||||
_glfw.ns.publicKeys[0x20] = GLFW_KEY_U;
|
_glfw.ns.keycodes[0x20] = GLFW_KEY_U;
|
||||||
_glfw.ns.publicKeys[0x09] = GLFW_KEY_V;
|
_glfw.ns.keycodes[0x09] = GLFW_KEY_V;
|
||||||
_glfw.ns.publicKeys[0x0D] = GLFW_KEY_W;
|
_glfw.ns.keycodes[0x0D] = GLFW_KEY_W;
|
||||||
_glfw.ns.publicKeys[0x07] = GLFW_KEY_X;
|
_glfw.ns.keycodes[0x07] = GLFW_KEY_X;
|
||||||
_glfw.ns.publicKeys[0x10] = GLFW_KEY_Y;
|
_glfw.ns.keycodes[0x10] = GLFW_KEY_Y;
|
||||||
_glfw.ns.publicKeys[0x06] = GLFW_KEY_Z;
|
_glfw.ns.keycodes[0x06] = GLFW_KEY_Z;
|
||||||
|
|
||||||
_glfw.ns.publicKeys[0x27] = GLFW_KEY_APOSTROPHE;
|
_glfw.ns.keycodes[0x27] = GLFW_KEY_APOSTROPHE;
|
||||||
_glfw.ns.publicKeys[0x2A] = GLFW_KEY_BACKSLASH;
|
_glfw.ns.keycodes[0x2A] = GLFW_KEY_BACKSLASH;
|
||||||
_glfw.ns.publicKeys[0x2B] = GLFW_KEY_COMMA;
|
_glfw.ns.keycodes[0x2B] = GLFW_KEY_COMMA;
|
||||||
_glfw.ns.publicKeys[0x18] = GLFW_KEY_EQUAL;
|
_glfw.ns.keycodes[0x18] = GLFW_KEY_EQUAL;
|
||||||
_glfw.ns.publicKeys[0x32] = GLFW_KEY_GRAVE_ACCENT;
|
_glfw.ns.keycodes[0x32] = GLFW_KEY_GRAVE_ACCENT;
|
||||||
_glfw.ns.publicKeys[0x21] = GLFW_KEY_LEFT_BRACKET;
|
_glfw.ns.keycodes[0x21] = GLFW_KEY_LEFT_BRACKET;
|
||||||
_glfw.ns.publicKeys[0x1B] = GLFW_KEY_MINUS;
|
_glfw.ns.keycodes[0x1B] = GLFW_KEY_MINUS;
|
||||||
_glfw.ns.publicKeys[0x2F] = GLFW_KEY_PERIOD;
|
_glfw.ns.keycodes[0x2F] = GLFW_KEY_PERIOD;
|
||||||
_glfw.ns.publicKeys[0x1E] = GLFW_KEY_RIGHT_BRACKET;
|
_glfw.ns.keycodes[0x1E] = GLFW_KEY_RIGHT_BRACKET;
|
||||||
_glfw.ns.publicKeys[0x29] = GLFW_KEY_SEMICOLON;
|
_glfw.ns.keycodes[0x29] = GLFW_KEY_SEMICOLON;
|
||||||
_glfw.ns.publicKeys[0x2C] = GLFW_KEY_SLASH;
|
_glfw.ns.keycodes[0x2C] = GLFW_KEY_SLASH;
|
||||||
_glfw.ns.publicKeys[0x0A] = GLFW_KEY_WORLD_1;
|
_glfw.ns.keycodes[0x0A] = GLFW_KEY_WORLD_1;
|
||||||
|
|
||||||
_glfw.ns.publicKeys[0x33] = GLFW_KEY_BACKSPACE;
|
_glfw.ns.keycodes[0x33] = GLFW_KEY_BACKSPACE;
|
||||||
_glfw.ns.publicKeys[0x39] = GLFW_KEY_CAPS_LOCK;
|
_glfw.ns.keycodes[0x39] = GLFW_KEY_CAPS_LOCK;
|
||||||
_glfw.ns.publicKeys[0x75] = GLFW_KEY_DELETE;
|
_glfw.ns.keycodes[0x75] = GLFW_KEY_DELETE;
|
||||||
_glfw.ns.publicKeys[0x7D] = GLFW_KEY_DOWN;
|
_glfw.ns.keycodes[0x7D] = GLFW_KEY_DOWN;
|
||||||
_glfw.ns.publicKeys[0x77] = GLFW_KEY_END;
|
_glfw.ns.keycodes[0x77] = GLFW_KEY_END;
|
||||||
_glfw.ns.publicKeys[0x24] = GLFW_KEY_ENTER;
|
_glfw.ns.keycodes[0x24] = GLFW_KEY_ENTER;
|
||||||
_glfw.ns.publicKeys[0x35] = GLFW_KEY_ESCAPE;
|
_glfw.ns.keycodes[0x35] = GLFW_KEY_ESCAPE;
|
||||||
_glfw.ns.publicKeys[0x7A] = GLFW_KEY_F1;
|
_glfw.ns.keycodes[0x7A] = GLFW_KEY_F1;
|
||||||
_glfw.ns.publicKeys[0x78] = GLFW_KEY_F2;
|
_glfw.ns.keycodes[0x78] = GLFW_KEY_F2;
|
||||||
_glfw.ns.publicKeys[0x63] = GLFW_KEY_F3;
|
_glfw.ns.keycodes[0x63] = GLFW_KEY_F3;
|
||||||
_glfw.ns.publicKeys[0x76] = GLFW_KEY_F4;
|
_glfw.ns.keycodes[0x76] = GLFW_KEY_F4;
|
||||||
_glfw.ns.publicKeys[0x60] = GLFW_KEY_F5;
|
_glfw.ns.keycodes[0x60] = GLFW_KEY_F5;
|
||||||
_glfw.ns.publicKeys[0x61] = GLFW_KEY_F6;
|
_glfw.ns.keycodes[0x61] = GLFW_KEY_F6;
|
||||||
_glfw.ns.publicKeys[0x62] = GLFW_KEY_F7;
|
_glfw.ns.keycodes[0x62] = GLFW_KEY_F7;
|
||||||
_glfw.ns.publicKeys[0x64] = GLFW_KEY_F8;
|
_glfw.ns.keycodes[0x64] = GLFW_KEY_F8;
|
||||||
_glfw.ns.publicKeys[0x65] = GLFW_KEY_F9;
|
_glfw.ns.keycodes[0x65] = GLFW_KEY_F9;
|
||||||
_glfw.ns.publicKeys[0x6D] = GLFW_KEY_F10;
|
_glfw.ns.keycodes[0x6D] = GLFW_KEY_F10;
|
||||||
_glfw.ns.publicKeys[0x67] = GLFW_KEY_F11;
|
_glfw.ns.keycodes[0x67] = GLFW_KEY_F11;
|
||||||
_glfw.ns.publicKeys[0x6F] = GLFW_KEY_F12;
|
_glfw.ns.keycodes[0x6F] = GLFW_KEY_F12;
|
||||||
_glfw.ns.publicKeys[0x69] = GLFW_KEY_F13;
|
_glfw.ns.keycodes[0x69] = GLFW_KEY_F13;
|
||||||
_glfw.ns.publicKeys[0x6B] = GLFW_KEY_F14;
|
_glfw.ns.keycodes[0x6B] = GLFW_KEY_F14;
|
||||||
_glfw.ns.publicKeys[0x71] = GLFW_KEY_F15;
|
_glfw.ns.keycodes[0x71] = GLFW_KEY_F15;
|
||||||
_glfw.ns.publicKeys[0x6A] = GLFW_KEY_F16;
|
_glfw.ns.keycodes[0x6A] = GLFW_KEY_F16;
|
||||||
_glfw.ns.publicKeys[0x40] = GLFW_KEY_F17;
|
_glfw.ns.keycodes[0x40] = GLFW_KEY_F17;
|
||||||
_glfw.ns.publicKeys[0x4F] = GLFW_KEY_F18;
|
_glfw.ns.keycodes[0x4F] = GLFW_KEY_F18;
|
||||||
_glfw.ns.publicKeys[0x50] = GLFW_KEY_F19;
|
_glfw.ns.keycodes[0x50] = GLFW_KEY_F19;
|
||||||
_glfw.ns.publicKeys[0x5A] = GLFW_KEY_F20;
|
_glfw.ns.keycodes[0x5A] = GLFW_KEY_F20;
|
||||||
_glfw.ns.publicKeys[0x73] = GLFW_KEY_HOME;
|
_glfw.ns.keycodes[0x73] = GLFW_KEY_HOME;
|
||||||
_glfw.ns.publicKeys[0x72] = GLFW_KEY_INSERT;
|
_glfw.ns.keycodes[0x72] = GLFW_KEY_INSERT;
|
||||||
_glfw.ns.publicKeys[0x7B] = GLFW_KEY_LEFT;
|
_glfw.ns.keycodes[0x7B] = GLFW_KEY_LEFT;
|
||||||
_glfw.ns.publicKeys[0x3A] = GLFW_KEY_LEFT_ALT;
|
_glfw.ns.keycodes[0x3A] = GLFW_KEY_LEFT_ALT;
|
||||||
_glfw.ns.publicKeys[0x3B] = GLFW_KEY_LEFT_CONTROL;
|
_glfw.ns.keycodes[0x3B] = GLFW_KEY_LEFT_CONTROL;
|
||||||
_glfw.ns.publicKeys[0x38] = GLFW_KEY_LEFT_SHIFT;
|
_glfw.ns.keycodes[0x38] = GLFW_KEY_LEFT_SHIFT;
|
||||||
_glfw.ns.publicKeys[0x37] = GLFW_KEY_LEFT_SUPER;
|
_glfw.ns.keycodes[0x37] = GLFW_KEY_LEFT_SUPER;
|
||||||
_glfw.ns.publicKeys[0x6E] = GLFW_KEY_MENU;
|
_glfw.ns.keycodes[0x6E] = GLFW_KEY_MENU;
|
||||||
_glfw.ns.publicKeys[0x47] = GLFW_KEY_NUM_LOCK;
|
_glfw.ns.keycodes[0x47] = GLFW_KEY_NUM_LOCK;
|
||||||
_glfw.ns.publicKeys[0x79] = GLFW_KEY_PAGE_DOWN;
|
_glfw.ns.keycodes[0x79] = GLFW_KEY_PAGE_DOWN;
|
||||||
_glfw.ns.publicKeys[0x74] = GLFW_KEY_PAGE_UP;
|
_glfw.ns.keycodes[0x74] = GLFW_KEY_PAGE_UP;
|
||||||
_glfw.ns.publicKeys[0x7C] = GLFW_KEY_RIGHT;
|
_glfw.ns.keycodes[0x7C] = GLFW_KEY_RIGHT;
|
||||||
_glfw.ns.publicKeys[0x3D] = GLFW_KEY_RIGHT_ALT;
|
_glfw.ns.keycodes[0x3D] = GLFW_KEY_RIGHT_ALT;
|
||||||
_glfw.ns.publicKeys[0x3E] = GLFW_KEY_RIGHT_CONTROL;
|
_glfw.ns.keycodes[0x3E] = GLFW_KEY_RIGHT_CONTROL;
|
||||||
_glfw.ns.publicKeys[0x3C] = GLFW_KEY_RIGHT_SHIFT;
|
_glfw.ns.keycodes[0x3C] = GLFW_KEY_RIGHT_SHIFT;
|
||||||
_glfw.ns.publicKeys[0x36] = GLFW_KEY_RIGHT_SUPER;
|
_glfw.ns.keycodes[0x36] = GLFW_KEY_RIGHT_SUPER;
|
||||||
_glfw.ns.publicKeys[0x31] = GLFW_KEY_SPACE;
|
_glfw.ns.keycodes[0x31] = GLFW_KEY_SPACE;
|
||||||
_glfw.ns.publicKeys[0x30] = GLFW_KEY_TAB;
|
_glfw.ns.keycodes[0x30] = GLFW_KEY_TAB;
|
||||||
_glfw.ns.publicKeys[0x7E] = GLFW_KEY_UP;
|
_glfw.ns.keycodes[0x7E] = GLFW_KEY_UP;
|
||||||
|
|
||||||
_glfw.ns.publicKeys[0x52] = GLFW_KEY_KP_0;
|
_glfw.ns.keycodes[0x52] = GLFW_KEY_KP_0;
|
||||||
_glfw.ns.publicKeys[0x53] = GLFW_KEY_KP_1;
|
_glfw.ns.keycodes[0x53] = GLFW_KEY_KP_1;
|
||||||
_glfw.ns.publicKeys[0x54] = GLFW_KEY_KP_2;
|
_glfw.ns.keycodes[0x54] = GLFW_KEY_KP_2;
|
||||||
_glfw.ns.publicKeys[0x55] = GLFW_KEY_KP_3;
|
_glfw.ns.keycodes[0x55] = GLFW_KEY_KP_3;
|
||||||
_glfw.ns.publicKeys[0x56] = GLFW_KEY_KP_4;
|
_glfw.ns.keycodes[0x56] = GLFW_KEY_KP_4;
|
||||||
_glfw.ns.publicKeys[0x57] = GLFW_KEY_KP_5;
|
_glfw.ns.keycodes[0x57] = GLFW_KEY_KP_5;
|
||||||
_glfw.ns.publicKeys[0x58] = GLFW_KEY_KP_6;
|
_glfw.ns.keycodes[0x58] = GLFW_KEY_KP_6;
|
||||||
_glfw.ns.publicKeys[0x59] = GLFW_KEY_KP_7;
|
_glfw.ns.keycodes[0x59] = GLFW_KEY_KP_7;
|
||||||
_glfw.ns.publicKeys[0x5B] = GLFW_KEY_KP_8;
|
_glfw.ns.keycodes[0x5B] = GLFW_KEY_KP_8;
|
||||||
_glfw.ns.publicKeys[0x5C] = GLFW_KEY_KP_9;
|
_glfw.ns.keycodes[0x5C] = GLFW_KEY_KP_9;
|
||||||
_glfw.ns.publicKeys[0x45] = GLFW_KEY_KP_ADD;
|
_glfw.ns.keycodes[0x45] = GLFW_KEY_KP_ADD;
|
||||||
_glfw.ns.publicKeys[0x41] = GLFW_KEY_KP_DECIMAL;
|
_glfw.ns.keycodes[0x41] = GLFW_KEY_KP_DECIMAL;
|
||||||
_glfw.ns.publicKeys[0x4B] = GLFW_KEY_KP_DIVIDE;
|
_glfw.ns.keycodes[0x4B] = GLFW_KEY_KP_DIVIDE;
|
||||||
_glfw.ns.publicKeys[0x4C] = GLFW_KEY_KP_ENTER;
|
_glfw.ns.keycodes[0x4C] = GLFW_KEY_KP_ENTER;
|
||||||
_glfw.ns.publicKeys[0x51] = GLFW_KEY_KP_EQUAL;
|
_glfw.ns.keycodes[0x51] = GLFW_KEY_KP_EQUAL;
|
||||||
_glfw.ns.publicKeys[0x43] = GLFW_KEY_KP_MULTIPLY;
|
_glfw.ns.keycodes[0x43] = GLFW_KEY_KP_MULTIPLY;
|
||||||
_glfw.ns.publicKeys[0x4E] = GLFW_KEY_KP_SUBTRACT;
|
_glfw.ns.keycodes[0x4E] = GLFW_KEY_KP_SUBTRACT;
|
||||||
|
|
||||||
for (scancode = 0; scancode < 256; scancode++)
|
for (scancode = 0; scancode < 256; scancode++)
|
||||||
{
|
{
|
||||||
// Store the reverse translation for faster key name lookup
|
// Store the reverse translation for faster key name lookup
|
||||||
if (_glfw.ns.publicKeys[scancode] >= 0)
|
if (_glfw.ns.keycodes[scancode] >= 0)
|
||||||
_glfw.ns.nativeKeys[_glfw.ns.publicKeys[scancode]] = scancode;
|
_glfw.ns.scancodes[_glfw.ns.keycodes[scancode]] = scancode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,8 +96,8 @@ typedef struct _GLFWlibraryNS
|
|||||||
id listener;
|
id listener;
|
||||||
|
|
||||||
char keyName[64];
|
char keyName[64];
|
||||||
short int publicKeys[256];
|
short int keycodes[256];
|
||||||
short int nativeKeys[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
// Where to place the cursor when re-enabled
|
// Where to place the cursor when re-enabled
|
||||||
double restoreCursorPosX, restoreCursorPosY;
|
double restoreCursorPosX, restoreCursorPosY;
|
||||||
|
@ -166,10 +166,10 @@ static int translateFlags(NSUInteger flags)
|
|||||||
//
|
//
|
||||||
static int translateKey(unsigned int key)
|
static int translateKey(unsigned int key)
|
||||||
{
|
{
|
||||||
if (key >= sizeof(_glfw.ns.publicKeys) / sizeof(_glfw.ns.publicKeys[0]))
|
if (key >= sizeof(_glfw.ns.keycodes) / sizeof(_glfw.ns.keycodes[0]))
|
||||||
return GLFW_KEY_UNKNOWN;
|
return GLFW_KEY_UNKNOWN;
|
||||||
|
|
||||||
return _glfw.ns.publicKeys[key];
|
return _glfw.ns.keycodes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Translate a GLFW keycode to a Cocoa modifier flag
|
// Translate a GLFW keycode to a Cocoa modifier flag
|
||||||
@ -1472,9 +1472,9 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
|||||||
const char* _glfwPlatformGetKeyName(int key, int scancode)
|
const char* _glfwPlatformGetKeyName(int key, int scancode)
|
||||||
{
|
{
|
||||||
if (key != GLFW_KEY_UNKNOWN)
|
if (key != GLFW_KEY_UNKNOWN)
|
||||||
scancode = _glfw.ns.nativeKeys[key];
|
scancode = _glfw.ns.scancodes[key];
|
||||||
|
|
||||||
if (!_glfwIsPrintable(_glfw.ns.publicKeys[scancode]))
|
if (!_glfwIsPrintable(_glfw.ns.keycodes[scancode]))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
UInt32 deadKeyState = 0;
|
UInt32 deadKeyState = 0;
|
||||||
@ -1513,7 +1513,7 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
|
|
||||||
int _glfwPlatformGetKeyScancode(int key)
|
int _glfwPlatformGetKeyScancode(int key)
|
||||||
{
|
{
|
||||||
return _glfw.ns.nativeKeys[key];
|
return _glfw.ns.scancodes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
|
240
src/mir_init.c
240
src/mir_init.c
@ -37,130 +37,130 @@ static void createKeyTables(void)
|
|||||||
{
|
{
|
||||||
int scancode;
|
int scancode;
|
||||||
|
|
||||||
memset(_glfw.mir.publicKeys, -1, sizeof(_glfw.mir.publicKeys));
|
memset(_glfw.mir.keycodes, -1, sizeof(_glfw.mir.keycodes));
|
||||||
memset(_glfw.mir.nativeKeys, -1, sizeof(_glfw.mir.nativeKeys));
|
memset(_glfw.mir.scancodes, -1, sizeof(_glfw.mir.scancodes));
|
||||||
|
|
||||||
_glfw.mir.publicKeys[KEY_GRAVE] = GLFW_KEY_GRAVE_ACCENT;
|
_glfw.mir.keycodes[KEY_GRAVE] = GLFW_KEY_GRAVE_ACCENT;
|
||||||
_glfw.mir.publicKeys[KEY_1] = GLFW_KEY_1;
|
_glfw.mir.keycodes[KEY_1] = GLFW_KEY_1;
|
||||||
_glfw.mir.publicKeys[KEY_2] = GLFW_KEY_2;
|
_glfw.mir.keycodes[KEY_2] = GLFW_KEY_2;
|
||||||
_glfw.mir.publicKeys[KEY_3] = GLFW_KEY_3;
|
_glfw.mir.keycodes[KEY_3] = GLFW_KEY_3;
|
||||||
_glfw.mir.publicKeys[KEY_4] = GLFW_KEY_4;
|
_glfw.mir.keycodes[KEY_4] = GLFW_KEY_4;
|
||||||
_glfw.mir.publicKeys[KEY_5] = GLFW_KEY_5;
|
_glfw.mir.keycodes[KEY_5] = GLFW_KEY_5;
|
||||||
_glfw.mir.publicKeys[KEY_6] = GLFW_KEY_6;
|
_glfw.mir.keycodes[KEY_6] = GLFW_KEY_6;
|
||||||
_glfw.mir.publicKeys[KEY_7] = GLFW_KEY_7;
|
_glfw.mir.keycodes[KEY_7] = GLFW_KEY_7;
|
||||||
_glfw.mir.publicKeys[KEY_8] = GLFW_KEY_8;
|
_glfw.mir.keycodes[KEY_8] = GLFW_KEY_8;
|
||||||
_glfw.mir.publicKeys[KEY_9] = GLFW_KEY_9;
|
_glfw.mir.keycodes[KEY_9] = GLFW_KEY_9;
|
||||||
_glfw.mir.publicKeys[KEY_0] = GLFW_KEY_0;
|
_glfw.mir.keycodes[KEY_0] = GLFW_KEY_0;
|
||||||
_glfw.mir.publicKeys[KEY_MINUS] = GLFW_KEY_MINUS;
|
_glfw.mir.keycodes[KEY_MINUS] = GLFW_KEY_MINUS;
|
||||||
_glfw.mir.publicKeys[KEY_EQUAL] = GLFW_KEY_EQUAL;
|
_glfw.mir.keycodes[KEY_EQUAL] = GLFW_KEY_EQUAL;
|
||||||
_glfw.mir.publicKeys[KEY_Q] = GLFW_KEY_Q;
|
_glfw.mir.keycodes[KEY_Q] = GLFW_KEY_Q;
|
||||||
_glfw.mir.publicKeys[KEY_W] = GLFW_KEY_W;
|
_glfw.mir.keycodes[KEY_W] = GLFW_KEY_W;
|
||||||
_glfw.mir.publicKeys[KEY_E] = GLFW_KEY_E;
|
_glfw.mir.keycodes[KEY_E] = GLFW_KEY_E;
|
||||||
_glfw.mir.publicKeys[KEY_R] = GLFW_KEY_R;
|
_glfw.mir.keycodes[KEY_R] = GLFW_KEY_R;
|
||||||
_glfw.mir.publicKeys[KEY_T] = GLFW_KEY_T;
|
_glfw.mir.keycodes[KEY_T] = GLFW_KEY_T;
|
||||||
_glfw.mir.publicKeys[KEY_Y] = GLFW_KEY_Y;
|
_glfw.mir.keycodes[KEY_Y] = GLFW_KEY_Y;
|
||||||
_glfw.mir.publicKeys[KEY_U] = GLFW_KEY_U;
|
_glfw.mir.keycodes[KEY_U] = GLFW_KEY_U;
|
||||||
_glfw.mir.publicKeys[KEY_I] = GLFW_KEY_I;
|
_glfw.mir.keycodes[KEY_I] = GLFW_KEY_I;
|
||||||
_glfw.mir.publicKeys[KEY_O] = GLFW_KEY_O;
|
_glfw.mir.keycodes[KEY_O] = GLFW_KEY_O;
|
||||||
_glfw.mir.publicKeys[KEY_P] = GLFW_KEY_P;
|
_glfw.mir.keycodes[KEY_P] = GLFW_KEY_P;
|
||||||
_glfw.mir.publicKeys[KEY_LEFTBRACE] = GLFW_KEY_LEFT_BRACKET;
|
_glfw.mir.keycodes[KEY_LEFTBRACE] = GLFW_KEY_LEFT_BRACKET;
|
||||||
_glfw.mir.publicKeys[KEY_RIGHTBRACE] = GLFW_KEY_RIGHT_BRACKET;
|
_glfw.mir.keycodes[KEY_RIGHTBRACE] = GLFW_KEY_RIGHT_BRACKET;
|
||||||
_glfw.mir.publicKeys[KEY_A] = GLFW_KEY_A;
|
_glfw.mir.keycodes[KEY_A] = GLFW_KEY_A;
|
||||||
_glfw.mir.publicKeys[KEY_S] = GLFW_KEY_S;
|
_glfw.mir.keycodes[KEY_S] = GLFW_KEY_S;
|
||||||
_glfw.mir.publicKeys[KEY_D] = GLFW_KEY_D;
|
_glfw.mir.keycodes[KEY_D] = GLFW_KEY_D;
|
||||||
_glfw.mir.publicKeys[KEY_F] = GLFW_KEY_F;
|
_glfw.mir.keycodes[KEY_F] = GLFW_KEY_F;
|
||||||
_glfw.mir.publicKeys[KEY_G] = GLFW_KEY_G;
|
_glfw.mir.keycodes[KEY_G] = GLFW_KEY_G;
|
||||||
_glfw.mir.publicKeys[KEY_H] = GLFW_KEY_H;
|
_glfw.mir.keycodes[KEY_H] = GLFW_KEY_H;
|
||||||
_glfw.mir.publicKeys[KEY_J] = GLFW_KEY_J;
|
_glfw.mir.keycodes[KEY_J] = GLFW_KEY_J;
|
||||||
_glfw.mir.publicKeys[KEY_K] = GLFW_KEY_K;
|
_glfw.mir.keycodes[KEY_K] = GLFW_KEY_K;
|
||||||
_glfw.mir.publicKeys[KEY_L] = GLFW_KEY_L;
|
_glfw.mir.keycodes[KEY_L] = GLFW_KEY_L;
|
||||||
_glfw.mir.publicKeys[KEY_SEMICOLON] = GLFW_KEY_SEMICOLON;
|
_glfw.mir.keycodes[KEY_SEMICOLON] = GLFW_KEY_SEMICOLON;
|
||||||
_glfw.mir.publicKeys[KEY_APOSTROPHE] = GLFW_KEY_APOSTROPHE;
|
_glfw.mir.keycodes[KEY_APOSTROPHE] = GLFW_KEY_APOSTROPHE;
|
||||||
_glfw.mir.publicKeys[KEY_Z] = GLFW_KEY_Z;
|
_glfw.mir.keycodes[KEY_Z] = GLFW_KEY_Z;
|
||||||
_glfw.mir.publicKeys[KEY_X] = GLFW_KEY_X;
|
_glfw.mir.keycodes[KEY_X] = GLFW_KEY_X;
|
||||||
_glfw.mir.publicKeys[KEY_C] = GLFW_KEY_C;
|
_glfw.mir.keycodes[KEY_C] = GLFW_KEY_C;
|
||||||
_glfw.mir.publicKeys[KEY_V] = GLFW_KEY_V;
|
_glfw.mir.keycodes[KEY_V] = GLFW_KEY_V;
|
||||||
_glfw.mir.publicKeys[KEY_B] = GLFW_KEY_B;
|
_glfw.mir.keycodes[KEY_B] = GLFW_KEY_B;
|
||||||
_glfw.mir.publicKeys[KEY_N] = GLFW_KEY_N;
|
_glfw.mir.keycodes[KEY_N] = GLFW_KEY_N;
|
||||||
_glfw.mir.publicKeys[KEY_M] = GLFW_KEY_M;
|
_glfw.mir.keycodes[KEY_M] = GLFW_KEY_M;
|
||||||
_glfw.mir.publicKeys[KEY_COMMA] = GLFW_KEY_COMMA;
|
_glfw.mir.keycodes[KEY_COMMA] = GLFW_KEY_COMMA;
|
||||||
_glfw.mir.publicKeys[KEY_DOT] = GLFW_KEY_PERIOD;
|
_glfw.mir.keycodes[KEY_DOT] = GLFW_KEY_PERIOD;
|
||||||
_glfw.mir.publicKeys[KEY_SLASH] = GLFW_KEY_SLASH;
|
_glfw.mir.keycodes[KEY_SLASH] = GLFW_KEY_SLASH;
|
||||||
_glfw.mir.publicKeys[KEY_BACKSLASH] = GLFW_KEY_BACKSLASH;
|
_glfw.mir.keycodes[KEY_BACKSLASH] = GLFW_KEY_BACKSLASH;
|
||||||
_glfw.mir.publicKeys[KEY_ESC] = GLFW_KEY_ESCAPE;
|
_glfw.mir.keycodes[KEY_ESC] = GLFW_KEY_ESCAPE;
|
||||||
_glfw.mir.publicKeys[KEY_TAB] = GLFW_KEY_TAB;
|
_glfw.mir.keycodes[KEY_TAB] = GLFW_KEY_TAB;
|
||||||
_glfw.mir.publicKeys[KEY_LEFTSHIFT] = GLFW_KEY_LEFT_SHIFT;
|
_glfw.mir.keycodes[KEY_LEFTSHIFT] = GLFW_KEY_LEFT_SHIFT;
|
||||||
_glfw.mir.publicKeys[KEY_RIGHTSHIFT] = GLFW_KEY_RIGHT_SHIFT;
|
_glfw.mir.keycodes[KEY_RIGHTSHIFT] = GLFW_KEY_RIGHT_SHIFT;
|
||||||
_glfw.mir.publicKeys[KEY_LEFTCTRL] = GLFW_KEY_LEFT_CONTROL;
|
_glfw.mir.keycodes[KEY_LEFTCTRL] = GLFW_KEY_LEFT_CONTROL;
|
||||||
_glfw.mir.publicKeys[KEY_RIGHTCTRL] = GLFW_KEY_RIGHT_CONTROL;
|
_glfw.mir.keycodes[KEY_RIGHTCTRL] = GLFW_KEY_RIGHT_CONTROL;
|
||||||
_glfw.mir.publicKeys[KEY_LEFTALT] = GLFW_KEY_LEFT_ALT;
|
_glfw.mir.keycodes[KEY_LEFTALT] = GLFW_KEY_LEFT_ALT;
|
||||||
_glfw.mir.publicKeys[KEY_RIGHTALT] = GLFW_KEY_RIGHT_ALT;
|
_glfw.mir.keycodes[KEY_RIGHTALT] = GLFW_KEY_RIGHT_ALT;
|
||||||
_glfw.mir.publicKeys[KEY_LEFTMETA] = GLFW_KEY_LEFT_SUPER;
|
_glfw.mir.keycodes[KEY_LEFTMETA] = GLFW_KEY_LEFT_SUPER;
|
||||||
_glfw.mir.publicKeys[KEY_RIGHTMETA] = GLFW_KEY_RIGHT_SUPER;
|
_glfw.mir.keycodes[KEY_RIGHTMETA] = GLFW_KEY_RIGHT_SUPER;
|
||||||
_glfw.mir.publicKeys[KEY_MENU] = GLFW_KEY_MENU;
|
_glfw.mir.keycodes[KEY_MENU] = GLFW_KEY_MENU;
|
||||||
_glfw.mir.publicKeys[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK;
|
_glfw.mir.keycodes[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK;
|
||||||
_glfw.mir.publicKeys[KEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK;
|
_glfw.mir.keycodes[KEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK;
|
||||||
_glfw.mir.publicKeys[KEY_PRINT] = GLFW_KEY_PRINT_SCREEN;
|
_glfw.mir.keycodes[KEY_PRINT] = GLFW_KEY_PRINT_SCREEN;
|
||||||
_glfw.mir.publicKeys[KEY_SCROLLLOCK] = GLFW_KEY_SCROLL_LOCK;
|
_glfw.mir.keycodes[KEY_SCROLLLOCK] = GLFW_KEY_SCROLL_LOCK;
|
||||||
_glfw.mir.publicKeys[KEY_PAUSE] = GLFW_KEY_PAUSE;
|
_glfw.mir.keycodes[KEY_PAUSE] = GLFW_KEY_PAUSE;
|
||||||
_glfw.mir.publicKeys[KEY_DELETE] = GLFW_KEY_DELETE;
|
_glfw.mir.keycodes[KEY_DELETE] = GLFW_KEY_DELETE;
|
||||||
_glfw.mir.publicKeys[KEY_BACKSPACE] = GLFW_KEY_BACKSPACE;
|
_glfw.mir.keycodes[KEY_BACKSPACE] = GLFW_KEY_BACKSPACE;
|
||||||
_glfw.mir.publicKeys[KEY_ENTER] = GLFW_KEY_ENTER;
|
_glfw.mir.keycodes[KEY_ENTER] = GLFW_KEY_ENTER;
|
||||||
_glfw.mir.publicKeys[KEY_HOME] = GLFW_KEY_HOME;
|
_glfw.mir.keycodes[KEY_HOME] = GLFW_KEY_HOME;
|
||||||
_glfw.mir.publicKeys[KEY_END] = GLFW_KEY_END;
|
_glfw.mir.keycodes[KEY_END] = GLFW_KEY_END;
|
||||||
_glfw.mir.publicKeys[KEY_PAGEUP] = GLFW_KEY_PAGE_UP;
|
_glfw.mir.keycodes[KEY_PAGEUP] = GLFW_KEY_PAGE_UP;
|
||||||
_glfw.mir.publicKeys[KEY_PAGEDOWN] = GLFW_KEY_PAGE_DOWN;
|
_glfw.mir.keycodes[KEY_PAGEDOWN] = GLFW_KEY_PAGE_DOWN;
|
||||||
_glfw.mir.publicKeys[KEY_INSERT] = GLFW_KEY_INSERT;
|
_glfw.mir.keycodes[KEY_INSERT] = GLFW_KEY_INSERT;
|
||||||
_glfw.mir.publicKeys[KEY_LEFT] = GLFW_KEY_LEFT;
|
_glfw.mir.keycodes[KEY_LEFT] = GLFW_KEY_LEFT;
|
||||||
_glfw.mir.publicKeys[KEY_RIGHT] = GLFW_KEY_RIGHT;
|
_glfw.mir.keycodes[KEY_RIGHT] = GLFW_KEY_RIGHT;
|
||||||
_glfw.mir.publicKeys[KEY_DOWN] = GLFW_KEY_DOWN;
|
_glfw.mir.keycodes[KEY_DOWN] = GLFW_KEY_DOWN;
|
||||||
_glfw.mir.publicKeys[KEY_UP] = GLFW_KEY_UP;
|
_glfw.mir.keycodes[KEY_UP] = GLFW_KEY_UP;
|
||||||
_glfw.mir.publicKeys[KEY_F1] = GLFW_KEY_F1;
|
_glfw.mir.keycodes[KEY_F1] = GLFW_KEY_F1;
|
||||||
_glfw.mir.publicKeys[KEY_F2] = GLFW_KEY_F2;
|
_glfw.mir.keycodes[KEY_F2] = GLFW_KEY_F2;
|
||||||
_glfw.mir.publicKeys[KEY_F3] = GLFW_KEY_F3;
|
_glfw.mir.keycodes[KEY_F3] = GLFW_KEY_F3;
|
||||||
_glfw.mir.publicKeys[KEY_F4] = GLFW_KEY_F4;
|
_glfw.mir.keycodes[KEY_F4] = GLFW_KEY_F4;
|
||||||
_glfw.mir.publicKeys[KEY_F5] = GLFW_KEY_F5;
|
_glfw.mir.keycodes[KEY_F5] = GLFW_KEY_F5;
|
||||||
_glfw.mir.publicKeys[KEY_F6] = GLFW_KEY_F6;
|
_glfw.mir.keycodes[KEY_F6] = GLFW_KEY_F6;
|
||||||
_glfw.mir.publicKeys[KEY_F7] = GLFW_KEY_F7;
|
_glfw.mir.keycodes[KEY_F7] = GLFW_KEY_F7;
|
||||||
_glfw.mir.publicKeys[KEY_F8] = GLFW_KEY_F8;
|
_glfw.mir.keycodes[KEY_F8] = GLFW_KEY_F8;
|
||||||
_glfw.mir.publicKeys[KEY_F9] = GLFW_KEY_F9;
|
_glfw.mir.keycodes[KEY_F9] = GLFW_KEY_F9;
|
||||||
_glfw.mir.publicKeys[KEY_F10] = GLFW_KEY_F10;
|
_glfw.mir.keycodes[KEY_F10] = GLFW_KEY_F10;
|
||||||
_glfw.mir.publicKeys[KEY_F11] = GLFW_KEY_F11;
|
_glfw.mir.keycodes[KEY_F11] = GLFW_KEY_F11;
|
||||||
_glfw.mir.publicKeys[KEY_F12] = GLFW_KEY_F12;
|
_glfw.mir.keycodes[KEY_F12] = GLFW_KEY_F12;
|
||||||
_glfw.mir.publicKeys[KEY_F13] = GLFW_KEY_F13;
|
_glfw.mir.keycodes[KEY_F13] = GLFW_KEY_F13;
|
||||||
_glfw.mir.publicKeys[KEY_F14] = GLFW_KEY_F14;
|
_glfw.mir.keycodes[KEY_F14] = GLFW_KEY_F14;
|
||||||
_glfw.mir.publicKeys[KEY_F15] = GLFW_KEY_F15;
|
_glfw.mir.keycodes[KEY_F15] = GLFW_KEY_F15;
|
||||||
_glfw.mir.publicKeys[KEY_F16] = GLFW_KEY_F16;
|
_glfw.mir.keycodes[KEY_F16] = GLFW_KEY_F16;
|
||||||
_glfw.mir.publicKeys[KEY_F17] = GLFW_KEY_F17;
|
_glfw.mir.keycodes[KEY_F17] = GLFW_KEY_F17;
|
||||||
_glfw.mir.publicKeys[KEY_F18] = GLFW_KEY_F18;
|
_glfw.mir.keycodes[KEY_F18] = GLFW_KEY_F18;
|
||||||
_glfw.mir.publicKeys[KEY_F19] = GLFW_KEY_F19;
|
_glfw.mir.keycodes[KEY_F19] = GLFW_KEY_F19;
|
||||||
_glfw.mir.publicKeys[KEY_F20] = GLFW_KEY_F20;
|
_glfw.mir.keycodes[KEY_F20] = GLFW_KEY_F20;
|
||||||
_glfw.mir.publicKeys[KEY_F21] = GLFW_KEY_F21;
|
_glfw.mir.keycodes[KEY_F21] = GLFW_KEY_F21;
|
||||||
_glfw.mir.publicKeys[KEY_F22] = GLFW_KEY_F22;
|
_glfw.mir.keycodes[KEY_F22] = GLFW_KEY_F22;
|
||||||
_glfw.mir.publicKeys[KEY_F23] = GLFW_KEY_F23;
|
_glfw.mir.keycodes[KEY_F23] = GLFW_KEY_F23;
|
||||||
_glfw.mir.publicKeys[KEY_F24] = GLFW_KEY_F24;
|
_glfw.mir.keycodes[KEY_F24] = GLFW_KEY_F24;
|
||||||
_glfw.mir.publicKeys[KEY_KPSLASH] = GLFW_KEY_KP_DIVIDE;
|
_glfw.mir.keycodes[KEY_KPSLASH] = GLFW_KEY_KP_DIVIDE;
|
||||||
_glfw.mir.publicKeys[KEY_KPDOT] = GLFW_KEY_KP_MULTIPLY;
|
_glfw.mir.keycodes[KEY_KPDOT] = GLFW_KEY_KP_MULTIPLY;
|
||||||
_glfw.mir.publicKeys[KEY_KPMINUS] = GLFW_KEY_KP_SUBTRACT;
|
_glfw.mir.keycodes[KEY_KPMINUS] = GLFW_KEY_KP_SUBTRACT;
|
||||||
_glfw.mir.publicKeys[KEY_KPPLUS] = GLFW_KEY_KP_ADD;
|
_glfw.mir.keycodes[KEY_KPPLUS] = GLFW_KEY_KP_ADD;
|
||||||
_glfw.mir.publicKeys[KEY_KP0] = GLFW_KEY_KP_0;
|
_glfw.mir.keycodes[KEY_KP0] = GLFW_KEY_KP_0;
|
||||||
_glfw.mir.publicKeys[KEY_KP1] = GLFW_KEY_KP_1;
|
_glfw.mir.keycodes[KEY_KP1] = GLFW_KEY_KP_1;
|
||||||
_glfw.mir.publicKeys[KEY_KP2] = GLFW_KEY_KP_2;
|
_glfw.mir.keycodes[KEY_KP2] = GLFW_KEY_KP_2;
|
||||||
_glfw.mir.publicKeys[KEY_KP3] = GLFW_KEY_KP_3;
|
_glfw.mir.keycodes[KEY_KP3] = GLFW_KEY_KP_3;
|
||||||
_glfw.mir.publicKeys[KEY_KP4] = GLFW_KEY_KP_4;
|
_glfw.mir.keycodes[KEY_KP4] = GLFW_KEY_KP_4;
|
||||||
_glfw.mir.publicKeys[KEY_KP5] = GLFW_KEY_KP_5;
|
_glfw.mir.keycodes[KEY_KP5] = GLFW_KEY_KP_5;
|
||||||
_glfw.mir.publicKeys[KEY_KP6] = GLFW_KEY_KP_6;
|
_glfw.mir.keycodes[KEY_KP6] = GLFW_KEY_KP_6;
|
||||||
_glfw.mir.publicKeys[KEY_KP7] = GLFW_KEY_KP_7;
|
_glfw.mir.keycodes[KEY_KP7] = GLFW_KEY_KP_7;
|
||||||
_glfw.mir.publicKeys[KEY_KP8] = GLFW_KEY_KP_8;
|
_glfw.mir.keycodes[KEY_KP8] = GLFW_KEY_KP_8;
|
||||||
_glfw.mir.publicKeys[KEY_KP9] = GLFW_KEY_KP_9;
|
_glfw.mir.keycodes[KEY_KP9] = GLFW_KEY_KP_9;
|
||||||
_glfw.mir.publicKeys[KEY_KPCOMMA] = GLFW_KEY_KP_DECIMAL;
|
_glfw.mir.keycodes[KEY_KPCOMMA] = GLFW_KEY_KP_DECIMAL;
|
||||||
_glfw.mir.publicKeys[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL;
|
_glfw.mir.keycodes[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL;
|
||||||
_glfw.mir.publicKeys[KEY_KPENTER] = GLFW_KEY_KP_ENTER;
|
_glfw.mir.keycodes[KEY_KPENTER] = GLFW_KEY_KP_ENTER;
|
||||||
|
|
||||||
for (scancode = 0; scancode < 256; scancode++)
|
for (scancode = 0; scancode < 256; scancode++)
|
||||||
{
|
{
|
||||||
if (_glfw.mir.publicKeys[scancode] > 0)
|
if (_glfw.mir.keycodes[scancode] > 0)
|
||||||
_glfw.mir.nativeKeys[_glfw.mir.publicKeys[scancode]] = scancode;
|
_glfw.mir.scancodes[_glfw.mir.keycodes[scancode]] = scancode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,8 +109,8 @@ typedef struct _GLFWlibraryMir
|
|||||||
MirCursorConfiguration* disabledConf;
|
MirCursorConfiguration* disabledConf;
|
||||||
EventQueue* eventQueue;
|
EventQueue* eventQueue;
|
||||||
|
|
||||||
short int publicKeys[256];
|
short int keycodes[256];
|
||||||
short int nativeKeys[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
|
|
||||||
pthread_mutex_t eventMutex;
|
pthread_mutex_t eventMutex;
|
||||||
pthread_cond_t eventCond;
|
pthread_cond_t eventCond;
|
||||||
|
@ -132,8 +132,8 @@ static int mirModToGLFWMod(uint32_t mods)
|
|||||||
|
|
||||||
static int toGLFWKeyCode(uint32_t key)
|
static int toGLFWKeyCode(uint32_t key)
|
||||||
{
|
{
|
||||||
if (key < sizeof(_glfw.mir.publicKeys) / sizeof(_glfw.mir.publicKeys[0]))
|
if (key < sizeof(_glfw.mir.keycodes) / sizeof(_glfw.mir.keycodes[0]))
|
||||||
return _glfw.mir.publicKeys[key];
|
return _glfw.mir.keycodes[key];
|
||||||
|
|
||||||
return GLFW_KEY_UNKNOWN;
|
return GLFW_KEY_UNKNOWN;
|
||||||
}
|
}
|
||||||
@ -811,7 +811,7 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
|
|
||||||
int _glfwPlatformGetKeyScancode(int key)
|
int _glfwPlatformGetKeyScancode(int key)
|
||||||
{
|
{
|
||||||
return _glfw.mir.nativeKeys[key];
|
return _glfw.mir.scancodes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
||||||
|
244
src/win32_init.c
244
src/win32_init.c
@ -168,135 +168,135 @@ static void createKeyTables(void)
|
|||||||
{
|
{
|
||||||
int scancode;
|
int scancode;
|
||||||
|
|
||||||
memset(_glfw.win32.publicKeys, -1, sizeof(_glfw.win32.publicKeys));
|
memset(_glfw.win32.keycodes, -1, sizeof(_glfw.win32.keycodes));
|
||||||
memset(_glfw.win32.nativeKeys, -1, sizeof(_glfw.win32.nativeKeys));
|
memset(_glfw.win32.scancodes, -1, sizeof(_glfw.win32.scancodes));
|
||||||
|
|
||||||
_glfw.win32.publicKeys[0x00B] = GLFW_KEY_0;
|
_glfw.win32.keycodes[0x00B] = GLFW_KEY_0;
|
||||||
_glfw.win32.publicKeys[0x002] = GLFW_KEY_1;
|
_glfw.win32.keycodes[0x002] = GLFW_KEY_1;
|
||||||
_glfw.win32.publicKeys[0x003] = GLFW_KEY_2;
|
_glfw.win32.keycodes[0x003] = GLFW_KEY_2;
|
||||||
_glfw.win32.publicKeys[0x004] = GLFW_KEY_3;
|
_glfw.win32.keycodes[0x004] = GLFW_KEY_3;
|
||||||
_glfw.win32.publicKeys[0x005] = GLFW_KEY_4;
|
_glfw.win32.keycodes[0x005] = GLFW_KEY_4;
|
||||||
_glfw.win32.publicKeys[0x006] = GLFW_KEY_5;
|
_glfw.win32.keycodes[0x006] = GLFW_KEY_5;
|
||||||
_glfw.win32.publicKeys[0x007] = GLFW_KEY_6;
|
_glfw.win32.keycodes[0x007] = GLFW_KEY_6;
|
||||||
_glfw.win32.publicKeys[0x008] = GLFW_KEY_7;
|
_glfw.win32.keycodes[0x008] = GLFW_KEY_7;
|
||||||
_glfw.win32.publicKeys[0x009] = GLFW_KEY_8;
|
_glfw.win32.keycodes[0x009] = GLFW_KEY_8;
|
||||||
_glfw.win32.publicKeys[0x00A] = GLFW_KEY_9;
|
_glfw.win32.keycodes[0x00A] = GLFW_KEY_9;
|
||||||
_glfw.win32.publicKeys[0x01E] = GLFW_KEY_A;
|
_glfw.win32.keycodes[0x01E] = GLFW_KEY_A;
|
||||||
_glfw.win32.publicKeys[0x030] = GLFW_KEY_B;
|
_glfw.win32.keycodes[0x030] = GLFW_KEY_B;
|
||||||
_glfw.win32.publicKeys[0x02E] = GLFW_KEY_C;
|
_glfw.win32.keycodes[0x02E] = GLFW_KEY_C;
|
||||||
_glfw.win32.publicKeys[0x020] = GLFW_KEY_D;
|
_glfw.win32.keycodes[0x020] = GLFW_KEY_D;
|
||||||
_glfw.win32.publicKeys[0x012] = GLFW_KEY_E;
|
_glfw.win32.keycodes[0x012] = GLFW_KEY_E;
|
||||||
_glfw.win32.publicKeys[0x021] = GLFW_KEY_F;
|
_glfw.win32.keycodes[0x021] = GLFW_KEY_F;
|
||||||
_glfw.win32.publicKeys[0x022] = GLFW_KEY_G;
|
_glfw.win32.keycodes[0x022] = GLFW_KEY_G;
|
||||||
_glfw.win32.publicKeys[0x023] = GLFW_KEY_H;
|
_glfw.win32.keycodes[0x023] = GLFW_KEY_H;
|
||||||
_glfw.win32.publicKeys[0x017] = GLFW_KEY_I;
|
_glfw.win32.keycodes[0x017] = GLFW_KEY_I;
|
||||||
_glfw.win32.publicKeys[0x024] = GLFW_KEY_J;
|
_glfw.win32.keycodes[0x024] = GLFW_KEY_J;
|
||||||
_glfw.win32.publicKeys[0x025] = GLFW_KEY_K;
|
_glfw.win32.keycodes[0x025] = GLFW_KEY_K;
|
||||||
_glfw.win32.publicKeys[0x026] = GLFW_KEY_L;
|
_glfw.win32.keycodes[0x026] = GLFW_KEY_L;
|
||||||
_glfw.win32.publicKeys[0x032] = GLFW_KEY_M;
|
_glfw.win32.keycodes[0x032] = GLFW_KEY_M;
|
||||||
_glfw.win32.publicKeys[0x031] = GLFW_KEY_N;
|
_glfw.win32.keycodes[0x031] = GLFW_KEY_N;
|
||||||
_glfw.win32.publicKeys[0x018] = GLFW_KEY_O;
|
_glfw.win32.keycodes[0x018] = GLFW_KEY_O;
|
||||||
_glfw.win32.publicKeys[0x019] = GLFW_KEY_P;
|
_glfw.win32.keycodes[0x019] = GLFW_KEY_P;
|
||||||
_glfw.win32.publicKeys[0x010] = GLFW_KEY_Q;
|
_glfw.win32.keycodes[0x010] = GLFW_KEY_Q;
|
||||||
_glfw.win32.publicKeys[0x013] = GLFW_KEY_R;
|
_glfw.win32.keycodes[0x013] = GLFW_KEY_R;
|
||||||
_glfw.win32.publicKeys[0x01F] = GLFW_KEY_S;
|
_glfw.win32.keycodes[0x01F] = GLFW_KEY_S;
|
||||||
_glfw.win32.publicKeys[0x014] = GLFW_KEY_T;
|
_glfw.win32.keycodes[0x014] = GLFW_KEY_T;
|
||||||
_glfw.win32.publicKeys[0x016] = GLFW_KEY_U;
|
_glfw.win32.keycodes[0x016] = GLFW_KEY_U;
|
||||||
_glfw.win32.publicKeys[0x02F] = GLFW_KEY_V;
|
_glfw.win32.keycodes[0x02F] = GLFW_KEY_V;
|
||||||
_glfw.win32.publicKeys[0x011] = GLFW_KEY_W;
|
_glfw.win32.keycodes[0x011] = GLFW_KEY_W;
|
||||||
_glfw.win32.publicKeys[0x02D] = GLFW_KEY_X;
|
_glfw.win32.keycodes[0x02D] = GLFW_KEY_X;
|
||||||
_glfw.win32.publicKeys[0x015] = GLFW_KEY_Y;
|
_glfw.win32.keycodes[0x015] = GLFW_KEY_Y;
|
||||||
_glfw.win32.publicKeys[0x02C] = GLFW_KEY_Z;
|
_glfw.win32.keycodes[0x02C] = GLFW_KEY_Z;
|
||||||
|
|
||||||
_glfw.win32.publicKeys[0x028] = GLFW_KEY_APOSTROPHE;
|
_glfw.win32.keycodes[0x028] = GLFW_KEY_APOSTROPHE;
|
||||||
_glfw.win32.publicKeys[0x02B] = GLFW_KEY_BACKSLASH;
|
_glfw.win32.keycodes[0x02B] = GLFW_KEY_BACKSLASH;
|
||||||
_glfw.win32.publicKeys[0x033] = GLFW_KEY_COMMA;
|
_glfw.win32.keycodes[0x033] = GLFW_KEY_COMMA;
|
||||||
_glfw.win32.publicKeys[0x00D] = GLFW_KEY_EQUAL;
|
_glfw.win32.keycodes[0x00D] = GLFW_KEY_EQUAL;
|
||||||
_glfw.win32.publicKeys[0x029] = GLFW_KEY_GRAVE_ACCENT;
|
_glfw.win32.keycodes[0x029] = GLFW_KEY_GRAVE_ACCENT;
|
||||||
_glfw.win32.publicKeys[0x01A] = GLFW_KEY_LEFT_BRACKET;
|
_glfw.win32.keycodes[0x01A] = GLFW_KEY_LEFT_BRACKET;
|
||||||
_glfw.win32.publicKeys[0x00C] = GLFW_KEY_MINUS;
|
_glfw.win32.keycodes[0x00C] = GLFW_KEY_MINUS;
|
||||||
_glfw.win32.publicKeys[0x034] = GLFW_KEY_PERIOD;
|
_glfw.win32.keycodes[0x034] = GLFW_KEY_PERIOD;
|
||||||
_glfw.win32.publicKeys[0x01B] = GLFW_KEY_RIGHT_BRACKET;
|
_glfw.win32.keycodes[0x01B] = GLFW_KEY_RIGHT_BRACKET;
|
||||||
_glfw.win32.publicKeys[0x027] = GLFW_KEY_SEMICOLON;
|
_glfw.win32.keycodes[0x027] = GLFW_KEY_SEMICOLON;
|
||||||
_glfw.win32.publicKeys[0x035] = GLFW_KEY_SLASH;
|
_glfw.win32.keycodes[0x035] = GLFW_KEY_SLASH;
|
||||||
_glfw.win32.publicKeys[0x056] = GLFW_KEY_WORLD_2;
|
_glfw.win32.keycodes[0x056] = GLFW_KEY_WORLD_2;
|
||||||
|
|
||||||
_glfw.win32.publicKeys[0x00E] = GLFW_KEY_BACKSPACE;
|
_glfw.win32.keycodes[0x00E] = GLFW_KEY_BACKSPACE;
|
||||||
_glfw.win32.publicKeys[0x153] = GLFW_KEY_DELETE;
|
_glfw.win32.keycodes[0x153] = GLFW_KEY_DELETE;
|
||||||
_glfw.win32.publicKeys[0x14F] = GLFW_KEY_END;
|
_glfw.win32.keycodes[0x14F] = GLFW_KEY_END;
|
||||||
_glfw.win32.publicKeys[0x01C] = GLFW_KEY_ENTER;
|
_glfw.win32.keycodes[0x01C] = GLFW_KEY_ENTER;
|
||||||
_glfw.win32.publicKeys[0x001] = GLFW_KEY_ESCAPE;
|
_glfw.win32.keycodes[0x001] = GLFW_KEY_ESCAPE;
|
||||||
_glfw.win32.publicKeys[0x147] = GLFW_KEY_HOME;
|
_glfw.win32.keycodes[0x147] = GLFW_KEY_HOME;
|
||||||
_glfw.win32.publicKeys[0x152] = GLFW_KEY_INSERT;
|
_glfw.win32.keycodes[0x152] = GLFW_KEY_INSERT;
|
||||||
_glfw.win32.publicKeys[0x15D] = GLFW_KEY_MENU;
|
_glfw.win32.keycodes[0x15D] = GLFW_KEY_MENU;
|
||||||
_glfw.win32.publicKeys[0x151] = GLFW_KEY_PAGE_DOWN;
|
_glfw.win32.keycodes[0x151] = GLFW_KEY_PAGE_DOWN;
|
||||||
_glfw.win32.publicKeys[0x149] = GLFW_KEY_PAGE_UP;
|
_glfw.win32.keycodes[0x149] = GLFW_KEY_PAGE_UP;
|
||||||
_glfw.win32.publicKeys[0x045] = GLFW_KEY_PAUSE;
|
_glfw.win32.keycodes[0x045] = GLFW_KEY_PAUSE;
|
||||||
_glfw.win32.publicKeys[0x146] = GLFW_KEY_PAUSE;
|
_glfw.win32.keycodes[0x146] = GLFW_KEY_PAUSE;
|
||||||
_glfw.win32.publicKeys[0x039] = GLFW_KEY_SPACE;
|
_glfw.win32.keycodes[0x039] = GLFW_KEY_SPACE;
|
||||||
_glfw.win32.publicKeys[0x00F] = GLFW_KEY_TAB;
|
_glfw.win32.keycodes[0x00F] = GLFW_KEY_TAB;
|
||||||
_glfw.win32.publicKeys[0x03A] = GLFW_KEY_CAPS_LOCK;
|
_glfw.win32.keycodes[0x03A] = GLFW_KEY_CAPS_LOCK;
|
||||||
_glfw.win32.publicKeys[0x145] = GLFW_KEY_NUM_LOCK;
|
_glfw.win32.keycodes[0x145] = GLFW_KEY_NUM_LOCK;
|
||||||
_glfw.win32.publicKeys[0x046] = GLFW_KEY_SCROLL_LOCK;
|
_glfw.win32.keycodes[0x046] = GLFW_KEY_SCROLL_LOCK;
|
||||||
_glfw.win32.publicKeys[0x03B] = GLFW_KEY_F1;
|
_glfw.win32.keycodes[0x03B] = GLFW_KEY_F1;
|
||||||
_glfw.win32.publicKeys[0x03C] = GLFW_KEY_F2;
|
_glfw.win32.keycodes[0x03C] = GLFW_KEY_F2;
|
||||||
_glfw.win32.publicKeys[0x03D] = GLFW_KEY_F3;
|
_glfw.win32.keycodes[0x03D] = GLFW_KEY_F3;
|
||||||
_glfw.win32.publicKeys[0x03E] = GLFW_KEY_F4;
|
_glfw.win32.keycodes[0x03E] = GLFW_KEY_F4;
|
||||||
_glfw.win32.publicKeys[0x03F] = GLFW_KEY_F5;
|
_glfw.win32.keycodes[0x03F] = GLFW_KEY_F5;
|
||||||
_glfw.win32.publicKeys[0x040] = GLFW_KEY_F6;
|
_glfw.win32.keycodes[0x040] = GLFW_KEY_F6;
|
||||||
_glfw.win32.publicKeys[0x041] = GLFW_KEY_F7;
|
_glfw.win32.keycodes[0x041] = GLFW_KEY_F7;
|
||||||
_glfw.win32.publicKeys[0x042] = GLFW_KEY_F8;
|
_glfw.win32.keycodes[0x042] = GLFW_KEY_F8;
|
||||||
_glfw.win32.publicKeys[0x043] = GLFW_KEY_F9;
|
_glfw.win32.keycodes[0x043] = GLFW_KEY_F9;
|
||||||
_glfw.win32.publicKeys[0x044] = GLFW_KEY_F10;
|
_glfw.win32.keycodes[0x044] = GLFW_KEY_F10;
|
||||||
_glfw.win32.publicKeys[0x057] = GLFW_KEY_F11;
|
_glfw.win32.keycodes[0x057] = GLFW_KEY_F11;
|
||||||
_glfw.win32.publicKeys[0x058] = GLFW_KEY_F12;
|
_glfw.win32.keycodes[0x058] = GLFW_KEY_F12;
|
||||||
_glfw.win32.publicKeys[0x064] = GLFW_KEY_F13;
|
_glfw.win32.keycodes[0x064] = GLFW_KEY_F13;
|
||||||
_glfw.win32.publicKeys[0x065] = GLFW_KEY_F14;
|
_glfw.win32.keycodes[0x065] = GLFW_KEY_F14;
|
||||||
_glfw.win32.publicKeys[0x066] = GLFW_KEY_F15;
|
_glfw.win32.keycodes[0x066] = GLFW_KEY_F15;
|
||||||
_glfw.win32.publicKeys[0x067] = GLFW_KEY_F16;
|
_glfw.win32.keycodes[0x067] = GLFW_KEY_F16;
|
||||||
_glfw.win32.publicKeys[0x068] = GLFW_KEY_F17;
|
_glfw.win32.keycodes[0x068] = GLFW_KEY_F17;
|
||||||
_glfw.win32.publicKeys[0x069] = GLFW_KEY_F18;
|
_glfw.win32.keycodes[0x069] = GLFW_KEY_F18;
|
||||||
_glfw.win32.publicKeys[0x06A] = GLFW_KEY_F19;
|
_glfw.win32.keycodes[0x06A] = GLFW_KEY_F19;
|
||||||
_glfw.win32.publicKeys[0x06B] = GLFW_KEY_F20;
|
_glfw.win32.keycodes[0x06B] = GLFW_KEY_F20;
|
||||||
_glfw.win32.publicKeys[0x06C] = GLFW_KEY_F21;
|
_glfw.win32.keycodes[0x06C] = GLFW_KEY_F21;
|
||||||
_glfw.win32.publicKeys[0x06D] = GLFW_KEY_F22;
|
_glfw.win32.keycodes[0x06D] = GLFW_KEY_F22;
|
||||||
_glfw.win32.publicKeys[0x06E] = GLFW_KEY_F23;
|
_glfw.win32.keycodes[0x06E] = GLFW_KEY_F23;
|
||||||
_glfw.win32.publicKeys[0x076] = GLFW_KEY_F24;
|
_glfw.win32.keycodes[0x076] = GLFW_KEY_F24;
|
||||||
_glfw.win32.publicKeys[0x038] = GLFW_KEY_LEFT_ALT;
|
_glfw.win32.keycodes[0x038] = GLFW_KEY_LEFT_ALT;
|
||||||
_glfw.win32.publicKeys[0x01D] = GLFW_KEY_LEFT_CONTROL;
|
_glfw.win32.keycodes[0x01D] = GLFW_KEY_LEFT_CONTROL;
|
||||||
_glfw.win32.publicKeys[0x02A] = GLFW_KEY_LEFT_SHIFT;
|
_glfw.win32.keycodes[0x02A] = GLFW_KEY_LEFT_SHIFT;
|
||||||
_glfw.win32.publicKeys[0x15B] = GLFW_KEY_LEFT_SUPER;
|
_glfw.win32.keycodes[0x15B] = GLFW_KEY_LEFT_SUPER;
|
||||||
_glfw.win32.publicKeys[0x137] = GLFW_KEY_PRINT_SCREEN;
|
_glfw.win32.keycodes[0x137] = GLFW_KEY_PRINT_SCREEN;
|
||||||
_glfw.win32.publicKeys[0x138] = GLFW_KEY_RIGHT_ALT;
|
_glfw.win32.keycodes[0x138] = GLFW_KEY_RIGHT_ALT;
|
||||||
_glfw.win32.publicKeys[0x11D] = GLFW_KEY_RIGHT_CONTROL;
|
_glfw.win32.keycodes[0x11D] = GLFW_KEY_RIGHT_CONTROL;
|
||||||
_glfw.win32.publicKeys[0x036] = GLFW_KEY_RIGHT_SHIFT;
|
_glfw.win32.keycodes[0x036] = GLFW_KEY_RIGHT_SHIFT;
|
||||||
_glfw.win32.publicKeys[0x15C] = GLFW_KEY_RIGHT_SUPER;
|
_glfw.win32.keycodes[0x15C] = GLFW_KEY_RIGHT_SUPER;
|
||||||
_glfw.win32.publicKeys[0x150] = GLFW_KEY_DOWN;
|
_glfw.win32.keycodes[0x150] = GLFW_KEY_DOWN;
|
||||||
_glfw.win32.publicKeys[0x14B] = GLFW_KEY_LEFT;
|
_glfw.win32.keycodes[0x14B] = GLFW_KEY_LEFT;
|
||||||
_glfw.win32.publicKeys[0x14D] = GLFW_KEY_RIGHT;
|
_glfw.win32.keycodes[0x14D] = GLFW_KEY_RIGHT;
|
||||||
_glfw.win32.publicKeys[0x148] = GLFW_KEY_UP;
|
_glfw.win32.keycodes[0x148] = GLFW_KEY_UP;
|
||||||
|
|
||||||
_glfw.win32.publicKeys[0x052] = GLFW_KEY_KP_0;
|
_glfw.win32.keycodes[0x052] = GLFW_KEY_KP_0;
|
||||||
_glfw.win32.publicKeys[0x04F] = GLFW_KEY_KP_1;
|
_glfw.win32.keycodes[0x04F] = GLFW_KEY_KP_1;
|
||||||
_glfw.win32.publicKeys[0x050] = GLFW_KEY_KP_2;
|
_glfw.win32.keycodes[0x050] = GLFW_KEY_KP_2;
|
||||||
_glfw.win32.publicKeys[0x051] = GLFW_KEY_KP_3;
|
_glfw.win32.keycodes[0x051] = GLFW_KEY_KP_3;
|
||||||
_glfw.win32.publicKeys[0x04B] = GLFW_KEY_KP_4;
|
_glfw.win32.keycodes[0x04B] = GLFW_KEY_KP_4;
|
||||||
_glfw.win32.publicKeys[0x04C] = GLFW_KEY_KP_5;
|
_glfw.win32.keycodes[0x04C] = GLFW_KEY_KP_5;
|
||||||
_glfw.win32.publicKeys[0x04D] = GLFW_KEY_KP_6;
|
_glfw.win32.keycodes[0x04D] = GLFW_KEY_KP_6;
|
||||||
_glfw.win32.publicKeys[0x047] = GLFW_KEY_KP_7;
|
_glfw.win32.keycodes[0x047] = GLFW_KEY_KP_7;
|
||||||
_glfw.win32.publicKeys[0x048] = GLFW_KEY_KP_8;
|
_glfw.win32.keycodes[0x048] = GLFW_KEY_KP_8;
|
||||||
_glfw.win32.publicKeys[0x049] = GLFW_KEY_KP_9;
|
_glfw.win32.keycodes[0x049] = GLFW_KEY_KP_9;
|
||||||
_glfw.win32.publicKeys[0x04E] = GLFW_KEY_KP_ADD;
|
_glfw.win32.keycodes[0x04E] = GLFW_KEY_KP_ADD;
|
||||||
_glfw.win32.publicKeys[0x053] = GLFW_KEY_KP_DECIMAL;
|
_glfw.win32.keycodes[0x053] = GLFW_KEY_KP_DECIMAL;
|
||||||
_glfw.win32.publicKeys[0x135] = GLFW_KEY_KP_DIVIDE;
|
_glfw.win32.keycodes[0x135] = GLFW_KEY_KP_DIVIDE;
|
||||||
_glfw.win32.publicKeys[0x11C] = GLFW_KEY_KP_ENTER;
|
_glfw.win32.keycodes[0x11C] = GLFW_KEY_KP_ENTER;
|
||||||
_glfw.win32.publicKeys[0x037] = GLFW_KEY_KP_MULTIPLY;
|
_glfw.win32.keycodes[0x037] = GLFW_KEY_KP_MULTIPLY;
|
||||||
_glfw.win32.publicKeys[0x04A] = GLFW_KEY_KP_SUBTRACT;
|
_glfw.win32.keycodes[0x04A] = GLFW_KEY_KP_SUBTRACT;
|
||||||
|
|
||||||
for (scancode = 0; scancode < 512; scancode++)
|
for (scancode = 0; scancode < 512; scancode++)
|
||||||
{
|
{
|
||||||
if (_glfw.win32.publicKeys[scancode] > 0)
|
if (_glfw.win32.keycodes[scancode] > 0)
|
||||||
_glfw.win32.nativeKeys[_glfw.win32.publicKeys[scancode]] = scancode;
|
_glfw.win32.scancodes[_glfw.win32.keycodes[scancode]] = scancode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,8 +249,8 @@ typedef struct _GLFWlibraryWin32
|
|||||||
DWORD foregroundLockTimeout;
|
DWORD foregroundLockTimeout;
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
char keyName[64];
|
char keyName[64];
|
||||||
short int publicKeys[512];
|
short int keycodes[512];
|
||||||
short int nativeKeys[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
// Where to place the cursor when re-enabled
|
// Where to place the cursor when re-enabled
|
||||||
double restoreCursorPosX, restoreCursorPosY;
|
double restoreCursorPosX, restoreCursorPosY;
|
||||||
// The window whose disabled cursor mode is active
|
// The window whose disabled cursor mode is active
|
||||||
|
@ -385,7 +385,7 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
|
|||||||
return _GLFW_KEY_INVALID;
|
return _GLFW_KEY_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _glfw.win32.publicKeys[HIWORD(lParam) & 0x1FF];
|
return _glfw.win32.keycodes[HIWORD(lParam) & 0x1FF];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the specified window and its video mode active on its monitor
|
// Make the specified window and its video mode active on its monitor
|
||||||
@ -1492,9 +1492,9 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
WCHAR name[16];
|
WCHAR name[16];
|
||||||
|
|
||||||
if (key != GLFW_KEY_UNKNOWN)
|
if (key != GLFW_KEY_UNKNOWN)
|
||||||
scancode = _glfw.win32.nativeKeys[key];
|
scancode = _glfw.win32.scancodes[key];
|
||||||
|
|
||||||
if (!_glfwIsPrintable(_glfw.win32.publicKeys[scancode]))
|
if (!_glfwIsPrintable(_glfw.win32.keycodes[scancode]))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!GetKeyNameTextW(scancode << 16, name, sizeof(name) / sizeof(WCHAR)))
|
if (!GetKeyNameTextW(scancode << 16, name, sizeof(name) / sizeof(WCHAR)))
|
||||||
@ -1513,7 +1513,7 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
|
|
||||||
int _glfwPlatformGetKeyScancode(int key)
|
int _glfwPlatformGetKeyScancode(int key)
|
||||||
{
|
{
|
||||||
return _glfw.win32.nativeKeys[key];
|
return _glfw.win32.scancodes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
|
244
src/wl_init.c
244
src/wl_init.c
@ -252,8 +252,8 @@ static void keyboardHandleLeave(void* data,
|
|||||||
|
|
||||||
static int toGLFWKeyCode(uint32_t key)
|
static int toGLFWKeyCode(uint32_t key)
|
||||||
{
|
{
|
||||||
if (key < sizeof(_glfw.wl.publicKeys) / sizeof(_glfw.wl.publicKeys[0]))
|
if (key < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0]))
|
||||||
return _glfw.wl.publicKeys[key];
|
return _glfw.wl.keycodes[key];
|
||||||
|
|
||||||
return GLFW_KEY_UNKNOWN;
|
return GLFW_KEY_UNKNOWN;
|
||||||
}
|
}
|
||||||
@ -442,130 +442,130 @@ static void createKeyTables(void)
|
|||||||
{
|
{
|
||||||
int scancode;
|
int scancode;
|
||||||
|
|
||||||
memset(_glfw.wl.publicKeys, -1, sizeof(_glfw.wl.publicKeys));
|
memset(_glfw.wl.keycodes, -1, sizeof(_glfw.wl.keycodes));
|
||||||
memset(_glfw.wl.nativeKeys, -1, sizeof(_glfw.wl.nativeKeys));
|
memset(_glfw.wl.scancodes, -1, sizeof(_glfw.wl.scancodes));
|
||||||
|
|
||||||
_glfw.wl.publicKeys[KEY_GRAVE] = GLFW_KEY_GRAVE_ACCENT;
|
_glfw.wl.keycodes[KEY_GRAVE] = GLFW_KEY_GRAVE_ACCENT;
|
||||||
_glfw.wl.publicKeys[KEY_1] = GLFW_KEY_1;
|
_glfw.wl.keycodes[KEY_1] = GLFW_KEY_1;
|
||||||
_glfw.wl.publicKeys[KEY_2] = GLFW_KEY_2;
|
_glfw.wl.keycodes[KEY_2] = GLFW_KEY_2;
|
||||||
_glfw.wl.publicKeys[KEY_3] = GLFW_KEY_3;
|
_glfw.wl.keycodes[KEY_3] = GLFW_KEY_3;
|
||||||
_glfw.wl.publicKeys[KEY_4] = GLFW_KEY_4;
|
_glfw.wl.keycodes[KEY_4] = GLFW_KEY_4;
|
||||||
_glfw.wl.publicKeys[KEY_5] = GLFW_KEY_5;
|
_glfw.wl.keycodes[KEY_5] = GLFW_KEY_5;
|
||||||
_glfw.wl.publicKeys[KEY_6] = GLFW_KEY_6;
|
_glfw.wl.keycodes[KEY_6] = GLFW_KEY_6;
|
||||||
_glfw.wl.publicKeys[KEY_7] = GLFW_KEY_7;
|
_glfw.wl.keycodes[KEY_7] = GLFW_KEY_7;
|
||||||
_glfw.wl.publicKeys[KEY_8] = GLFW_KEY_8;
|
_glfw.wl.keycodes[KEY_8] = GLFW_KEY_8;
|
||||||
_glfw.wl.publicKeys[KEY_9] = GLFW_KEY_9;
|
_glfw.wl.keycodes[KEY_9] = GLFW_KEY_9;
|
||||||
_glfw.wl.publicKeys[KEY_0] = GLFW_KEY_0;
|
_glfw.wl.keycodes[KEY_0] = GLFW_KEY_0;
|
||||||
_glfw.wl.publicKeys[KEY_MINUS] = GLFW_KEY_MINUS;
|
_glfw.wl.keycodes[KEY_MINUS] = GLFW_KEY_MINUS;
|
||||||
_glfw.wl.publicKeys[KEY_EQUAL] = GLFW_KEY_EQUAL;
|
_glfw.wl.keycodes[KEY_EQUAL] = GLFW_KEY_EQUAL;
|
||||||
_glfw.wl.publicKeys[KEY_Q] = GLFW_KEY_Q;
|
_glfw.wl.keycodes[KEY_Q] = GLFW_KEY_Q;
|
||||||
_glfw.wl.publicKeys[KEY_W] = GLFW_KEY_W;
|
_glfw.wl.keycodes[KEY_W] = GLFW_KEY_W;
|
||||||
_glfw.wl.publicKeys[KEY_E] = GLFW_KEY_E;
|
_glfw.wl.keycodes[KEY_E] = GLFW_KEY_E;
|
||||||
_glfw.wl.publicKeys[KEY_R] = GLFW_KEY_R;
|
_glfw.wl.keycodes[KEY_R] = GLFW_KEY_R;
|
||||||
_glfw.wl.publicKeys[KEY_T] = GLFW_KEY_T;
|
_glfw.wl.keycodes[KEY_T] = GLFW_KEY_T;
|
||||||
_glfw.wl.publicKeys[KEY_Y] = GLFW_KEY_Y;
|
_glfw.wl.keycodes[KEY_Y] = GLFW_KEY_Y;
|
||||||
_glfw.wl.publicKeys[KEY_U] = GLFW_KEY_U;
|
_glfw.wl.keycodes[KEY_U] = GLFW_KEY_U;
|
||||||
_glfw.wl.publicKeys[KEY_I] = GLFW_KEY_I;
|
_glfw.wl.keycodes[KEY_I] = GLFW_KEY_I;
|
||||||
_glfw.wl.publicKeys[KEY_O] = GLFW_KEY_O;
|
_glfw.wl.keycodes[KEY_O] = GLFW_KEY_O;
|
||||||
_glfw.wl.publicKeys[KEY_P] = GLFW_KEY_P;
|
_glfw.wl.keycodes[KEY_P] = GLFW_KEY_P;
|
||||||
_glfw.wl.publicKeys[KEY_LEFTBRACE] = GLFW_KEY_LEFT_BRACKET;
|
_glfw.wl.keycodes[KEY_LEFTBRACE] = GLFW_KEY_LEFT_BRACKET;
|
||||||
_glfw.wl.publicKeys[KEY_RIGHTBRACE] = GLFW_KEY_RIGHT_BRACKET;
|
_glfw.wl.keycodes[KEY_RIGHTBRACE] = GLFW_KEY_RIGHT_BRACKET;
|
||||||
_glfw.wl.publicKeys[KEY_A] = GLFW_KEY_A;
|
_glfw.wl.keycodes[KEY_A] = GLFW_KEY_A;
|
||||||
_glfw.wl.publicKeys[KEY_S] = GLFW_KEY_S;
|
_glfw.wl.keycodes[KEY_S] = GLFW_KEY_S;
|
||||||
_glfw.wl.publicKeys[KEY_D] = GLFW_KEY_D;
|
_glfw.wl.keycodes[KEY_D] = GLFW_KEY_D;
|
||||||
_glfw.wl.publicKeys[KEY_F] = GLFW_KEY_F;
|
_glfw.wl.keycodes[KEY_F] = GLFW_KEY_F;
|
||||||
_glfw.wl.publicKeys[KEY_G] = GLFW_KEY_G;
|
_glfw.wl.keycodes[KEY_G] = GLFW_KEY_G;
|
||||||
_glfw.wl.publicKeys[KEY_H] = GLFW_KEY_H;
|
_glfw.wl.keycodes[KEY_H] = GLFW_KEY_H;
|
||||||
_glfw.wl.publicKeys[KEY_J] = GLFW_KEY_J;
|
_glfw.wl.keycodes[KEY_J] = GLFW_KEY_J;
|
||||||
_glfw.wl.publicKeys[KEY_K] = GLFW_KEY_K;
|
_glfw.wl.keycodes[KEY_K] = GLFW_KEY_K;
|
||||||
_glfw.wl.publicKeys[KEY_L] = GLFW_KEY_L;
|
_glfw.wl.keycodes[KEY_L] = GLFW_KEY_L;
|
||||||
_glfw.wl.publicKeys[KEY_SEMICOLON] = GLFW_KEY_SEMICOLON;
|
_glfw.wl.keycodes[KEY_SEMICOLON] = GLFW_KEY_SEMICOLON;
|
||||||
_glfw.wl.publicKeys[KEY_APOSTROPHE] = GLFW_KEY_APOSTROPHE;
|
_glfw.wl.keycodes[KEY_APOSTROPHE] = GLFW_KEY_APOSTROPHE;
|
||||||
_glfw.wl.publicKeys[KEY_Z] = GLFW_KEY_Z;
|
_glfw.wl.keycodes[KEY_Z] = GLFW_KEY_Z;
|
||||||
_glfw.wl.publicKeys[KEY_X] = GLFW_KEY_X;
|
_glfw.wl.keycodes[KEY_X] = GLFW_KEY_X;
|
||||||
_glfw.wl.publicKeys[KEY_C] = GLFW_KEY_C;
|
_glfw.wl.keycodes[KEY_C] = GLFW_KEY_C;
|
||||||
_glfw.wl.publicKeys[KEY_V] = GLFW_KEY_V;
|
_glfw.wl.keycodes[KEY_V] = GLFW_KEY_V;
|
||||||
_glfw.wl.publicKeys[KEY_B] = GLFW_KEY_B;
|
_glfw.wl.keycodes[KEY_B] = GLFW_KEY_B;
|
||||||
_glfw.wl.publicKeys[KEY_N] = GLFW_KEY_N;
|
_glfw.wl.keycodes[KEY_N] = GLFW_KEY_N;
|
||||||
_glfw.wl.publicKeys[KEY_M] = GLFW_KEY_M;
|
_glfw.wl.keycodes[KEY_M] = GLFW_KEY_M;
|
||||||
_glfw.wl.publicKeys[KEY_COMMA] = GLFW_KEY_COMMA;
|
_glfw.wl.keycodes[KEY_COMMA] = GLFW_KEY_COMMA;
|
||||||
_glfw.wl.publicKeys[KEY_DOT] = GLFW_KEY_PERIOD;
|
_glfw.wl.keycodes[KEY_DOT] = GLFW_KEY_PERIOD;
|
||||||
_glfw.wl.publicKeys[KEY_SLASH] = GLFW_KEY_SLASH;
|
_glfw.wl.keycodes[KEY_SLASH] = GLFW_KEY_SLASH;
|
||||||
_glfw.wl.publicKeys[KEY_BACKSLASH] = GLFW_KEY_BACKSLASH;
|
_glfw.wl.keycodes[KEY_BACKSLASH] = GLFW_KEY_BACKSLASH;
|
||||||
_glfw.wl.publicKeys[KEY_ESC] = GLFW_KEY_ESCAPE;
|
_glfw.wl.keycodes[KEY_ESC] = GLFW_KEY_ESCAPE;
|
||||||
_glfw.wl.publicKeys[KEY_TAB] = GLFW_KEY_TAB;
|
_glfw.wl.keycodes[KEY_TAB] = GLFW_KEY_TAB;
|
||||||
_glfw.wl.publicKeys[KEY_LEFTSHIFT] = GLFW_KEY_LEFT_SHIFT;
|
_glfw.wl.keycodes[KEY_LEFTSHIFT] = GLFW_KEY_LEFT_SHIFT;
|
||||||
_glfw.wl.publicKeys[KEY_RIGHTSHIFT] = GLFW_KEY_RIGHT_SHIFT;
|
_glfw.wl.keycodes[KEY_RIGHTSHIFT] = GLFW_KEY_RIGHT_SHIFT;
|
||||||
_glfw.wl.publicKeys[KEY_LEFTCTRL] = GLFW_KEY_LEFT_CONTROL;
|
_glfw.wl.keycodes[KEY_LEFTCTRL] = GLFW_KEY_LEFT_CONTROL;
|
||||||
_glfw.wl.publicKeys[KEY_RIGHTCTRL] = GLFW_KEY_RIGHT_CONTROL;
|
_glfw.wl.keycodes[KEY_RIGHTCTRL] = GLFW_KEY_RIGHT_CONTROL;
|
||||||
_glfw.wl.publicKeys[KEY_LEFTALT] = GLFW_KEY_LEFT_ALT;
|
_glfw.wl.keycodes[KEY_LEFTALT] = GLFW_KEY_LEFT_ALT;
|
||||||
_glfw.wl.publicKeys[KEY_RIGHTALT] = GLFW_KEY_RIGHT_ALT;
|
_glfw.wl.keycodes[KEY_RIGHTALT] = GLFW_KEY_RIGHT_ALT;
|
||||||
_glfw.wl.publicKeys[KEY_LEFTMETA] = GLFW_KEY_LEFT_SUPER;
|
_glfw.wl.keycodes[KEY_LEFTMETA] = GLFW_KEY_LEFT_SUPER;
|
||||||
_glfw.wl.publicKeys[KEY_RIGHTMETA] = GLFW_KEY_RIGHT_SUPER;
|
_glfw.wl.keycodes[KEY_RIGHTMETA] = GLFW_KEY_RIGHT_SUPER;
|
||||||
_glfw.wl.publicKeys[KEY_MENU] = GLFW_KEY_MENU;
|
_glfw.wl.keycodes[KEY_MENU] = GLFW_KEY_MENU;
|
||||||
_glfw.wl.publicKeys[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK;
|
_glfw.wl.keycodes[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK;
|
||||||
_glfw.wl.publicKeys[KEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK;
|
_glfw.wl.keycodes[KEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK;
|
||||||
_glfw.wl.publicKeys[KEY_PRINT] = GLFW_KEY_PRINT_SCREEN;
|
_glfw.wl.keycodes[KEY_PRINT] = GLFW_KEY_PRINT_SCREEN;
|
||||||
_glfw.wl.publicKeys[KEY_SCROLLLOCK] = GLFW_KEY_SCROLL_LOCK;
|
_glfw.wl.keycodes[KEY_SCROLLLOCK] = GLFW_KEY_SCROLL_LOCK;
|
||||||
_glfw.wl.publicKeys[KEY_PAUSE] = GLFW_KEY_PAUSE;
|
_glfw.wl.keycodes[KEY_PAUSE] = GLFW_KEY_PAUSE;
|
||||||
_glfw.wl.publicKeys[KEY_DELETE] = GLFW_KEY_DELETE;
|
_glfw.wl.keycodes[KEY_DELETE] = GLFW_KEY_DELETE;
|
||||||
_glfw.wl.publicKeys[KEY_BACKSPACE] = GLFW_KEY_BACKSPACE;
|
_glfw.wl.keycodes[KEY_BACKSPACE] = GLFW_KEY_BACKSPACE;
|
||||||
_glfw.wl.publicKeys[KEY_ENTER] = GLFW_KEY_ENTER;
|
_glfw.wl.keycodes[KEY_ENTER] = GLFW_KEY_ENTER;
|
||||||
_glfw.wl.publicKeys[KEY_HOME] = GLFW_KEY_HOME;
|
_glfw.wl.keycodes[KEY_HOME] = GLFW_KEY_HOME;
|
||||||
_glfw.wl.publicKeys[KEY_END] = GLFW_KEY_END;
|
_glfw.wl.keycodes[KEY_END] = GLFW_KEY_END;
|
||||||
_glfw.wl.publicKeys[KEY_PAGEUP] = GLFW_KEY_PAGE_UP;
|
_glfw.wl.keycodes[KEY_PAGEUP] = GLFW_KEY_PAGE_UP;
|
||||||
_glfw.wl.publicKeys[KEY_PAGEDOWN] = GLFW_KEY_PAGE_DOWN;
|
_glfw.wl.keycodes[KEY_PAGEDOWN] = GLFW_KEY_PAGE_DOWN;
|
||||||
_glfw.wl.publicKeys[KEY_INSERT] = GLFW_KEY_INSERT;
|
_glfw.wl.keycodes[KEY_INSERT] = GLFW_KEY_INSERT;
|
||||||
_glfw.wl.publicKeys[KEY_LEFT] = GLFW_KEY_LEFT;
|
_glfw.wl.keycodes[KEY_LEFT] = GLFW_KEY_LEFT;
|
||||||
_glfw.wl.publicKeys[KEY_RIGHT] = GLFW_KEY_RIGHT;
|
_glfw.wl.keycodes[KEY_RIGHT] = GLFW_KEY_RIGHT;
|
||||||
_glfw.wl.publicKeys[KEY_DOWN] = GLFW_KEY_DOWN;
|
_glfw.wl.keycodes[KEY_DOWN] = GLFW_KEY_DOWN;
|
||||||
_glfw.wl.publicKeys[KEY_UP] = GLFW_KEY_UP;
|
_glfw.wl.keycodes[KEY_UP] = GLFW_KEY_UP;
|
||||||
_glfw.wl.publicKeys[KEY_F1] = GLFW_KEY_F1;
|
_glfw.wl.keycodes[KEY_F1] = GLFW_KEY_F1;
|
||||||
_glfw.wl.publicKeys[KEY_F2] = GLFW_KEY_F2;
|
_glfw.wl.keycodes[KEY_F2] = GLFW_KEY_F2;
|
||||||
_glfw.wl.publicKeys[KEY_F3] = GLFW_KEY_F3;
|
_glfw.wl.keycodes[KEY_F3] = GLFW_KEY_F3;
|
||||||
_glfw.wl.publicKeys[KEY_F4] = GLFW_KEY_F4;
|
_glfw.wl.keycodes[KEY_F4] = GLFW_KEY_F4;
|
||||||
_glfw.wl.publicKeys[KEY_F5] = GLFW_KEY_F5;
|
_glfw.wl.keycodes[KEY_F5] = GLFW_KEY_F5;
|
||||||
_glfw.wl.publicKeys[KEY_F6] = GLFW_KEY_F6;
|
_glfw.wl.keycodes[KEY_F6] = GLFW_KEY_F6;
|
||||||
_glfw.wl.publicKeys[KEY_F7] = GLFW_KEY_F7;
|
_glfw.wl.keycodes[KEY_F7] = GLFW_KEY_F7;
|
||||||
_glfw.wl.publicKeys[KEY_F8] = GLFW_KEY_F8;
|
_glfw.wl.keycodes[KEY_F8] = GLFW_KEY_F8;
|
||||||
_glfw.wl.publicKeys[KEY_F9] = GLFW_KEY_F9;
|
_glfw.wl.keycodes[KEY_F9] = GLFW_KEY_F9;
|
||||||
_glfw.wl.publicKeys[KEY_F10] = GLFW_KEY_F10;
|
_glfw.wl.keycodes[KEY_F10] = GLFW_KEY_F10;
|
||||||
_glfw.wl.publicKeys[KEY_F11] = GLFW_KEY_F11;
|
_glfw.wl.keycodes[KEY_F11] = GLFW_KEY_F11;
|
||||||
_glfw.wl.publicKeys[KEY_F12] = GLFW_KEY_F12;
|
_glfw.wl.keycodes[KEY_F12] = GLFW_KEY_F12;
|
||||||
_glfw.wl.publicKeys[KEY_F13] = GLFW_KEY_F13;
|
_glfw.wl.keycodes[KEY_F13] = GLFW_KEY_F13;
|
||||||
_glfw.wl.publicKeys[KEY_F14] = GLFW_KEY_F14;
|
_glfw.wl.keycodes[KEY_F14] = GLFW_KEY_F14;
|
||||||
_glfw.wl.publicKeys[KEY_F15] = GLFW_KEY_F15;
|
_glfw.wl.keycodes[KEY_F15] = GLFW_KEY_F15;
|
||||||
_glfw.wl.publicKeys[KEY_F16] = GLFW_KEY_F16;
|
_glfw.wl.keycodes[KEY_F16] = GLFW_KEY_F16;
|
||||||
_glfw.wl.publicKeys[KEY_F17] = GLFW_KEY_F17;
|
_glfw.wl.keycodes[KEY_F17] = GLFW_KEY_F17;
|
||||||
_glfw.wl.publicKeys[KEY_F18] = GLFW_KEY_F18;
|
_glfw.wl.keycodes[KEY_F18] = GLFW_KEY_F18;
|
||||||
_glfw.wl.publicKeys[KEY_F19] = GLFW_KEY_F19;
|
_glfw.wl.keycodes[KEY_F19] = GLFW_KEY_F19;
|
||||||
_glfw.wl.publicKeys[KEY_F20] = GLFW_KEY_F20;
|
_glfw.wl.keycodes[KEY_F20] = GLFW_KEY_F20;
|
||||||
_glfw.wl.publicKeys[KEY_F21] = GLFW_KEY_F21;
|
_glfw.wl.keycodes[KEY_F21] = GLFW_KEY_F21;
|
||||||
_glfw.wl.publicKeys[KEY_F22] = GLFW_KEY_F22;
|
_glfw.wl.keycodes[KEY_F22] = GLFW_KEY_F22;
|
||||||
_glfw.wl.publicKeys[KEY_F23] = GLFW_KEY_F23;
|
_glfw.wl.keycodes[KEY_F23] = GLFW_KEY_F23;
|
||||||
_glfw.wl.publicKeys[KEY_F24] = GLFW_KEY_F24;
|
_glfw.wl.keycodes[KEY_F24] = GLFW_KEY_F24;
|
||||||
_glfw.wl.publicKeys[KEY_KPSLASH] = GLFW_KEY_KP_DIVIDE;
|
_glfw.wl.keycodes[KEY_KPSLASH] = GLFW_KEY_KP_DIVIDE;
|
||||||
_glfw.wl.publicKeys[KEY_KPDOT] = GLFW_KEY_KP_MULTIPLY;
|
_glfw.wl.keycodes[KEY_KPDOT] = GLFW_KEY_KP_MULTIPLY;
|
||||||
_glfw.wl.publicKeys[KEY_KPMINUS] = GLFW_KEY_KP_SUBTRACT;
|
_glfw.wl.keycodes[KEY_KPMINUS] = GLFW_KEY_KP_SUBTRACT;
|
||||||
_glfw.wl.publicKeys[KEY_KPPLUS] = GLFW_KEY_KP_ADD;
|
_glfw.wl.keycodes[KEY_KPPLUS] = GLFW_KEY_KP_ADD;
|
||||||
_glfw.wl.publicKeys[KEY_KP0] = GLFW_KEY_KP_0;
|
_glfw.wl.keycodes[KEY_KP0] = GLFW_KEY_KP_0;
|
||||||
_glfw.wl.publicKeys[KEY_KP1] = GLFW_KEY_KP_1;
|
_glfw.wl.keycodes[KEY_KP1] = GLFW_KEY_KP_1;
|
||||||
_glfw.wl.publicKeys[KEY_KP2] = GLFW_KEY_KP_2;
|
_glfw.wl.keycodes[KEY_KP2] = GLFW_KEY_KP_2;
|
||||||
_glfw.wl.publicKeys[KEY_KP3] = GLFW_KEY_KP_3;
|
_glfw.wl.keycodes[KEY_KP3] = GLFW_KEY_KP_3;
|
||||||
_glfw.wl.publicKeys[KEY_KP4] = GLFW_KEY_KP_4;
|
_glfw.wl.keycodes[KEY_KP4] = GLFW_KEY_KP_4;
|
||||||
_glfw.wl.publicKeys[KEY_KP5] = GLFW_KEY_KP_5;
|
_glfw.wl.keycodes[KEY_KP5] = GLFW_KEY_KP_5;
|
||||||
_glfw.wl.publicKeys[KEY_KP6] = GLFW_KEY_KP_6;
|
_glfw.wl.keycodes[KEY_KP6] = GLFW_KEY_KP_6;
|
||||||
_glfw.wl.publicKeys[KEY_KP7] = GLFW_KEY_KP_7;
|
_glfw.wl.keycodes[KEY_KP7] = GLFW_KEY_KP_7;
|
||||||
_glfw.wl.publicKeys[KEY_KP8] = GLFW_KEY_KP_8;
|
_glfw.wl.keycodes[KEY_KP8] = GLFW_KEY_KP_8;
|
||||||
_glfw.wl.publicKeys[KEY_KP9] = GLFW_KEY_KP_9;
|
_glfw.wl.keycodes[KEY_KP9] = GLFW_KEY_KP_9;
|
||||||
_glfw.wl.publicKeys[KEY_KPCOMMA] = GLFW_KEY_KP_DECIMAL;
|
_glfw.wl.keycodes[KEY_KPCOMMA] = GLFW_KEY_KP_DECIMAL;
|
||||||
_glfw.wl.publicKeys[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL;
|
_glfw.wl.keycodes[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL;
|
||||||
_glfw.wl.publicKeys[KEY_KPENTER] = GLFW_KEY_KP_ENTER;
|
_glfw.wl.keycodes[KEY_KPENTER] = GLFW_KEY_KP_ENTER;
|
||||||
|
|
||||||
for (scancode = 0; scancode < 256; scancode++)
|
for (scancode = 0; scancode < 256; scancode++)
|
||||||
{
|
{
|
||||||
if (_glfw.wl.publicKeys[scancode] > 0)
|
if (_glfw.wl.keycodes[scancode] > 0)
|
||||||
_glfw.wl.nativeKeys[_glfw.wl.publicKeys[scancode]] = scancode;
|
_glfw.wl.scancodes[_glfw.wl.keycodes[scancode]] = scancode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,8 +129,8 @@ typedef struct _GLFWlibraryWayland
|
|||||||
int monitorsCount;
|
int monitorsCount;
|
||||||
int monitorsSize;
|
int monitorsSize;
|
||||||
|
|
||||||
short int publicKeys[256];
|
short int keycodes[256];
|
||||||
short int nativeKeys[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct xkb_context* context;
|
struct xkb_context* context;
|
||||||
|
@ -688,7 +688,7 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
|
|
||||||
int _glfwPlatformGetKeyScancode(int key)
|
int _glfwPlatformGetKeyScancode(int key)
|
||||||
{
|
{
|
||||||
return _glfw.wl.nativeKeys[key];
|
return _glfw.wl.scancodes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
|
@ -232,8 +232,8 @@ static void createKeyTables(void)
|
|||||||
{
|
{
|
||||||
int scancode, key;
|
int scancode, key;
|
||||||
|
|
||||||
memset(_glfw.x11.publicKeys, -1, sizeof(_glfw.x11.publicKeys));
|
memset(_glfw.x11.keycodes, -1, sizeof(_glfw.x11.keycodes));
|
||||||
memset(_glfw.x11.nativeKeys, -1, sizeof(_glfw.x11.nativeKeys));
|
memset(_glfw.x11.scancodes, -1, sizeof(_glfw.x11.scancodes));
|
||||||
|
|
||||||
if (_glfw.x11.xkb.available)
|
if (_glfw.x11.xkb.available)
|
||||||
{
|
{
|
||||||
@ -305,7 +305,7 @@ static void createKeyTables(void)
|
|||||||
else key = GLFW_KEY_UNKNOWN;
|
else key = GLFW_KEY_UNKNOWN;
|
||||||
|
|
||||||
if ((scancode >= 0) && (scancode < 256))
|
if ((scancode >= 0) && (scancode < 256))
|
||||||
_glfw.x11.publicKeys[scancode] = key;
|
_glfw.x11.keycodes[scancode] = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
XkbFreeNames(desc, XkbKeyNamesMask, True);
|
XkbFreeNames(desc, XkbKeyNamesMask, True);
|
||||||
@ -316,12 +316,12 @@ static void createKeyTables(void)
|
|||||||
{
|
{
|
||||||
// Translate the un-translated key codes using traditional X11 KeySym
|
// Translate the un-translated key codes using traditional X11 KeySym
|
||||||
// lookups
|
// lookups
|
||||||
if (_glfw.x11.publicKeys[scancode] < 0)
|
if (_glfw.x11.keycodes[scancode] < 0)
|
||||||
_glfw.x11.publicKeys[scancode] = translateKeyCode(scancode);
|
_glfw.x11.keycodes[scancode] = translateKeyCode(scancode);
|
||||||
|
|
||||||
// Store the reverse translation for faster key name lookup
|
// Store the reverse translation for faster key name lookup
|
||||||
if (_glfw.x11.publicKeys[scancode] > 0)
|
if (_glfw.x11.keycodes[scancode] > 0)
|
||||||
_glfw.x11.nativeKeys[_glfw.x11.publicKeys[scancode]] = scancode;
|
_glfw.x11.scancodes[_glfw.x11.keycodes[scancode]] = scancode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,9 +151,9 @@ typedef struct _GLFWlibraryX11
|
|||||||
// Key name string
|
// Key name string
|
||||||
char keyName[64];
|
char keyName[64];
|
||||||
// X11 keycode to GLFW key LUT
|
// X11 keycode to GLFW key LUT
|
||||||
short int publicKeys[256];
|
short int keycodes[256];
|
||||||
// GLFW key to X11 keycode LUT
|
// GLFW key to X11 keycode LUT
|
||||||
short int nativeKeys[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
// Where to place the cursor when re-enabled
|
// Where to place the cursor when re-enabled
|
||||||
double restoreCursorPosX, restoreCursorPosY;
|
double restoreCursorPosX, restoreCursorPosY;
|
||||||
// The window whose disabled cursor mode is active
|
// The window whose disabled cursor mode is active
|
||||||
|
@ -206,7 +206,7 @@ static int translateKey(int scancode)
|
|||||||
if (scancode < 0 || scancode > 255)
|
if (scancode < 0 || scancode > 255)
|
||||||
return GLFW_KEY_UNKNOWN;
|
return GLFW_KEY_UNKNOWN;
|
||||||
|
|
||||||
return _glfw.x11.publicKeys[scancode];
|
return _glfw.x11.keycodes[scancode];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the GLFW window corresponding to the specified X11 window
|
// Return the GLFW window corresponding to the specified X11 window
|
||||||
@ -2167,9 +2167,9 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (key != GLFW_KEY_UNKNOWN)
|
if (key != GLFW_KEY_UNKNOWN)
|
||||||
scancode = _glfw.x11.nativeKeys[key];
|
scancode = _glfw.x11.scancodes[key];
|
||||||
|
|
||||||
if (!_glfwIsPrintable(_glfw.x11.publicKeys[scancode]))
|
if (!_glfwIsPrintable(_glfw.x11.keycodes[scancode]))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
keysym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 0);
|
keysym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 0);
|
||||||
@ -2188,7 +2188,7 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
|
|
||||||
int _glfwPlatformGetKeyScancode(int key)
|
int _glfwPlatformGetKeyScancode(int key)
|
||||||
{
|
{
|
||||||
return _glfw.x11.nativeKeys[key];
|
return _glfw.x11.scancodes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
|
Loading…
Reference in New Issue
Block a user