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
This commit is contained in:
Seunghwan Choi
2023-01-13 21:12:59 +09:00
committed by Prabir Pradhan
parent 3d0d262b93
commit 670b33dd90
7 changed files with 83 additions and 15 deletions

View File

@@ -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);