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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
/* Generated by wayland-scanner 1.23.1 */
#ifndef WLR_OUTPUT_POWER_MANAGEMENT_UNSTABLE_V1_SERVER_PROTOCOL_H
#define WLR_OUTPUT_POWER_MANAGEMENT_UNSTABLE_V1_SERVER_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
#include "wayland-server.h"
#ifdef __cplusplus
extern "C" {
#endif
struct wl_client;
struct wl_resource;
/**
* @page page_wlr_output_power_management_unstable_v1 The wlr_output_power_management_unstable_v1 protocol
* Control power management modes of outputs
*
* @section page_desc_wlr_output_power_management_unstable_v1 Description
*
* This protocol allows clients to control power management modes
* of outputs that are currently part of the compositor space. The
* intent is to allow special clients like desktop shells to power
* down outputs when the system is idle.
*
* To modify outputs not currently part of the compositor space see
* wlr-output-management.
*
* Warning! The protocol described in this file is experimental and
* backward incompatible changes may be made. Backward compatible changes
* may be added together with the corresponding interface version bump.
* Backward incompatible changes are done by bumping the version number in
* the protocol and interface names and resetting the interface version.
* Once the protocol is to be declared stable, the 'z' prefix and the
* version number in the protocol and interface names are removed and the
* interface version number is reset.
*
* @section page_ifaces_wlr_output_power_management_unstable_v1 Interfaces
* - @subpage page_iface_zwlr_output_power_manager_v1 - manager to create per-output power management
* - @subpage page_iface_zwlr_output_power_v1 - adjust power management mode for an output
* @section page_copyright_wlr_output_power_management_unstable_v1 Copyright
* <pre>
*
* Copyright © 2019 Purism SPC
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
* </pre>
*/
struct wl_output;
struct zwlr_output_power_manager_v1;
struct zwlr_output_power_v1;
#ifndef ZWLR_OUTPUT_POWER_MANAGER_V1_INTERFACE
#define ZWLR_OUTPUT_POWER_MANAGER_V1_INTERFACE
/**
* @page page_iface_zwlr_output_power_manager_v1 zwlr_output_power_manager_v1
* @section page_iface_zwlr_output_power_manager_v1_desc Description
*
* This interface is a manager that allows creating per-output power
* management mode controls.
* @section page_iface_zwlr_output_power_manager_v1_api API
* See @ref iface_zwlr_output_power_manager_v1.
*/
/**
* @defgroup iface_zwlr_output_power_manager_v1 The zwlr_output_power_manager_v1 interface
*
* This interface is a manager that allows creating per-output power
* management mode controls.
*/
extern const struct wl_interface zwlr_output_power_manager_v1_interface;
#endif
#ifndef ZWLR_OUTPUT_POWER_V1_INTERFACE
#define ZWLR_OUTPUT_POWER_V1_INTERFACE
/**
* @page page_iface_zwlr_output_power_v1 zwlr_output_power_v1
* @section page_iface_zwlr_output_power_v1_desc Description
*
* This object offers requests to set the power management mode of
* an output.
* @section page_iface_zwlr_output_power_v1_api API
* See @ref iface_zwlr_output_power_v1.
*/
/**
* @defgroup iface_zwlr_output_power_v1 The zwlr_output_power_v1 interface
*
* This object offers requests to set the power management mode of
* an output.
*/
extern const struct wl_interface zwlr_output_power_v1_interface;
#endif
/**
* @ingroup iface_zwlr_output_power_manager_v1
* @struct zwlr_output_power_manager_v1_interface
*/
struct zwlr_output_power_manager_v1_interface {
/**
* get a power management for an output
*
* Create a output power management mode control that can be used
* to adjust the power management mode for a given output.
*/
void (*get_output_power)(struct wl_client *client,
struct wl_resource *resource,
uint32_t id,
struct wl_resource *output);
/**
* destroy the manager
*
* All objects created by the manager will still remain valid,
* until their appropriate destroy request has been called.
*/
void (*destroy)(struct wl_client *client,
struct wl_resource *resource);
};
/**
* @ingroup iface_zwlr_output_power_manager_v1
*/
#define ZWLR_OUTPUT_POWER_MANAGER_V1_GET_OUTPUT_POWER_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_output_power_manager_v1
*/
#define ZWLR_OUTPUT_POWER_MANAGER_V1_DESTROY_SINCE_VERSION 1
#ifndef ZWLR_OUTPUT_POWER_V1_MODE_ENUM
#define ZWLR_OUTPUT_POWER_V1_MODE_ENUM
enum zwlr_output_power_v1_mode {
/**
* Output is turned off.
*/
ZWLR_OUTPUT_POWER_V1_MODE_OFF = 0,
/**
* Output is turned on, no power saving
*/
ZWLR_OUTPUT_POWER_V1_MODE_ON = 1,
};
/**
* @ingroup iface_zwlr_output_power_v1
* Validate a zwlr_output_power_v1 mode value.
*
* @return true on success, false on error.
* @ref zwlr_output_power_v1_mode
*/
static inline bool
zwlr_output_power_v1_mode_is_valid(uint32_t value, uint32_t version) {
switch (value) {
case ZWLR_OUTPUT_POWER_V1_MODE_OFF:
return version >= 1;
case ZWLR_OUTPUT_POWER_V1_MODE_ON:
return version >= 1;
default:
return false;
}
}
#endif /* ZWLR_OUTPUT_POWER_V1_MODE_ENUM */
#ifndef ZWLR_OUTPUT_POWER_V1_ERROR_ENUM
#define ZWLR_OUTPUT_POWER_V1_ERROR_ENUM
enum zwlr_output_power_v1_error {
/**
* inexistent power save mode
*/
ZWLR_OUTPUT_POWER_V1_ERROR_INVALID_MODE = 1,
};
/**
* @ingroup iface_zwlr_output_power_v1
* Validate a zwlr_output_power_v1 error value.
*
* @return true on success, false on error.
* @ref zwlr_output_power_v1_error
*/
static inline bool
zwlr_output_power_v1_error_is_valid(uint32_t value, uint32_t version) {
switch (value) {
case ZWLR_OUTPUT_POWER_V1_ERROR_INVALID_MODE:
return version >= 1;
default:
return false;
}
}
#endif /* ZWLR_OUTPUT_POWER_V1_ERROR_ENUM */
/**
* @ingroup iface_zwlr_output_power_v1
* @struct zwlr_output_power_v1_interface
*/
struct zwlr_output_power_v1_interface {
/**
* Set an outputs power save mode
*
* Set an output's power save mode to the given mode. The mode
* change is effective immediately. If the output does not support
* the given mode a failed event is sent.
* @param mode the power save mode to set
*/
void (*set_mode)(struct wl_client *client,
struct wl_resource *resource,
uint32_t mode);
/**
* destroy this power management
*
* Destroys the output power management mode control object.
*/
void (*destroy)(struct wl_client *client,
struct wl_resource *resource);
};
#define ZWLR_OUTPUT_POWER_V1_MODE 0
#define ZWLR_OUTPUT_POWER_V1_FAILED 1
/**
* @ingroup iface_zwlr_output_power_v1
*/
#define ZWLR_OUTPUT_POWER_V1_MODE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_output_power_v1
*/
#define ZWLR_OUTPUT_POWER_V1_FAILED_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_output_power_v1
*/
#define ZWLR_OUTPUT_POWER_V1_SET_MODE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_output_power_v1
*/
#define ZWLR_OUTPUT_POWER_V1_DESTROY_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_output_power_v1
* Sends an mode event to the client owning the resource.
* @param resource_ The client's resource
* @param mode the output's new power management mode
*/
static inline void
zwlr_output_power_v1_send_mode(struct wl_resource *resource_, uint32_t mode)
{
wl_resource_post_event(resource_, ZWLR_OUTPUT_POWER_V1_MODE, mode);
}
/**
* @ingroup iface_zwlr_output_power_v1
* Sends an failed event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zwlr_output_power_v1_send_failed(struct wl_resource *resource_)
{
wl_resource_post_event(resource_, ZWLR_OUTPUT_POWER_V1_FAILED);
}
#ifdef __cplusplus
}
#endif
#endif
|