From 888a6a41edc5e4250076b7e36e4d626eb70edc71 Mon Sep 17 00:00:00 2001 From: Garfield Tan Date: Thu, 9 Jan 2020 11:39:16 -0800 Subject: Let InputReader set mouse cursor's display. InputReader was already responsible to bind device/event and display. It makes sense to further extend it to control the display where mouse cursor is shown. Bug: 146385350 Test: Mouse cursor shows up at expected display. Test: atest inputflinger_tests Change-Id: Ie7a9546550b70c8834462b06de929472196fe713 --- services/inputflinger/InputReaderBase.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'services/inputflinger/InputReaderBase.cpp') diff --git a/services/inputflinger/InputReaderBase.cpp b/services/inputflinger/InputReaderBase.cpp index 2d6f2c1cc9..b2dadf8460 100644 --- a/services/inputflinger/InputReaderBase.cpp +++ b/services/inputflinger/InputReaderBase.cpp @@ -125,6 +125,16 @@ std::optional InputReaderConfiguration::getDisplayViewportByPor return std::nullopt; } +std::optional InputReaderConfiguration::getDisplayViewportById( + int32_t displayId) const { + for (const DisplayViewport& currentViewport : mDisplays) { + if (currentViewport.displayId == displayId) { + return std::make_optional(currentViewport); + } + } + return std::nullopt; +} + void InputReaderConfiguration::setDisplayViewports(const std::vector& viewports) { mDisplays = viewports; } @@ -151,4 +161,4 @@ void TouchAffineTransformation::applyTo(float& x, float& y) const { y = newY; } -} // namespace android \ No newline at end of file +} // namespace android -- cgit v1.2.3-59-g8ed1b