2 * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
4 * Permission to use, copy, modify, distribute, and sell this
5 * software and its documentation for any purpose is hereby granted
6 * without fee, provided that\n the above copyright notice appear in
7 * all copies and that both that copyright notice and this permission
8 * notice appear in supporting documentation, and that the name of
9 * the copyright holders not be used in advertising or publicity
10 * pertaining to distribution of the software without specific,
11 * written prior permission. The copyright holders make no
12 * representations about the suitability of this software for any
13 * purpose. It is provided "as is" without express or implied
16 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
21 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
26 #ifndef WL_EOM_CLIENT_PROTOCOL_H
27 #define WL_EOM_CLIENT_PROTOCOL_H
35 #include "wayland-client.h"
41 struct wl_shell_surface;
44 extern const struct wl_interface wl_eom_interface;
46 #ifndef WL_EOM_ERROR_ENUM
47 #define WL_EOM_ERROR_ENUM
49 WL_EOM_ERROR_NONE = 0,
50 WL_EOM_ERROR_NO_OUTPUT = 1,
51 WL_EOM_ERROR_NO_ATTRIBUTE = 2,
52 WL_EOM_ERROR_OUTPUT_OCCUPIED = 3,
54 #endif /* WL_EOM_ERROR_ENUM */
56 #ifndef WL_EOM_TYPE_ENUM
57 #define WL_EOM_TYPE_ENUM
59 * wl_eom_type - connector type
60 * @WL_EOM_TYPE_NONE: none
61 * @WL_EOM_TYPE_VGA: VGA output connector type
62 * @WL_EOM_TYPE_DVII: DVI-I output connector type
63 * @WL_EOM_TYPE_DVID: DVI-D output connector type
64 * @WL_EOM_TYPE_DVIA: DVI-A output connector type
65 * @WL_EOM_TYPE_COMPOSITE: Composite output connector type
66 * @WL_EOM_TYPE_SVIDEO: S-Video output connector type
67 * @WL_EOM_TYPE_LVDS: LVDS output connector type
68 * @WL_EOM_TYPE_COMPONENT: Component output connector type
69 * @WL_EOM_TYPE_9PINDIN: 9 pin DIN output connector type
70 * @WL_EOM_TYPE_DISPLAYPORT: DisplayPort output connector type
71 * @WL_EOM_TYPE_HDMIA: HDMI type A output connector type
72 * @WL_EOM_TYPE_HDMIB: HDMI type B output connector type
73 * @WL_EOM_TYPE_TV: TV output connector type
74 * @WL_EOM_TYPE_EDP: eDP output connector type
75 * @WL_EOM_TYPE_VIRTUAL: Virtual output connector type
76 * @WL_EOM_TYPE_DSI: DSI output connector type
78 * Define several connectors type of the external outputs
86 WL_EOM_TYPE_COMPOSITE = 5,
87 WL_EOM_TYPE_SVIDEO = 6,
89 WL_EOM_TYPE_COMPONENT = 8,
90 WL_EOM_TYPE_9PINDIN = 9,
91 WL_EOM_TYPE_DISPLAYPORT = 10,
92 WL_EOM_TYPE_HDMIA = 11,
93 WL_EOM_TYPE_HDMIB = 12,
96 WL_EOM_TYPE_VIRTUAL = 15,
99 #endif /* WL_EOM_TYPE_ENUM */
101 #ifndef WL_EOM_STATUS_ENUM
102 #define WL_EOM_STATUS_ENUM
104 * wl_eom_status - connection status of the external output
105 * @WL_EOM_STATUS_NONE: none
106 * @WL_EOM_STATUS_CONNECTION: output connected
107 * @WL_EOM_STATUS_DISCONNECTION: output disconnected
109 * The status of external output is connected or not.
112 WL_EOM_STATUS_NONE = 0,
113 WL_EOM_STATUS_CONNECTION = 1,
114 WL_EOM_STATUS_DISCONNECTION = 2,
116 #endif /* WL_EOM_STATUS_ENUM */
118 #ifndef WL_EOM_MODE_ENUM
119 #define WL_EOM_MODE_ENUM
121 * wl_eom_mode - mode of the external output
122 * @WL_EOM_MODE_NONE: none
123 * @WL_EOM_MODE_MIRROR: mirror mode
124 * @WL_EOM_MODE_PRESENTATION: presentation mode
126 * There are two modes for external output. Mirror mode is showing main
127 * display screen to external output. Presentation mode is showing app's
128 * specific buffer contents to external output.
131 WL_EOM_MODE_NONE = 0,
132 WL_EOM_MODE_MIRROR = 1,
133 WL_EOM_MODE_PRESENTATION = 2,
135 #endif /* WL_EOM_MODE_ENUM */
137 #ifndef WL_EOM_ATTRIBUTE_ENUM
138 #define WL_EOM_ATTRIBUTE_ENUM
140 * wl_eom_attribute - attribute of the external output
141 * @WL_EOM_ATTRIBUTE_NONE: none
142 * @WL_EOM_ATTRIBUTE_NORMAL: nomal attribute
143 * @WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARE: exclusive share attribute
144 * @WL_EOM_ATTRIBUTE_EXCLUSIVE: exclusive attribute
146 * Application can use external output by attribute.
148 * If application succeed to set attribute and set external output window,
149 * the external output's mode will be changed to Presentation mode.
151 * Attribute has priority. If attribute is set to normal, it can be changed
152 * by normal, exclusive_share, exclusive. If attribute is set to
153 * exclusive_share, it can be changed by exclusive_share, exclusive. If
154 * attribute is set to exclusive, it cannot be changed by other
155 * application. If application which set attribute is quit or set to none,
156 * the mode will be changed to Mirror if connected.
158 enum wl_eom_attribute {
159 WL_EOM_ATTRIBUTE_NONE = 0,
160 WL_EOM_ATTRIBUTE_NORMAL = 1,
161 WL_EOM_ATTRIBUTE_EXCLUSIVE_SHARE = 2,
162 WL_EOM_ATTRIBUTE_EXCLUSIVE = 3,
164 #endif /* WL_EOM_ATTRIBUTE_ENUM */
166 #ifndef WL_EOM_ATTRIBUTE_STATE_ENUM
167 #define WL_EOM_ATTRIBUTE_STATE_ENUM
169 * wl_eom_attribute_state - state of the external output attribute
170 * @WL_EOM_ATTRIBUTE_STATE_NONE: none
171 * @WL_EOM_ATTRIBUTE_STATE_ACTIVE: attribute is active on the output
172 * @WL_EOM_ATTRIBUTE_STATE_INACTIVE: attribute is inactive on the output
173 * @WL_EOM_ATTRIBUTE_STATE_LOST: the connection of output is lost
175 * It means the state of attribute. The applicatoin which set attribute
176 * successful can get state.
178 * Active means the external window is set to external output succefully.
179 * So application can use that window. Inactive means cannot use external
180 * output, because of dissconnecting or some other reasons. But if
181 * connected again, the application can use external output. Lost means the
182 * application is lost it's right to external output by other application's
185 enum wl_eom_attribute_state {
186 WL_EOM_ATTRIBUTE_STATE_NONE = 0,
187 WL_EOM_ATTRIBUTE_STATE_ACTIVE = 1,
188 WL_EOM_ATTRIBUTE_STATE_INACTIVE = 2,
189 WL_EOM_ATTRIBUTE_STATE_LOST = 3,
191 #endif /* WL_EOM_ATTRIBUTE_STATE_ENUM */
194 * wl_eom - an interface for external outputs
195 * @output_count: external output count
197 * @output_type: output type and connection info
198 * @output_mode: output mode info
199 * @output_attribute: output attribute info
200 * @output_set_window: reslut of set_window
202 * An interface to get information of external outputs and to use
205 struct wl_eom_listener {
207 * output_count - external output count
210 * Get the number of external output devices that are supported
213 void (*output_count)(void *data,
214 struct wl_eom *wl_eom,
225 * @connection: (none)
228 * @attribute_state: (none)
231 * Send information of specific external output to client.
233 * Output_id is numbering of external outputs. It is fixed when
234 * booting time. The type, mode attribute, attribute_state is
235 * mentioned above. The w and h is the resolution of external
236 * output. The w_mm and h_mm is the physical size of external
237 * output. The unit is mm.
239 void (*output_info)(void *data,
240 struct wl_eom *wl_eom,
251 uint32_t attribute_state,
254 * output_type - output type and connection info
259 * Send information of output type and connection.
261 void (*output_type)(void *data,
262 struct wl_eom *wl_eom,
267 * output_mode - output mode info
271 * Send information of output mode.
273 void (*output_mode)(void *data,
274 struct wl_eom *wl_eom,
278 * output_attribute - output attribute info
281 * @attribute_state: (none)
284 * Send information of output attribute and attribute state.
286 void (*output_attribute)(void *data,
287 struct wl_eom *wl_eom,
290 uint32_t attribute_state,
293 * output_set_window - reslut of set_window
297 * Send the result of set_window to client.
299 void (*output_set_window)(void *data,
300 struct wl_eom *wl_eom,
306 wl_eom_add_listener(struct wl_eom *wl_eom,
307 const struct wl_eom_listener *listener, void *data)
309 return wl_proxy_add_listener((struct wl_proxy *) wl_eom,
310 (void (**)(void)) listener, data);
313 #define WL_EOM_SET_ATTRIBUTE 0
314 #define WL_EOM_SET_XDG_WINDOW 1
315 #define WL_EOM_SET_SHELL_WINDOW 2
316 #define WL_EOM_GET_OUTPUT_INFO 3
318 #define WL_EOM_SET_ATTRIBUTE_SINCE_VERSION 1
319 #define WL_EOM_SET_XDG_WINDOW_SINCE_VERSION 1
320 #define WL_EOM_SET_SHELL_WINDOW_SINCE_VERSION 1
321 #define WL_EOM_GET_OUTPUT_INFO_SINCE_VERSION 1
324 wl_eom_set_user_data(struct wl_eom *wl_eom, void *user_data)
326 wl_proxy_set_user_data((struct wl_proxy *) wl_eom, user_data);
330 wl_eom_get_user_data(struct wl_eom *wl_eom)
332 return wl_proxy_get_user_data((struct wl_proxy *) wl_eom);
335 static inline uint32_t
336 wl_eom_get_version(struct wl_eom *wl_eom)
338 return wl_proxy_get_version((struct wl_proxy *) wl_eom);
342 wl_eom_destroy(struct wl_eom *wl_eom)
344 wl_proxy_destroy((struct wl_proxy *) wl_eom);
348 wl_eom_set_attribute(struct wl_eom *wl_eom, uint32_t output_id, uint32_t attribute)
350 wl_proxy_marshal((struct wl_proxy *) wl_eom,
351 WL_EOM_SET_ATTRIBUTE, output_id, attribute);
355 wl_eom_set_xdg_window(struct wl_eom *wl_eom, uint32_t output_id, struct xdg_surface *surface)
357 wl_proxy_marshal((struct wl_proxy *) wl_eom,
358 WL_EOM_SET_XDG_WINDOW, output_id, surface);
362 wl_eom_set_shell_window(struct wl_eom *wl_eom, uint32_t output_id, struct wl_shell_surface *surface)
364 wl_proxy_marshal((struct wl_proxy *) wl_eom,
365 WL_EOM_SET_SHELL_WINDOW, output_id, surface);
369 wl_eom_get_output_info(struct wl_eom *wl_eom, uint32_t output_id)
371 wl_proxy_marshal((struct wl_proxy *) wl_eom,
372 WL_EOM_GET_OUTPUT_INFO, output_id);