summaryrefslogtreecommitdiffstats
path: root/services/input
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-08-26 17:14:14 -0700
committerJeff Brown <jeffbrown@google.com>2011-08-26 17:14:14 -0700
commitdaf4a127ba2af82a3fb477044b872719a0ab1827 (patch)
tree2147e705a6b912683abd7169910acb548413d946 /services/input
parent9b9783ad60d31f3df5d2524e13abc1437d5b6f7d (diff)
downloadframeworks_base-daf4a127ba2af82a3fb477044b872719a0ab1827.zip
frameworks_base-daf4a127ba2af82a3fb477044b872719a0ab1827.tar.gz
frameworks_base-daf4a127ba2af82a3fb477044b872719a0ab1827.tar.bz2
Add a "show touches" option for demos and presentations.
Bug: 4569045 Change-Id: I8726ea292dd7def790a5e40d7d7e58968974f896
Diffstat (limited to 'services/input')
-rw-r--r--services/input/InputReader.cpp35
-rw-r--r--services/input/InputReader.h9
2 files changed, 32 insertions, 12 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index bfcf8e0..f4e5b79 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -2491,7 +2491,8 @@ void TouchInputMapper::configure(nsecs_t when,
bool resetNeeded = false;
if (!changes || (changes & (InputReaderConfiguration::CHANGE_DISPLAY_INFO
- | InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT))) {
+ | InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT
+ | InputReaderConfiguration::CHANGE_SHOW_TOUCHES))) {
// Configure device sources, surface dimensions, orientation and
// scaling factors.
configureSurface(when, &resetNeeded);
@@ -2681,16 +2682,17 @@ void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) {
bool deviceModeChanged;
if (mDeviceMode != oldDeviceMode) {
deviceModeChanged = true;
+ mOrientedRanges.clear();
+ }
- if (mDeviceMode == DEVICE_MODE_POINTER) {
- if (mPointerController == NULL) {
- mPointerController = getPolicy()->obtainPointerController(getDeviceId());
- }
- } else {
- mPointerController.clear();
+ // Create pointer controller if needed.
+ if (mDeviceMode == DEVICE_MODE_POINTER ||
+ (mDeviceMode == DEVICE_MODE_DIRECT && mConfig.showTouches)) {
+ if (mPointerController == NULL) {
+ mPointerController = getPolicy()->obtainPointerController(getDeviceId());
}
-
- mOrientedRanges.clear();
+ } else {
+ mPointerController.clear();
}
bool orientationChanged = mSurfaceOrientation != orientation;
@@ -3380,7 +3382,7 @@ void TouchInputMapper::sync(nsecs_t when) {
cookPointerData();
// Dispatch the touches either directly or by translation through a pointer on screen.
- if (mPointerController != NULL) {
+ if (mDeviceMode == DEVICE_MODE_POINTER) {
for (BitSet32 idBits(mCurrentRawPointerData.touchingIdBits); !idBits.isEmpty(); ) {
uint32_t id = idBits.clearFirstMarkedBit();
const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id);
@@ -3418,6 +3420,17 @@ void TouchInputMapper::sync(nsecs_t when) {
dispatchPointerUsage(when, policyFlags, pointerUsage);
} else {
+ if (mDeviceMode == DEVICE_MODE_DIRECT
+ && mConfig.showTouches && mPointerController != NULL) {
+ mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_SPOT);
+ mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
+
+ mPointerController->setButtonState(mCurrentButtonState);
+ mPointerController->setSpots(mCurrentCookedPointerData.pointerCoords,
+ mCurrentCookedPointerData.idToIndex,
+ mCurrentCookedPointerData.touchingIdBits);
+ }
+
dispatchHoverExit(when, policyFlags);
dispatchTouches(when, policyFlags);
dispatchHoverEnterAndMove(when, policyFlags);
@@ -3442,7 +3455,7 @@ void TouchInputMapper::sync(nsecs_t when) {
}
void TouchInputMapper::timeoutExpired(nsecs_t when) {
- if (mPointerController != NULL) {
+ if (mDeviceMode == DEVICE_MODE_POINTER) {
if (mPointerUsage == POINTER_USAGE_GESTURES) {
dispatchPointerGestures(when, 0 /*policyFlags*/, true /*isTimeout*/);
}
diff --git a/services/input/InputReader.h b/services/input/InputReader.h
index bad96df..cd3ea37 100644
--- a/services/input/InputReader.h
+++ b/services/input/InputReader.h
@@ -56,6 +56,9 @@ struct InputReaderConfiguration {
// The display size or orientation changed.
CHANGE_DISPLAY_INFO = 1 << 2,
+ // The visible touches option changed.
+ CHANGE_SHOW_TOUCHES = 1 << 3,
+
// All devices must be reopened.
CHANGE_MUST_REOPEN = 1 << 31,
};
@@ -140,6 +143,9 @@ struct InputReaderConfiguration {
// will cover this portion of the display diagonal.
float pointerGestureZoomSpeedRatio;
+ // True to show the location of touches on the touch screen as spots.
+ bool showTouches;
+
InputReaderConfiguration() :
virtualKeyQuietTime(0),
pointerVelocityControlParameters(1.0f, 500.0f, 3000.0f, 3.0f),
@@ -155,7 +161,8 @@ struct InputReaderConfiguration {
pointerGestureSwipeTransitionAngleCosine(0.2588f), // cosine of 75 degrees
pointerGestureSwipeMaxWidthRatio(0.25f),
pointerGestureMovementSpeedRatio(0.8f),
- pointerGestureZoomSpeedRatio(0.3f) { }
+ pointerGestureZoomSpeedRatio(0.3f),
+ showTouches(false) { }
bool getDisplayInfo(int32_t displayId, bool external,
int32_t* width, int32_t* height, int32_t* orientation) const;