Skip to content

GTK: Splits are equalized when double clicking anywhere, not just the divider #4354

Closed

Description

@mitchellh

Discussed in #4352

Originally posted by Opposite34 January 1, 2025
Referring to #3557

Some people brought up that the splits are equalized when double clicked anywhere on the window, which of course shouldn't be done as some TUIs rely on double clicks to work properly (selecting words in some editors, etc).

In the PR above, the author mentioned double clicking on a handle bar (aka divider) to equalize the splits. However, the gtkMouseDown callback they wrote seems to just check for double clicks without checking the mouse position:

fn gtkMouseDown(
    _: *c.GtkGestureClick,
    n_press: c.gint,
    _: c.gdouble,
    _: c.gdouble,
    ud: ?*anyopaque,
) callconv(.C) void {
    if (n_press == 2) {
        const self: *Split = @ptrCast(@alignCast(ud));
        _ = equalize(self);
    }
}
```</div>

### Solution

Double-clicking should only apply to the split divider.

Activity

  1. added
    contributor friendlyA well-scoped, approachable issue for someone looking to contribute.
    guiGUI or app issue regardless of platform (i.e. Swift, GTK)
    on Jan 2, 2025
  2. added this to the 1.0.2 milestone on Jan 2, 2025
  3. Opposite34 commented on Jan 2, 2025

    @Opposite34

    Cross-posting from Discord. Essentially I tried something and found some roadblocks:

    1. It seems like on my system, if I double click directly at the divider, it equalize for a split second and then resized back to the way it was (I'm gonna assume this could be some kind of race condition between the mouse dragging resize and the double click to equalize). Anyway, for now I solve this by having a leeway (~20px or so) that you can double click away from the divider itself.

    2. Now here's the next problem. Adapting the current logic we had, because equalize is done recursively from the current split, when you double click on a divider of the children splits, only those equalize... Not sure how to redesign this though...

    Going to take a break for now. I will try to think about how to get the proper behavior for this.
    Edited: branched a partial fix I did on my fork in case people want to look into this, but didn't PR as it doesn't address everything wrong here.

  4. mitchellh commented on Jan 3, 2025

    @mitchellh
    ContributorAuthor

    I reverted the commit for now to resolve this: bec46fc

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

    contributor friendlyA well-scoped, approachable issue for someone looking to contribute.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