summaryrefslogtreecommitdiffstats
path: root/ui.h
diff options
context:
space:
mode:
Diffstat (limited to 'ui.h')
-rw-r--r--ui.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/ui.h b/ui.h
index aca7b7b87..6c8987a33 100644
--- a/ui.h
+++ b/ui.h
@@ -80,8 +80,17 @@ class RecoveryUI {
enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE };
virtual KeyAction CheckKey(int key);
+ // Called immediately before each call to CheckKey(), tell you if
+ // the key was long-pressed.
virtual void NextCheckKeyIsLong(bool is_long_press);
+ // Called when a key is held down long enough to have been a
+ // long-press (but before the key is released). This means that
+ // if the key is eventually registered (released without any other
+ // keys being pressed in the meantime), NextCheckKeyIsLong() will
+ // be called with "true".
+ virtual void KeyLongPress(int key);
+
// --- menu display ---
// Display some header text followed by a menu of items, which appears
@@ -108,15 +117,25 @@ private:
int key_queue[256], key_queue_len;
char key_pressed[KEY_MAX + 1]; // under key_queue_mutex
int key_last_down; // under key_queue_mutex
- clock_t key_down_time; // under key_queue_mutex
+ bool key_long_press; // under key_queue_mutex
+ int key_down_count; // under key_queue_mutex
int rel_sum;
+ typedef struct {
+ RecoveryUI* ui;
+ int key_code;
+ int count;
+ } key_timer_t;
+
pthread_t input_t;
static void* input_thread(void* cookie);
static int input_callback(int fd, short revents, void* data);
void process_key(int key_code, int updown);
bool usb_connected();
+
+ static void* time_key_helper(void* cookie);
+ void time_key(int key_code, int count);
};
#endif // RECOVERY_UI_H