Fixed print screen key input for all platforms.

This commit is contained in:
SephiRok 2013-02-21 18:39:22 +01:00 committed by Camilla Berglund
parent 788bbefd8e
commit 1ae9ce1e0a
5 changed files with 12 additions and 2 deletions

View File

@ -471,6 +471,7 @@ skills.
* Riku Salminen * Riku Salminen
* Sebastian Schuberth * Sebastian Schuberth
* Matt Sealey * Matt Sealey
* SephiRok
* Steve Sexton * Steve Sexton
* Dmitri Shuralyov * Dmitri Shuralyov
* Daniel Skorupski * Daniel Skorupski

View File

@ -257,7 +257,7 @@ static int convertMacKeyCode(unsigned int macKeyCode)
/* 66 */ -1, /* 66 */ -1,
/* 67 */ GLFW_KEY_F11, /* 67 */ GLFW_KEY_F11,
/* 68 */ -1, /* 68 */ -1,
/* 69 */ GLFW_KEY_F13, /* 69 */ GLFW_KEY_PRINT_SCREEN,
/* 6a */ GLFW_KEY_F16, /* 6a */ GLFW_KEY_F16,
/* 6b */ GLFW_KEY_F14, /* 6b */ GLFW_KEY_F14,
/* 6c */ -1, /* 6c */ -1,

View File

@ -214,6 +214,7 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
case VK_F24: return GLFW_KEY_F24; case VK_F24: return GLFW_KEY_F24;
case VK_NUMLOCK: return GLFW_KEY_NUM_LOCK; case VK_NUMLOCK: return GLFW_KEY_NUM_LOCK;
case VK_CAPITAL: return GLFW_KEY_CAPS_LOCK; case VK_CAPITAL: return GLFW_KEY_CAPS_LOCK;
case VK_SNAPSHOT: return GLFW_KEY_PRINT_SCREEN;
case VK_SCROLL: return GLFW_KEY_SCROLL_LOCK; case VK_SCROLL: return GLFW_KEY_SCROLL_LOCK;
case VK_PAUSE: return GLFW_KEY_PAUSE; case VK_PAUSE: return GLFW_KEY_PAUSE;
case VK_LWIN: return GLFW_KEY_LEFT_SUPER; case VK_LWIN: return GLFW_KEY_LEFT_SUPER;
@ -413,12 +414,18 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_KEYUP: case WM_KEYUP:
case WM_SYSKEYUP: case WM_SYSKEYUP:
{ {
// Special trick: release both shift keys on SHIFT up event
if (wParam == VK_SHIFT) if (wParam == VK_SHIFT)
{ {
// Special trick: release both shift keys on SHIFT up event
_glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, GLFW_RELEASE); _glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, GLFW_RELEASE);
_glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, GLFW_RELEASE); _glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, GLFW_RELEASE);
} }
else if (wParam == VK_SNAPSHOT)
{
// Key down is not reported for the print screen key
_glfwInputKey(window, GLFW_KEY_PRINT_SCREEN, GLFW_PRESS);
_glfwInputKey(window, GLFW_KEY_PRINT_SCREEN, GLFW_RELEASE);
}
else else
_glfwInputKey(window, translateKey(wParam, lParam), GLFW_RELEASE); _glfwInputKey(window, translateKey(wParam, lParam), GLFW_RELEASE);

View File

@ -92,6 +92,7 @@ static int keyCodeToGLFWKeyCode(int keyCode)
case XK_Menu: return GLFW_KEY_MENU; case XK_Menu: return GLFW_KEY_MENU;
case XK_Num_Lock: return GLFW_KEY_NUM_LOCK; case XK_Num_Lock: return GLFW_KEY_NUM_LOCK;
case XK_Caps_Lock: return GLFW_KEY_CAPS_LOCK; case XK_Caps_Lock: return GLFW_KEY_CAPS_LOCK;
case XK_Print: return GLFW_KEY_PRINT_SCREEN;
case XK_Scroll_Lock: return GLFW_KEY_SCROLL_LOCK; case XK_Scroll_Lock: return GLFW_KEY_SCROLL_LOCK;
case XK_Pause: return GLFW_KEY_PAUSE; case XK_Pause: return GLFW_KEY_PAUSE;
case XK_Delete: return GLFW_KEY_DELETE; case XK_Delete: return GLFW_KEY_DELETE;

View File

@ -163,6 +163,7 @@ static const char* get_key_name(int key)
case GLFW_KEY_KP_DECIMAL: return "KEYPAD DECIMAL"; case GLFW_KEY_KP_DECIMAL: return "KEYPAD DECIMAL";
case GLFW_KEY_KP_EQUAL: return "KEYPAD EQUAL"; case GLFW_KEY_KP_EQUAL: return "KEYPAD EQUAL";
case GLFW_KEY_KP_ENTER: return "KEYPAD ENTER"; case GLFW_KEY_KP_ENTER: return "KEYPAD ENTER";
case GLFW_KEY_PRINT_SCREEN: return "PRINT SCREEN";
case GLFW_KEY_NUM_LOCK: return "NUM LOCK"; case GLFW_KEY_NUM_LOCK: return "NUM LOCK";
case GLFW_KEY_CAPS_LOCK: return "CAPS LOCK"; case GLFW_KEY_CAPS_LOCK: return "CAPS LOCK";
case GLFW_KEY_SCROLL_LOCK: return "SCROLL LOCK"; case GLFW_KEY_SCROLL_LOCK: return "SCROLL LOCK";