Skip to content

Commit

Permalink
Fix #8362
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Feb 23, 2025
1 parent 69eda4a commit 1effdd8
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions kitty/glfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,13 +699,11 @@ set_glfw_mouse_cursor(GLFWwindow *w, GLFWCursorShape shape) {
if (cursors[shape].glfw) glfwSetCursor(w, cursors[shape].glfw);
}

void
set_mouse_cursor(MouseShape type) {
if (global_state.callback_os_window) {
GLFWwindow *w = (GLFWwindow*)global_state.callback_os_window->handle;
switch(type) {
case INVALID_POINTER: break;
/* start enum to glfw (auto generated by gen-key-constants.py do not edit) */
static void
set_glfw_mouse_pointer_shape_in_window(GLFWwindow *w, MouseShape type) {
switch(type) {
case INVALID_POINTER: break;
/* start enum to glfw (auto generated by gen-key-constants.py do not edit) */
case DEFAULT_POINTER: set_glfw_mouse_cursor(w, GLFW_DEFAULT_CURSOR); break;
case TEXT_POINTER: set_glfw_mouse_cursor(w, GLFW_TEXT_CURSOR); break;
case POINTER_POINTER: set_glfw_mouse_cursor(w, GLFW_POINTER_CURSOR); break;
Expand Down Expand Up @@ -736,8 +734,15 @@ set_mouse_cursor(MouseShape type) {
case NO_DROP_POINTER: set_glfw_mouse_cursor(w, GLFW_NO_DROP_CURSOR); break;
case GRAB_POINTER: set_glfw_mouse_cursor(w, GLFW_GRAB_CURSOR); break;
case GRABBING_POINTER: set_glfw_mouse_cursor(w, GLFW_GRABBING_CURSOR); break;
/* end enum to glfw */
}
/* end enum to glfw */
}
}

void
set_mouse_cursor(MouseShape type) {
if (global_state.callback_os_window) {
GLFWwindow *w = (GLFWwindow*)global_state.callback_os_window->handle;
set_glfw_mouse_pointer_shape_in_window(w, type);
}
}

Expand Down Expand Up @@ -1289,7 +1294,7 @@ create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) {
#endif
send_prerendered_sprites_for_window(w);
if (logo.pixels && logo.width && logo.height) glfwSetWindowIcon(glfw_window, 1, &logo);
set_glfw_mouse_cursor(glfw_window, GLFW_TEXT_CURSOR);
set_glfw_mouse_pointer_shape_in_window(glfw_window, OPT(default_pointer_shape));
update_os_window_viewport(w, false);
glfwSetWindowPosCallback(glfw_window, window_pos_callback);
// missing size callback
Expand Down

0 comments on commit 1effdd8

Please sign in to comment.