论坛版主
|
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp
old mode 100644
new mode 100755
index 9dbabfb..541eb3b
--- a/services/inputflinger/InputReader.cpp
+++ b/services/inputflinger/InputReader.cpp
@@ -16,31 +16,31 @@
#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
// Log debug messages about touch screen filtering hacks.
-#define DEBUG_HACKS 0
+#define DEBUG_HACKS 1
// Log debug messages about virtual key processing.
-#define DEBUG_VIRTUAL_KEYS 0
+#define DEBUG_VIRTUAL_KEYS 1
// Log debug messages about pointers.
-#define DEBUG_POINTERS 0
+#define DEBUG_POINTERS 1
// Log debug messages about pointer assignment calculations.
-#define DEBUG_POINTER_ASSIGNMENT 0
+#define DEBUG_POINTER_ASSIGNMENT 1
// Log debug messages about gesture detection.
-#define DEBUG_GESTURES 0
+#define DEBUG_GESTURES 1
// Log debug messages about the vibrator.
-#define DEBUG_VIBRATOR 0
+#define DEBUG_VIBRATOR 1
// Log debug messages about fusing stylus data.
-#define DEBUG_STYLUS_FUSION 0
+#define DEBUG_STYLUS_FUSION 1
#include "InputReader.h"
@@ -57,6 +57,7 @@
#include <android-base/stringprintf.h>
#include <input/Keyboard.h>
#include <input/VirtualKeyMap.h>
+#include <cutils/properties.h>
#define INDENT " "
#define INDENT2 " "
@@ -183,6 +184,7 @@ static int32_t rotateKeyCode(int32_t keyCode, int32_t orientation) {
static void rotateDelta(int32_t orientation, float* deltaX, float* deltaY) {
float temp;
+ ALOGD("rotateDelta orientation =%d",orientation);
switch (orientation) {
case DISPLAY_ORIENTATION_90:
temp = *deltaX;
@@ -2782,6 +2784,25 @@ void CursorInputMapper::process(const RawEvent* rawEvent) {
}
}
+int getPropertyInt(const char *key, int32_t def) {
+ int len;
+ char* end;
+ char buf[PROPERTY_VALUE_MAX] = {0};
+ int32_t result = def;
+
+ len = property_get(key, buf, "");
+
+ if (len > 0) {
+ result = strtol(buf, &end, 0);
+
+ if (end == buf) {
+ result = def;
+ }
+ }
+
+ return result;
+}
+
void CursorInputMapper::sync(nsecs_t when) {
int32_t lastButtonState = mButtonState;
int32_t currentButtonState = mCursorButtonAccumulator.getButtonState();
@@ -2790,6 +2811,8 @@ void CursorInputMapper::sync(nsecs_t when) {
bool wasDown = isPointerDown(lastButtonState);
bool down = isPointerDown(currentButtonState);
bool downChanged;
+ // char buf[200] = {0};
+
if (!wasDown && down) {
mDownTime = when;
downChanged = true;
@@ -2807,12 +2830,21 @@ void CursorInputMapper::sync(nsecs_t when) {
float deltaY = mCursorMotionAccumulator.getRelativeY() * mYScale;
bool moved = deltaX != 0 || deltaY != 0;
+
+ const char * dir="persist.vendor.sys.orientation";
+ int state=getPropertyInt(dir,0);
+ ALOGD("generateVertexShader %d\n", state);
+
// Rotate delta according to orientation if needed.
+ // ALOGD("rotateDelta111 deltaX=%0.3f,deltaY=%0.3f,orientationAware=%d,hasAssociatedDisplay=%d",deltaX,deltaY,mParameters.orientationAware,mParameters.hasAssociatedDisplay);
if (mParameters.orientationAware && mParameters.hasAssociatedDisplay
&& (deltaX != 0.0f || deltaY != 0.0f)) {
rotateDelta(mOrientation, &deltaX, &deltaY);
}
+ if(state==2)
+ rotateDelta(DISPLAY_ORIENTATION_180, &deltaX, &deltaY);
+
// Move the pointer.
PointerProperties pointerProperties;
pointerProperties.clear();
@@ -2850,12 +2882,20 @@ void CursorInputMapper::sync(nsecs_t when) {
float x, y;
mPointerController->getPosition(&x, &y);
+ if(state==2){
+ x=1919-x;
+ y=1079-y;
+ }
+ // ALOGD("rotateDelta111 pointerCoords x=%0.3f,y=%0.3f,deltaX=%0.3f,deltaY=%0.3f",x,y,deltaX,deltaY);
+ // x=x-1919;
+ // y=y-1079;
pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, x);
pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y);
pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X, deltaX);
pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y, deltaY);
displayId = ADISPLAY_ID_DEFAULT;
} else {
+ ALOGD("rotateDelta111 pointerCoords x=%0.3f,y=%0.3f",deltaX,deltaY);
pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, deltaX);
pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, deltaY);
displayId = ADISPLAY_ID_NONE;
|