blob: 32e592d8d7fccf5ef4ebd896b5d8fd49a093ab64 (
plain)
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
|
/*
* mousemate plugin for VDR
*
* MouseMate.h - MouseMate control class
*
*
* This code is distributed under the terms and conditions of the
* GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
*/
#ifndef _MOUSEMATE_H_
#define _MOUSEMATE_H_
#include <vdr/keys.h>
#include <vdr/thread.h>
#include <vdr/tools.h>
#include <vdr/remote.h>
#include "MouseMateMonitor.h"
#include "ButtonObserver.h"
#include "setup.h"
/*
You may try other relative movement events
*/
#define Wheel REL_WHEEL
/*
Number of observed mouse-buttons
*/
#define MAX_BTN_COUNT 8
/*
You may define EVENTCODE_SNIFFER in order to get event code, type and value of
your device.
*/
// #define EVENTCODE_SNIFFER
/*
You may define DEBUG in order to get information about context, event, etc.
*/
// #define DEBUG
/*
******************* no user defines after this line *************************
*/
#define TimeMs cTimeMs::Now
#define test_bit(bit, array) (array[bit/8] & (1<<(bit%8)))
class cMouseMate : public cThread
{
private:
int fd; // file id for mouse device
bool pushed;
uint64_t lastPush;
int offset;
int offsetX;
int offsetY;
bool click;
bool turn;
bool toggle; // toggle key binding
uint64_t toggletime; // time for auto off toggle
// controll more than one button with buttonObservers & for loop
cButtonObserver buttonObservers[MAX_BTN_COUNT];
short int btnCount; // number of used buttons:
bool active;
cMouseMateMonitor *Monitor;
virtual void Action();
void Toggle();
void ProcessInputEvent(struct input_event * ev);
void ProcessEvent(int event);
void SendKey(eKeys key);
public:
cMouseMate();
virtual ~cMouseMate();
bool IsButtonUsed(unsigned int buttoncode);
short int Get_btnCount();
};
extern cMouseMate * MouseMate;
#endif
|