• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2008-2011 Kristian Høgsberg
3  * Copyright © 2012, 2017, 2018 Collabora, Ltd.
4  * Copyright © 2017, 2018 General Electric Company
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial
16  * portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  */
27 #define LOG_TAG "WAYLAND_SERVER" // OHOS logcat
28 
29 #ifndef _WAYLAND_SYSTEM_COMPOSITOR_H_
30 #define _WAYLAND_SYSTEM_COMPOSITOR_H_
31 
32 #ifdef  __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <stdbool.h>
37 #include <stdint.h>
38 #include <time.h>
39 #include <pixman.h>
40 #include <hilog/log.h> // OHOS hilog
41 #include <xkbcommon/xkbcommon.h>
42 
43 #define WL_HIDE_DEPRECATED
44 #include <wayland-server.h>
45 
46 #include <libweston/matrix.h>
47 #include <libweston/zalloc.h>
48 
49 struct weston_geometry {
50 	int32_t x, y;
51 	int32_t width, height;
52 };
53 
54 struct weston_position {
55 	int32_t x, y;
56 };
57 
58 struct weston_size {
59 	int32_t width, height;
60 };
61 
62 struct weston_transform {
63 	struct weston_matrix matrix;
64 	struct wl_list link;
65 };
66 
67 /** 2D device coordinates normalized to [0, 1] range */
68 struct weston_point2d_device_normalized {
69 	double x;
70 	double y;
71 };
72 
73 struct weston_surface;
74 struct weston_buffer;
75 struct shell_surface;
76 struct weston_seat;
77 struct weston_output;
78 struct input_method;
79 struct weston_pointer;
80 struct linux_dmabuf_buffer;
81 struct weston_recorder;
82 struct weston_pointer_constraint;
83 struct ro_anonymous_file;
84 
85 enum weston_keyboard_modifier {
86 	MODIFIER_CTRL = (1 << 0),
87 	MODIFIER_ALT = (1 << 1),
88 	MODIFIER_SUPER = (1 << 2),
89 	MODIFIER_SHIFT = (1 << 3),
90 };
91 
92 enum weston_keyboard_locks {
93 	WESTON_NUM_LOCK = (1 << 0),
94 	WESTON_CAPS_LOCK = (1 << 1),
95 };
96 
97 enum weston_led {
98 	LED_NUM_LOCK = (1 << 0),
99 	LED_CAPS_LOCK = (1 << 1),
100 	LED_SCROLL_LOCK = (1 << 2),
101 };
102 
103 enum weston_mode_aspect_ratio {
104 	/** The picture aspect ratio values, for the aspect_ratio field of
105 	 *  weston_mode. The values here, are taken from
106 	 *  DRM_MODE_PICTURE_ASPECT_* from drm_mode.h.
107 	 */
108 	WESTON_MODE_PIC_AR_NONE = 0,	/* DRM_MODE_PICTURE_ASPECT_NONE */
109 	WESTON_MODE_PIC_AR_4_3 = 1,	/* DRM_MODE_PICTURE_ASPECT_4_3 */
110 	WESTON_MODE_PIC_AR_16_9 = 2,	/* DRM_MODE_PICTURE_ASPECT_16_9 */
111 	WESTON_MODE_PIC_AR_64_27 = 3,	/* DRM_MODE_PICTURE_ASPECT_64_27 */
112 	WESTON_MODE_PIC_AR_256_135 = 4,	/* DRM_MODE_PICTURE_ASPECT_256_135*/
113 };
114 
115 enum weston_surface_protection_mode {
116 	WESTON_SURFACE_PROTECTION_MODE_RELAXED,
117 	WESTON_SURFACE_PROTECTION_MODE_ENFORCED
118 };
119 
120 struct weston_mode {
121 	uint32_t flags;
122 	enum weston_mode_aspect_ratio aspect_ratio;
123 	int32_t width, height;
124 	uint32_t refresh;
125 	struct wl_list link;
126 };
127 
128 struct weston_animation {
129 	void (*frame)(struct weston_animation *animation,
130 		      struct weston_output *output,
131 		      const struct timespec *time);
132 	int frame_counter;
133 	struct wl_list link;
134 };
135 
136 enum {
137 	WESTON_SPRING_OVERSHOOT,
138 	WESTON_SPRING_CLAMP,
139 	WESTON_SPRING_BOUNCE
140 };
141 
142 struct weston_spring {
143 	double k;
144 	double friction;
145 	double current;
146 	double target;
147 	double previous;
148 	double min, max;
149 	struct timespec timestamp;
150 	uint32_t clip;
151 };
152 
153 struct weston_output_zoom {
154 	bool active;
155 	float increment;
156 	float level;
157 	float max_level;
158 	float trans_x, trans_y;
159 	struct {
160 		double x, y;
161 	} current;
162 	struct weston_seat *seat;
163 	struct weston_animation animation_z;
164 	struct weston_spring spring_z;
165 	struct wl_listener motion_listener;
166 };
167 
168 /* bit compatible with drm definitions. */
169 enum dpms_enum {
170 	WESTON_DPMS_ON,
171 	WESTON_DPMS_STANDBY,
172 	WESTON_DPMS_SUSPEND,
173 	WESTON_DPMS_OFF
174 };
175 
176 /* enum for content protection requests/status
177  *
178  * This enum represents the content protection requests and statuses in
179  * libweston and its enum values correspond to those of 'type' enum defined in
180  * weston-content-protection protocol. The values should exactly match to the
181  * values of the 'type' enum of the protocol.
182  */
183 
184 enum weston_hdcp_protection {
185 	WESTON_HDCP_DISABLE = 0,
186 	WESTON_HDCP_ENABLE_TYPE_0,
187 	WESTON_HDCP_ENABLE_TYPE_1
188 };
189 
190 /** Represents a head, usually a display connector
191  *
192  * \rst
193  See :ref:`libweston-head`. \endrst
194  *
195  * \ingroup head
196  */
197 struct weston_head {
198 	struct weston_compositor *compositor;	/**< owning compositor */
199 	struct wl_list compositor_link;	/**< in weston_compositor::head_list */
200 	struct wl_signal destroy_signal;	/**< destroy callbacks */
201 
202 	struct weston_output *output;	/**< the output driving this head */
203 	struct wl_list output_link;	/**< in weston_output::head_list */
204 
205 	struct wl_list resource_list;	/**< wl_output protocol objects */
206 	struct wl_global *global;	/**< wl_output global */
207 
208 	struct wl_list xdg_output_resource_list; /**< xdg_output protocol objects */
209 
210 	int32_t mm_width;		/**< physical image width in mm */
211 	int32_t mm_height;		/**< physical image height in mm */
212 
213 	/** WL_OUTPUT_TRANSFORM enum to apply to match native orientation */
214 	uint32_t transform;
215 
216 	char *make;			/**< monitor manufacturer (PNP ID) */
217 	char *model;			/**< monitor model */
218 	char *serial_number;		/**< monitor serial */
219 	uint32_t subpixel;		/**< enum wl_output_subpixel */
220 	bool connection_internal;	/**< embedded monitor (e.g. laptop) */
221 	bool device_changed;		/**< monitor information has changed */
222 
223 	char *name;			/**< head name, e.g. connector name */
224 	bool connected;			/**< is physically connected */
225 	bool non_desktop;		/**< non-desktop display, e.g. HMD */
226 
227 	/** Current content protection status */
228 	enum weston_hdcp_protection current_protection;
229 };
230 
231 /** Content producer for heads
232  *
233  * \rst
234  See :ref:`libweston-output`. \endrst
235  *
236  * \ingroup output
237  */
238 struct weston_output {
239 	uint32_t id;
240 	char *name;
241 
242 	/** Matches the lifetime from the user perspective */
243 	struct wl_signal user_destroy_signal;
244 
245 	void *renderer_state;
246 	void *hdi_renderer_state;
247 	void *gpu_renderer_state;
248 
249 	struct wl_list link;
250 	struct weston_compositor *compositor;
251 
252 	/** From global to output buffer coordinates. */
253 	struct weston_matrix matrix;
254 	/** From output buffer to global coordinates. */
255 	struct weston_matrix inverse_matrix;
256 
257 	struct wl_list animation_list;
258 	int32_t x, y, width, height;
259 
260 	/** Output area in global coordinates, simple rect */
261 	pixman_region32_t region;
262 
263 	/** True if damage has occurred since the last repaint for this output;
264 	 *  if set, a repaint will eventually occur. */
265 	bool repaint_needed;
266 
267 	/** Used only between repaint_begin and repaint_cancel. */
268 	bool repainted;
269 
270 	/** State of the repaint loop */
271 	enum {
272 		REPAINT_NOT_SCHEDULED = 0, /**< idle; no repaint will occur */
273 		REPAINT_BEGIN_FROM_IDLE, /**< start_repaint_loop scheduled */
274 		REPAINT_SCHEDULED, /**< repaint is scheduled to occur */
275 		REPAINT_AWAITING_COMPLETION, /**< last repaint not yet finished */
276 	} repaint_status;
277 
278 	/** If repaint_status is REPAINT_SCHEDULED, contains the time the
279 	 *  next repaint should be run */
280 	struct timespec next_repaint;
281 
282 	/** For cancelling the idle_repaint callback on output destruction. */
283 	struct wl_event_source *idle_repaint_source;
284 
285 	struct weston_output_zoom zoom;
286 	int dirty;
287 	struct wl_signal frame_signal;
288 	struct wl_signal destroy_signal;	/**< sent when disabled */
289 	int move_x, move_y;
290 	struct timespec frame_time; /* presentation timestamp */
291 	uint64_t msc;        /* media stream counter */
292 	int disable_planes;
293 	int destroying;
294 	struct wl_list feedback_list;
295 
296 	uint32_t transform;
297 	int32_t native_scale;
298 	int32_t current_scale;
299 	int32_t original_scale;
300 
301 	struct weston_mode *native_mode;
302 	struct weston_mode *current_mode;
303 	struct weston_mode *original_mode;
304 	struct wl_list mode_list;
305 
306 	struct wl_list head_list; /**< List of driven weston_heads */
307 
308 	enum weston_hdcp_protection desired_protection;
309 	enum weston_hdcp_protection current_protection;
310 	bool allow_protection;
311 
312 	int (*start_repaint_loop)(struct weston_output *output);
313 	int (*repaint)(struct weston_output *output,
314 			pixman_region32_t *damage,
315 			void *repaint_data);
316 	void (*destroy)(struct weston_output *output);
317 	void (*assign_planes)(struct weston_output *output, void *repaint_data);
318 	int (*switch_mode)(struct weston_output *output, struct weston_mode *mode);
319 
320 	/* backlight values are on 0-255 range, where higher is brighter */
321 	int32_t backlight_current;
322 	void (*set_backlight)(struct weston_output *output, uint32_t value);
323 	void (*set_dpms)(struct weston_output *output, enum dpms_enum level);
324 
325 	uint16_t gamma_size;
326 	void (*set_gamma)(struct weston_output *output,
327 			  uint16_t size,
328 			  uint16_t *r,
329 			  uint16_t *g,
330 			  uint16_t *b);
331 
332 	bool enabled; /**< is in the output_list, not pending list */
333 	int scale;
334 
335 	int (*enable)(struct weston_output *output);
336 	int (*disable)(struct weston_output *output);
337 
338 	/** Attach a head in the backend
339 	 *
340 	 * @param output The output to attach to.
341 	 * @param head The head to attach.
342 	 * @return 0 on success, -1 on failure.
343 	 *
344 	 * Do anything necessary to account for a new head being attached to
345 	 * the output, and check any conditions possible. On failure, both
346 	 * the head and the output must be left as before the call.
347 	 *
348 	 * Libweston core will add the head to the head_list after a successful
349 	 * call.
350 	 */
351 	int (*attach_head)(struct weston_output *output,
352 			   struct weston_head *head);
353 
354 	/** Detach a head in the backend
355 	 *
356 	 * @param output The output to detach from.
357 	 * @param head The head to detach.
358 	 *
359 	 * Do any clean-up necessary to detach this head from the output.
360 	 * The head has already been removed from the output's head_list.
361 	 */
362 	void (*detach_head)(struct weston_output *output,
363 			    struct weston_head *head);
364 };
365 
366 enum weston_pointer_motion_mask {
367 	WESTON_POINTER_MOTION_ABS = 1 << 0,
368 	WESTON_POINTER_MOTION_REL = 1 << 1,
369 	WESTON_POINTER_MOTION_REL_UNACCEL = 1 << 2,
370 };
371 
372 struct weston_pointer_motion_event {
373 	uint32_t mask;
374 	struct timespec time;
375 	double x;
376 	double y;
377 	double dx;
378 	double dy;
379 	double dx_unaccel;
380 	double dy_unaccel;
381 };
382 
383 struct weston_pointer_axis_event {
384 	uint32_t axis;
385 	double value;
386 	bool has_discrete;
387 	int32_t discrete;
388 };
389 
390 struct weston_pointer_grab;
391 struct weston_pointer_grab_interface {
392 	void (*focus)(struct weston_pointer_grab *grab);
393 	void (*motion)(struct weston_pointer_grab *grab,
394 		       const struct timespec *time,
395 		       struct weston_pointer_motion_event *event);
396 	void (*button)(struct weston_pointer_grab *grab,
397 		       const struct timespec *time,
398 		       uint32_t button, uint32_t state);
399 	void (*axis)(struct weston_pointer_grab *grab,
400 		     const struct timespec *time,
401 		     struct weston_pointer_axis_event *event);
402 	void (*axis_source)(struct weston_pointer_grab *grab, uint32_t source);
403 	void (*frame)(struct weston_pointer_grab *grab);
404 	void (*cancel)(struct weston_pointer_grab *grab);
405 };
406 
407 struct weston_pointer_grab {
408 	const struct weston_pointer_grab_interface *interface;
409 	struct weston_pointer *pointer;
410 };
411 
412 struct weston_keyboard_grab;
413 struct weston_keyboard_grab_interface {
414 	void (*key)(struct weston_keyboard_grab *grab,
415 		    const struct timespec *time, uint32_t key, uint32_t state);
416 	void (*modifiers)(struct weston_keyboard_grab *grab, uint32_t serial,
417 			  uint32_t mods_depressed, uint32_t mods_latched,
418 			  uint32_t mods_locked, uint32_t group);
419 	void (*cancel)(struct weston_keyboard_grab *grab);
420 };
421 
422 struct weston_keyboard_grab {
423 	const struct weston_keyboard_grab_interface *interface;
424 	struct weston_keyboard *keyboard;
425 };
426 
427 struct weston_touch_grab;
428 struct weston_touch_grab_interface {
429 	void (*down)(struct weston_touch_grab *grab,
430 			const struct timespec *time,
431 			int touch_id,
432 			wl_fixed_t sx,
433 			wl_fixed_t sy);
434 	void (*up)(struct weston_touch_grab *grab,
435 			const struct timespec *time,
436 			int touch_id);
437 	void (*motion)(struct weston_touch_grab *grab,
438 			const struct timespec *time,
439 			int touch_id,
440 			wl_fixed_t sx,
441 			wl_fixed_t sy);
442 	void (*frame)(struct weston_touch_grab *grab);
443 	void (*cancel)(struct weston_touch_grab *grab);
444 };
445 
446 struct weston_touch_grab {
447 	const struct weston_touch_grab_interface *interface;
448 	struct weston_touch *touch;
449 };
450 
451 struct weston_data_offer {
452 	struct wl_resource *resource;
453 	struct weston_data_source *source;
454 	struct wl_listener source_destroy_listener;
455 	uint32_t dnd_actions;
456 	enum wl_data_device_manager_dnd_action preferred_dnd_action;
457 	bool in_ask;
458 };
459 
460 struct weston_data_source {
461 	struct wl_resource *resource;
462 	struct wl_signal destroy_signal;
463 	struct wl_array mime_types;
464 	struct weston_data_offer *offer;
465 	struct weston_seat *seat;
466 	bool accepted;
467 	bool actions_set;
468 	bool set_selection;
469 	uint32_t dnd_actions;
470 	enum wl_data_device_manager_dnd_action current_dnd_action;
471 	enum wl_data_device_manager_dnd_action compositor_action;
472 
473 	void (*accept)(struct weston_data_source *source,
474 		       uint32_t serial, const char *mime_type);
475 	void (*send)(struct weston_data_source *source,
476 		     const char *mime_type, int32_t fd);
477 	void (*cancel)(struct weston_data_source *source);
478 };
479 
480 struct weston_pointer_client {
481 	struct wl_list link;
482 	struct wl_client *client;
483 	struct wl_list pointer_resources;
484 	struct wl_list relative_pointer_resources;
485 };
486 
487 struct weston_pointer {
488 	struct weston_seat *seat;
489 
490 	struct wl_list pointer_clients;
491 
492 	struct weston_view *focus;
493 	struct weston_pointer_client *focus_client;
494 	uint32_t focus_serial;
495 	struct wl_listener focus_view_listener;
496 	struct wl_listener focus_resource_listener;
497 	struct wl_signal focus_signal;
498 	struct wl_signal motion_signal;
499 	struct wl_signal destroy_signal;
500 
501 	struct weston_view *sprite;
502 	struct wl_listener sprite_destroy_listener;
503 	int32_t hotspot_x, hotspot_y;
504 
505 	struct weston_pointer_grab *grab;
506 	struct weston_pointer_grab default_grab;
507 	wl_fixed_t grab_x, grab_y;
508 	uint32_t grab_button;
509 	uint32_t grab_serial;
510 	struct timespec grab_time;
511 
512 	wl_fixed_t x, y;
513 	wl_fixed_t sx, sy;
514 	uint32_t button_count;
515 
516 	struct wl_listener output_destroy_listener;
517 
518 	struct wl_list timestamps_list;
519 };
520 
521 /** libinput style calibration matrix
522  *
523  * See https://wayland.freedesktop.org/libinput/doc/latest/absolute_axes.html
524  * and libinput_device_config_calibration_set_matrix().
525  */
526 struct weston_touch_device_matrix {
527 	float m[6];
528 };
529 
530 struct weston_touch_device;
531 
532 /** Operations for a calibratable touchscreen */
533 struct weston_touch_device_ops {
534 	/** Get the associated output if existing. */
535 	struct weston_output *(*get_output)(struct weston_touch_device *device);
536 
537 	/** Get the name of the associated head if existing. */
538 	const char *
539 	(*get_calibration_head_name)(struct weston_touch_device *device);
540 
541 	/** Retrieve the current calibration matrix. */
542 	void (*get_calibration)(struct weston_touch_device *device,
543 				struct weston_touch_device_matrix *cal);
544 
545 	/** Set a new calibration matrix. */
546 	void (*set_calibration)(struct weston_touch_device *device,
547 				const struct weston_touch_device_matrix *cal);
548 };
549 
550 enum weston_touch_mode {
551 	/** Normal touch event handling */
552 	WESTON_TOUCH_MODE_NORMAL,
553 
554 	/** Prepare moving to WESTON_TOUCH_MODE_CALIB.
555 	 *
556 	 * Move to WESTON_TOUCH_MODE_CALIB as soon as no touches are down on
557 	 * any seat. Until then, all touch events are routed normally.
558 	 */
559 	WESTON_TOUCH_MODE_PREP_CALIB,
560 
561 	/** Calibration mode
562 	 *
563 	 * Only a single weston_touch_device forwards events to the calibrator
564 	 * all other touch device cause a calibrator "wrong device" event to
565 	 * be sent.
566 	 */
567 	WESTON_TOUCH_MODE_CALIB,
568 
569 	/** Prepare moving to WESTON_TOUCH_MODE_NORMAL.
570 	 *
571 	 * Move to WESTON_TOUCH_MODE_NORMAL as soon as no touches are down on
572 	 * any seat. Until then, touch events are routed as in
573 	 * WESTON_TOUCH_MODE_CALIB except "wrong device" events are not sent.
574 	 */
575 	WESTON_TOUCH_MODE_PREP_NORMAL
576 };
577 
578 /** Represents a physical touchscreen input device */
579 struct weston_touch_device {
580 	char *syspath;			/**< unique name */
581 
582 	struct weston_touch *aggregate;	/**< weston_touch this is part of */
583 	struct wl_list link;		/**< in weston_touch::device_list */
584 	struct wl_signal destroy_signal;	/**< destroy notifier */
585 
586 	void *backend_data;		/**< backend-specific private */
587 
588 	const struct weston_touch_device_ops *ops;
589 	struct weston_touch_device_matrix saved_calibration;
590 };
591 
592 /** Represents a set of touchscreen devices aggregated under a seat */
593 struct weston_touch {
594 	struct weston_seat *seat;
595 
596 	struct wl_list device_list;	/* struct weston_touch_device::link */
597 
598 	struct wl_list resource_list;
599 	struct wl_list focus_resource_list;
600 	struct weston_view *focus;
601 	struct wl_listener focus_view_listener;
602 	struct wl_listener focus_resource_listener;
603 	uint32_t focus_serial;
604 	struct wl_signal focus_signal;
605 
606 	uint32_t num_tp;
607 
608 	struct weston_touch_grab *grab;
609 	struct weston_touch_grab default_grab;
610 	int grab_touch_id;
611 	wl_fixed_t grab_x, grab_y;
612 	uint32_t grab_serial;
613 	struct timespec grab_time;
614 
615 	struct wl_list timestamps_list;
616 };
617 
618 void
619 weston_pointer_motion_to_abs(struct weston_pointer *pointer,
620 			     struct weston_pointer_motion_event *event,
621 			     wl_fixed_t *x, wl_fixed_t *y);
622 
623 void
624 weston_pointer_send_motion(struct weston_pointer *pointer,
625 			   const struct timespec *time,
626 			   struct weston_pointer_motion_event *event);
627 bool
628 weston_pointer_has_focus_resource(struct weston_pointer *pointer);
629 void
630 weston_pointer_send_button(struct weston_pointer *pointer,
631 			   const struct timespec *time,
632 			   uint32_t button, uint32_t state_w);
633 void
634 weston_pointer_send_axis(struct weston_pointer *pointer,
635 			 const struct timespec *time,
636 			 struct weston_pointer_axis_event *event);
637 void
638 weston_pointer_send_axis_source(struct weston_pointer *pointer,
639 				uint32_t source);
640 void
641 weston_pointer_send_frame(struct weston_pointer *pointer);
642 
643 void
644 weston_pointer_set_focus(struct weston_pointer *pointer,
645 			 struct weston_view *view,
646 			 wl_fixed_t sx, wl_fixed_t sy);
647 void
648 weston_pointer_clear_focus(struct weston_pointer *pointer);
649 void
650 weston_pointer_start_grab(struct weston_pointer *pointer,
651 			  struct weston_pointer_grab *grab);
652 void
653 weston_pointer_end_grab(struct weston_pointer *pointer);
654 void
655 weston_pointer_move(struct weston_pointer *pointer,
656 		    struct weston_pointer_motion_event *event);
657 void
658 weston_keyboard_set_focus(struct weston_keyboard *keyboard,
659 			  struct weston_surface *surface);
660 void
661 weston_keyboard_start_grab(struct weston_keyboard *device,
662 			   struct weston_keyboard_grab *grab);
663 void
664 weston_keyboard_end_grab(struct weston_keyboard *keyboard);
665 int
666 /*
667  * 'mask' and 'value' should be a bitwise mask of one or more
668  * valued of the weston_keyboard_locks enum.
669  */
670 weston_keyboard_set_locks(struct weston_keyboard *keyboard,
671 			  uint32_t mask, uint32_t value);
672 
673 void
674 weston_keyboard_send_key(struct weston_keyboard *keyboard,
675 			 const struct timespec *time, uint32_t key,
676 			 enum wl_keyboard_key_state state);
677 void
678 weston_keyboard_send_modifiers(struct weston_keyboard *keyboard,
679 			       uint32_t serial, uint32_t mods_depressed,
680 			       uint32_t mods_latched,
681 			       uint32_t mods_locked, uint32_t group);
682 
683 void
684 weston_touch_set_focus(struct weston_touch *touch,
685 		       struct weston_view *view);
686 void
687 weston_touch_start_grab(struct weston_touch *touch,
688 			struct weston_touch_grab *grab);
689 void
690 weston_touch_end_grab(struct weston_touch *touch);
691 
692 void
693 weston_touch_send_down(struct weston_touch *touch, const struct timespec *time,
694 		       int touch_id, wl_fixed_t x, wl_fixed_t y);
695 void
696 weston_touch_send_up(struct weston_touch *touch, const struct timespec *time,
697 		     int touch_id);
698 void
699 weston_touch_send_motion(struct weston_touch *touch,
700 			 const struct timespec *time, int touch_id,
701 			 wl_fixed_t x, wl_fixed_t y);
702 void
703 weston_touch_send_frame(struct weston_touch *touch);
704 
705 
706 void
707 weston_seat_set_selection(struct weston_seat *seat,
708 			  struct weston_data_source *source, uint32_t serial);
709 
710 int
711 weston_pointer_start_drag(struct weston_pointer *pointer,
712 		       struct weston_data_source *source,
713 		       struct weston_surface *icon,
714 		       struct wl_client *client);
715 struct weston_xkb_info {
716 	struct xkb_keymap *keymap;
717 	struct ro_anonymous_file *keymap_rofile;
718 	int32_t ref_count;
719 	xkb_mod_index_t shift_mod;
720 	xkb_mod_index_t caps_mod;
721 	xkb_mod_index_t ctrl_mod;
722 	xkb_mod_index_t alt_mod;
723 	xkb_mod_index_t mod2_mod;
724 	xkb_mod_index_t mod3_mod;
725 	xkb_mod_index_t super_mod;
726 	xkb_mod_index_t mod5_mod;
727 	xkb_led_index_t num_led;
728 	xkb_led_index_t caps_led;
729 	xkb_led_index_t scroll_led;
730 };
731 
732 struct weston_keyboard {
733 	struct weston_seat *seat;
734 
735 	struct wl_list resource_list;
736 	struct wl_list focus_resource_list;
737 	struct weston_surface *focus;
738 	struct wl_listener focus_resource_listener;
739 	uint32_t focus_serial;
740 	struct wl_signal focus_signal;
741 
742 	struct weston_keyboard_grab *grab;
743 	struct weston_keyboard_grab default_grab;
744 	uint32_t grab_key;
745 	uint32_t grab_serial;
746 	struct timespec grab_time;
747 
748 	struct wl_array keys;
749 
750 	struct {
751 		uint32_t mods_depressed;
752 		uint32_t mods_latched;
753 		uint32_t mods_locked;
754 		uint32_t group;
755 	} modifiers;
756 
757 	struct weston_keyboard_grab input_method_grab;
758 	struct wl_resource *input_method_resource;
759 
760 	struct weston_xkb_info *xkb_info;
761 	struct {
762 		struct xkb_state *state;
763 		enum weston_led leds;
764 	} xkb_state;
765 	struct xkb_keymap *pending_keymap;
766 
767 	struct wl_list timestamps_list;
768 };
769 
770 struct weston_seat {
771 	struct wl_list base_resource_list;
772 
773 	struct wl_global *global;
774 	struct weston_pointer *pointer_state;
775 	struct weston_keyboard *keyboard_state;
776 	struct weston_touch *touch_state;
777 	int pointer_device_count;
778 	int keyboard_device_count;
779 	int touch_device_count;
780 
781 	struct weston_output *output; /* constraint */
782 
783 	struct wl_signal destroy_signal;
784 	struct wl_signal updated_caps_signal;
785 
786 	struct weston_compositor *compositor;
787 	struct wl_list link;
788 	enum weston_keyboard_modifier modifier_state;
789 	struct weston_surface *saved_kbd_focus;
790 	struct wl_listener saved_kbd_focus_listener;
791 	struct wl_list drag_resource_list;
792 
793 	uint32_t selection_serial;
794 	struct weston_data_source *selection_data_source;
795 	struct wl_listener selection_data_source_listener;
796 	struct wl_signal selection_signal;
797 
798 	void (*led_update)(struct weston_seat *ws, enum weston_led leds);
799 
800 	struct input_method *input_method;
801 	char *seat_name;
802 };
803 
804 enum {
805 	WESTON_COMPOSITOR_ACTIVE,	/* normal rendering and events */
806 	WESTON_COMPOSITOR_IDLE,		/* shell->unlock called on activity */
807 	WESTON_COMPOSITOR_OFFSCREEN,	/* no rendering, no frame events */
808 	WESTON_COMPOSITOR_SLEEPING	/* same as offscreen, but also set dpms
809                                          * to off */
810 };
811 
812 struct weston_layer_entry {
813 	struct wl_list link;
814 	struct weston_layer *layer;
815 };
816 
817 /**
818  * Higher value means higher in the stack.
819  *
820  * These values are based on well-known concepts in a classic desktop
821  * environment. Third-party modules based on libweston are encouraged to use
822  * them to integrate better with other projects.
823  *
824  * A fully integrated environment can use any value, based on these or not,
825  * at their discretion.
826  */
827 enum weston_layer_position {
828 	/*
829 	 * Special value to make the layer invisible and still rendered.
830 	 * This is used by compositors wanting e.g. minimized surfaces to still
831 	 * receive frame callbacks.
832 	 */
833 	WESTON_LAYER_POSITION_HIDDEN     = 0x00000000,
834 
835 	/*
836 	 * There should always be a background layer with a surface covering
837 	 * the visible area.
838 	 *
839 	 * If the compositor handles the background itself, it should use
840 	 * BACKGROUND.
841 	 *
842 	 * If the compositor supports runtime-loadable modules to set the
843 	 * background, it should put a solid color surface at (BACKGROUND - 1)
844 	 * and modules must use BACKGROUND.
845 	 */
846 	WESTON_LAYER_POSITION_BACKGROUND = 0x00000002,
847 
848 	/* For "desktop widgets" and applications like conky. */
849 	WESTON_LAYER_POSITION_BOTTOM_UI  = 0x30000000,
850 
851 	/* For regular applications, only one layer should have this value
852 	 * to ensure proper stacking control. */
853 	WESTON_LAYER_POSITION_NORMAL     = 0x50000000,
854 
855 	/* For desktop UI, like panels. */
856 	WESTON_LAYER_POSITION_UI         = 0x80000000,
857 
858 	/* For fullscreen applications that should cover UI. */
859 	WESTON_LAYER_POSITION_FULLSCREEN = 0xb0000000,
860 
861 	/* For special UI like on-screen keyboard that fullscreen applications
862 	 * will need. */
863 	WESTON_LAYER_POSITION_TOP_UI     = 0xe0000000,
864 
865 	/* For the lock surface. */
866 	WESTON_LAYER_POSITION_LOCK       = 0xffff0000,
867 
868 	/* Values reserved for libweston internal usage */
869 	WESTON_LAYER_POSITION_CURSOR     = 0xfffffffe,
870 	WESTON_LAYER_POSITION_FADE       = 0xffffffff,
871 };
872 
873 struct weston_layer {
874 	struct weston_compositor *compositor;
875 	struct wl_list link; /* weston_compositor::layer_list */
876 	enum weston_layer_position position;
877 	pixman_box32_t mask;
878 	struct weston_layer_entry view_list;
879 };
880 
881 struct weston_plane {
882 	struct weston_compositor *compositor;
883 	pixman_region32_t damage; /**< in global coords */
884 	pixman_region32_t clip;
885 	int32_t x, y;
886 	struct wl_list link;
887 };
888 
889 struct weston_renderer {
890 	int (*read_pixels)(struct weston_output *output,
891 			       pixman_format_code_t format, void *pixels,
892 			       uint32_t x, uint32_t y,
893 			       uint32_t width, uint32_t height);
894 	void (*repaint_output)(struct weston_output *output,
895 			       pixman_region32_t *output_damage);
896 	void (*flush_damage)(struct weston_surface *surface);
897 	void (*attach)(struct weston_surface *es, struct weston_buffer *buffer);
898 	void (*surface_set_color)(struct weston_surface *surface,
899 			       float red, float green,
900 			       float blue, float alpha);
901 	void (*destroy)(struct weston_compositor *ec);
902 
903 
904 	/** See weston_surface_get_content_size() */
905 	void (*surface_get_content_size)(struct weston_surface *surface,
906 					 int *width, int *height);
907 
908 	/** See weston_surface_copy_content() */
909 	int (*surface_copy_content)(struct weston_surface *surface,
910 				    void *target, size_t size,
911 				    int src_x, int src_y,
912 				    int width, int height);
913 
914 	/** See weston_compositor_import_dmabuf() */
915 	bool (*import_dmabuf)(struct weston_compositor *ec,
916 			      struct linux_dmabuf_buffer *buffer);
917 
918 	/** On error sets num_formats to zero */
919 	void (*query_dmabuf_formats)(struct weston_compositor *ec,
920 				int **formats, int *num_formats);
921 
922 	/** On error sets num_modifiers to zero */
923 	void (*query_dmabuf_modifiers)(struct weston_compositor *ec,
924 				int format, uint64_t **modifiers,
925 				int *num_modifiers);
926 };
927 
928 enum weston_capability {
929 	/* backend/renderer supports arbitrary rotation */
930 	WESTON_CAP_ROTATION_ANY			= 0x0001,
931 
932 	/* screencaptures need to be y-flipped */
933 	WESTON_CAP_CAPTURE_YFLIP		= 0x0002,
934 
935 	/* backend/renderer has a separate cursor plane */
936 	WESTON_CAP_CURSOR_PLANE			= 0x0004,
937 
938 	/* backend supports setting arbitrary resolutions */
939 	WESTON_CAP_ARBITRARY_MODES		= 0x0008,
940 
941 	/* renderer supports weston_view_set_mask() clipping */
942 	WESTON_CAP_VIEW_CLIP_MASK		= 0x0010,
943 
944 	/* renderer supports explicit synchronization */
945 	WESTON_CAP_EXPLICIT_SYNC		= 0x0020,
946 };
947 
948 /* Configuration struct for a backend.
949  *
950  * This struct carries the configuration for a backend, and it's
951  * passed to the backend's init entry point. The backend will
952  * likely want to subclass this in order to handle backend specific
953  * data.
954  *
955  * \rststar
956  * .. note:
957  *
958  *    Alternate designs were proposed (Feb 2016) for using opaque structures[1]
959  *    and for section+key/value getter/setters[2].  The rationale for selecting
960  *    the transparent structure design is based on several assumptions[3] which
961  *    may require re-evaluating the design choice if they fail to hold.
962  *
963  *    1. https://lists.freedesktop.org/archives/wayland-devel/2016-February/026989.html
964  *    2. https://lists.freedesktop.org/archives/wayland-devel/2016-February/026929.html
965  *    3. https://lists.freedesktop.org/archives/wayland-devel/2016-February/027228.html
966  *
967  * \endrststar
968  */
969 struct weston_backend_config {
970    /** Major version for the backend-specific config struct
971     *
972     * This version must match exactly what the backend expects, otherwise
973     * the struct is incompatible.
974     */
975    uint32_t struct_version;
976 
977    /** Minor version of the backend-specific config struct
978     *
979     * This must be set to sizeof(struct backend-specific config).
980     * If the value here is smaller than what the backend expects, the
981     * extra config members will assume their default values.
982     *
983     * A value greater than what the backend expects is incompatible.
984     */
985    size_t struct_size;
986 };
987 
988 struct weston_backend;
989 
990 /** Callback for saving calibration
991  *
992  * \param compositor The compositor.
993  * \param device The physical touch device to save for.
994  * \param calibration The new calibration from a client.
995  * \return -1 on failure, 0 on success.
996  *
997  * Failure will prevent taking the new calibration into use.
998  */
999 typedef int (*weston_touch_calibration_save_func)(
1000 	struct weston_compositor *compositor,
1001 	struct weston_touch_device *device,
1002 	const struct weston_touch_device_matrix *calibration);
1003 struct weston_touch_calibrator;
1004 
1005 struct weston_desktop_xwayland;
1006 struct weston_desktop_xwayland_interface;
1007 struct weston_debug_compositor;
1008 
1009 /** Main object, container-like structure which aggregates all other objects.
1010  *
1011  * \ingroup compositor
1012  */
1013 struct weston_compositor {
1014 	struct wl_signal destroy_signal;
1015 
1016 	struct wl_display *wl_display;
1017 	struct weston_desktop_xwayland *xwayland;
1018 	const struct weston_desktop_xwayland_interface *xwayland_interface;
1019 
1020 	/* surface signals */
1021 	struct wl_signal create_surface_signal;
1022 	struct wl_signal activate_signal;
1023 	struct wl_signal transform_signal;
1024 
1025 	struct wl_signal kill_signal;
1026 	struct wl_signal idle_signal;
1027 	struct wl_signal wake_signal;
1028 
1029 	struct wl_signal show_input_panel_signal;
1030 	struct wl_signal hide_input_panel_signal;
1031 	struct wl_signal update_input_panel_signal;
1032 
1033 	struct wl_signal seat_created_signal;
1034 	struct wl_signal output_created_signal;
1035 	struct wl_signal output_destroyed_signal;
1036 	struct wl_signal output_moved_signal;
1037 	struct wl_signal output_resized_signal; /* callback argument: resized output */
1038 
1039 	/* Signal for output changes triggered by configuration from frontend
1040 	 * or head state changes from backend.
1041 	 */
1042 	struct wl_signal output_heads_changed_signal; /* arg: weston_output */
1043 
1044 	struct wl_signal session_signal;
1045 	bool session_active;
1046 
1047 	struct weston_layer fade_layer;
1048 	struct weston_layer cursor_layer;
1049 
1050 	struct wl_list pending_output_list;
1051 	struct wl_list output_list;
1052 	struct wl_list head_list;	/* struct weston_head::compositor_link */
1053 	struct wl_list seat_list;
1054 	struct wl_list layer_list;	/* struct weston_layer::link */
1055 	struct wl_list view_list;	/* struct weston_view::link */
1056 	struct wl_list plane_list;
1057 	struct wl_list key_binding_list;
1058 	struct wl_list modifier_binding_list;
1059 	struct wl_list button_binding_list;
1060 	struct wl_list touch_binding_list;
1061 	struct wl_list axis_binding_list;
1062 	struct wl_list debug_binding_list;
1063 
1064 	uint32_t state;
1065 	struct wl_event_source *idle_source;
1066 	uint32_t idle_inhibit;
1067 	int idle_time;			/* timeout, s */
1068 	struct wl_event_source *repaint_timer;
1069 
1070 	const struct weston_pointer_grab_interface *default_pointer_grab;
1071 
1072 	/* Repaint state. */
1073 	struct weston_plane primary_plane;
1074 	uint32_t capabilities; /* combination of enum weston_capability */
1075 
1076 	struct weston_renderer *renderer;
1077 	struct weston_renderer *hdi_renderer;
1078 	struct weston_renderer *gpu_renderer;
1079 
1080 	pixman_format_code_t read_format;
1081 
1082 	struct weston_backend *backend;
1083 
1084 	struct weston_launcher *launcher;
1085 
1086 	struct wl_list plugin_api_list; /* struct weston_plugin_api::link */
1087 
1088 	uint32_t output_id_pool;
1089 
1090 	struct xkb_rule_names xkb_names;
1091 	struct xkb_context *xkb_context;
1092 	struct weston_xkb_info *xkb_info;
1093 
1094 	int32_t kb_repeat_rate;
1095 	int32_t kb_repeat_delay;
1096 
1097 	bool vt_switching;
1098 
1099 	clockid_t presentation_clock;
1100 	int32_t repaint_msec;
1101 
1102 	unsigned int activate_serial;
1103 
1104 	struct wl_global *pointer_constraints;
1105 
1106 	int exit_code;
1107 
1108 	void *user_data;
1109 	void (*exit)(struct weston_compositor *c);
1110 
1111 	/* Whether to let the compositor run without any input device. */
1112 	bool require_input;
1113 
1114 	/* Signal for a backend to inform a frontend about possible changes
1115 	 * in head status.
1116 	 */
1117 	struct wl_signal heads_changed_signal;
1118 	struct wl_event_source *heads_changed_source;
1119 
1120 	/* Touchscreen calibrator support: */
1121 	enum weston_touch_mode touch_mode;
1122 	struct wl_global *touch_calibration;
1123 	weston_touch_calibration_save_func touch_calibration_save;
1124 	struct weston_layer calibrator_layer;
1125 	struct weston_touch_calibrator *touch_calibrator;
1126 
1127 // OHOS remove logger
1128 //	struct weston_log_context *weston_log_ctx;
1129 //	struct weston_log_scope *debug_scene;
1130 	struct weston_log_scope *timeline;
1131 
1132 	struct content_protection *content_protection;
1133 };
1134 
1135 struct weston_buffer {
1136 	struct wl_resource *resource;
1137 	struct wl_signal destroy_signal;
1138 	struct wl_listener destroy_listener;
1139 
1140 	union {
1141 		struct wl_shm_buffer *shm_buffer;
1142 		void *legacy_buffer;
1143 	};
1144 	int32_t width, height;
1145 	uint32_t busy_count;
1146 	int y_inverted;
1147 };
1148 
1149 struct weston_buffer_reference {
1150 	struct weston_buffer *buffer;
1151 	struct wl_listener destroy_listener;
1152 };
1153 
1154 struct weston_buffer_viewport {
1155 	struct {
1156 		/* wl_surface.set_buffer_transform */
1157 		uint32_t transform;
1158 
1159 		/* wl_surface.set_scaling_factor */
1160 		int32_t scale;
1161 
1162 		/*
1163 		 * If src_width != wl_fixed_from_int(-1),
1164 		 * then and only then src_* are used.
1165 		 */
1166 		wl_fixed_t src_x, src_y;
1167 		wl_fixed_t src_width, src_height;
1168 	} buffer;
1169 
1170 	struct {
1171 		/*
1172 		 * If width == -1, the size is inferred from the buffer.
1173 		 */
1174 		int32_t width, height;
1175 	} surface;
1176 
1177 	int changed;
1178 };
1179 
1180 struct weston_buffer_release {
1181 	/* The associated zwp_linux_buffer_release_v1 resource. */
1182 	struct wl_resource *resource;
1183 	/* How many weston_buffer_release_reference objects point to this
1184 	 * object. */
1185 	uint32_t ref_count;
1186 	/* The fence fd, if any, associated with this release. If the fence fd
1187 	 * is -1 then this is considered an immediate release. */
1188 	int fence_fd;
1189 };
1190 
1191 struct weston_buffer_release_reference {
1192 	struct weston_buffer_release *buffer_release;
1193 	/* Listener for the destruction of the wl_resource associated with the
1194 	 * referenced buffer_release object. */
1195 	struct wl_listener destroy_listener;
1196 };
1197 
1198 struct weston_region {
1199 	struct wl_resource *resource;
1200 	pixman_region32_t region;
1201 };
1202 
1203 /* Using weston_view transformations
1204  *
1205  * To add a transformation to a view, create a struct weston_transform, and
1206  * add it to the list view->geometry.transformation_list. Whenever you
1207  * change the list, anything under view->geometry, or anything in the
1208  * weston_transforms linked into the list, you must call
1209  * weston_view_geometry_dirty().
1210  *
1211  * The order in the list defines the order of transformations. Let the list
1212  * contain the transformation matrices M1, ..., Mn as head to tail. The
1213  * transformation is applied to view-local coordinate vector p as
1214  *    P = Mn * ... * M2 * M1 * p
1215  * to produce the global coordinate vector P. The total transform
1216  *    Mn * ... * M2 * M1
1217  * is cached in view->transform.matrix, and the inverse of it in
1218  * view->transform.inverse.
1219  *
1220  * The list always contains view->transform.position transformation, which
1221  * is the translation by view->geometry.x and y.
1222  *
1223  * If you want to apply a transformation in local coordinates, add your
1224  * weston_transform to the head of the list. If you want to apply a
1225  * transformation in global coordinates, add it to the tail of the list.
1226  *
1227  * If view->geometry.parent is set, the total transformation of this
1228  * view will be the parent's total transformation and this transformation
1229  * combined:
1230  *    Mparent * Mn * ... * M2 * M1
1231  */
1232 enum weston_renderer_type {
1233 	WESTON_RENDERER_TYPE_HDI = 0,
1234 	WESTON_RENDERER_TYPE_GPU = 1
1235 };
1236 
1237 struct weston_view {
1238 	struct weston_surface *surface;
1239 	struct wl_list surface_link;
1240 	struct wl_signal destroy_signal;
1241 
1242 	struct wl_list link;             /* weston_compositor::view_list */
1243 	struct weston_layer_entry layer_link; /* part of geometry */
1244 	struct weston_plane *plane;
1245 
1246 	/* For weston_layer inheritance from another view */
1247 	struct weston_view *parent_view;
1248 
1249 	unsigned int click_to_activate_serial;
1250 
1251 	pixman_region32_t clip;          /* See weston_view_damage_below() */
1252 	float alpha;                     /* part of geometry, see below */
1253 
1254 	void *renderer_state;
1255 	void *hdi_renderer_state;
1256 	void *gpu_renderer_state;
1257 
1258 	/* Surface geometry state, mutable.
1259 	 * If you change anything, call weston_surface_geometry_dirty().
1260 	 * That includes the transformations referenced from the list.
1261 	 */
1262 	struct {
1263 		float x, y; /* surface translation on display */
1264 
1265 		/* struct weston_transform */
1266 		struct wl_list transformation_list;
1267 
1268 		/* managed by weston_surface_set_transform_parent() */
1269 		struct weston_view *parent;
1270 		struct wl_listener parent_destroy_listener;
1271 		struct wl_list child_list; /* geometry.parent_link */
1272 		struct wl_list parent_link;
1273 
1274 		/* managed by weston_view_set_mask() */
1275 		bool scissor_enabled;
1276 		pixman_region32_t scissor; /* always a simple rect */
1277 	} geometry;
1278 
1279 	/* State derived from geometry state, read-only.
1280 	 * This is updated by weston_view_update_transform().
1281 	 */
1282 	struct {
1283 		int dirty;
1284 
1285 		/* Approximations in global coordinates:
1286 		 * - boundingbox is guaranteed to include the whole view in
1287 		 *   the smallest possible single rectangle.
1288 		 * - opaque is guaranteed to be fully opaque, though not
1289 		 *   necessarily include all opaque areas.
1290 		 */
1291 		pixman_region32_t boundingbox;
1292 		pixman_region32_t opaque;
1293 
1294 		/* matrix and inverse are used only if enabled = 1.
1295 		 * If enabled = 0, use x, y, width, height directly.
1296 		 */
1297 		int enabled;
1298 		struct weston_matrix matrix;
1299 		struct weston_matrix inverse;
1300 
1301 		struct weston_transform position; /* matrix from x, y */
1302 	} transform;
1303 
1304 	/*
1305 	 * The primary output for this view.
1306 	 * Used for picking the output for driving internal animations on the
1307 	 * view, inheriting the primary output for related views in shells, etc.
1308 	 */
1309 	struct weston_output *output;
1310 	struct wl_listener output_destroy_listener;
1311 
1312 	/*
1313 	 * A more complete representation of all outputs this surface is
1314 	 * displayed on.
1315 	 */
1316 	uint32_t output_mask;
1317 
1318 	/* Per-surface Presentation feedback flags, controlled by backend. */
1319 	uint32_t psf_flags;
1320 
1321 	bool is_mapped;
1322 	enum weston_renderer_type renderer_type;
1323 };
1324 
1325 struct weston_surface_state {
1326 	/* wl_surface.attach */
1327 	int newly_attached;
1328 	struct weston_buffer *buffer;
1329 	struct wl_listener buffer_destroy_listener;
1330 	int32_t sx;
1331 	int32_t sy;
1332 
1333 	/* wl_surface.damage */
1334 	pixman_region32_t damage_surface;
1335 	/* wl_surface.damage_buffer */
1336 	pixman_region32_t damage_buffer;
1337 
1338 	/* wl_surface.set_opaque_region */
1339 	pixman_region32_t opaque;
1340 
1341 	/* wl_surface.set_input_region */
1342 	pixman_region32_t input;
1343 
1344 	/* wl_surface.frame */
1345 	struct wl_list frame_callback_list;
1346 
1347 	/* presentation.feedback */
1348 	struct wl_list feedback_list;
1349 
1350 	/* wl_surface.set_buffer_transform */
1351 	/* wl_surface.set_scaling_factor */
1352 	/* wp_viewport.set_source */
1353 	/* wp_viewport.set_destination */
1354 	struct weston_buffer_viewport buffer_viewport;
1355 
1356 	/* zwp_surface_synchronization_v1.set_acquire_fence */
1357 	int acquire_fence_fd;
1358 
1359 	/* zwp_surface_synchronization_v1.get_release */
1360 	struct weston_buffer_release_reference buffer_release_ref;
1361 
1362 	/* weston_protected_surface.set_type */
1363 	enum weston_hdcp_protection desired_protection;
1364 
1365 	/* weston_protected_surface.enforced/relaxed */
1366 	enum weston_surface_protection_mode protection_mode;
1367 };
1368 
1369 struct weston_surface_activation_data {
1370 	struct weston_surface *surface;
1371 	struct weston_seat *seat;
1372 };
1373 
1374 struct weston_pointer_constraint {
1375 	struct wl_list link;
1376 
1377 	struct weston_surface *surface;
1378 	struct weston_view *view;
1379 	struct wl_resource *resource;
1380 	struct weston_pointer_grab grab;
1381 	struct weston_pointer *pointer;
1382 	uint32_t lifetime;
1383 
1384 	pixman_region32_t region;
1385 	pixman_region32_t region_pending;
1386 	bool region_is_pending;
1387 
1388 	wl_fixed_t hint_x;
1389 	wl_fixed_t hint_y;
1390 	wl_fixed_t hint_x_pending;
1391 	wl_fixed_t hint_y_pending;
1392 	bool hint_is_pending;
1393 
1394 	struct wl_listener pointer_destroy_listener;
1395 	struct wl_listener surface_destroy_listener;
1396 	struct wl_listener surface_commit_listener;
1397 	struct wl_listener surface_activate_listener;
1398 };
1399 
1400 struct weston_surface {
1401 	struct wl_resource *resource;
1402 	struct wl_signal destroy_signal; /* callback argument: this surface */
1403 	struct weston_compositor *compositor;
1404 	struct wl_signal commit_signal;
1405 
1406 	/** Damage in local coordinates from the client, for tex upload. */
1407 	pixman_region32_t damage;
1408 
1409 	pixman_region32_t opaque;        /* part of geometry, see below */
1410 	pixman_region32_t input;
1411 	int32_t width, height;
1412 	int32_t ref_count;
1413 
1414 	/* Not for long-term storage.  This exists for book-keeping while
1415 	 * iterating over surfaces and views
1416 	 */
1417 	bool touched;
1418 
1419 	void *renderer_state;
1420 	void *hdi_renderer_state;
1421 	void *gpu_renderer_state;
1422 
1423 	struct wl_list views;
1424 
1425 	/*
1426 	 * Which output to vsync this surface to.
1427 	 * Used to determine whether to send or queue frame events, and for
1428 	 * other client-visible syncing/throttling tied to the output
1429 	 * repaint cycle.
1430 	 */
1431 	struct weston_output *output;
1432 
1433 	/*
1434 	 * A more complete representation of all outputs this surface is
1435 	 * displayed on.
1436 	 */
1437 	uint32_t output_mask;
1438 
1439 	struct wl_list frame_callback_list;
1440 	struct wl_list feedback_list;
1441 
1442 	struct weston_buffer_reference buffer_ref;
1443 	struct weston_buffer_viewport buffer_viewport;
1444 	int32_t width_from_buffer; /* before applying viewport */
1445 	int32_t height_from_buffer;
1446 	bool keep_buffer; /* for backends to prevent early release */
1447 
1448 	/* wp_viewport resource for this surface */
1449 	struct wl_resource *viewport_resource;
1450 
1451 	/* All the pending state, that wl_surface.commit will apply. */
1452 	struct weston_surface_state pending;
1453 
1454 	/* Matrices representating of the full transformation between
1455 	 * buffer and surface coordinates.  These matrices are updated
1456 	 * using the weston_surface_build_buffer_matrix function. */
1457 	struct weston_matrix buffer_to_surface_matrix;
1458 	struct weston_matrix surface_to_buffer_matrix;
1459 
1460 	/*
1461 	 * If non-NULL, this function will be called on
1462 	 * wl_surface::commit after a new buffer has been set up for
1463 	 * this surface. The integer params are the sx and sy
1464 	 * parameters supplied to wl_surface::attach.
1465 	 */
1466 	void (*committed)(struct weston_surface *es, int32_t sx, int32_t sy);
1467 	void *committed_private;
1468 	int (*get_label)(struct weston_surface *surface, char *buf, size_t len);
1469 
1470 	/* Parent's list of its sub-surfaces, weston_subsurface:parent_link.
1471 	 * Contains also the parent itself as a dummy weston_subsurface,
1472 	 * if the list is not empty.
1473 	 */
1474 	struct wl_list subsurface_list; /* weston_subsurface::parent_link */
1475 	struct wl_list subsurface_list_pending; /* ...::parent_link_pending */
1476 
1477 	/*
1478 	 * For tracking protocol role assignments. Different roles may
1479 	 * have the same configure hook, e.g. in shell.c. Configure hook
1480 	 * may get reset, this will not.
1481 	 * XXX: map configure functions 1:1 to roles, and never reset it,
1482 	 * and replace role_name with configure.
1483 	 */
1484 	const char *role_name;
1485 
1486 	bool is_mapped;
1487 	bool is_opaque;
1488 
1489 	/* An list of per seat pointer constraints. */
1490 	struct wl_list pointer_constraints;
1491 
1492 	/* zwp_surface_synchronization_v1 resource for this surface */
1493 	struct wl_resource *synchronization_resource;
1494 	int acquire_fence_fd;
1495 	struct weston_buffer_release_reference buffer_release_ref;
1496 
1497 	enum weston_hdcp_protection desired_protection;
1498 	enum weston_hdcp_protection current_protection;
1499 	enum weston_surface_protection_mode protection_mode;
1500 	enum wl_surface_type type; // OHOS surface type
1501 };
1502 
1503 struct weston_subsurface {
1504 	struct wl_resource *resource;
1505 
1506 	/* guaranteed to be valid and non-NULL */
1507 	struct weston_surface *surface;
1508 	struct wl_listener surface_destroy_listener;
1509 
1510 	/* can be NULL */
1511 	struct weston_surface *parent;
1512 	struct wl_listener parent_destroy_listener;
1513 	struct wl_list parent_link;
1514 	struct wl_list parent_link_pending;
1515 
1516 	struct {
1517 		int32_t x;
1518 		int32_t y;
1519 		int set;
1520 	} position;
1521 
1522 	int has_cached_data;
1523 	struct weston_surface_state cached;
1524 	struct weston_buffer_reference cached_buffer_ref;
1525 
1526 	/* Sub-surface has been reordered; need to apply damage. */
1527 	bool reordered;
1528 
1529 	int synchronized;
1530 
1531 	/* Used for constructing the view tree */
1532 	struct wl_list unused_views;
1533 };
1534 
1535 struct protected_surface {
1536 	struct weston_surface *surface;
1537 	struct wl_listener surface_destroy_listener;
1538 	struct wl_list link;
1539 	struct wl_resource *protection_resource;
1540 	struct content_protection *cp_backptr;
1541 };
1542 
1543 struct content_protection {
1544 	struct weston_compositor *compositor;
1545 	struct wl_listener destroy_listener;
1546 // OHOS remove logger
1547 //	struct weston_log_scope *debug;
1548 	struct wl_list protected_list;
1549 	struct wl_event_source *surface_protection_update;
1550 };
1551 
1552 
1553 enum weston_key_state_update {
1554 	STATE_UPDATE_AUTOMATIC,
1555 	STATE_UPDATE_NONE,
1556 };
1557 
1558 enum weston_activate_flag {
1559 	WESTON_ACTIVATE_FLAG_NONE = 0,
1560 	WESTON_ACTIVATE_FLAG_CONFIGURE = 1 << 0,
1561 	WESTON_ACTIVATE_FLAG_CLICKED = 1 << 1,
1562 };
1563 
1564 void
1565 weston_version(int *major, int *minor, int *micro);
1566 
1567 void
1568 weston_view_set_output(struct weston_view *view, struct weston_output *output);
1569 
1570 void
1571 weston_view_update_transform(struct weston_view *view);
1572 
1573 void
1574 weston_view_geometry_dirty(struct weston_view *view);
1575 
1576 void
1577 weston_view_to_global_float(struct weston_view *view,
1578 			    float sx, float sy, float *x, float *y);
1579 
1580 void
1581 weston_view_from_global(struct weston_view *view,
1582 			int32_t x, int32_t y, int32_t *vx, int32_t *vy);
1583 void
1584 weston_view_from_global_fixed(struct weston_view *view,
1585 			      wl_fixed_t x, wl_fixed_t y,
1586 			      wl_fixed_t *vx, wl_fixed_t *vy);
1587 
1588 void
1589 weston_view_activate(struct weston_view *view,
1590 		     struct weston_seat *seat,
1591 		     uint32_t flags);
1592 
1593 void
1594 notify_modifiers(struct weston_seat *seat, uint32_t serial);
1595 
1596 void
1597 weston_layer_entry_insert(struct weston_layer_entry *list,
1598 			  struct weston_layer_entry *entry);
1599 void
1600 weston_layer_entry_remove(struct weston_layer_entry *entry);
1601 void
1602 weston_layer_init(struct weston_layer *layer,
1603 		  struct weston_compositor *compositor);
1604 void
1605 weston_layer_set_position(struct weston_layer *layer,
1606 			  enum weston_layer_position position);
1607 void
1608 weston_layer_unset_position(struct weston_layer *layer);
1609 
1610 void
1611 weston_layer_set_mask(struct weston_layer *layer, int x, int y, int width, int height);
1612 
1613 void
1614 weston_layer_set_mask_infinite(struct weston_layer *layer);
1615 
1616 bool
1617 weston_layer_mask_is_infinite(struct weston_layer *layer);
1618 
1619 /* An invalid flag in presented_flags to catch logic errors. */
1620 #define WP_PRESENTATION_FEEDBACK_INVALID (1U << 31)
1621 
1622 void
1623 weston_output_schedule_repaint(struct weston_output *output);
1624 void
1625 weston_compositor_schedule_repaint(struct weston_compositor *compositor);
1626 void
1627 weston_compositor_damage_all(struct weston_compositor *compositor);
1628 void
1629 weston_compositor_wake(struct weston_compositor *compositor);
1630 void
1631 weston_compositor_sleep(struct weston_compositor *compositor);
1632 struct weston_view *
1633 weston_compositor_pick_view(struct weston_compositor *compositor,
1634 			    wl_fixed_t x, wl_fixed_t y,
1635 			    wl_fixed_t *sx, wl_fixed_t *sy);
1636 
1637 
1638 struct weston_binding;
1639 typedef void (*weston_key_binding_handler_t)(struct weston_keyboard *keyboard,
1640 					     const struct timespec *time,
1641 					     uint32_t key,
1642 					     void *data);
1643 struct weston_binding *
1644 weston_compositor_add_key_binding(struct weston_compositor *compositor,
1645 				  uint32_t key,
1646 				  enum weston_keyboard_modifier modifier,
1647 				  weston_key_binding_handler_t binding,
1648 				  void *data);
1649 // OHOS remove debugger
1650 //struct weston_binding *
1651 //weston_compositor_add_debug_binding(struct weston_compositor *compositor,
1652 //				    uint32_t key,
1653 //				    weston_key_binding_handler_t binding,
1654 //				    void *data);
1655 
1656 typedef void (*weston_modifier_binding_handler_t)(struct weston_keyboard *keyboard,
1657 					          enum weston_keyboard_modifier modifier,
1658 					          void *data);
1659 struct weston_binding *
1660 weston_compositor_add_modifier_binding(struct weston_compositor *compositor,
1661 				       enum weston_keyboard_modifier modifier,
1662 				       weston_modifier_binding_handler_t binding,
1663 				       void *data);
1664 
1665 typedef void (*weston_button_binding_handler_t)(struct weston_pointer *pointer,
1666 						const struct timespec *time,
1667 						uint32_t button,
1668 						void *data);
1669 struct weston_binding *
1670 weston_compositor_add_button_binding(struct weston_compositor *compositor,
1671 				     uint32_t button,
1672 				     enum weston_keyboard_modifier modifier,
1673 				     weston_button_binding_handler_t binding,
1674 				     void *data);
1675 
1676 typedef void (*weston_touch_binding_handler_t)(struct weston_touch *touch,
1677 					       const struct timespec *time,
1678 					       void *data);
1679 struct weston_binding *
1680 weston_compositor_add_touch_binding(struct weston_compositor *compositor,
1681 				    enum weston_keyboard_modifier modifier,
1682 				    weston_touch_binding_handler_t binding,
1683 				    void *data);
1684 
1685 typedef void (*weston_axis_binding_handler_t)(struct weston_pointer *pointer,
1686 					      const struct timespec *time,
1687 					      struct weston_pointer_axis_event *event,
1688 					      void *data);
1689 struct weston_binding *
1690 weston_compositor_add_axis_binding(struct weston_compositor *compositor,
1691 			           uint32_t axis,
1692 			           enum weston_keyboard_modifier modifier,
1693 			           weston_axis_binding_handler_t binding,
1694 				   void *data);
1695 
1696 void
1697 weston_binding_destroy(struct weston_binding *binding);
1698 
1699 void
1700 weston_install_debug_key_binding(struct weston_compositor *compositor,
1701 				 uint32_t mod);
1702 
1703 void
1704 weston_compositor_set_default_pointer_grab(struct weston_compositor *compositor,
1705 			const struct weston_pointer_grab_interface *interface);
1706 
1707 struct weston_surface *
1708 weston_surface_create(struct weston_compositor *compositor);
1709 
1710 struct weston_view *
1711 weston_view_create(struct weston_surface *surface);
1712 
1713 void
1714 weston_view_destroy(struct weston_view *view);
1715 
1716 void
1717 weston_view_set_position(struct weston_view *view,
1718 			 float x, float y);
1719 
1720 void
1721 weston_view_set_transform_parent(struct weston_view *view,
1722 				 struct weston_view *parent);
1723 
1724 void
1725 weston_view_set_mask(struct weston_view *view,
1726 		     int x, int y, int width, int height);
1727 
1728 void
1729 weston_view_set_mask_infinite(struct weston_view *view);
1730 
1731 bool
1732 weston_view_is_mapped(struct weston_view *view);
1733 
1734 void
1735 weston_view_schedule_repaint(struct weston_view *view);
1736 
1737 bool
1738 weston_surface_is_mapped(struct weston_surface *surface);
1739 
1740 void
1741 weston_surface_set_size(struct weston_surface *surface,
1742 			int32_t width, int32_t height);
1743 
1744 void
1745 weston_surface_damage(struct weston_surface *surface);
1746 
1747 void
1748 weston_view_damage_below(struct weston_view *view);
1749 
1750 void
1751 weston_view_unmap(struct weston_view *view);
1752 
1753 void
1754 weston_surface_unmap(struct weston_surface *surface);
1755 
1756 struct weston_surface *
1757 weston_surface_get_main_surface(struct weston_surface *surface);
1758 
1759 int
1760 weston_surface_set_role(struct weston_surface *surface,
1761 			const char *role_name,
1762 			struct wl_resource *error_resource,
1763 			uint32_t error_code);
1764 const char *
1765 weston_surface_get_role(struct weston_surface *surface);
1766 
1767 void
1768 weston_surface_set_label_func(struct weston_surface *surface,
1769 			      int (*desc)(struct weston_surface *,
1770 					  char *, size_t));
1771 
1772 void
1773 weston_surface_get_content_size(struct weston_surface *surface,
1774 				int *width, int *height);
1775 
1776 struct weston_geometry
1777 weston_surface_get_bounding_box(struct weston_surface *surface);
1778 
1779 int
1780 weston_surface_copy_content(struct weston_surface *surface,
1781 			    void *target, size_t size,
1782 			    int src_x, int src_y,
1783 			    int width, int height);
1784 
1785 struct weston_buffer *
1786 weston_buffer_from_resource(struct wl_resource *resource);
1787 
1788 void
1789 weston_compositor_get_time(struct timespec *time);
1790 
1791 void
1792 weston_compositor_destroy(struct weston_compositor *ec);
1793 
1794 // OHOS remove logger
1795 //struct weston_compositor *
1796 //weston_compositor_create(struct wl_display *display,
1797 //			 struct weston_log_context *log_ctx, void *user_data);
1798 struct weston_compositor *
1799 weston_compositor_create(struct wl_display *display, void *user_data);
1800 
1801 bool
1802 weston_compositor_add_destroy_listener_once(struct weston_compositor *compositor,
1803 					    struct wl_listener *listener,
1804 					    wl_notify_func_t destroy_handler);
1805 
1806 enum weston_compositor_backend {
1807 	WESTON_BACKEND_DRM,
1808 	WESTON_BACKEND_FBDEV,
1809 	WESTON_BACKEND_HEADLESS,
1810 	WESTON_BACKEND_RDP,
1811 	WESTON_BACKEND_WAYLAND,
1812 	WESTON_BACKEND_X11,
1813 	WESTON_BACKEND_HDI,
1814 };
1815 
1816 int
1817 weston_compositor_load_backend(struct weston_compositor *compositor,
1818 			       enum weston_compositor_backend backend,
1819 			       struct weston_backend_config *config_base);
1820 void
1821 weston_compositor_exit(struct weston_compositor *ec);
1822 void *
1823 weston_compositor_get_user_data(struct weston_compositor *compositor);
1824 void
1825 weston_compositor_exit_with_code(struct weston_compositor *compositor,
1826 				 int exit_code);
1827 void
1828 weston_output_update_zoom(struct weston_output *output);
1829 void
1830 weston_output_activate_zoom(struct weston_output *output,
1831 			    struct weston_seat *seat);
1832 void
1833 weston_output_add_destroy_listener(struct weston_output *output,
1834 				   struct wl_listener *listener);
1835 struct wl_listener *
1836 weston_output_get_destroy_listener(struct weston_output *output,
1837 				   wl_notify_func_t notify);
1838 int
1839 weston_compositor_set_xkb_rule_names(struct weston_compositor *ec,
1840 				     struct xkb_rule_names *names);
1841 
1842 /* String literal of spaces, the same width as the timestamp. */
1843 #define STAMP_SPACE "               "
1844 
1845 /**
1846  * \ingroup wlog
1847  */
1848 // OHOS remove logger
1849 //typedef int (*log_func_t)(const char *fmt, va_list ap);
1850 //void
1851 //weston_log_set_handler(log_func_t log, log_func_t cont);
1852 //int
1853 //weston_log(const char *fmt, ...)
1854 //	__attribute__ ((format (printf, 1, 2)));
1855 //int
1856 //weston_log_continue(const char *fmt, ...)
1857 //	__attribute__ ((format (printf, 1, 2)));
1858 // OHOS logcat
1859 #define weston_log(fmt, ...) (HILOG_INFO(LOG_CORE, fmt, ##__VA_ARGS__))
1860 #define weston_vlog vprintf
1861 #define weston_log_continue(fmt, ...) (HILOG_DEBUG(LOG_CORE, fmt, ##__VA_ARGS__))
1862 
1863 
1864 enum weston_screenshooter_outcome {
1865 	WESTON_SCREENSHOOTER_SUCCESS,
1866 	WESTON_SCREENSHOOTER_NO_MEMORY,
1867 	WESTON_SCREENSHOOTER_BAD_BUFFER
1868 };
1869 
1870 typedef void (*weston_screenshooter_done_func_t)(void *data,
1871 				enum weston_screenshooter_outcome outcome);
1872 int
1873 weston_screenshooter_shoot(struct weston_output *output, struct weston_buffer *buffer,
1874 			   weston_screenshooter_done_func_t done, void *data);
1875 struct weston_recorder *
1876 weston_recorder_start(struct weston_output *output, const char *filename);
1877 void
1878 weston_recorder_stop(struct weston_recorder *recorder);
1879 
1880 struct weston_view_animation;
1881 typedef	void (*weston_view_animation_done_func_t)(struct weston_view_animation *animation, void *data);
1882 
1883 void
1884 weston_view_animation_destroy(struct weston_view_animation *animation);
1885 
1886 struct weston_view_animation *
1887 weston_zoom_run(struct weston_view *view, float start, float stop,
1888 		weston_view_animation_done_func_t done, void *data);
1889 
1890 struct weston_view_animation *
1891 weston_fade_run(struct weston_view *view,
1892 		float start, float end, float k,
1893 		weston_view_animation_done_func_t done, void *data);
1894 
1895 struct weston_view_animation *
1896 weston_move_scale_run(struct weston_view *view, int dx, int dy,
1897 		      float start, float end, bool reverse,
1898 		      weston_view_animation_done_func_t done, void *data);
1899 
1900 struct weston_view_animation *
1901 weston_move_run(struct weston_view *view, int dx, int dy,
1902 		float start, float end, bool reverse,
1903 		weston_view_animation_done_func_t done, void *data);
1904 
1905 void
1906 weston_fade_update(struct weston_view_animation *fade, float target);
1907 
1908 struct weston_view_animation *
1909 weston_stable_fade_run(struct weston_view *front_view, float start,
1910 		       struct weston_view *back_view, float end,
1911 		       weston_view_animation_done_func_t done, void *data);
1912 
1913 struct weston_view_animation *
1914 weston_slide_run(struct weston_view *view, float start, float stop,
1915 		 weston_view_animation_done_func_t done, void *data);
1916 
1917 void
1918 weston_surface_set_color(struct weston_surface *surface,
1919 			 float red, float green, float blue, float alpha);
1920 
1921 void
1922 weston_surface_destroy(struct weston_surface *surface);
1923 
1924 int
1925 weston_output_mode_switch_to_temporary(struct weston_output *output,
1926 				       struct weston_mode *mode,
1927 				       int32_t scale);
1928 int
1929 weston_output_mode_switch_to_native(struct weston_output *output);
1930 
1931 int
1932 weston_backend_init(struct weston_compositor *c,
1933 		    struct weston_backend_config *config_base);
1934 int
1935 weston_module_init(struct weston_compositor *compositor);
1936 
1937 void *
1938 weston_load_module(const char *name, const char *entrypoint);
1939 
1940 size_t
1941 weston_module_path_from_env(const char *name, char *path, size_t path_len);
1942 
1943 int
1944 weston_parse_transform(const char *transform, uint32_t *out);
1945 
1946 const char *
1947 weston_transform_to_string(uint32_t output_transform);
1948 
1949 struct weston_keyboard *
1950 weston_seat_get_keyboard(struct weston_seat *seat);
1951 
1952 struct weston_pointer *
1953 weston_seat_get_pointer(struct weston_seat *seat);
1954 
1955 struct weston_touch *
1956 weston_seat_get_touch(struct weston_seat *seat);
1957 
1958 void
1959 weston_seat_set_keyboard_focus(struct weston_seat *seat,
1960 			       struct weston_surface *surface);
1961 
1962 void
1963 weston_keyboard_send_keymap(struct weston_keyboard *kbd,
1964 			    struct wl_resource *resource);
1965 
1966 int
1967 weston_compositor_load_xwayland(struct weston_compositor *compositor);
1968 
1969 bool
1970 weston_head_is_connected(struct weston_head *head);
1971 
1972 bool
1973 weston_head_is_enabled(struct weston_head *head);
1974 
1975 bool
1976 weston_head_is_device_changed(struct weston_head *head);
1977 
1978 bool
1979 weston_head_is_non_desktop(struct weston_head *head);
1980 
1981 void
1982 weston_head_reset_device_changed(struct weston_head *head);
1983 
1984 const char *
1985 weston_head_get_name(struct weston_head *head);
1986 
1987 struct weston_output *
1988 weston_head_get_output(struct weston_head *head);
1989 
1990 uint32_t
1991 weston_head_get_transform(struct weston_head *head);
1992 
1993 void
1994 weston_head_detach(struct weston_head *head);
1995 
1996 void
1997 weston_head_add_destroy_listener(struct weston_head *head,
1998 				 struct wl_listener *listener);
1999 
2000 struct wl_listener *
2001 weston_head_get_destroy_listener(struct weston_head *head,
2002 				 wl_notify_func_t notify);
2003 
2004 void
2005 weston_head_set_content_protection_status(struct weston_head *head,
2006 					  enum weston_hdcp_protection status);
2007 
2008 struct weston_head *
2009 weston_compositor_iterate_heads(struct weston_compositor *compositor,
2010 				struct weston_head *iter);
2011 
2012 void
2013 weston_compositor_add_heads_changed_listener(struct weston_compositor *compositor,
2014 					     struct wl_listener *listener);
2015 
2016 struct weston_output *
2017 weston_compositor_find_output_by_name(struct weston_compositor *compositor,
2018 				      const char *name);
2019 
2020 struct weston_output *
2021 weston_compositor_create_output(struct weston_compositor *compositor,
2022 				const char *name);
2023 
2024 struct weston_output *
2025 weston_compositor_create_output_with_head(struct weston_compositor *compositor,
2026 					  struct weston_head *head);
2027 
2028 void
2029 weston_output_destroy(struct weston_output *output);
2030 
2031 int
2032 weston_output_attach_head(struct weston_output *output,
2033 			  struct weston_head *head);
2034 
2035 struct weston_head *
2036 weston_output_iterate_heads(struct weston_output *output,
2037 			    struct weston_head *iter);
2038 
2039 void
2040 weston_output_set_scale(struct weston_output *output,
2041 			int32_t scale);
2042 
2043 void
2044 weston_output_set_transform(struct weston_output *output,
2045 			    uint32_t transform);
2046 
2047 void
2048 weston_output_init(struct weston_output *output,
2049 		   struct weston_compositor *compositor,
2050 		   const char *name);
2051 
2052 void
2053 weston_output_move(struct weston_output *output, int x, int y);
2054 
2055 int
2056 weston_output_enable(struct weston_output *output);
2057 
2058 void
2059 weston_output_disable(struct weston_output *output);
2060 
2061 void
2062 weston_compositor_flush_heads_changed(struct weston_compositor *compositor);
2063 
2064 struct weston_head *
2065 weston_head_from_resource(struct wl_resource *resource);
2066 
2067 struct weston_head *
2068 weston_output_get_first_head(struct weston_output *output);
2069 
2070 void
2071 weston_output_allow_protection(struct weston_output *output,
2072 			       bool allow_protection);
2073 
2074 int
2075 weston_compositor_enable_touch_calibrator(struct weston_compositor *compositor,
2076 				weston_touch_calibration_save_func save);
2077 
2078 // OHOS remove logger
2079 //struct weston_log_context *
2080 //weston_log_ctx_create(void);
2081 //
2082 //void
2083 //weston_log_ctx_destroy(struct weston_log_context *log_ctx);
2084 
2085 int
2086 weston_compositor_enable_content_protection(struct weston_compositor *compositor);
2087 
2088 // OHOS remove timeline
2089 //void
2090 //weston_timeline_refresh_subscription_objects(struct weston_compositor *wc,
2091 //					     void *object);
2092 
2093 #ifdef  __cplusplus
2094 }
2095 #endif
2096 
2097 #endif
2098