diff --git a/kitty/data-types.h b/kitty/data-types.h index 6e4a5df21..ae43ea5fc 100644 --- a/kitty/data-types.h +++ b/kitty/data-types.h @@ -266,5 +266,5 @@ void scroll_event(double, double); void fake_scroll(int, bool); void set_special_key_combo(int glfw_key, int mods); void on_text_input(unsigned int codepoint, int mods); -void on_key_input(int key, int scancode, int action, int mods); +void on_key_input(int key, int scancode, int action, int mods, const char*, int); void request_window_attention(id_type, bool); diff --git a/kitty/glfw.c b/kitty/glfw.c index 47cf1777c..f80328c69 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -96,20 +96,12 @@ refresh_callback(GLFWwindow *w) { } static void -char_mods_callback(GLFWwindow *w, unsigned int codepoint, int mods) { - if (!set_callback_window(w)) return; - global_state.callback_os_window->cursor_blink_zero_time = monotonic(); - if (is_window_ready_for_callbacks()) on_text_input(codepoint, mods); - global_state.callback_os_window = NULL; -} - -static void -key_callback(GLFWwindow *w, int key, int scancode, int action, int mods) { +key_callback(GLFWwindow *w, int key, int scancode, int action, int mods, const char* text, int state) { if (!set_callback_window(w)) return; global_state.callback_os_window->cursor_blink_zero_time = monotonic(); if (key >= 0 && key <= GLFW_KEY_LAST) { global_state.callback_os_window->is_key_pressed[key] = action == GLFW_RELEASE ? false : true; - if (is_window_ready_for_callbacks()) on_key_input(key, scancode, action, mods); + if (is_window_ready_for_callbacks()) on_key_input(key, scancode, action, mods, text, state); } global_state.callback_os_window = NULL; } @@ -375,11 +367,10 @@ create_os_window(PyObject UNUSED *self, PyObject *args) { update_os_window_viewport(w, false); glfwSetFramebufferSizeCallback(glfw_window, framebuffer_size_callback); glfwSetWindowRefreshCallback(glfw_window, refresh_callback); - glfwSetCharModsCallback(glfw_window, char_mods_callback); glfwSetMouseButtonCallback(glfw_window, mouse_button_callback); glfwSetScrollCallback(glfw_window, scroll_callback); glfwSetCursorPosCallback(glfw_window, cursor_pos_callback); - glfwSetKeyCallback(glfw_window, key_callback); + glfwSetKeyboardCallback(glfw_window, key_callback); glfwSetWindowFocusCallback(glfw_window, window_focus_callback); glfwSetDropCallback(glfw_window, drop_callback); #ifdef __APPLE__ diff --git a/kitty/keys.c b/kitty/keys.c index 1469913db..3ddb85c26 100644 --- a/kitty/keys.c +++ b/kitty/keys.c @@ -153,9 +153,10 @@ send_key_to_child(Window *w, int key, int mods, int action) { } void -on_key_input(int key, int scancode, int action, int mods) { +on_key_input(int key, int scancode, int action, int mods, const char* text, int state) { Window *w = active_window(); if (!w) return; + (void)state; (void)text; Screen *screen = w->render_data.screen; int lkey = get_localized_key(key, scancode); if (action == GLFW_PRESS || action == GLFW_REPEAT) {