diff options
author | 2023-01-13 21:12:59 +0900 | |
---|---|---|
committer | 2023-02-02 11:22:57 +0000 | |
commit | 670b33dd9068490e5a177ffa999639e774453b9e (patch) | |
tree | 91ad2b55a3c5ce94b5d28baefb5d8935b4aeee3f /libs/input/PointerController.cpp | |
parent | 3d0d262b93da10d6e01f5d3b277ace83aad4c2f6 (diff) |
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
Diffstat (limited to 'libs/input/PointerController.cpp')
-rw-r--r-- | libs/input/PointerController.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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); |