Skip to content

Track mouse events outside the window#624

Closed
dcolascione wants to merge 1 commit into
kovidgoyal:masterfrom
dcolascione:implicit-grab
Closed

Track mouse events outside the window#624
dcolascione wants to merge 1 commit into
kovidgoyal:masterfrom
dcolascione:implicit-grab

Conversation

@dcolascione
Copy link
Copy Markdown
Contributor

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.

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.
@max-baz
Copy link
Copy Markdown
Contributor

max-baz commented Jul 4, 2018

Just curious, what is the status on this PR?

@kovidgoyal
Copy link
Copy Markdown
Owner

It's waiting for the changes I indicated in my review. Apparently @dcolascione is busy at the moment.

@max-baz
Copy link
Copy Markdown
Contributor

max-baz commented Jul 4, 2018

Did you leave the comments somewhere else outside of this PR, or Github simply doesn't show the review to me? I don't see the review here, and I want to follow the discussion thread 🙂

Screenshot

image

@kovidgoyal
Copy link
Copy Markdown
Owner

@max-baz
Copy link
Copy Markdown
Contributor

max-baz commented Jul 4, 2018

That's the link to this PR, and I don't see any comments. I think you might have forgotten to click "Submit review", and until you do that, nobody except you sees the comments.

image

Comment thread kitty/mouse.c
}
}
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)) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an unnecessary change.

Comment thread kitty/state.h
OSWindow *callback_os_window;
Window *drag_start_window;
bool drag_start_in_tab_bar;
int drag_start_window_idx;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kovidgoyal
Copy link
Copy Markdown
Owner

Wow, that's confusing :) I clicked submit review now should be fine.

@max-baz
Copy link
Copy Markdown
Contributor

max-baz commented Jul 4, 2018

Yup, thanks, now @dcolascione has some work to do 😛

@kovidgoyal kovidgoyal closed this in 77c4f5f Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants