-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmode.h
More file actions
70 lines (56 loc) · 1.63 KB
/
mode.h
File metadata and controls
70 lines (56 loc) · 1.63 KB
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
#ifndef MODE_H_
#define MODE_H_
#include <string>
#include <vector>
#include <xcb/randr.h>
#include <xcb/xcb.h>
#include <tuple>
#include "monitor_setup.h"
#include "edid.h"
namespace schrandr {
struct Output {
xcb_randr_output_t output;
Edid edid;
std::string name;
friend std::ostream& operator<<(std::ostream &out, const Output &op);
};
struct CRTC {
public:
xcb_randr_crtc_t crtc;
xcb_randr_mode_t mode;
int x;
int y;
std::vector<Output> outputs;
bool hasSameEdids(const CRTC &crtc) const;
bool isEmpty() const;
friend std::ostream& operator<<(std::ostream &out, const CRTC &crtc);
};
class Screen {
public:
int width;
int height;
int width_mm;
int height_mm;
std::vector<CRTC> crtcs_;
void add_crtc(CRTC c);
int eraseCrtc(const xcb_randr_crtc_t &crtc);
std::vector<CRTC> get_crtcs()const;
bool operator==(const Screen &lhs);
bool operator!=(const Screen &lhs);
};
class Mode {
public:
Mode();
void add_screen(Screen s);
std::vector<Screen> get_screens() const;
MonitorSetup get_monitor_setup() const;
void set_monitor_setup(MonitorSetup s);
int eraseCrtc(const xcb_randr_crtc_t &crtc);
Output getOutputByEdid(const Edid &edid) const;
std::vector<Output> getActiveOutputs() const;
CRTC getCrtcByOutput(const xcb_randr_output_t &output) const;
private:
std::vector<Screen> screens_;
};
}
#endif