Per-window input rotation: Let InputReader use un-rotated coordinates
InputReader works in the rotated coordinate system that is oriented with the display's orientation obtained through DisplayViewport. When per-window input rotation is enabled, we let InputReader work in the un-rotated coordinate space as if the display's orientation is always ROTATION_0. Since the input rotation is included in the per-window transform, the output from InputReader should not be rotated. This requires two changes in InputReader: 1. When setting an orientation to use for an InputDevice, we do the opposite of the default behavior: If a device was being rotated before, we don't rotate it anymore, and vice-versa. We invert the direction of the rotation so that when the coordinates are rotated by the per-window transform, they appear as expected. 2. Since PointerController should still use the rotated coordinates, we need to convert all display coordinates going in/out of PointerController. Bug: 179274888 Test: test touch, mouse, and touchpad input in all four orientations using a test app and the PointerLocationView. Change-Id: I1eec8ba1d72355564a79cdf1c14c88828124e8a4
Loading
Please register or sign in to comment