Track mouse events outside the window#624
Closed
dcolascione wants to merge 1 commit into
Closed
Conversation
On mouse down, there's an "implicit grab" made by the window system which ensures that mouse events are delivered to the window that received the mouse-down even if the cursor strays outside the original window before mouse-up. Kitty has been filtering out these outside-window events and ignoring them, creating behavior that differs from most other applications. This change remembers the window bound to the mouse-down event and uses it until mouse up, implementing more conventional moues behavior.
Contributor
|
Just curious, what is the status on this PR? |
Owner
|
It's waiting for the changes I indicated in my review. Apparently @dcolascione is busy at the moment. |
Contributor
Contributor
kovidgoyal
requested changes
Jul 4, 2018
| } | ||
| } | ||
| if (!cell_for_pos(w, &x, &y, global_state.callback_os_window)) return; | ||
| if (!cell_for_pos(w, &x, &y, global_state.callback_os_window)) { |
Owner
There was a problem hiding this comment.
This looks like an unnecessary change.
| OSWindow *callback_os_window; | ||
| Window *drag_start_window; | ||
| bool drag_start_in_tab_bar; | ||
| int drag_start_window_idx; |
Owner
There was a problem hiding this comment.
Tracking window pointers and window_idx is unsafe. Both can change at any time. Instead use the window id, which is guaranteed unique for the lifetime of kitty. As for window_idx, you should calculate it maually by iterating for the windows in the current tab, as window_for_event does anyway.
Owner
|
Wow, that's confusing :) I clicked submit review now should be fine. |
Contributor
|
Yup, thanks, now @dcolascione has some work to do 😛 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


On mouse down, there's an "implicit grab" made by the window system
which ensures that mouse events are delivered to the window that
received the mouse-down even if the cursor strays outside the original
window before mouse-up. Kitty has been filtering out these
outside-window events and ignoring them, creating behavior that
differs from most other applications.
This change remembers the window bound to the mouse-down event and
uses it until mouse up, implementing more conventional moues behavior.