diff options
author | 2021-07-20 23:53:10 +0000 | |
---|---|---|
committer | 2021-07-20 23:53:10 +0000 | |
commit | 2ab7a803bb4e934cbf8d08384fcaf5028cfed59e (patch) | |
tree | d29d6c7e2f3908a157b61d514b886cf739705802 /libs/input/Input.cpp | |
parent | 57ca2a902aa9714c59ebd822f78fea9ca66d9f46 (diff) | |
parent | 7cdf8ef17636cdc5cc5fe41578951b4b1f23865c (diff) |
Merge "TouchEvent (1/n): Adding TouchModeEvent to InputChannel"
Diffstat (limited to 'libs/input/Input.cpp')
-rw-r--r-- | libs/input/Input.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp index 82a814f293..53a8c4f16f 100644 --- a/libs/input/Input.cpp +++ b/libs/input/Input.cpp @@ -160,6 +160,9 @@ const char* inputEventTypeToString(int32_t type) { case AINPUT_EVENT_TYPE_DRAG: { return "DRAG"; } + case AINPUT_EVENT_TYPE_TOUCH_MODE: { + return "TOUCH_MODE"; + } } return "UNKNOWN"; } @@ -883,6 +886,19 @@ void DragEvent::initialize(const DragEvent& from) { mY = from.mY; } +// --- TouchModeEvent --- + +void TouchModeEvent::initialize(int32_t id, bool isInTouchMode) { + InputEvent::initialize(id, ReservedInputDeviceId::VIRTUAL_KEYBOARD_ID, AINPUT_SOURCE_UNKNOWN, + ADISPLAY_ID_NONE, INVALID_HMAC); + mIsInTouchMode = isInTouchMode; +} + +void TouchModeEvent::initialize(const TouchModeEvent& from) { + InputEvent::initialize(from); + mIsInTouchMode = from.mIsInTouchMode; +} + // --- PooledInputEventFactory --- PooledInputEventFactory::PooledInputEventFactory(size_t maxPoolSize) : @@ -937,6 +953,15 @@ DragEvent* PooledInputEventFactory::createDragEvent() { return event; } +TouchModeEvent* PooledInputEventFactory::createTouchModeEvent() { + if (mTouchModeEventPool.empty()) { + return new TouchModeEvent(); + } + TouchModeEvent* event = mTouchModeEventPool.front().release(); + mTouchModeEventPool.pop(); + return event; +} + void PooledInputEventFactory::recycle(InputEvent* event) { switch (event->getType()) { case AINPUT_EVENT_TYPE_KEY: |