summaryrefslogtreecommitdiff
path: root/src/bin/e_randr.h
blob: d0158230ea837d7b710fd6ba286e5b33a88573db (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#ifdef E_TYPEDEFS

typedef struct _E_Randr_Crtc_Info E_Randr_Crtc_Info;
typedef struct _E_Randr_Edid_Hash E_Randr_Edid_Hash;
typedef struct _E_Randr_Monitor_Info E_Randr_Monitor_Info;
typedef struct _E_Randr_Output_Info E_Randr_Output_Info;
typedef struct _E_Randr_Screen_Info_11 E_Randr_Screen_Info_11;
typedef struct _E_Randr_Screen_Info_12 E_Randr_Screen_Info_12;
typedef union _E_Randr_Screen_RRVD_Info E_Randr_Screen_RRVD_Info;
typedef struct _E_Randr_Screen_Info E_Randr_Screen_Info;
typedef struct _E_Randr_Serialized_Output_Policy E_Randr_Serialized_Output_Policy;
typedef struct _E_Randr_Serialized_Output E_Randr_Serialized_Output;
typedef struct _E_Randr_Serialized_Crtc E_Randr_Serialized_Crtc;
typedef struct _E_Randr_Serialized_Setup_11 E_Randr_Serialized_Setup_11;
typedef struct _E_Randr_Serialized_Setup_12 E_Randr_Serialized_Setup_12;
typedef struct _E_Randr_Serialized_Setup E_Randr_Serialized_Setup;

typedef enum _E_Randr_Configuration_Store_Modifier
{
   E_RANDR_CONFIGURATION_STORE_POLICIES = (1 << 0),
   E_RANDR_CONFIGURATION_STORE_RESOLUTIONS = (1 << 1),
   E_RANDR_CONFIGURATION_STORE_ARRANGEMENT = (1 << 2),
   E_RANDR_CONFIGURATION_STORE_ORIENTATIONS = (1 << 3),
   E_RANDR_CONFIGURATION_STORE_ALL = (
         E_RANDR_CONFIGURATION_STORE_POLICIES
         | E_RANDR_CONFIGURATION_STORE_RESOLUTIONS
         | E_RANDR_CONFIGURATION_STORE_ARRANGEMENT
         | E_RANDR_CONFIGURATION_STORE_ORIENTATIONS)
} E_Randr_Configuration_Store_Modifier;

EAPI void e_randr_store_configuration(E_Randr_Configuration_Store_Modifier modifier);

#else
#ifndef E_RANDR_H
#define E_RANDR_H

struct _E_Randr_Crtc_Info
{
   Ecore_X_ID xid;
   Eina_Rectangle geometry;
   Eina_Rectangle panning;
   Eina_Rectangle tracking;
   Eina_Rectangle border;
   Ecore_X_Randr_Orientation current_orientation;
   Ecore_X_Randr_Orientation orientations;
   Ecore_X_Randr_Crtc_Gamma **gamma_ramps;
   int gamma_ramp_size;
   Eina_List *outputs;
   Eina_List *possible_outputs;
   Eina_List *outputs_common_modes;
   Ecore_X_Randr_Mode_Info *current_mode;
};

struct _E_Randr_Edid_Hash
{
   int hash;
};

struct _E_Randr_Monitor_Info
{
   Eina_List *modes;
   Eina_List *preferred_modes;
   Ecore_X_Randr_Screen_Size size_mm;
   unsigned char *edid;
   unsigned long edid_length;
   E_Randr_Edid_Hash edid_hash;
   int max_backlight;
   double backlight_level;
};

struct _E_Randr_Output_Info
{
   Ecore_X_ID xid;
   char *name;
   int name_length;
   E_Randr_Crtc_Info *crtc;
   Eina_List *wired_clones;
   Ecore_X_Randr_Signal_Format signalformats;
   Ecore_X_Randr_Signal_Format signalformat;
   int connector_number;
   Ecore_X_Randr_Connector_Type connector_type;
   Ecore_X_Randr_Connection_Status connection_status;
   Ecore_X_Randr_Output_Policy policy;
   Eina_List *possible_crtcs;
   Eina_List *compatibility_list;
   Ecore_X_Render_Subpixel_Order subpixel_order;
   /*
    * Attached Monitor specific:
    */
   E_Randr_Monitor_Info *monitor;
};

struct _E_Randr_Screen_Info_11
{
   //List of Ecore_X_Randr_Screen_Size_MM*
   Eina_List *sizes;
   int csize_index;
   Ecore_X_Randr_Orientation corientation;
   Ecore_X_Randr_Orientation orientations;
   //List of Ecore_X_Randr_Refresh_Rate*
   Eina_List *rates;
   Ecore_X_Randr_Refresh_Rate current_rate;
};

struct _E_Randr_Screen_Info_12
{
   Ecore_X_Randr_Screen_Size min_size;
   Ecore_X_Randr_Screen_Size max_size;
   Ecore_X_Randr_Screen_Size current_size;
   Eina_List *modes;
   Eina_List *crtcs;
   Eina_List *outputs;
   E_Randr_Output_Info *primary_output;
   Ecore_X_Randr_Relative_Alignment alignment;
};

//RRVD == RandR(R) Version Depended
union _E_Randr_Screen_RRVD_Info
{
   E_Randr_Screen_Info_11 *randr_info_11;
   E_Randr_Screen_Info_12 *randr_info_12;
};

struct _E_Randr_Screen_Info
{
   Ecore_X_Window root;
   int randr_version;
   E_Randr_Screen_RRVD_Info rrvd_info;
};

//Following stuff is just for configuration purposes

struct _E_Randr_Serialized_Output_Policy
{
   char *name;
   Ecore_X_Randr_Output_Policy policy;
};

struct _E_Randr_Serialized_Output
{
   char *name;
   double backlight_level;
};

struct _E_Randr_Serialized_Crtc
{
   int index;
   //List of E_Randr_Serialized_Output objects that were used on the same output
   Eina_List *outputs;
   Evas_Coord_Point pos;
   Ecore_X_Randr_Orientation orientation;
   //the serialized mode_info
   Ecore_X_Randr_Mode_Info *mode_info;
};

struct _E_Randr_Serialized_Setup_12
{
   double timestamp;
   //List of E_Randr_Serialized_Crtc objects
   Eina_List *crtcs;
   /*
    * List of E_Randr_Edid_Hash elements of all connected monitors
    */
   Eina_List *edid_hashes;
};

struct _E_Randr_Serialized_Setup_11
{
   Ecore_X_Randr_Screen_Size_MM size;
   Ecore_X_Randr_Refresh_Rate refresh_rate;
   Ecore_X_Randr_Orientation orientation;
};

struct _E_Randr_Serialized_Setup
{
   E_Randr_Serialized_Setup_11 *serialized_setup_11;
   //List of E_Randr_Serialized_Setup_12 objects
   Eina_List *serialized_setups_12;
   //List of E_Randr_Serialized_Output_Policy objects
   Eina_List *outputs_policies;
};

EINTERN Eina_Bool e_randr_init(void);
EAPI Eina_Bool e_randr_screen_info_refresh(void);
EINTERN int e_randr_shutdown(void);
EINTERN void e_randr_serialized_setup_free(E_Randr_Serialized_Setup *ss);
EINTERN void e_randr_11_serialized_setup_free(E_Randr_Serialized_Setup_11 *ss_11);
EINTERN void e_randr_12_serialized_setup_free(E_Randr_Serialized_Setup_12 *ss_12);
EINTERN void e_randr_12_serialized_output_policy_free(E_Randr_Serialized_Output_Policy *policy);

EAPI extern E_Randr_Screen_Info e_randr_screen_info;

#endif
#endif