forked from rmkit-dev/rmkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpy
66 lines (48 loc) · 1.29 KB
/
main.cpy
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
#include <cstddef>
#include <fstream>
#include "../build/rmkit.h"
#include "../shared/string.h"
#include "gesture_parser.h"
INFILE := "genie.conf"
using namespace std
using namespace genie
class App:
public:
vector<input::TouchEvent> touch_events
def handle_key_event(input::SynKeyEvent &key_ev):
pass
def run():
ui::MainLoop::key_event += PLS_DELEGATE(self.handle_key_event)
// ui::MainLoop::motion_event += PLS_DELEGATE(self.handle_motion_event)
// just to kick off the app, we do a full redraw
ui::MainLoop::refresh()
ui::MainLoop::redraw()
while true:
ui::MainLoop::main()
ui::MainLoop::redraw()
ui::MainLoop::read_input()
ui::MainLoop::handle_gestures()
// gesture=swipe
// direction=left
// coordinates=[0 100 90 100]
// fingers=2
// command="/home/root/swipes/swipeup.sh"
def setup_gestures(App &app):
string line
ifstream infile(INFILE)
vector<string> lines
while getline(infile, line):
lines.push_back(line)
gestures := parse_config(lines)
if gestures.size() == 0:
debug "NO GESTURES"
exit(0)
for auto g : gestures:
ui::MainLoop::gestures.push_back(g)
def main(int argc, char **argv):
App app
if argc > 1:
INFILE = argv[1]
debug "USING", INFILE, "AS CONFIG FILE"
setup_gestures(app)
app.run()