-
Notifications
You must be signed in to change notification settings - Fork 1.4k
hide mouse after idle time based on mouse-hide-after config
#9937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
mitchellh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, overall very clean, just one major question.
src/Surface.zig
Outdated
|
|
||
| /// Hide the mouse if `mouse-hide-after` is configured and the mouse has been | ||
| /// idle (no movement) for at least that duration. | ||
| pub fn maybeHideMouseAfterIdle(self: *Surface) void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this core stuff at all? I think it might be cleaner to just implement this 100% in the apprt.
|
@mitchellh Thanks for the review! I completely agree and have made the requested changes. hope this aligns with what you expected. |
bo2themax
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on macOS, only a small suggestion
| return v; | ||
| } | ||
|
|
||
| var mouseHideAfter: UInt { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Duration is better, like undoTimeout down below
pluiedev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall on the GTK side, just one question
src/apprt/gtk/class/surface.zig
Outdated
| priv.cursor_pos = pos; | ||
|
|
||
| // Track mouse movement time for `mouse-hide-after`. | ||
| priv.last_mouse_move_time = std.time.Instant.now() catch null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ever used? I don't think it is, right?
issue: #8385
Implement a new
mouse-hide-afterduration config that hides the cursor after a period of no mouse movement while keeping it hidden during typing. The core tracks the last mouse move inSurface.cursorPosCallbackand usesSurface.maybeHideMouseAfterIdle()to decide when to callhideMouse(). On macOS this is driven by a per-surface NSTimer inSurfaceView_AppKit, and on GTK by a per-surface GLib timeout inclass/surface.zig, both reset on mouse movement. macOS usesNSCursor.setHiddenUntilMouseMovesto integrate with the native cursor API, while GTK relies on the existingmouse_visibilityaction wired through the core surface.Tests on macos and linux