forked from libthinkpad/dockd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crtc.h
73 lines (50 loc) · 1.4 KB
/
crtc.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
#ifndef CRTC_H
#define CRTC_H
#include <X11/extensions/Xrandr.h>
#include <libthinkpad.h>
using ThinkPad::Utilities::Ini::Ini;
using ThinkPad::Utilities::Ini::IniKeypair;
using ThinkPad::Utilities::Ini::IniSection;
#define CONFIG_LOCATION_DOCKED "/etc/dockd/docked.conf"
#define CONFIG_LOCATION_UNDOCKED "/etc/dockd/undocked.conf"
typedef struct _crtc {
RRCrtc crtc;
XRRCrtcInfo *info;
} crtc_t;
class CRTControllerManager {
private:
Display *display;
int screen;
Window window;
XRRScreenResources *resources;
class CRTConfig {
public:
RRCrtc crtc;
int x, y;
RRMode mode;
Rotation rotation;
RROutput *outputs;
size_t noutputs;
};
class OutputConfigs {
public:
vector<RROutput> outputs;
RRMode mode;
int error = 0;
};
OutputConfigs getOutputConfigs(vector<const char *> *vector, IniSection *pSection);
bool isOutputModeSupported(RROutput pInfo, RRMode pOutputInfo);
void connectToX();
void disconnectFromX();
RROutput getRROutputByName(const char *outputName);
RRMode getRRModeByNameSupported(const char *getString, RROutput i);
public:
enum DockState {
DOCKED, UNDOCKED, INVALID
};
CRTControllerManager();
~CRTControllerManager();
bool applyConfiguration(DockState state);
bool writeConfigToDisk(DockState state);
};
#endif // CRTC_H