mirror of
https://github.com/gwm17/glfw.git
synced 2024-12-04 07:58:51 -05:00
parent
e6a32db7b9
commit
2eb1657d91
|
@ -258,29 +258,11 @@ static int toGLFWKeyCode(uint32_t key)
|
||||||
return GLFW_KEY_UNKNOWN;
|
return GLFW_KEY_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keyboardHandleKey(void* data,
|
static void inputChar(_GLFWwindow* window, uint32_t key)
|
||||||
struct wl_keyboard* keyboard,
|
|
||||||
uint32_t serial,
|
|
||||||
uint32_t time,
|
|
||||||
uint32_t key,
|
|
||||||
uint32_t state)
|
|
||||||
{
|
{
|
||||||
uint32_t code, num_syms;
|
uint32_t code, num_syms;
|
||||||
long cp;
|
long cp;
|
||||||
int keyCode;
|
|
||||||
int action;
|
|
||||||
const xkb_keysym_t *syms;
|
const xkb_keysym_t *syms;
|
||||||
_GLFWwindow* window = _glfw.wl.keyboardFocus;
|
|
||||||
|
|
||||||
if (!window)
|
|
||||||
return;
|
|
||||||
|
|
||||||
keyCode = toGLFWKeyCode(key);
|
|
||||||
action = state == WL_KEYBOARD_KEY_STATE_PRESSED
|
|
||||||
? GLFW_PRESS : GLFW_RELEASE;
|
|
||||||
|
|
||||||
_glfwInputKey(window, keyCode, key, action,
|
|
||||||
_glfw.wl.xkb.modifiers);
|
|
||||||
|
|
||||||
code = key + 8;
|
code = key + 8;
|
||||||
num_syms = xkb_key_get_syms(_glfw.wl.xkb.state, code, &syms);
|
num_syms = xkb_key_get_syms(_glfw.wl.xkb.state, code, &syms);
|
||||||
|
@ -297,6 +279,31 @@ static void keyboardHandleKey(void* data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void keyboardHandleKey(void* data,
|
||||||
|
struct wl_keyboard* keyboard,
|
||||||
|
uint32_t serial,
|
||||||
|
uint32_t time,
|
||||||
|
uint32_t key,
|
||||||
|
uint32_t state)
|
||||||
|
{
|
||||||
|
int keyCode;
|
||||||
|
int action;
|
||||||
|
_GLFWwindow* window = _glfw.wl.keyboardFocus;
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
keyCode = toGLFWKeyCode(key);
|
||||||
|
action = state == WL_KEYBOARD_KEY_STATE_PRESSED
|
||||||
|
? GLFW_PRESS : GLFW_RELEASE;
|
||||||
|
|
||||||
|
_glfwInputKey(window, keyCode, key, action,
|
||||||
|
_glfw.wl.xkb.modifiers);
|
||||||
|
|
||||||
|
if (action == GLFW_PRESS)
|
||||||
|
inputChar(window, key);
|
||||||
|
}
|
||||||
|
|
||||||
static void keyboardHandleModifiers(void* data,
|
static void keyboardHandleModifiers(void* data,
|
||||||
struct wl_keyboard* keyboard,
|
struct wl_keyboard* keyboard,
|
||||||
uint32_t serial,
|
uint32_t serial,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user