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

[Windows] request_redraw example continuously generates spurious CursorMoved event #1428

Closed
filnet opened this issue Jan 31, 2020 · 4 comments
Labels
B - bug Dang, that shouldn't have happened C - needs investigation Issue must be confirmed and researched D - easy Likely easier than most tasks here DS - windows H - good first issue Ideal for new contributors

Comments

@filnet
Copy link
Contributor

filnet commented Jan 31, 2020

On master, run the request_redraw example and keep the mouse pointer inside the window.
This will continuously generate a CursorMoved event.
Note that the position is always the same.

# cargo run --example request_redraw > log.txt
    Finished dev [unoptimized + debuginfo] target(s) in 0.27s
     Running `target\debug\examples\request_redraw.exe`
NewEvents(Init)
DeviceEvent { device_id: DeviceId(DeviceId(65597)), event: Added }
DeviceEvent { device_id: DeviceId(DeviceId(720955)), event: Added }
DeviceEvent { device_id: DeviceId(DeviceId(65601)), event: Added }
DeviceEvent { device_id: DeviceId(DeviceId(720959)), event: Added }
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorEntered { device_id: DeviceId(DeviceId(0)) } }
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawRequested(WindowId(WindowId(0x150bc8)))

redrawing!

RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 88296.907572977s }, requested_resume: None })
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 88297.857701111s }, requested_resume: None })
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 88297.891609389s }, requested_resume: None })
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 88298.884658111s }, requested_resume: None })
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 88299.896964899s }, requested_resume: None })
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 88300.90603008s }, requested_resume: None })
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 88301.923038956s }, requested_resume: None })
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 88302.915392581s }, requested_resume: None })
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 88303.953817589s }, requested_resume: None })
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 88304.964164733s }, requested_resume: None })
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawEventsCleared
NewEvents(WaitCancelled { start: Instant { t: 88305.976293626s }, requested_resume: None })
WindowEvent { window_id: WindowId(WindowId(0x150bc8)), event: CursorMoved { device_id: DeviceId(DeviceId(0)), position: PhysicalPosition { x: 841.0, y: 434.0 }, modifiers: (empty) } }
MainEventsCleared
RedrawEventsCleared
@goddessfreya goddessfreya added DS - windows H - good first issue Ideal for new contributors C - needs investigation Issue must be confirmed and researched B - bug Dang, that shouldn't have happened D - easy Likely easier than most tasks here labels Feb 1, 2020
@filnet
Copy link
Contributor Author

filnet commented Feb 1, 2020

Can't reproduce on Windows 10.
Seems to affect Windows 7. I'll double check.

@filnet
Copy link
Contributor Author

filnet commented Feb 3, 2020

I confirm the issue on Windows 7.
I had a hard time reproducing the issue at first. Had to close a bunch of apps.

And found this: https://devblogs.microsoft.com/oldnewthing/20031001-00/?p=42343

But what I am seeing is a CursorMoved every 1 second approximately which the above does not really explain.

@filnet
Copy link
Contributor Author

filnet commented Feb 3, 2020

Found the cause : http://debugandconquer.blogspot.com/2015/08/the-cause-of-spurious-mouse-move.html

I confirmed that, on Windows 7, having the Task Manager open will trigger those spurious events.
And when the Task Manager is not running, then no spurious events are seen.

So we have to expect spurious WM_MOUSEMOVE messages and handle them.

filnet added a commit to filnet/winit that referenced this issue Feb 3, 2020
filnet added a commit to filnet/winit that referenced this issue Feb 4, 2020
filnet added a commit to filnet/winit that referenced this issue Feb 4, 2020
filnet added a commit to filnet/winit that referenced this issue Feb 4, 2020
filnet added a commit to filnet/winit that referenced this issue Feb 4, 2020
filnet added a commit to filnet/winit that referenced this issue Feb 4, 2020
filnet added a commit to filnet/winit that referenced this issue Feb 5, 2020
@filnet
Copy link
Contributor Author

filnet commented Feb 13, 2020

Found another case: just clicking a mouse button will generate a CursorMoved event even if the mouse pointer was not moved.

Osspial pushed a commit to filnet/winit that referenced this issue Mar 6, 2020
@Osspial Osspial closed this as completed in 71bd6e7 Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B - bug Dang, that shouldn't have happened C - needs investigation Issue must be confirmed and researched D - easy Likely easier than most tasks here DS - windows H - good first issue Ideal for new contributors
Development

No branches or pull requests

2 participants