diff options
author | Steve Kondik <shade@chemlab.org> | 2012-06-03 07:27:20 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2013-01-03 00:54:01 -0800 |
commit | 5297d48d394724bbb3386c8d6222d0b81d41d497 (patch) | |
tree | 9de76185f047ecce0727e95d8a3e1a93efaeaaac /services/jni | |
parent | 289b640d1a5b0b90ba513a474e826ba3ba323288 (diff) | |
download | frameworks_base-5297d48d394724bbb3386c8d6222d0b81d41d497.zip frameworks_base-5297d48d394724bbb3386c8d6222d0b81d41d497.tar.gz frameworks_base-5297d48d394724bbb3386c8d6222d0b81d41d497.tar.bz2 |
input: Add option to toggle pointer icon when using stylus
* 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.
Change-Id: Ib7f23e8b69589e3f875d150caf05065b64676e44
Conflicts:
services/input/InputReader.cpp
services/input/InputReader.h
services/jni/com_android_server_input_InputManagerService.cpp
Diffstat (limited to 'services/jni')
-rw-r--r-- | services/jni/com_android_server_input_InputManagerService.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/services/jni/com_android_server_input_InputManagerService.cpp b/services/jni/com_android_server_input_InputManagerService.cpp index a97becf..55a8061 100644 --- a/services/jni/com_android_server_input_InputManagerService.cpp +++ b/services/jni/com_android_server_input_InputManagerService.cpp @@ -176,6 +176,7 @@ public: void setSystemUiVisibility(int32_t visibility); void setPointerSpeed(int32_t speed); void setShowTouches(bool enabled); + void setStylusIconEnabled(bool enabled); /* --- InputReaderPolicyInterface implementation --- */ @@ -236,6 +237,9 @@ private: // Show touches feature enable/disable. bool showTouches; + // Show icon when stylus is used + bool stylusIconEnabled; + // Sprite controller singleton, created on first use. sp<SpriteController> spriteController; @@ -274,6 +278,7 @@ NativeInputManager::NativeInputManager(jobject contextObj, mLocked.pointerSpeed = 0; mLocked.pointerGesturesEnabled = true; mLocked.showTouches = false; + mLocked.stylusIconEnabled = false; } sp<EventHub> eventHub = new EventHub(); @@ -406,8 +411,11 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon outConfig->showTouches = mLocked.showTouches; + outConfig->stylusIconEnabled = mLocked.stylusIconEnabled; + outConfig->setDisplayInfo(false /*external*/, mLocked.internalViewport); outConfig->setDisplayInfo(true /*external*/, mLocked.externalViewport); + } // release lock } @@ -728,6 +736,22 @@ void NativeInputManager::setShowTouches(bool enabled) { InputReaderConfiguration::CHANGE_SHOW_TOUCHES); } +void NativeInputManager::setStylusIconEnabled(bool enabled) { + { // acquire lock + AutoMutex _l(mLock); + + if (mLocked.stylusIconEnabled == enabled) { + return; + } + + ALOGI("Setting stylus icon enabled to %s.", enabled ? "enabled" : "disabled"); + mLocked.stylusIconEnabled = enabled; + } // release lock + + mInputManager->getReader()->requestRefreshConfiguration( + InputReaderConfiguration::CHANGE_STYLUS_ICON_ENABLED); +} + bool NativeInputManager::isScreenOn() { return android_server_PowerManagerService_isScreenOn(); } @@ -1219,6 +1243,13 @@ static void nativeSetShowTouches(JNIEnv* env, im->setShowTouches(enabled); } +static void nativeSetStylusIconEnabled(JNIEnv* env, + jclass clazz, jint ptr, jboolean enabled) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); + + im->setStylusIconEnabled(enabled); +} + static void nativeVibrate(JNIEnv* env, jclass clazz, jint ptr, jint deviceId, jlongArray patternObj, jint repeat, jint token) { @@ -1324,6 +1355,8 @@ static JNINativeMethod gInputManagerMethods[] = { (void*) nativeSetPointerSpeed }, { "nativeSetShowTouches", "(IZ)V", (void*) nativeSetShowTouches }, + { "nativeSetStylusIconEnabled", "(IZ)V", + (void*) nativeSetStylusIconEnabled }, { "nativeVibrate", "(II[JII)V", (void*) nativeVibrate }, { "nativeCancelVibrate", "(III)V", |