From 0a080c3666e39fef15fa8049e206c78225fcc6e3 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 Merged-In: 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 f48a64551e..0e2a2e7f9e 100644 --- a/services/inputflinger/InputReaderBase.cpp +++ b/services/inputflinger/InputReaderBase.cpp @@ -99,6 +99,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; } @@ -125,4 +135,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