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

Update pointer focus before motion occurs #757

Merged
merged 1 commit into from
Aug 21, 2024
Merged

Conversation

ids1024
Copy link
Member

@ids1024 ids1024 commented Aug 21, 2024

This seems to work, but produces a flood of events. Smithay probably need a method to update focus without producing events unless a surface is entered.

Instead of time: 0, this and other synthesized events should probably use CLOCK_MONOTONIC. It seems libinput does document that it uses that.

@ids1024
Copy link
Member Author

ids1024 commented Aug 21, 2024

Actually, we can just test PointerHandle::current_focus() to see if we need to change it. So maybe no smithay changes are needed.

@Drakulix
Copy link
Member

This seems to work, but produces a flood of events.

Why does it flood though. refresh_focus is called on an idle-callback, right? So it should only happen once all events are processed and the compositor would go into sleep, no?

@ids1024
Copy link
Member Author

ids1024 commented Aug 21, 2024

My earlier draft didn't have the pointer.current_focus() check so it sent motion events with the same position every time the idle callback was run. Now this seems to be reasonable.

If the surface under the pointer has changed, we should send an `enter`
event immediately, instead of waiting for the next motion event. This
seems to fix that, without producing unnecessary events.

Instead of `time: 0`, this and other synthesized events should probably
use `CLOCK_MONOTONIC`. It seems libinput does document that it uses
that.
@ids1024 ids1024 changed the title WIP Update pointer focus before motion occurs Update pointer focus before motion occurs Aug 21, 2024
@ids1024
Copy link
Member Author

ids1024 commented Aug 21, 2024

I think this should be correct. The use of current_location().as_global() seems to match what is used elsewhere, and this now doesn't seem to produce input events unnecessarily.

I think the timestamp here and elsewhere shouldn't be 0, but if so that can be updated in various places after Smithay/smithay#1509 is merged.

@ids1024 ids1024 marked this pull request as ready for review August 21, 2024 18:20
@ids1024 ids1024 requested a review from a team August 21, 2024 18:20
@Drakulix Drakulix merged commit ca6f05c into master Aug 21, 2024
1 check passed
@Drakulix Drakulix deleted the pointer-focus-update branch August 21, 2024 19:37
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.

2 participants