summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2015-02-01 23:40:19 -0500
committerSteve Kondik <steve@cyngn.com>2015-10-17 14:03:23 -0700
commit6b6c0cde5b9f074ad43b4a0f2a37db8ec5409574 (patch)
tree936be300acec7eafbc4b5d9d86917ddc37f128cd
parentac086d353e02e745ddf6d5d43f1a3f8298df1688 (diff)
downloadframeworks_native-6b6c0cde5b9f074ad43b4a0f2a37db8ec5409574.zip
frameworks_native-6b6c0cde5b9f074ad43b4a0f2a37db8ec5409574.tar.gz
frameworks_native-6b6c0cde5b9f074ad43b4a0f2a37db8ec5409574.tar.bz2
input: Add option to toggle pointer icon when using stylus(3/3)
* The visible pointer icon when hovering or drawing with the stylus is quite annoying when trying to actually draw with it. Turn it off by default and add an option to turn it on. Forward Port from CM-11.0 Change-Id: Ie4e9e6bcc48803b195d1615d83d6e36d663cc33a
-rw-r--r--services/inputflinger/InputReader.cpp16
-rw-r--r--services/inputflinger/InputReader.h22
2 files changed, 28 insertions, 10 deletions
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp
index f89953c..7b85f07 100644
--- a/services/inputflinger/InputReader.cpp
+++ b/services/inputflinger/InputReader.cpp
@@ -16,7 +16,7 @@
#define LOG_TAG "InputReader"
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
// Log debug messages for each raw event received from the EventHub.
#define DEBUG_RAW_EVENTS 0
@@ -2940,7 +2940,8 @@ void TouchInputMapper::configure(nsecs_t when,
if (!changes || (changes & (InputReaderConfiguration::CHANGE_DISPLAY_INFO
| InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT
| InputReaderConfiguration::CHANGE_SHOW_TOUCHES
- | InputReaderConfiguration::CHANGE_EXTERNAL_STYLUS_PRESENCE))) {
+ | InputReaderConfiguration::CHANGE_EXTERNAL_STYLUS_PRESENCE
+ | InputReaderConfiguration::CHANGE_STYLUS_ICON_ENABLED))) {
// Configure device sources, surface dimensions, orientation and
// scaling factors.
configureSurface(when, &resetNeeded);
@@ -4870,7 +4871,7 @@ void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlag
&& (mPointerGesture.lastGestureMode == PointerGesture::SWIPE
|| mPointerGesture.lastGestureMode == PointerGesture::FREEFORM)) {
// Remind the user of where the pointer is after finishing a gesture with spots.
- mPointerController->unfade(PointerControllerInterface::TRANSITION_GRADUAL);
+ unfadePointer(PointerControllerInterface::TRANSITION_GRADUAL);
}
break;
case PointerGesture::TAP:
@@ -5936,7 +5937,7 @@ void TouchInputMapper::dispatchPointerSimple(nsecs_t when, uint32_t policyFlags,
mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER);
mPointerController->clearSpots();
mPointerController->setButtonState(mCurrentRawState.buttonState);
- mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE);
+ unfadePointer(PointerControllerInterface::TRANSITION_IMMEDIATE);
} else if (!down && !hovering && (mPointerSimple.down || mPointerSimple.hovering)) {
mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
}
@@ -6143,6 +6144,13 @@ void TouchInputMapper::fadePointer() {
}
}
+void TouchInputMapper::unfadePointer(PointerControllerInterface::Transition transition) {
+ if (mPointerController != NULL &&
+ !(mPointerUsage == POINTER_USAGE_STYLUS && !mConfig.stylusIconEnabled)) {
+ mPointerController->unfade(transition);
+ }
+}
+
nsecs_t TouchInputMapper::mLastStylusTime = 0;
bool TouchInputMapper::rejectPalm(nsecs_t when) {
diff --git a/services/inputflinger/InputReader.h b/services/inputflinger/InputReader.h
index 22a5dc8..9a46fb8 100644
--- a/services/inputflinger/InputReader.h
+++ b/services/inputflinger/InputReader.h
@@ -145,7 +145,10 @@ struct InputReaderConfiguration {
CHANGE_EXTERNAL_STYLUS_PRESENCE = 1 << 7,
// Volume keys rotation option changed.
- CHANGE_VOLUME_KEYS_ROTATION = 1 << 7,
+ CHANGE_VOLUME_KEYS_ROTATION = 1 << 8,
+
+ // Stylus icon option changed.
+ CHANGE_STYLUS_ICON_ENABLED = 1 << 9,
// All devices must be reopened.
CHANGE_MUST_REOPEN = 1 << 31,
@@ -234,13 +237,16 @@ struct InputReaderConfiguration {
// True to show the location of touches on the touch screen as spots.
bool showTouches;
- // Remap volume keys according to display rotation
- // 0 - disabled, 1 - phone or hybrid rotation mode, 2 - tablet rotation mode
- int volumeKeysRotationMode;
+ // True to show the pointer icon when a stylus is used.
+ bool stylusIconEnabled;
// Ignore finger touches this long after the stylus has been used (including hover)
nsecs_t stylusPalmRejectionTime;
+ // Remap volume keys according to display rotation
+ // 0 - disabled, 1 - phone or hybrid rotation mode, 2 - tablet rotation mode
+ int volumeKeysRotationMode;
+
InputReaderConfiguration() :
virtualKeyQuietTime(0),
pointerVelocityControlParameters(1.0f, 500.0f, 3000.0f, 3.0f),
@@ -257,9 +263,11 @@ struct InputReaderConfiguration {
pointerGestureSwipeMaxWidthRatio(0.25f),
pointerGestureMovementSpeedRatio(0.8f),
pointerGestureZoomSpeedRatio(0.3f),
- stylusPalmRejectionTime(50 * 10000000LL), // 50 ms
showTouches(false),
- volumeKeysRotationMode(0) { }
+ stylusIconEnabled(false),
+ stylusPalmRejectionTime(50 * 10000000LL), // 50 ms
+ volumeKeysRotationMode(0)
+ { }
bool getDisplayInfo(bool external, DisplayViewport* outViewport) const;
void setDisplayInfo(bool external, const DisplayViewport& viewport);
@@ -1870,6 +1878,8 @@ private:
static void assignPointerIds(const RawState* last, RawState* current);
+ void unfadePointer(PointerControllerInterface::Transition transition);
+
bool rejectPalm(nsecs_t when);
};