Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement MouseEvent buttons attribute #23249
Conversation
highfive
commented
Apr 23, 2019
|
Heads up! This PR modifies the following files:
|
highfive
commented
Apr 23, 2019
|
I have a question regarding the next steps. |
|
@georgeroman I think synthetic clicks should be treated differently, like whatwg/html#4452 describes. I would expect a synthetic click to produce an event that only claims to have a left mouse button active. |
|
r? @Manishearth |
|
Looks good! I can't find how right/aux events get triggered, though. Do we just not support those yet? |
| ), | ||
| /// The mouse was moved over a point (or was moved out of the recognizable region). | ||
| MouseMoveEvent(Option<Point2D<f32>>, Option<UntrustedNodeAddress>), | ||
| MouseMoveEvent(Option<Point2D<f32>>, Option<UntrustedNodeAddress>, u16), |
This comment has been minimized.
This comment has been minimized.
Manishearth
Apr 30, 2019
Member
leave an inline comment on the u16 saying it's a button mask of MouseButton values
(or mention this in the doc comment)
| @@ -701,7 +702,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { | |||
| let results = self.hit_test_at_point(cursor); | |||
| if let Some(item) = results.items.first() { | |||
| let node_address = Some(UntrustedNodeAddress(item.tag.0 as *const c_void)); | |||
| let event = MouseMoveEvent(Some(item.point_in_viewport.to_untyped()), node_address); | |||
| let event = MouseMoveEvent(Some(item.point_in_viewport.to_untyped()), node_address, 0); | |||
This comment has been minimized.
This comment has been minimized.
Manishearth
Apr 30, 2019
Member
Can you use MouseButton::Left as u16 so it's clear what the zero means?
| @@ -658,6 +658,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { | |||
| result.point_in_viewport.to_untyped(), | |||
| Some(UntrustedNodeAddress(result.tag.0 as *const c_void)), | |||
| Some(result.point_relative_to_item.to_untyped()), | |||
| 0, | |||
This comment has been minimized.
This comment has been minimized.
| Right, | ||
| Right = 2, | ||
| /// The middle mouse button. | ||
| Middle = 4, |
This comment has been minimized.
This comment has been minimized.
KwanEsq
Apr 30, 2019
•
Contributor
Shouldn't this use a new MouseButtonMask enum (or something), rather than mangling this one?
This comment has been minimized.
This comment has been minimized.
georgeroman
May 2, 2019
Author
Contributor
I could add a new enum for this purpose, but it would be exactly the same as this one since MouseButtonEvent (which I use for updating the buttons bitmask) stores the button that triggered the event as a MouseButton.
This comment has been minimized.
This comment has been minimized.
KwanEsq
May 2, 2019
Contributor
Then don't alter the values of this enum, just map them ala MouseButton::Left => 1 etc.
|
Hmm, I guess to make comments on code show up in the conversation I have to "start a review" rather than "add single comment"? (Which I don't feel qualified for) Edit: okay, now my comment appears here, it just took a while. |
|
@Manishearth I also noticed that all mouse events have |
|
Ah yeah, I should have mentioned that as well. Middle-button isn't supported at all, and right-button is incorrectly reported as MouseButton::Left (zero). I was experimenting with implementing them, and the auxclick event. Though given none of the wpt mouse event tests run yet because testdriver isn't yet supported (Support Webdriver based tests project), I wasn't sure about submitting it yet. |
|
@bors-servo r+ |
|
|
…nishearth Implement MouseEvent buttons attribute <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #22884 <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23249) <!-- Reviewable:end -->
|
|
|
|
@bors-servo retry |
|
Due to force-pushed, maybe we need to |
|
@bors-servo r+ |
|
|
|
@bors-servo r=Manishearth |
|
|
|
…nishearth Implement MouseEvent buttons attribute <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #22884 <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23249) <!-- Reviewable:end -->
|
|
georgeroman commentedApr 23, 2019
•
edited by SimonSapin
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is