Skip to content

Send mouse position after focused/cursorenter events - #349

Merged
elinorbgr merged 9 commits into
rust-windowing:masterfrom
stuartnelson3:stn/mouse-moved-after-focus
Nov 26, 2017
Merged

elinorbgr merged 9 commits into
rust-windowing:masterfrom
stuartnelson3:stn/mouse-moved-after-focus

Conversation

@stuartnelson3

@stuartnelson3 stuartnelson3 commented Nov 12, 2017 •

Copy link
Copy Markdown
Contributor

This is a first pass at updating the mouse's position after a CursorEntered/Focused event. I ran cargo test but haven't done any manual testing.

There's a lot of copy/paste in the macos code. I'm also not sure how best to send a second event in that situation.

fixes #348

@stuartnelson3 stuartnelson3 changed the title Stn/mouse moved after focus Send mouse position after focused/cursorenter events Nov 12, 2017
@Xaeroxe

Xaeroxe commented Nov 14, 2017

Copy link
Copy Markdown
Contributor

It's worth noting the machinery with the VecDeque isn't needed in the OSx backend. You can just push_back an event into the Vec you're extending from the Iterator. Otherwise this looks great!

@Xaeroxe

Xaeroxe commented Nov 15, 2017

Copy link
Copy Markdown
Contributor

Sorry I didn't make myself very clear, this is actually what I meant.

let x = (scale_factor * view_point.x as f32) as f64;
let y = (scale_factor * (view_rect.size.height - view_point.y) as f32) as f64;
let window_event = WindowEvent::CursorMoved { device_id: DEVICE_ID, position: (x, y) };

self.shared.pending_events.lock().unwrap().push_back(window_event);

@stuartnelson3

Copy link
Copy Markdown
Contributor Author

No worries, thanks for clarifying!

@Xaeroxe

Xaeroxe commented Nov 15, 2017

Copy link
Copy Markdown
Contributor

Looks great, thanks!

@stuartnelson3

Copy link
Copy Markdown
Contributor Author

Let me know if there's anything else to do!

Assuming this gets merged, what's the process for bumping the version? I'm hoping to get this merged into glutin as soon as possible so I can unblock servo/servo#19120

@Xaeroxe

Xaeroxe commented Nov 15, 2017

Copy link
Copy Markdown
Contributor

Amethyst also has interest in pushing to cargo so we can start using #344

@tomaka

tomaka commented Nov 15, 2017

Copy link
Copy Markdown
Contributor

Assuming this gets merged, what's the process for bumping the version?

Just submit another PR with a version bump in the Cargo.toml and the changelog.

@stuartnelson3 stuartnelson3 mentioned this pull request Nov 16, 2017
3 tasks done
@Xaeroxe

Xaeroxe commented Nov 17, 2017

Copy link
Copy Markdown
Contributor

I take it we need some reviews from collaborators to merge this.

@vberger reviewed and merged my last input-related PR so I'll ping him for this one.

@elinorbgr

Copy link
Copy Markdown
Contributor

well, this looks good to me, but it touches all the backends I'm not familiar with... Did you test it on windows, macos and x11 ?

@stuartnelson3

Copy link
Copy Markdown
Contributor Author

I only was able to test it on macos and x11, which worked. I don't have access to a windows machine, unfortunately.

@Xaeroxe

Xaeroxe commented Nov 20, 2017

Copy link
Copy Markdown
Contributor

I'll give this a shot on Windows tonight (approximately 10-11 hours from the time on this comment)

@Xaeroxe

Xaeroxe commented Nov 21, 2017

Copy link
Copy Markdown
Contributor

@vberger @stuartnelson3 This works on Windows.

Not related to this PR, but interestingly I don't get Device and MouseMoved events when the window isn't focused, so our existing documentation is actually a bit incorrect on that.

@stuartnelson3

Copy link
Copy Markdown
Contributor Author

Is there anything to be done to move this PR forward?

@elinorbgr

Copy link
Copy Markdown
Contributor

All is good, sorry for the delay!

@elinorbgr
elinorbgr merged commit 0f14e63 into rust-windowing:master Nov 26, 2017
@stuartnelson3
stuartnelson3 deleted the stn/mouse-moved-after-focus branch November 26, 2017 22:05
tmfink pushed a commit to tmfink/winit that referenced this pull request Jan 5, 2022
tmfink pushed a commit to tmfink/winit that referenced this pull request Jan 5, 2022
`usvg` should never have nested `<svg>` nodes, so remove code that (doesn't) handle that case.

Closes rust-windowing#349.
madsmtm pushed a commit to madsmtm/winit that referenced this pull request Jun 11, 2022
…ndowing#349)

* fix(events): properly fire `WindowEvent::Destroyed` on Linux

* remove unused variable

* fix docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Expose mouse pos

4 participants