forked from multirom-armani/multirom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput.h
86 lines (70 loc) · 2.14 KB
/
input.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* This file is part of MultiROM.
*
* MultiROM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MultiROM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MultiROM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INPUT_H
#define INPUT_H
#include <sys/time.h>
#include "framebuffer.h"
#define KEY_VOLUMEUP 115
#define KEY_VOLUMEDOWN 114
#define KEY_POWER 116
enum
{
TCHNG_POS = 0x01,
//TCHNG_PRESSURE = 0x02, // unused
TCHNG_ADDED = 0x04,
TCHNG_REMOVED = 0x08
};
typedef struct
{
int id;
int x, orig_x;
int y, orig_y;
int changed;
int consumed;
struct timeval time;
int64_t us_diff;
} touch_event;
typedef int (*touch_callback)(touch_event*, void*); // event, data
void start_input_thread(void);
void start_input_thread_wait(int wait_for_start);
void stop_input_thread(void);
int get_last_key(void);
int wait_for_key(void);
int is_any_key_pressed(void);
void add_touch_handler(touch_callback callback, void *data);
void rm_touch_handler(touch_callback callback, void *data);
void add_touch_handler_async(touch_callback callback, void *data);
void rm_touch_handler_async(touch_callback callback, void *data);
void input_push_context(void);
void input_pop_context(void);
enum
{
KEYACT_NONE = 0,
KEYACT_UP,
KEYACT_DOWN,
KEYACT_CONFIRM,
KEYACT_CLEAR,
};
#define KEYACT_FRAME_W (8*DPI_MUL)
typedef int (*keyaction_call)(void *, int); // data, action
void keyaction_add(void *parent, keyaction_call call, void *data);
void keyaction_remove(keyaction_call call, void *data);
void keyaction_clear(void);
void keyaction_clear_active(void);
int keyaction_handle_keyevent(int key, int press);
void keyaction_enable(int enable);
#endif