summaryrefslogtreecommitdiffstats
path: root/services/jni
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-09-09 20:33:43 -0700
committerJeff Brown <jeffbrown@google.com>2012-09-10 15:48:47 -0700
commit83d616a9c7b9505153d258511eb5c16b552e268d (patch)
tree4df9620550008dc0e3e0daf21f442b9fe6cc8051 /services/jni
parent7a8cce3d8a6fb781d840ddf60324a301f5a3f2d9 (diff)
downloadframeworks_base-83d616a9c7b9505153d258511eb5c16b552e268d.zip
frameworks_base-83d616a9c7b9505153d258511eb5c16b552e268d.tar.gz
frameworks_base-83d616a9c7b9505153d258511eb5c16b552e268d.tar.bz2
Make input system aware of multiple displays.
The input system needs to know about the window that has focus, even if it is on a secondary display. So now we send it the list of all windows and indicate which display they are on. We filter the list of windows as necessary when delivering touch events. To keep things simple, monitor input channels and input filters are not supported except on the main display. We also do not pass the display id to applications; it is only used inside the input system for now. Properly scale touch coordinates based on the viewport. This will be needed to ensure that touch works on external display as well as when the internal display is being used to simulate a different resolution. Change-Id: I1815579a52fcc852c519b5391fc7ab8767c2dc59
Diffstat (limited to 'services/jni')
-rw-r--r--services/jni/com_android_server_input_InputManagerService.cpp7
-rw-r--r--services/jni/com_android_server_input_InputWindowHandle.cpp6
2 files changed, 11 insertions, 2 deletions
diff --git a/services/jni/com_android_server_input_InputManagerService.cpp b/services/jni/com_android_server_input_InputManagerService.cpp
index 5e36bf8..319cacd 100644
--- a/services/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/jni/com_android_server_input_InputManagerService.cpp
@@ -993,7 +993,8 @@ static void nativeStart(JNIEnv* env, jclass clazz, jint ptr) {
static void nativeSetDisplayViewport(JNIEnv* env, jclass clazz, jint ptr, jboolean external,
jint displayId, jint orientation,
jint logicalLeft, jint logicalTop, jint logicalRight, jint logicalBottom,
- jint physicalLeft, jint physicalTop, jint physicalRight, jint physicalBottom) {
+ jint physicalLeft, jint physicalTop, jint physicalRight, jint physicalBottom,
+ jint deviceWidth, jint deviceHeight) {
NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
DisplayViewport v;
@@ -1007,6 +1008,8 @@ static void nativeSetDisplayViewport(JNIEnv* env, jclass clazz, jint ptr, jboole
v.physicalTop = physicalTop;
v.physicalRight = physicalRight;
v.physicalBottom = physicalBottom;
+ v.deviceWidth = deviceWidth;
+ v.deviceHeight = deviceHeight;
im->setDisplayViewport(external, v);
}
@@ -1288,7 +1291,7 @@ static JNINativeMethod gInputManagerMethods[] = {
(void*) nativeInit },
{ "nativeStart", "(I)V",
(void*) nativeStart },
- { "nativeSetDisplayViewport", "(IZIIIIIIIIII)V",
+ { "nativeSetDisplayViewport", "(IZIIIIIIIIIIII)V",
(void*) nativeSetDisplayViewport },
{ "nativeGetScanCodeState", "(IIII)I",
(void*) nativeGetScanCodeState },
diff --git a/services/jni/com_android_server_input_InputWindowHandle.cpp b/services/jni/com_android_server_input_InputWindowHandle.cpp
index 01fb781..6692994 100644
--- a/services/jni/com_android_server_input_InputWindowHandle.cpp
+++ b/services/jni/com_android_server_input_InputWindowHandle.cpp
@@ -52,6 +52,7 @@ static struct {
jfieldID ownerPid;
jfieldID ownerUid;
jfieldID inputFeatures;
+ jfieldID displayId;
} gInputWindowHandleClassInfo;
static Mutex gHandleMutex;
@@ -151,6 +152,8 @@ bool NativeInputWindowHandle::updateInfo() {
gInputWindowHandleClassInfo.ownerUid);
mInfo->inputFeatures = env->GetIntField(obj,
gInputWindowHandleClassInfo.inputFeatures);
+ mInfo->displayId = env->GetIntField(obj,
+ gInputWindowHandleClassInfo.displayId);
env->DeleteLocalRef(obj);
return true;
@@ -291,6 +294,9 @@ int register_android_server_InputWindowHandle(JNIEnv* env) {
GET_FIELD_ID(gInputWindowHandleClassInfo.inputFeatures, clazz,
"inputFeatures", "I");
+
+ GET_FIELD_ID(gInputWindowHandleClassInfo.displayId, clazz,
+ "displayId", "I");
return 0;
}