summaryrefslogtreecommitdiffstats
path: root/gui/gui.cpp
diff options
context:
space:
mode:
authorDees Troy <dees_troy@teamw.in>2014-02-07 19:39:53 +0100
committerGerrit Code Review <gerrit2@gerrit>2014-02-07 19:39:53 +0100
commite492e27d77ad0c033fc0f55d7a5ffe18752ac7bd (patch)
treea8f5b7c167c0f365dec2735c11717e09c781a9b7 /gui/gui.cpp
parentMerge "Expansion of vibrate options" into android-4.4 (diff)
parentImplement mouse cursor (diff)
downloadandroid_bootable_recovery-e492e27d77ad0c033fc0f55d7a5ffe18752ac7bd.tar
android_bootable_recovery-e492e27d77ad0c033fc0f55d7a5ffe18752ac7bd.tar.gz
android_bootable_recovery-e492e27d77ad0c033fc0f55d7a5ffe18752ac7bd.tar.bz2
android_bootable_recovery-e492e27d77ad0c033fc0f55d7a5ffe18752ac7bd.tar.lz
android_bootable_recovery-e492e27d77ad0c033fc0f55d7a5ffe18752ac7bd.tar.xz
android_bootable_recovery-e492e27d77ad0c033fc0f55d7a5ffe18752ac7bd.tar.zst
android_bootable_recovery-e492e27d77ad0c033fc0f55d7a5ffe18752ac7bd.zip
Diffstat (limited to 'gui/gui.cpp')
-rw-r--r--gui/gui.cpp63
1 files changed, 62 insertions, 1 deletions
diff --git a/gui/gui.cpp b/gui/gui.cpp
index e9efc1db9..2098342b0 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -186,6 +186,7 @@ static void * input_thread(void *cookie)
static struct timeval touchStart;
HardwareKeyboard kb;
string seconds;
+ MouseCursor *cursor = PageManager::GetMouseCursor();
#ifndef TW_NO_SCREEN_TIMEOUT
//start screen timeout threads
@@ -329,7 +330,47 @@ static void * input_thread(void *cookie)
#ifdef _EVENT_LOGGING
LOGERR("TOUCH_KEY: %d\n", ev.code);
#endif
- if (ev.value != 0)
+ // Left mouse button
+ if(ev.code == BTN_LEFT)
+ {
+ if(ev.value == 1)
+ {
+ cursor->GetPos(x, y);
+
+ if (PageManager::NotifyTouch(TOUCH_START, x, y) > 0)
+ state = 1;
+ drag = 1;
+ touch_and_hold = 1;
+ dontwait = 1;
+ key_repeat = 0;
+ gettimeofday(&touchStart, NULL);
+ }
+ else if(drag == 1)
+ {
+ if (state == 0)
+ {
+ cursor->GetPos(x, y);
+
+ PageManager::NotifyTouch(TOUCH_RELEASE, x, y);
+
+ touch_and_hold = 0;
+ touch_repeat = 0;
+ if (!key_repeat)
+ dontwait = 0;
+ }
+ state = 0;
+ drag = 0;
+ }
+ }
+ // side mouse button, often used for "back" function
+ else if(ev.code == BTN_SIDE)
+ {
+ if(ev.value == 1)
+ kb.KeyDown(KEY_BACK);
+ else
+ kb.KeyUp(KEY_BACK);
+ }
+ else if (ev.value != 0)
{
// This is a key press
if (kb.KeyDown(ev.code))
@@ -367,6 +408,26 @@ static void * input_thread(void *cookie)
#endif
}
}
+ else if(ev.type == EV_REL)
+ {
+#ifdef _EVENT_LOGGING
+ LOGERR("EV_REL %d %d\n", ev.code, ev.value);
+#endif
+ if(ev.code == REL_X)
+ cursor->Move(ev.value, 0);
+ else if(ev.code == REL_Y)
+ cursor->Move(0, ev.value);
+
+ if(drag == 1) {
+ cursor->GetPos(x, y);
+#ifdef _EVENT_LOGGING
+ LOGERR("TOUCH_DRAG: %d, %d\n", x, y);
+#endif
+ if (PageManager::NotifyTouch(TOUCH_DRAG, x, y) > 0)
+ state = 1;
+ key_repeat = 0;
+ }
+ }
}
return NULL;
}