aboutsummaryrefslogtreecommitdiffstats
path: root/ui.h
diff options
context:
space:
mode:
authorTao Bao2017-08-03 13:18:27 -0500
committerGerrit Code Review2017-08-03 13:18:27 -0500
commitfaa5b1f773f3f49a89d07b06f113ab125dcdf345 (patch)
treeaf5ad49a87e0bbbb6de0f8133c1c0e7835913728 /ui.h
parentf411f3dcfb334347e075635e426bd7c115e7fed3 (diff)
parent5f8dd9951d986b65d98d6a9ea38003427e9e46df (diff)
downloadplatform-bootable-recovery-faa5b1f773f3f49a89d07b06f113ab125dcdf345.tar.gz
platform-bootable-recovery-faa5b1f773f3f49a89d07b06f113ab125dcdf345.tar.xz
platform-bootable-recovery-faa5b1f773f3f49a89d07b06f113ab125dcdf345.zip
Merge "ui: Move the support for touch inputs into RecoveryUI."
Diffstat (limited to 'ui.h')
-rw-r--r--ui.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/ui.h b/ui.h
index 7eb04aec..5cda7af0 100644
--- a/ui.h
+++ b/ui.h
@@ -82,6 +82,12 @@ class RecoveryUI {
82 // otherwise. 82 // otherwise.
83 virtual bool HasThreeButtons(); 83 virtual bool HasThreeButtons();
84 84
85 // Returns true if it has a power key.
86 virtual bool HasPowerKey() const;
87
88 // Returns true if it supports touch inputs.
89 virtual bool HasTouchScreen() const;
90
85 // Erases any queued-up keys. 91 // Erases any queued-up keys.
86 virtual void FlushKeys(); 92 virtual void FlushKeys();
87 93
@@ -129,7 +135,14 @@ class RecoveryUI {
129 unsigned int brightness_normal_; 135 unsigned int brightness_normal_;
130 unsigned int brightness_dimmed_; 136 unsigned int brightness_dimmed_;
131 137
138 // Whether we should listen for touch inputs (default: false).
139 bool touch_screen_allowed_;
140
132 private: 141 private:
142 // The sensitivity when detecting a swipe.
143 const int kTouchLowThreshold;
144 const int kTouchHighThreshold;
145
133 // Key event input queue 146 // Key event input queue
134 pthread_mutex_t key_queue_mutex; 147 pthread_mutex_t key_queue_mutex;
135 pthread_cond_t key_queue_cond; 148 pthread_cond_t key_queue_cond;
@@ -147,6 +160,16 @@ class RecoveryUI {
147 bool has_power_key; 160 bool has_power_key;
148 bool has_up_key; 161 bool has_up_key;
149 bool has_down_key; 162 bool has_down_key;
163 bool has_touch_screen;
164
165 // Touch event related variables. See the comments in RecoveryUI::OnInputEvent().
166 int touch_slot_;
167 int touch_X_;
168 int touch_Y_;
169 int touch_start_X_;
170 int touch_start_Y_;
171 bool touch_finger_down_;
172 bool touch_swiping_;
150 173
151 struct key_timer_t { 174 struct key_timer_t {
152 RecoveryUI* ui; 175 RecoveryUI* ui;
@@ -157,6 +180,7 @@ class RecoveryUI {
157 pthread_t input_thread_; 180 pthread_t input_thread_;
158 181
159 void OnKeyDetected(int key_code); 182 void OnKeyDetected(int key_code);
183 void OnTouchDetected(int dx, int dy);
160 int OnInputEvent(int fd, uint32_t epevents); 184 int OnInputEvent(int fd, uint32_t epevents);
161 void ProcessKey(int key_code, int updown); 185 void ProcessKey(int key_code, int updown);
162 186