-
Notifications
You must be signed in to change notification settings - Fork 6
/
Mouse.h
49 lines (43 loc) · 846 Bytes
/
Mouse.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
#pragma once
#include "Settings.h"
#include "vfo.h"
#include <chrono>
#include <cstdio>
#include <fcntl.h>
#include <linux/input.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
extern const int screenWidth;
extern const int screenHeight;
struct MouseState
{
lv_coord_t x;
lv_coord_t y;
bool pressed;
bool MouseActivity;
bool doubleclick;
int Rotated;
};
class Mouse
{
public:
void init_mouse();
Mouse();
Mouse(int mousefd);
MouseState GetMouseState();
bool GetMouseAttached();
private:
int fd;
char mouseDev[80];
bool bstep;
input_event mouse_event;
int step;
bool read_mouse_event();
std::string mouse_name;
MouseState state{0, 0, LV_INDEV_STATE_REL, false};
bool MouseActivity;
std::chrono::time_point<std::chrono::system_clock> last_click_time;
int click_count;
std::string find_mouse();
};