summaryrefslogtreecommitdiff
path: root/libs/input/PointerController.cpp
diff options
context:
space:
mode:
authorJun Mukai <mukai@google.com>2015-12-03 01:13:31 -0800
committerJun Mukai <mukai@google.com>2015-12-18 10:22:43 -0800
commit347e5d498f4c216d588e98776a386d8bdf93d05c (patch)
tree8f9b85983dcee4deeefc7fcbaa64124b6ea176f8 /libs/input/PointerController.cpp
parent92e432c30e2304272c2f5b1b33366f32c3d763cf (diff)
Introduce pointer capture API.
This depends on I4189eb4d93f50c2865b7a325727be5ceebcc71f8 of frameworks/native. Bug: 5452473 Change-Id: Ie21e521f3e5c581f976dc0feb5d84bfa48b046cd
Diffstat (limited to 'libs/input/PointerController.cpp')
-rw-r--r--libs/input/PointerController.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp
index 529849e99fb6..212c6a0d2c3c 100644
--- a/libs/input/PointerController.cpp
+++ b/libs/input/PointerController.cpp
@@ -90,6 +90,7 @@ PointerController::PointerController(const sp<PointerControllerPolicyInterface>&
mLocked.lastFrameUpdatedTime = 0;
mLocked.buttonState = 0;
+ mLocked.iconDetached = false;
mPolicy->loadPointerIcon(&mLocked.pointerIcon);
@@ -184,6 +185,10 @@ void PointerController::setPosition(float x, float y) {
}
void PointerController::setPositionLocked(float x, float y) {
+ if (mLocked.iconDetached) {
+ return;
+ }
+
float minX, minY, maxX, maxY;
if (getBoundsLocked(&minX, &minY, &maxX, &maxY)) {
if (x <= minX) {
@@ -217,6 +222,10 @@ void PointerController::fade(Transition transition) {
// Remove the inactivity timeout, since we are fading now.
removeInactivityTimeoutLocked();
+ if (mLocked.iconDetached) {
+ return;
+ }
+
// Start fading.
if (transition == TRANSITION_IMMEDIATE) {
mLocked.pointerFadeDirection = 0;
@@ -234,6 +243,10 @@ void PointerController::unfade(Transition transition) {
// Always reset the inactivity timer.
resetInactivityTimeoutLocked();
+ if (mLocked.iconDetached) {
+ return;
+ }
+
// Start unfading.
if (transition == TRANSITION_IMMEDIATE) {
mLocked.pointerFadeDirection = 0;
@@ -349,6 +362,22 @@ void PointerController::reloadPointerResources() {
updatePointerLocked();
}
+void PointerController::detachPointerIcon(bool detached) {
+ AutoMutex _l(mLock);
+
+ if (mLocked.iconDetached == detached) {
+ return;
+ }
+
+ mLocked.iconDetached = detached;
+ if (detached) {
+ mLocked.pointerFadeDirection = -1;
+ } else {
+ mLocked.pointerFadeDirection = 1;
+ }
+ startAnimationLocked();
+}
+
void PointerController::setDisplayViewport(int32_t width, int32_t height, int32_t orientation) {
AutoMutex _l(mLock);