From 0b7fe504dc93246957aee38c0d93ea1fa1580fab Mon Sep 17 00:00:00 2001 From: Vojtech Bocek Date: Thu, 13 Mar 2014 17:36:52 +0100 Subject: Add support for actions triggered by key combination Change-Id: I9dfa7de40229f00412d63fc9c1eb3a809a6eb2e6 Signed-off-by: Vojtech Bocek --- gui/gui.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'gui/gui.cpp') diff --git a/gui/gui.cpp b/gui/gui.cpp index 0164ec393..c0bd008a9 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -187,8 +187,8 @@ static void * input_thread(void *cookie) static int x = 0, y = 0; static int lshift = 0, rshift = 0; static struct timeval touchStart; - HardwareKeyboard kb; string seconds; + HardwareKeyboard *kb = PageManager::GetHardwareKeyboard(); MouseCursor *cursor = PageManager::GetMouseCursor(); #ifndef TW_NO_SCREEN_TIMEOUT @@ -249,7 +249,7 @@ static void * input_thread(void *cookie) #endif gettimeofday(&touchStart, NULL); key_repeat = 2; - kb.KeyRepeat(); + kb->KeyRepeat(); #ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); #endif @@ -261,7 +261,7 @@ static void * input_thread(void *cookie) LOGERR("KEY_REPEAT: %d,%d\n", x, y); #endif gettimeofday(&touchStart, NULL); - kb.KeyRepeat(); + kb->KeyRepeat(); #ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); #endif @@ -356,6 +356,9 @@ static void * input_thread(void *cookie) { cursor->GetPos(x, y); +#ifdef _EVENT_LOGGING + LOGERR("TOUCH_RELEASE: %d,%d\n", x, y); +#endif PageManager::NotifyTouch(TOUCH_RELEASE, x, y); touch_and_hold = 0; @@ -371,15 +374,13 @@ static void * input_thread(void *cookie) else if(ev.code == BTN_SIDE) { if(ev.value == 1) - kb.KeyDown(KEY_BACK); + kb->KeyDown(KEY_BACK); else - kb.KeyUp(KEY_BACK); - } - else if (ev.value != 0) - { + kb->KeyUp(KEY_BACK); + } else if (ev.value != 0) { // This is a key press - if (kb.KeyDown(ev.code)) - { + if (kb->KeyDown(ev.code)) { + // Key repeat is enabled for this key key_repeat = 1; touch_and_hold = 0; touch_repeat = 0; @@ -388,9 +389,7 @@ static void * input_thread(void *cookie) #ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); #endif - } - else - { + } else { key_repeat = 0; touch_and_hold = 0; touch_repeat = 0; @@ -399,11 +398,9 @@ static void * input_thread(void *cookie) blankTimer.resetTimerAndUnblank(); #endif } - } - else - { + } else { // This is a key release - kb.KeyUp(ev.code); + kb->KeyUp(ev.code); key_repeat = 0; touch_and_hold = 0; touch_repeat = 0; -- cgit v1.2.3