Kitty: Cursor disappears on unfocused kitty after switching i3 workspaces

Created on 9 Apr 2018  路  11Comments  路  Source: kovidgoyal/kitty

This doesn't happen every time, but it happens often enough to be annoying.

Using these steps I could get almost 100% reproducibility:

  1. Close all windows on all workspaces
  2. On workspace 1, open two kitty side by side
  3. Switch to workspace 2, open two kitty side by side
  4. Switch back to workspace 1, try to move cursor above both kitty windows

When cursor is above the unfocused kitty, it disappears.

kitty-cursor-issue

I saw you use i3 too, can you reproduce?

All 11 comments

I have the same problem on archlinux + i3 too.
i3 4.15.0.1
Kitty 0.8.4.

Apparently this bug is related to mouse_hide_wait option, which has a default value of 3.0.

The workaround is to set mouse_hide_wait 0 in the config.

I haven't seen it as far as I can recall, and if you set mouse_hide_wait to zero you disable hiding of the mouse cursor, which will of course prevent the mouse cursor from ever being hidden.

Looking at the code, I dont see any possibility of a bug in kitty. kitty calls show_mouse_cursor() whenever glfw reports any mouse event. SO even if the mouse cursor is hidden, simply moving it around will call show_mouse_cursor(). This can be easily verified by putting printf() into show_mouse_cursor() and hide_mouse() in glfw.c

From looking at glfw's mouse handling code, you might need to click in the window first, because only if it is focused does glfw allow changing the mouse visibility.

That is true, the bug happens only with unfocused windows - and when I click on the window to bring it back to focus, the cursor will immediately show up.

So it seems the bug cannot be fixed due to glfw's limitations of changing the cursor visibility for non-focused windows?

Sure it can be fixed, one just has to fix glfw :)

For instance, this patch should take care of it, since as far as I can tell the requirement that the window be focused to change the mouse cursor is Apple only:

diff --git a/glfw/input.c b/glfw/input.c
index e78a8c12..0a1b1f0f 100644
--- a/glfw/input.c
+++ b/glfw/input.c
@@ -620,7 +620,9 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
                                   &window->virtualCursorPosX,
                                   &window->virtualCursorPosY);

+#ifdef __APPLE__
         if (_glfwPlatformWindowFocused(window))
+#endif
             _glfwPlatformSetCursorMode(window, value);
     }
     else if (mode == GLFW_STICKY_KEYS)

Huh, I thought the glfw is an external library 馃檪 I confirm that it does fix the issue!

It is an external library, kitty just has its own forked copy with various improvements.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atomsymbol picture atomsymbol  路  3Comments

mihaicristiantanase picture mihaicristiantanase  路  3Comments

bewzaalex picture bewzaalex  路  3Comments

RedBeard0531 picture RedBeard0531  路  4Comments

jasminabasurita picture jasminabasurita  路  3Comments