-
Notifications
You must be signed in to change notification settings - Fork 100
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
Precise pointer events for Wayland platform #1854
Conversation
std::pair<float, float> const& pos, | ||
std::pair<float, float> const& scroll) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really ought to have strong types for pos
and scroll
. Lists of identical types are easy to get in the wrong order and this continues down that "slippery slope".
I know you've mentioned floating point geometry before (#1829) and this seems like an opportunity to do something towards it.
(I'm not convinced that generalizing the current "geometry" classes is the best way forward, but we could think about that.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, following the style here, why isn't this just tuple<float, float, float, float> const& axes
;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why isn't this just
tuple<float, float, float, float> const& axes
;)
Because that has substantially more ways to induce bugs? As it currently is, the main way to get is wrong is passing parameters out of order (which you can check because they have meaningful names) or mixing up .first
and .second
which again are at least obviously wrong once you notice. A 4-part tuple has all of those problems, plus making it ambiguous (unless explained in comments) what order things are supposed to be in. A more convincing alternative to me would be float pos_x, float pos_y, float scroll_horz, float scroll_vert
, but I'm not sure if that has any particular advantages over std::pair
.
Of course you're right that we need a real solution to #1829, but I'm not convinced this needs to be blocked on that. The in-practice maintenance burden here is low.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In part I agree: this doesn't touch any API accessible from downstream.
But if we're passing a generic 'tuple around several interfaces we really ought to have a type. And that internal type could be replaced with a "real solution to #1829".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a generic 'tuple
In this case pair is just a 2-tuple
e60ce90
to
1630616
Compare
This now uses the new floating point geometry types. Stacked on #1961. |
1630616
to
d8b5c99
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sensible, doesn't break anything obvious. Let's have it on trunk.
bors r+
Build succeeded: |
This adds support for floating point pointer motion and scrolling to the Wayland platform. It appears touches were already precise. Fixes #1852. There's still a notable problem, where scrolling events don't appear to be precise because they are arbitrarily multiplied by 10 by the Wayland frontend. This will be fixed in a different PR.