Skip to content

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

Closed

Description

@lucascool12

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

Activity

  1. added
    guiGUI or app issue regardless of platform (i.e. Swift, GTK)
    on Dec 27, 2024
  2. mitchellh commented on Dec 27, 2024

    @mitchellh
    Contributor

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

  3. jnichols0 commented on Dec 29, 2024

    @jnichols0
    Contributor

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

  4. lucascool12 commented on Dec 29, 2024

    @lucascool12
    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;
  5. added this to the 1.1.0 milestone on Jan 12, 2025
  6. added a commit that references this issue on Jan 12, 2025
    caddf59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    guiGUI or app issue regardless of platform (i.e. Swift, GTK)os/linux

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions