From 670b33dd9068490e5a177ffa999639e774453b9e Mon Sep 17 00:00:00 2001 From: Seunghwan Choi Date: Fri, 13 Jan 2023 21:12:59 +0900 Subject: Separate default pointer for mouse and stylus (frameworks/base part) PointerIcon.TYPE_NOT_SPECIFIED will be used for requesting default pointer. For the type, MouseCursorController will decide whether to show mouse or stylus icon, based on the active source. Need complement: the resource for default stylus icon should be added. Test: Manual Test(hover pointer on handwriting area) Bug: b/215436642 Change-Id: I6a337cb69bea57427f676e561900802270d206ae --- libs/input/PointerController.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libs/input/PointerController.cpp') diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp index 099efd3a1a2f..fedf58d7c6d0 100644 --- a/libs/input/PointerController.cpp +++ b/libs/input/PointerController.cpp @@ -195,7 +195,11 @@ void PointerController::setPresentation(Presentation presentation) { return; } - if (presentation == Presentation::POINTER) { + if (presentation == Presentation::POINTER || presentation == Presentation::STYLUS_HOVER) { + // For now, we support stylus hover using the mouse cursor implementation. + // TODO: Add proper support for stylus hover icons. + mCursorController.setStylusHoverMode(presentation == Presentation::STYLUS_HOVER); + mCursorController.getAdditionalMouseResources(); clearSpotsLocked(); } @@ -249,7 +253,8 @@ void PointerController::reloadPointerResources() { if (mCursorController.resourcesLoaded()) { bool getAdditionalMouseResources = false; - if (mLocked.presentation == PointerController::Presentation::POINTER) { + if (mLocked.presentation == PointerController::Presentation::POINTER || + mLocked.presentation == PointerController::Presentation::STYLUS_HOVER) { getAdditionalMouseResources = true; } mCursorController.reloadPointerResources(getAdditionalMouseResources); @@ -260,7 +265,8 @@ void PointerController::setDisplayViewport(const DisplayViewport& viewport) { std::scoped_lock lock(getLock()); bool getAdditionalMouseResources = false; - if (mLocked.presentation == PointerController::Presentation::POINTER) { + if (mLocked.presentation == PointerController::Presentation::POINTER || + mLocked.presentation == PointerController::Presentation::STYLUS_HOVER) { getAdditionalMouseResources = true; } mCursorController.setDisplayViewport(viewport, getAdditionalMouseResources); -- cgit v1.2.3-59-g8ed1b