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

SDL: Fix a bunch of input timeout edge-cases #1541

Merged
merged 4 commits into from
Oct 24, 2022
Merged

Conversation

NiLuJe
Copy link
Member

@NiLuJe NiLuJe commented Oct 24, 2022

One being a failure to actually round properly, which lead to potentially passing a float to a C function that takes an int; and the other being that SDL's input timeout only has ms precision, which is much coarser than us, which meant that anything > 0 and < 1 ms was asking for an immediate return for as long as that fractional ms ticked. Instead, we now round up to 1ms in these cases.

Goes hand in hand w/ koreader/koreader@d034e1a


This change is Reviewable

We may have been passing a float to SDL, which would have had...
unexpected results.
non-zero, round the timeout up to 1ms (our lowest supported unit).

This prevents a bunch of useless roundtrips in some cases
(e.g., autosuspend), because front has higher precision ;).
Copy link
Member

@Frenzie Frenzie left a comment

Choose a reason for hiding this comment

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

SDL has such low precision? I never realized.

@NiLuJe
Copy link
Member Author

NiLuJe commented Oct 24, 2022

IIRC, they discourage from using that model (but this one fits very nicely into our own ;p). FWIW, poll has the same precision, though (which is sorta why I kept using select in our C module ;), despite poll's API being much nicer to deal with).

Copy link
Member Author

@NiLuJe NiLuJe left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @NiLuJe)

@NiLuJe NiLuJe merged commit 8b1b0db into koreader:master Oct 24, 2022
NiLuJe added a commit to NiLuJe/koreader that referenced this pull request Oct 24, 2022
NiLuJe added a commit to koreader/koreader that referenced this pull request Oct 24, 2022
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.

None yet

2 participants