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

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

Closed
mitchellh opened this issue Jan 2, 2025 · 2 comments · May be fixed by #4443
Closed

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

mitchellh opened this issue Jan 2, 2025 · 2 comments · May be fixed by #4443
Labels
contributor friendly A well-scoped, approachable issue for someone looking to contributor. gui GUI or app issue regardless of platform (i.e. Swift, GTK) os/linux
Milestone

Comments

@mitchellh
Copy link
Contributor

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.
@mitchellh mitchellh added contributor friendly A well-scoped, approachable issue for someone looking to contributor. gui GUI or app issue regardless of platform (i.e. Swift, GTK) os/linux labels Jan 2, 2025
@mitchellh mitchellh added this to the 1.0.2 milestone Jan 2, 2025
@Opposite34
Copy link

Opposite34 commented Jan 2, 2025

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.

@mitchellh
Copy link
Contributor Author

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
Labels
contributor friendly A well-scoped, approachable issue for someone looking to contributor. gui GUI or app issue regardless of platform (i.e. Swift, GTK) os/linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants