From fd8666df526a6fe317e4f3bb98a9dc2cbca872e5 Mon Sep 17 00:00:00 2001 From: Andrii Kulian Date: Fri, 5 Oct 2018 16:58:39 -0700 Subject: Load correct resources for pointer icon on external screen When mouse pointer changes displays, it should also reload the icon from new resources. Otherwise, if the densities of the previous and new displays are different, the size of the pointer sprite will look too small or too large. - Add getDisplayContext to get the corresponding Context by displayId. - Cache system pointer icons per display, clear if display removed. - Fix icon moved to default when not resetting out of task bound. Bug: 113559891 Test: Enable mouse pointer on default display, move to other screen Change-Id: Ic42d0ec32d9c979281e13c83b9e8b57134fd4f0d --- libs/input/PointerController.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libs/input/PointerController.cpp') diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp index b4f19c99c6fe..d742cc34b57e 100644 --- a/libs/input/PointerController.cpp +++ b/libs/input/PointerController.cpp @@ -255,7 +255,7 @@ void PointerController::setPresentation(Presentation presentation) { if (presentation == PRESENTATION_POINTER && mLocked.additionalMouseResources.empty()) { mPolicy->loadAdditionalMouseResources(&mLocked.additionalMouseResources, - &mLocked.animationResources); + &mLocked.animationResources, mLocked.viewport.displayId); } if (mLocked.presentation != presentation) { @@ -727,14 +727,14 @@ void PointerController::fadeOutAndReleaseAllSpotsLocked() { } void PointerController::loadResourcesLocked() REQUIRES(mLock) { - mPolicy->loadPointerResources(&mResources); + mPolicy->loadPointerResources(&mResources, mLocked.viewport.displayId); if (mLocked.presentation == PRESENTATION_POINTER) { mLocked.additionalMouseResources.clear(); mLocked.animationResources.clear(); - mPolicy->loadPointerIcon(&mLocked.pointerIcon); + mPolicy->loadPointerIcon(&mLocked.pointerIcon, mLocked.viewport.displayId); mPolicy->loadAdditionalMouseResources(&mLocked.additionalMouseResources, - &mLocked.animationResources); + &mLocked.animationResources, mLocked.viewport.displayId); } mLocked.pointerIconChanged = true; -- cgit v1.2.3