macOS: Workaround for cocoa bug that could cause the mouse cursor to become hidden in other applications in rare circumstances

Use window focus gained/lost events instead of mouse enter/exit events
to hide/show the mouse cursor.

Fixes #1218
This commit is contained in:
Kovid Goyal 2019-02-03 08:58:16 +05:30
parent e9d0d40809
commit 84caf787aa
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 6 deletions

View File

@ -21,6 +21,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- macOS: Add an option :opt:`macos_show_window_title_in_menubar` to not
show the current window title in the menu-bar (:iss:`1066`)
- macOS: Workaround for cocoa bug that could cause the mouse cursor to become
hidden in other applications in rare circumstances (:iss:`1218`)
- Fix using remote control to set cursor text color causing errors when
creating new windows (:iss:`1326`)

View File

@ -457,6 +457,7 @@ - (void)windowDidBecomeKey:(NSNotification *)notification
_glfwInputWindowFocus(window, GLFW_TRUE);
updateCursorMode(window);
if (window->cursorMode == GLFW_CURSOR_HIDDEN) hideCursor(window);
if (_glfw.ns.disabledCursorWindow != window && cursorInClientArea(window))
{
double x = 0, y = 0;
@ -469,6 +470,7 @@ - (void)windowDidResignKey:(NSNotification *)notification
{
if (window->monitor && window->autoIconify)
_glfwPlatformIconifyWindow(window);
showCursor(window);
_glfwInputWindowFocus(window, GLFW_FALSE);
}
@ -720,17 +722,11 @@ - (void)otherMouseUp:(NSEvent *)event
- (void)mouseExited:(NSEvent *)event
{
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
showCursor(window);
_glfwInputCursorEnter(window, GLFW_FALSE);
}
- (void)mouseEntered:(NSEvent *)event
{
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
hideCursor(window);
_glfwInputCursorEnter(window, GLFW_TRUE);
}