Skip to content
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

Mouse is shown when title changes with mouse-hide-while-typing enabled #3345

Closed
lucascool12 opened this issue Dec 27, 2024 · 3 comments · Fixed by #4973
Closed

Mouse is shown when title changes with mouse-hide-while-typing enabled #3345

lucascool12 opened this issue Dec 27, 2024 · 3 comments · Fixed by #4973
Labels
gui GUI or app issue regardless of platform (i.e. Swift, GTK) os/linux
Milestone

Comments

@lucascool12
Copy link

When setting the option mouse-hide-while-typing to true anytime the title changes for any reason the mouse is shown again.
For example: open Neovim, set the title option with :set title and then open a split to a different file. When switching between these to windows with Ctrl + w + w the mouse is shown again.

I did some digging and found that commenting out this self.showMouse() call fixes this specific issue.

Ghostty version:

Ghostty 1.0.0-4b4d406-nix

Version
  - version: 1.0.0-4b4d406-nix
  - channel: tip
Build Config
  - Zig version: 0.13.0
  - build mode : builtin.OptimizeMode.ReleaseFast
  - app runtime: apprt.Runtime.gtk
  - font engine: font.main.Backend.fontconfig_freetype
  - renderer   : renderer.OpenGL
  - libxev     : main.Backend.io_uring
  - GTK version:
    build      : 4.16.3
    runtime    : 4.16.3
  - libadwaita : enabled
    build      : 1.6.2
    runtime    : 1.6.2
@mitchellh mitchellh added os/linux gui GUI or app issue regardless of platform (i.e. Swift, GTK) labels Dec 27, 2024
@mitchellh
Copy link
Contributor

Unconfirmed but seems simple enough to test. Probably a GTK oddity that we can fix.

@jnichols0
Copy link
Contributor

Related issue: #1419, looks like it was resolved acknowledging this issue remains.

@lucascool12
Copy link
Author

Ok I did some further debugging, and it seems that gtk (or something somewhere) calls gtkMouseMotion with the exact same mouse position.

As such the following code fixes this issue. This seems like a pretty good solution I think.

diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig
index 3d80d925..0561e1d2 100644
--- a/src/apprt/gtk/Surface.zig
+++ b/src/apprt/gtk/Surface.zig
@@ -1405,6 +1405,10 @@ fn gtkMouseMotion(
         .y = @floatCast(scaled.y),
     };
 
+    if (std.meta.eql(self.cursor_pos, pos)) {
+        return;
+    }
+
     // Our pos changed, update
     self.cursor_pos = pos;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gui GUI or app issue regardless of platform (i.e. Swift, GTK) os/linux
Projects
None yet
3 participants