Allow touch to use a key code to sync touch events
This is needed to make touch work on the x86-64 emulator target though I have seen the key code used on other devices as a way to synchronize touch events. Change-Id: I31a3cc56e6470f2c707641b537140e44f5e686aa
This commit is contained in:
+17
@@ -342,18 +342,22 @@ void InputHandler::process_EV_ABS(input_event& ev)
|
||||
|
||||
if (ev.code == 0)
|
||||
{
|
||||
#ifndef TW_USE_KEY_CODE_TOUCH_SYNC
|
||||
if (state == AS_IN_ACTION_AREA)
|
||||
{
|
||||
LOGEVENT("TOUCH_RELEASE: %d,%d\n", x, y);
|
||||
PageManager::NotifyTouch(TOUCH_RELEASE, x, y);
|
||||
}
|
||||
touch_status = TS_NONE;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!touch_status)
|
||||
{
|
||||
#ifndef TW_USE_KEY_CODE_TOUCH_SYNC
|
||||
doTouchStart();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -403,6 +407,13 @@ void InputHandler::process_EV_KEY(input_event& ev)
|
||||
kb->KeyUp(KEY_BACK);
|
||||
} else if (ev.value != 0) {
|
||||
// This is a key press
|
||||
#ifdef TW_USE_KEY_CODE_TOUCH_SYNC
|
||||
if (ev.code == TW_USE_KEY_CODE_TOUCH_SYNC) {
|
||||
LOGEVENT("key code %i key press == touch start %i %i\n", TW_USE_KEY_CODE_TOUCH_SYNC, x, y);
|
||||
doTouchStart();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (kb->KeyDown(ev.code)) {
|
||||
// Key repeat is enabled for this key
|
||||
key_status = KS_KEY_PRESSED;
|
||||
@@ -417,6 +428,12 @@ void InputHandler::process_EV_KEY(input_event& ev)
|
||||
kb->KeyUp(ev.code);
|
||||
key_status = KS_NONE;
|
||||
touch_status = TS_NONE;
|
||||
#ifdef TW_USE_KEY_CODE_TOUCH_SYNC
|
||||
if (ev.code == TW_USE_KEY_CODE_TOUCH_SYNC) {
|
||||
LOGEVENT("key code %i key release == touch release %i %i\n", TW_USE_KEY_CODE_TOUCH_SYNC, x, y);
|
||||
PageManager::NotifyTouch(TOUCH_RELEASE, x, y);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user