[go: nahoru, domu]

Use WM_INPUT when pointerlock request unadjusted movement

This CL adds support for pointerlock unadjusted movement on Windows
behind flag. The api is added at crrev.com/c/1764943 behind flag.
(design doc:
https://docs.google.com/document/d/1vvnthXjzfZXiAx7ih-mVhGc_YJ8-_rtlAhIn8i6_6nM/)

When entering pointer lock, if is requesting unadjusted movement, use
|RegisterRawInputDevices| to listen to WM_INPUT messages, and set the
|use_wm_input_| to true. When unlock, remove mouse as raw input device
are reset the bit.

When |use_wm_input_| is true(in lock and unadjusted movement mode),
convert WM_INPUT messages into ET_MOUSE_MOVED events as they are
representing mouse movements.
The move/drag events from WM_MOUSE are suppressed.

Since WM_INPUT messages do not have coordinates, use current mouse
positions as the event coordinates so that there is no jump when
switching between normal events and raw movement events.

This CL adds a field movement_ in ui::MouseEvent to store the raw mouse
movement info from the mouse raw input event. This field only valid if
the event has EF_RAW_MOVEMENT flag set.




Bug: 982379
Change-Id: Ia6e5969717917bbefc0579b5ed587a68df4b26ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1769518
Commit-Queue: Ella Ge <eirage@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699577}
23 files changed