impr: Allow num keys to be interpreted as function keys if numlock isn't set
Closes #1475
This commit is contained in:
parent
c3c9603ea1
commit
4cbd84671c
@ -1074,6 +1074,7 @@ namespace hex {
|
|||||||
|
|
||||||
#if !defined(OS_WEB)
|
#if !defined(OS_WEB)
|
||||||
// Register key press callback
|
// Register key press callback
|
||||||
|
glfwSetInputMode(m_window, GLFW_LOCK_KEY_MODS, GLFW_TRUE);
|
||||||
glfwSetKeyCallback(m_window, [](GLFWwindow *window, int key, int scanCode, int action, int mods) {
|
glfwSetKeyCallback(m_window, [](GLFWwindow *window, int key, int scanCode, int action, int mods) {
|
||||||
hex::unused(mods);
|
hex::unused(mods);
|
||||||
|
|
||||||
@ -1100,6 +1101,19 @@ namespace hex {
|
|||||||
) {
|
) {
|
||||||
auto win = static_cast<Window *>(glfwGetWindowUserPointer(window));
|
auto win = static_cast<Window *>(glfwGetWindowUserPointer(window));
|
||||||
win->m_unlockFrameRate = true;
|
win->m_unlockFrameRate = true;
|
||||||
|
|
||||||
|
if (!(mods & GLFW_MOD_NUM_LOCK)) {
|
||||||
|
if (key == GLFW_KEY_KP_0) key = GLFW_KEY_INSERT;
|
||||||
|
else if (key == GLFW_KEY_KP_1) key = GLFW_KEY_END;
|
||||||
|
else if (key == GLFW_KEY_KP_2) key = GLFW_KEY_DOWN;
|
||||||
|
else if (key == GLFW_KEY_KP_3) key = GLFW_KEY_PAGE_DOWN;
|
||||||
|
else if (key == GLFW_KEY_KP_4) key = GLFW_KEY_LEFT;
|
||||||
|
else if (key == GLFW_KEY_KP_6) key = GLFW_KEY_RIGHT;
|
||||||
|
else if (key == GLFW_KEY_KP_7) key = GLFW_KEY_HOME;
|
||||||
|
else if (key == GLFW_KEY_KP_8) key = GLFW_KEY_UP;
|
||||||
|
else if (key == GLFW_KEY_KP_9) key = GLFW_KEY_PAGE_UP;
|
||||||
|
}
|
||||||
|
|
||||||
win->m_pressedKeys.push_back(key);
|
win->m_pressedKeys.push_back(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user