Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

click-to-focus on window should focus the pane under the mouse cursor #881

Closed
wez opened this issue Jun 17, 2021 Discussed in #880 · 5 comments
Closed

click-to-focus on window should focus the pane under the mouse cursor #881

wez opened this issue Jun 17, 2021 Discussed in #880 · 5 comments
Labels
bug Something isn't working fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds.

Comments

@wez
Copy link
Owner

wez commented Jun 17, 2021

Discussed in #880

Originally posted by mivok June 17, 2021
Hi.

I currently have wezterm running with multiple panes in a single window. If I have another window focused, and click on the wezterm window, but over an inactive pane, I need to click a second time in order to focus the pane as well. Is it possible to have the pane be immediately focused on the first click that activates the window?

I do have pane_focus_follows_mouse = true, which almost does what I want. Unfortunately, if I click the window to focus it, and don't also move the mouse after clicking, then the pane under the cursor never actually gets focused. I also have swallow_mouse_click_on_pane_focus = false (or rather I have it left at the default), but that doesn't appear to be what I'm looking for either.

@wez wez added the bug Something isn't working label Jun 17, 2021
@wez
Copy link
Owner Author

wez commented Jun 19, 2021

I looked at this a bit tonight; on macOS at least, the click that focuses the window isn't reported as a mouse event. This is potentially tricky; the internal focus event plumbing needs to include/infer information about the focus event so that we don't do something annoying like implicitly focusing the pane that was under the mouse prior to CMD-tabing away and back again, but does focus the the pane under the mouse when the focus was due to a mouse click.

@mivok
Copy link

mivok commented Jun 25, 2021

It looks like you might be able to set acceptsFirstMouse on an NSView to get it to show up as an event: https://developer.apple.com/documentation/appkit/nsview/1483410-acceptsfirstmouse/. I took a brief look at the code and immediately got very very lost, but I think something similar to what you did with accepts_first_responder would be how it would need to be done in https://github.com/wez/wezterm/blob/main/window/src/os/macos/window.rs

@wez
Copy link
Owner Author

wez commented Jun 26, 2021

Thanks for the lead! I've pushed a commit that implements this. The mac builds typically take about 30 minutes to build out after a push; please try it when it's built and let me know how well this works for you!

@wez wez added the fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. label Jun 26, 2021
@mivok
Copy link

mivok commented Jun 27, 2021

I just did a quick test with nightly and it appears to work perfectly. Thank you!

@wez wez closed this as completed Jul 1, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Something isn't working fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds.
Projects
None yet
Development

No branches or pull requests

2 participants