diff options
Diffstat (limited to 'services/inputflinger/reader/mapper/TouchCursorInputMapperCommon.h')
-rw-r--r-- | services/inputflinger/reader/mapper/TouchCursorInputMapperCommon.h | 65 |
1 files changed, 10 insertions, 55 deletions
diff --git a/services/inputflinger/reader/mapper/TouchCursorInputMapperCommon.h b/services/inputflinger/reader/mapper/TouchCursorInputMapperCommon.h index da0fea4616..2a3e2637f1 100644 --- a/services/inputflinger/reader/mapper/TouchCursorInputMapperCommon.h +++ b/services/inputflinger/reader/mapper/TouchCursorInputMapperCommon.h @@ -17,38 +17,16 @@ #ifndef _UI_INPUTREADER_TOUCH_CURSOR_INPUT_MAPPER_COMMON_H #define _UI_INPUTREADER_TOUCH_CURSOR_INPUT_MAPPER_COMMON_H -#include <android-base/properties.h> -#include <input/DisplayViewport.h> -#include <stdint.h> - #include "EventHub.h" #include "InputListener.h" #include "InputReaderContext.h" +#include <stdint.h> + namespace android { // --- Static Definitions --- -// When per-window input rotation is enabled, display transformations such as rotation and -// projection are part of the input window's transform. This means InputReader should work in the -// un-rotated coordinate space. -static bool isPerWindowInputRotationEnabled() { - static const bool PER_WINDOW_INPUT_ROTATION = - base::GetBoolProperty("persist.debug.per_window_input_rotation", false); - return PER_WINDOW_INPUT_ROTATION; -} - -static int32_t getInverseRotation(int32_t orientation) { - switch (orientation) { - case DISPLAY_ORIENTATION_90: - return DISPLAY_ORIENTATION_270; - case DISPLAY_ORIENTATION_270: - return DISPLAY_ORIENTATION_90; - default: - return orientation; - } -} - static void rotateDelta(int32_t orientation, float* deltaX, float* deltaY) { float temp; switch (orientation) { @@ -68,29 +46,6 @@ static void rotateDelta(int32_t orientation, float* deltaX, float* deltaY) { *deltaX = -*deltaY; *deltaY = temp; break; - - default: - break; - } -} - -// Rotates the given point (x, y) by the supplied orientation. The width and height are the -// dimensions of the surface prior to this rotation being applied. -static void rotatePoint(int32_t orientation, float& x, float& y, int32_t width, int32_t height) { - rotateDelta(orientation, &x, &y); - switch (orientation) { - case DISPLAY_ORIENTATION_90: - y += width; - break; - case DISPLAY_ORIENTATION_180: - x += width; - y += height; - break; - case DISPLAY_ORIENTATION_270: - x += height; - break; - default: - break; } } @@ -103,27 +58,27 @@ static bool isPointerDown(int32_t buttonState) { } static void synthesizeButtonKey(InputReaderContext* context, int32_t action, nsecs_t when, - nsecs_t readTime, int32_t deviceId, uint32_t source, - int32_t displayId, uint32_t policyFlags, int32_t lastButtonState, + int32_t deviceId, uint32_t source, int32_t displayId, + uint32_t policyFlags, int32_t lastButtonState, int32_t currentButtonState, int32_t buttonState, int32_t keyCode) { if ((action == AKEY_EVENT_ACTION_DOWN && !(lastButtonState & buttonState) && (currentButtonState & buttonState)) || (action == AKEY_EVENT_ACTION_UP && (lastButtonState & buttonState) && !(currentButtonState & buttonState))) { - NotifyKeyArgs args(context->getNextId(), when, readTime, deviceId, source, displayId, - policyFlags, action, 0, keyCode, 0, context->getGlobalMetaState(), when); + NotifyKeyArgs args(context->getNextId(), when, deviceId, source, displayId, policyFlags, + action, 0, keyCode, 0, context->getGlobalMetaState(), when); context->getListener()->notifyKey(&args); } } static void synthesizeButtonKeys(InputReaderContext* context, int32_t action, nsecs_t when, - nsecs_t readTime, int32_t deviceId, uint32_t source, - int32_t displayId, uint32_t policyFlags, int32_t lastButtonState, + int32_t deviceId, uint32_t source, int32_t displayId, + uint32_t policyFlags, int32_t lastButtonState, int32_t currentButtonState) { - synthesizeButtonKey(context, action, when, readTime, deviceId, source, displayId, policyFlags, + synthesizeButtonKey(context, action, when, deviceId, source, displayId, policyFlags, lastButtonState, currentButtonState, AMOTION_EVENT_BUTTON_BACK, AKEYCODE_BACK); - synthesizeButtonKey(context, action, when, readTime, deviceId, source, displayId, policyFlags, + synthesizeButtonKey(context, action, when, deviceId, source, displayId, policyFlags, lastButtonState, currentButtonState, AMOTION_EVENT_BUTTON_FORWARD, AKEYCODE_FORWARD); } |