blob: c38c952f87e59158e85b3661d4b4bd3df1d259ba [file] [log] [blame]
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001/*
2 * Copyright © 2008-2011 Kristian Høgsberg
Pekka Paalanen925788f2018-04-19 14:20:01 +03003 * Copyright © 2012, 2017, 2018 Collabora, Ltd.
4 * Copyright © 2017, 2018 General Electric Company
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05005 *
Bryce Harringtona0bbfea2015-06-11 15:35:43 -07006 * 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:
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050013 *
Bryce Harringtona0bbfea2015-06-11 15:35:43 -070014 * 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.
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050026 */
27
28#ifndef _WAYLAND_SYSTEM_COMPOSITOR_H_
29#define _WAYLAND_SYSTEM_COMPOSITOR_H_
30
Giulio Camuffo7fe01b12013-03-28 18:02:42 +010031#ifdef __cplusplus
32extern "C" {
33#endif
34
Derek Foreman280e7dd2014-10-03 13:13:42 -050035#include <stdbool.h>
Jussi Kukkonen649bbce2016-07-19 14:16:27 +030036#include <stdint.h>
Pekka Paalanenb5eedad2014-09-23 22:08:45 -040037#include <time.h>
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050038#include <pixman.h>
Daniel Stone855028f2012-05-01 20:37:10 +010039#include <xkbcommon/xkbcommon.h>
Kristian Høgsberg3c179332013-08-06 19:27:04 -070040
41#define WL_HIDE_DEPRECATED
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050042#include <wayland-server.h>
43
Pekka Paalanen96dc4492019-04-04 13:47:40 +030044#include <libweston/matrix.h>
Pekka Paalanen91b10102019-04-04 14:27:31 +030045#include <libweston/config-parser.h>
Pekka Paalanenecbdcfd2019-04-04 14:46:00 +030046#include <libweston/zalloc.h>
Pekka Paalanena78cf772019-03-28 16:35:56 +020047#include <libweston/timeline-object.h>
Pekka Paalanen2eaa11e2012-03-30 15:45:40 +030048
Quentin Glidic248dd102016-08-12 10:41:34 +020049struct weston_geometry {
50 int32_t x, y;
51 int32_t width, height;
52};
53
54struct weston_position {
55 int32_t x, y;
56};
57
58struct weston_size {
59 int32_t width, height;
60};
61
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050062struct weston_transform {
63 struct weston_matrix matrix;
Pekka Paalanenc61eca62012-01-06 14:10:06 +020064 struct wl_list link;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050065};
66
Pekka Paalanenf4062532018-02-26 16:18:29 +020067/** 2D device coordinates normalized to [0, 1] range */
68struct weston_point2d_device_normalized {
69 double x;
70 double y;
71};
72
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050073struct weston_surface;
Jason Ekstrand6bd62942013-06-20 20:38:23 -050074struct weston_buffer;
Tiago Vignattibc052c92012-04-19 16:18:18 +030075struct shell_surface;
Daniel Stone37816df2012-05-16 18:45:18 +010076struct weston_seat;
Scott Moreau062be7e2012-04-20 13:37:33 -060077struct weston_output;
Jan Arne Petersene829adc2012-08-10 16:47:22 +020078struct input_method;
Derek Foremane4d6c832015-08-05 14:48:11 -050079struct weston_pointer;
Pekka Paalanen230f3b12014-09-29 14:18:40 -040080struct linux_dmabuf_buffer;
Giulio Camuffo26f62d42016-06-02 21:48:09 +030081struct weston_recorder;
Jonas Ådahld3414f22016-07-22 17:56:31 +080082struct weston_pointer_constraint;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050083
Daniel Stone496ca172012-05-30 16:31:42 +010084enum weston_keyboard_modifier {
85 MODIFIER_CTRL = (1 << 0),
86 MODIFIER_ALT = (1 << 1),
87 MODIFIER_SUPER = (1 << 2),
Kristian Høgsberg73694c82012-06-28 14:13:10 -040088 MODIFIER_SHIFT = (1 << 3),
Daniel Stone496ca172012-05-30 16:31:42 +010089};
90
Giulio Camuffo6ef444d2014-08-28 19:44:09 +030091enum weston_keyboard_locks {
92 WESTON_NUM_LOCK = (1 << 0),
93 WESTON_CAPS_LOCK = (1 << 1),
94};
95
Daniel Stone8c8164f2012-05-30 16:31:45 +010096enum weston_led {
97 LED_NUM_LOCK = (1 << 0),
98 LED_CAPS_LOCK = (1 << 1),
99 LED_SCROLL_LOCK = (1 << 2),
100};
101
Ankit Nautiyala21c3932097-03-19 00:24:57 +0530102enum weston_mode_aspect_ratio {
103 /** The picture aspect ratio values, for the aspect_ratio field of
104 * weston_mode. The values here, are taken from
105 * DRM_MODE_PICTURE_ASPECT_* from drm_mode.h.
106 */
107 WESTON_MODE_PIC_AR_NONE = 0, /* DRM_MODE_PICTURE_ASPECT_NONE */
108 WESTON_MODE_PIC_AR_4_3 = 1, /* DRM_MODE_PICTURE_ASPECT_4_3 */
109 WESTON_MODE_PIC_AR_16_9 = 2, /* DRM_MODE_PICTURE_ASPECT_16_9 */
110 WESTON_MODE_PIC_AR_64_27 = 3, /* DRM_MODE_PICTURE_ASPECT_64_27 */
111 WESTON_MODE_PIC_AR_256_135 = 4, /* DRM_MODE_PICTURE_ASPECT_256_135*/
112};
113
114
115
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500116struct weston_mode {
117 uint32_t flags;
Ankit Nautiyala21c3932097-03-19 00:24:57 +0530118 enum weston_mode_aspect_ratio aspect_ratio;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500119 int32_t width, height;
120 uint32_t refresh;
121 struct wl_list link;
122};
123
Scott Moreaue6603982012-06-11 13:07:51 -0600124struct weston_animation {
125 void (*frame)(struct weston_animation *animation,
Alexandros Frantzis8250a612017-11-16 18:20:52 +0200126 struct weston_output *output,
127 const struct timespec *time);
Scott Moreaue6603982012-06-11 13:07:51 -0600128 int frame_counter;
129 struct wl_list link;
130};
131
Kristian Høgsberg7eec9b32013-06-17 09:15:22 -0400132enum {
133 WESTON_SPRING_OVERSHOOT,
134 WESTON_SPRING_CLAMP,
135 WESTON_SPRING_BOUNCE
136};
137
Scott Moreaue6603982012-06-11 13:07:51 -0600138struct weston_spring {
139 double k;
140 double friction;
141 double current;
142 double target;
143 double previous;
Kristian Høgsberg091b0962013-06-17 09:23:14 -0400144 double min, max;
Alexandros Frantzis8250a612017-11-16 18:20:52 +0200145 struct timespec timestamp;
Kristian Høgsberg7eec9b32013-06-17 09:15:22 -0400146 uint32_t clip;
Scott Moreaue6603982012-06-11 13:07:51 -0600147};
148
Scott Moreauccbf29d2012-02-22 14:21:41 -0700149struct weston_output_zoom {
Derek Foremana36eb502015-07-23 14:55:12 -0500150 bool active;
Scott Moreauccbf29d2012-02-22 14:21:41 -0700151 float increment;
152 float level;
Scott Moreaue6603982012-06-11 13:07:51 -0600153 float max_level;
Scott Moreauccbf29d2012-02-22 14:21:41 -0700154 float trans_x, trans_y;
Giulio Camuffo6850e7b2015-10-07 20:14:18 +0300155 struct {
156 double x, y;
157 } current;
Derek Foreman22276a52015-07-23 14:55:15 -0500158 struct weston_seat *seat;
Scott Moreaue6603982012-06-11 13:07:51 -0600159 struct weston_animation animation_z;
160 struct weston_spring spring_z;
Giulio Camuffo412b0242013-11-14 23:42:51 +0100161 struct wl_listener motion_listener;
Scott Moreauccbf29d2012-02-22 14:21:41 -0700162};
163
Tiago Vignatti8e53c7f2012-02-29 19:53:50 +0200164/* bit compatible with drm definitions. */
165enum dpms_enum {
166 WESTON_DPMS_ON,
167 WESTON_DPMS_STANDBY,
168 WESTON_DPMS_SUSPEND,
169 WESTON_DPMS_OFF
170};
171
Pekka Paalanen01f60212017-03-24 15:39:24 +0200172/** Represents a monitor
173 *
174 * This object represents a monitor (hardware backends like DRM) or a window
175 * (windowed nested backends).
176 */
177struct weston_head {
Pekka Paalanen1adcbac2017-08-14 16:05:35 +0300178 struct weston_compositor *compositor; /**< owning compositor */
179 struct wl_list compositor_link; /**< in weston_compositor::head_list */
Pekka Paalanen2e1bedb2017-10-10 11:21:58 +0300180 struct wl_signal destroy_signal; /**< destroy callbacks */
Pekka Paalanen1adcbac2017-08-14 16:05:35 +0300181
Pekka Paalanen05347622017-03-27 12:24:34 +0300182 struct weston_output *output; /**< the output driving this head */
Pekka Paalanen7cdbabe2017-03-28 16:27:25 +0300183 struct wl_list output_link; /**< in weston_output::head_list */
Pekka Paalanen05347622017-03-27 12:24:34 +0300184
Pekka Paalanen1b9bf592017-03-27 12:15:38 +0300185 struct wl_list resource_list; /**< wl_output protocol objects */
186 struct wl_global *global; /**< wl_output global */
187
Pekka Paalanen01f60212017-03-24 15:39:24 +0200188 int32_t mm_width; /**< physical image width in mm */
189 int32_t mm_height; /**< physical image height in mm */
190 char *make; /**< monitor manufacturer (PNP ID) */
191 char *model; /**< monitor model */
192 char *serial_number; /**< monitor serial */
193 uint32_t subpixel; /**< enum wl_output_subpixel */
194 bool connection_internal; /**< embedded monitor (e.g. laptop) */
Pekka Paalanene19970f2017-08-28 14:11:02 +0300195 bool device_changed; /**< monitor information has changed */
Pekka Paalanen9b02e472017-08-14 14:43:13 +0300196
197 char *name; /**< head name, e.g. connector name */
Pekka Paalanen7fe858b2017-08-14 15:45:14 +0300198 bool connected; /**< is physically connected */
Philipp Zabelc18ffd32018-08-30 17:38:03 +0200199 bool non_desktop; /**< non-desktop display, e.g. HMD */
Pekka Paalanen01f60212017-03-24 15:39:24 +0200200};
201
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500202struct weston_output {
Casey Dahlin58ba1372012-04-19 22:50:08 -0400203 uint32_t id;
Richard Hughesafe690c2013-05-02 10:10:04 +0100204 char *name;
Casey Dahlin58ba1372012-04-19 22:50:08 -0400205
Pekka Paalanen37b7c6e2017-11-07 10:15:01 +0200206 /** Matches the lifetime from the user perspective */
207 struct wl_signal user_destroy_signal;
208
John Kåre Alsaker94659272012-11-13 19:10:18 +0100209 void *renderer_state;
210
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500211 struct wl_list link;
212 struct weston_compositor *compositor;
Jason Ekstrandfb23df72014-10-16 10:55:21 -0500213
214 /** From global to output buffer coordinates. */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500215 struct weston_matrix matrix;
Derek Foremanc0023212015-03-24 11:36:13 -0500216 /** From output buffer to global coordinates. */
217 struct weston_matrix inverse_matrix;
Jason Ekstrandfb23df72014-10-16 10:55:21 -0500218
Scott Moreau9d1b1122012-06-08 19:40:53 -0600219 struct wl_list animation_list;
Scott Moreau1bad5db2012-08-18 01:04:05 -0600220 int32_t x, y, width, height;
Pekka Paalanenefd08c72015-02-23 13:54:49 +0200221
222 /** Output area in global coordinates, simple rect */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500223 pixman_region32_t region;
Pekka Paalanenefd08c72015-02-23 13:54:49 +0200224
Ander Conselvan de Oliveirab8fcca92012-11-16 17:23:52 +0200225 pixman_region32_t previous_damage;
Daniel Stone09a97e22017-03-01 11:34:06 +0000226
227 /** True if damage has occurred since the last repaint for this output;
228 * if set, a repaint will eventually occur. */
229 bool repaint_needed;
Daniel Stone05df8c12017-03-03 16:59:42 +0000230
Tomohito Esaki7f4d9ff2018-06-05 10:37:06 +0900231 /** Used only between repaint_begin and repaint_cancel. */
232 bool repainted;
233
Daniel Stone05df8c12017-03-03 16:59:42 +0000234 /** State of the repaint loop */
235 enum {
236 REPAINT_NOT_SCHEDULED = 0, /**< idle; no repaint will occur */
237 REPAINT_BEGIN_FROM_IDLE, /**< start_repaint_loop scheduled */
238 REPAINT_SCHEDULED, /**< repaint is scheduled to occur */
239 REPAINT_AWAITING_COMPLETION, /**< last repaint not yet finished */
240 } repaint_status;
241
Daniel Stone6847b852017-03-01 11:34:08 +0000242 /** If repaint_status is REPAINT_SCHEDULED, contains the time the
243 * next repaint should be run */
244 struct timespec next_repaint;
245
Pekka Paalanendcbcfc72017-10-26 14:33:59 +0300246 /** For cancelling the idle_repaint callback on output destruction. */
247 struct wl_event_source *idle_repaint_source;
248
Scott Moreauccbf29d2012-02-22 14:21:41 -0700249 struct weston_output_zoom zoom;
250 int dirty;
Kristian Høgsberg5fb70bf2012-05-24 12:29:46 -0400251 struct wl_signal frame_signal;
Pekka Paalanen37b7c6e2017-11-07 10:15:01 +0200252 struct wl_signal destroy_signal; /**< sent when disabled */
Zhang, Xiong Yf3012412013-12-13 22:10:53 +0200253 int move_x, move_y;
Alexandros Frantzise6ac2af2017-11-16 18:20:53 +0200254 struct timespec frame_time; /* presentation timestamp */
Pekka Paalanen641307c2014-09-23 22:08:47 -0400255 uint64_t msc; /* media stream counter */
Kristian Høgsberg79af73e2012-08-03 15:45:23 -0400256 int disable_planes;
Ander Conselvan de Oliveirae1e23522013-12-13 22:10:55 +0200257 int destroying;
Pekka Paalanen133e4392014-09-23 22:08:46 -0400258 struct wl_list feedback_list;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500259
Kristian Høgsberg05890dc2012-08-10 10:09:20 -0400260 uint32_t transform;
Hardening57388e42013-09-18 23:56:36 +0200261 int32_t native_scale;
Hardeningff39efa2013-09-18 23:56:35 +0200262 int32_t current_scale;
Hardening57388e42013-09-18 23:56:36 +0200263 int32_t original_scale;
Alexander Larsson4ea95522013-05-22 14:41:37 +0200264
Hardening57388e42013-09-18 23:56:36 +0200265 struct weston_mode *native_mode;
Hardeningff39efa2013-09-18 23:56:35 +0200266 struct weston_mode *current_mode;
267 struct weston_mode *original_mode;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500268 struct wl_list mode_list;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500269
Pekka Paalanen7cdbabe2017-03-28 16:27:25 +0300270 struct wl_list head_list; /**< List of driven weston_heads */
Pekka Paalanen01f60212017-03-24 15:39:24 +0200271
Jonas Ådahle5a12252013-04-05 23:07:11 +0200272 void (*start_repaint_loop)(struct weston_output *output);
David Herrmann1edf44c2013-10-22 17:11:26 +0200273 int (*repaint)(struct weston_output *output,
Daniel Stoneb1f166d2017-03-01 11:34:10 +0000274 pixman_region32_t *damage,
275 void *repaint_data);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500276 void (*destroy)(struct weston_output *output);
Daniel Stoneb1f166d2017-03-01 11:34:10 +0000277 void (*assign_planes)(struct weston_output *output, void *repaint_data);
Alex Wu2dda6042012-04-17 17:20:47 +0800278 int (*switch_mode)(struct weston_output *output, struct weston_mode *mode);
Tiago Vignatti8e53c7f2012-02-29 19:53:50 +0200279
Tiago Vignatti5ab91ad2012-03-12 19:40:09 -0300280 /* backlight values are on 0-255 range, where higher is brighter */
Kristian Høgsberg7c609122013-05-23 20:30:26 -0400281 int32_t backlight_current;
Tiago Vignatti8e53c7f2012-02-29 19:53:50 +0200282 void (*set_backlight)(struct weston_output *output, uint32_t value);
283 void (*set_dpms)(struct weston_output *output, enum dpms_enum level);
Richard Hughese7299962013-05-01 21:52:12 +0100284
285 uint16_t gamma_size;
286 void (*set_gamma)(struct weston_output *output,
287 uint16_t size,
288 uint16_t *r,
289 uint16_t *g,
290 uint16_t *b);
Pekka Paalanenb5026542014-11-12 15:09:24 +0200291
292 struct weston_timeline_object timeline;
Armin Krezovića01ab6d2016-09-30 14:11:02 +0200293
Pekka Paalanen7f340ff2017-03-30 14:56:22 +0300294 bool enabled; /**< is in the output_list, not pending list */
Armin Krezovića01ab6d2016-09-30 14:11:02 +0200295 int scale;
296
297 int (*enable)(struct weston_output *output);
298 int (*disable)(struct weston_output *output);
Pekka Paalanen992a8cb2017-08-16 10:39:17 +0300299
300 /** Attach a head in the backend
301 *
302 * @param output The output to attach to.
303 * @param head The head to attach.
304 * @return 0 on success, -1 on failure.
305 *
306 * Do anything necessary to account for a new head being attached to
307 * the output, and check any conditions possible. On failure, both
308 * the head and the output must be left as before the call.
309 *
310 * Libweston core will add the head to the head_list after a successful
311 * call.
312 */
313 int (*attach_head)(struct weston_output *output,
314 struct weston_head *head);
315
316 /** Detach a head in the backend
317 *
318 * @param output The output to detach from.
319 * @param head The head to detach.
320 *
321 * Do any clean-up necessary to detach this head from the output.
322 * The head has already been removed from the output's head_list.
323 */
324 void (*detach_head)(struct weston_output *output,
325 struct weston_head *head);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500326};
327
Jonas Ådahld2510102014-10-05 21:39:14 +0200328enum weston_pointer_motion_mask {
329 WESTON_POINTER_MOTION_ABS = 1 << 0,
330 WESTON_POINTER_MOTION_REL = 1 << 1,
Jonas Ådahl3845b322014-10-21 23:51:29 +0200331 WESTON_POINTER_MOTION_REL_UNACCEL = 1 << 2,
Jonas Ådahld2510102014-10-05 21:39:14 +0200332};
333
334struct weston_pointer_motion_event {
335 uint32_t mask;
Alexandros Frantzis84b31f82017-11-24 18:01:46 +0200336 struct timespec time;
Jonas Ådahld2510102014-10-05 21:39:14 +0200337 double x;
338 double y;
339 double dx;
340 double dy;
Jonas Ådahl3845b322014-10-21 23:51:29 +0200341 double dx_unaccel;
342 double dy_unaccel;
Jonas Ådahld2510102014-10-05 21:39:14 +0200343};
344
Peter Hutterer89b6a492016-01-18 15:58:17 +1000345struct weston_pointer_axis_event {
346 uint32_t axis;
Giulio Camuffo90a6fc62016-03-22 17:44:54 +0200347 double value;
Peter Hutterer87743e92016-01-18 16:38:22 +1000348 bool has_discrete;
349 int32_t discrete;
Peter Hutterer89b6a492016-01-18 15:58:17 +1000350};
351
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400352struct weston_pointer_grab;
353struct weston_pointer_grab_interface {
Kristian Høgsberg6848c252013-05-08 22:02:59 -0400354 void (*focus)(struct weston_pointer_grab *grab);
Alexandros Frantzis84b31f82017-11-24 18:01:46 +0200355 void (*motion)(struct weston_pointer_grab *grab,
356 const struct timespec *time,
Jonas Ådahld2510102014-10-05 21:39:14 +0200357 struct weston_pointer_motion_event *event);
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400358 void (*button)(struct weston_pointer_grab *grab,
Alexandros Frantzis215bedc2017-11-16 18:20:55 +0200359 const struct timespec *time,
360 uint32_t button, uint32_t state);
Jonas Ådahl0336ca02014-10-04 16:28:29 +0200361 void (*axis)(struct weston_pointer_grab *grab,
Alexandros Frantzis80321942017-11-16 18:20:56 +0200362 const struct timespec *time,
Peter Hutterer89b6a492016-01-18 15:58:17 +1000363 struct weston_pointer_axis_event *event);
Peter Hutterer87743e92016-01-18 16:38:22 +1000364 void (*axis_source)(struct weston_pointer_grab *grab, uint32_t source);
365 void (*frame)(struct weston_pointer_grab *grab);
Jonas Ådahl1ea343e2013-10-25 23:18:05 +0200366 void (*cancel)(struct weston_pointer_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400367};
368
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400369struct weston_pointer_grab {
370 const struct weston_pointer_grab_interface *interface;
371 struct weston_pointer *pointer;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400372};
373
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400374struct weston_keyboard_grab;
375struct weston_keyboard_grab_interface {
Alexandros Frantzis47e79c82017-11-16 18:20:57 +0200376 void (*key)(struct weston_keyboard_grab *grab,
377 const struct timespec *time, uint32_t key, uint32_t state);
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400378 void (*modifiers)(struct weston_keyboard_grab *grab, uint32_t serial,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400379 uint32_t mods_depressed, uint32_t mods_latched,
380 uint32_t mods_locked, uint32_t group);
Jonas Ådahl1ea343e2013-10-25 23:18:05 +0200381 void (*cancel)(struct weston_keyboard_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400382};
383
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400384struct weston_keyboard_grab {
385 const struct weston_keyboard_grab_interface *interface;
386 struct weston_keyboard *keyboard;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400387};
388
Kristian Høgsberge329f362013-05-06 22:19:57 -0400389struct weston_touch_grab;
390struct weston_touch_grab_interface {
391 void (*down)(struct weston_touch_grab *grab,
Alexandros Frantzis9448deb2017-11-16 18:20:58 +0200392 const struct timespec *time,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400393 int touch_id,
394 wl_fixed_t sx,
395 wl_fixed_t sy);
Kristian Høgsberge329f362013-05-06 22:19:57 -0400396 void (*up)(struct weston_touch_grab *grab,
Alexandros Frantzis27a51b82017-11-16 18:20:59 +0200397 const struct timespec *time,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400398 int touch_id);
Kristian Høgsberge329f362013-05-06 22:19:57 -0400399 void (*motion)(struct weston_touch_grab *grab,
Alexandros Frantzis7d2abcf2017-11-16 18:21:00 +0200400 const struct timespec *time,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400401 int touch_id,
402 wl_fixed_t sx,
403 wl_fixed_t sy);
Jonas Ådahl1679f232014-04-12 09:39:51 +0200404 void (*frame)(struct weston_touch_grab *grab);
Jonas Ådahl1ea343e2013-10-25 23:18:05 +0200405 void (*cancel)(struct weston_touch_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400406};
407
Kristian Høgsberge329f362013-05-06 22:19:57 -0400408struct weston_touch_grab {
409 const struct weston_touch_grab_interface *interface;
410 struct weston_touch *touch;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400411};
412
Kristian Høgsberg5e76a492013-07-25 16:09:37 -0700413struct weston_data_offer {
Jason Ekstrand8a4a9eb2013-06-14 10:07:55 -0500414 struct wl_resource *resource;
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700415 struct weston_data_source *source;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400416 struct wl_listener source_destroy_listener;
Carlos Garnacho9c931792016-01-18 23:52:12 +0100417 uint32_t dnd_actions;
418 enum wl_data_device_manager_dnd_action preferred_dnd_action;
419 bool in_ask;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400420};
421
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700422struct weston_data_source {
Jason Ekstrand8a4a9eb2013-06-14 10:07:55 -0500423 struct wl_resource *resource;
424 struct wl_signal destroy_signal;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400425 struct wl_array mime_types;
Carlos Garnacho78d4bf92016-01-15 21:14:23 +0100426 struct weston_data_offer *offer;
427 struct weston_seat *seat;
428 bool accepted;
Carlos Garnacho9c931792016-01-18 23:52:12 +0100429 bool actions_set;
Harish Krupo737ac0d2019-04-19 22:06:37 +0530430 bool set_selection;
Carlos Garnacho9c931792016-01-18 23:52:12 +0100431 uint32_t dnd_actions;
432 enum wl_data_device_manager_dnd_action current_dnd_action;
Carlos Garnachob2889882016-01-15 21:14:26 +0100433 enum wl_data_device_manager_dnd_action compositor_action;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400434
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700435 void (*accept)(struct weston_data_source *source,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400436 uint32_t serial, const char *mime_type);
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700437 void (*send)(struct weston_data_source *source,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400438 const char *mime_type, int32_t fd);
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700439 void (*cancel)(struct weston_data_source *source);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400440};
441
Jonas Ådahl2cbf2932015-07-22 12:05:38 +0800442struct weston_pointer_client {
443 struct wl_list link;
444 struct wl_client *client;
445 struct wl_list pointer_resources;
Jonas Ådahl30d61d82014-10-22 21:21:17 +0200446 struct wl_list relative_pointer_resources;
Jonas Ådahl2cbf2932015-07-22 12:05:38 +0800447};
448
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400449struct weston_pointer {
Kristian Høgsberge3148752013-05-06 23:19:49 -0400450 struct weston_seat *seat;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400451
Jonas Ådahl2cbf2932015-07-22 12:05:38 +0800452 struct wl_list pointer_clients;
453
Jason Ekstranda7af7042013-10-12 22:38:11 -0500454 struct weston_view *focus;
Jonas Ådahl2cbf2932015-07-22 12:05:38 +0800455 struct weston_pointer_client *focus_client;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400456 uint32_t focus_serial;
Giulio Camuffo576fe2a2013-11-20 18:00:24 +0100457 struct wl_listener focus_view_listener;
458 struct wl_listener focus_resource_listener;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400459 struct wl_signal focus_signal;
Giulio Camuffo6fcb3782013-11-14 23:42:50 +0100460 struct wl_signal motion_signal;
Jonas Ådahl3eb4ddd2016-07-22 17:52:58 +0800461 struct wl_signal destroy_signal;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400462
Jason Ekstranda7af7042013-10-12 22:38:11 -0500463 struct weston_view *sprite;
Kristian Høgsberg195b8692013-05-08 15:02:05 -0400464 struct wl_listener sprite_destroy_listener;
465 int32_t hotspot_x, hotspot_y;
466
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400467 struct weston_pointer_grab *grab;
468 struct weston_pointer_grab default_grab;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400469 wl_fixed_t grab_x, grab_y;
470 uint32_t grab_button;
471 uint32_t grab_serial;
Alexandros Frantzis215bedc2017-11-16 18:20:55 +0200472 struct timespec grab_time;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400473
474 wl_fixed_t x, y;
Kristian Høgsbergdb1fccb2014-02-05 17:14:42 -0800475 wl_fixed_t sx, sy;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400476 uint32_t button_count;
Ander Conselvan de Oliveiraf84327a2014-01-29 18:47:51 +0200477
478 struct wl_listener output_destroy_listener;
Alexandros Frantzisdb907b72018-02-20 14:06:26 +0200479
480 struct wl_list timestamps_list;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400481};
482
Louis-Francis Ratté-Boulianne6ef59c92017-11-28 20:42:47 -0500483/** libinput style calibration matrix
484 *
485 * See https://wayland.freedesktop.org/libinput/doc/latest/absolute_axes.html
486 * and libinput_device_config_calibration_set_matrix().
487 */
488struct weston_touch_device_matrix {
489 float m[6];
490};
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400491
Louis-Francis Ratté-Boulianne6ef59c92017-11-28 20:42:47 -0500492struct weston_touch_device;
493
494/** Operations for a calibratable touchscreen */
495struct weston_touch_device_ops {
496 /** Get the associated output if existing. */
497 struct weston_output *(*get_output)(struct weston_touch_device *device);
498
499 /** Get the name of the associated head if existing. */
500 const char *
501 (*get_calibration_head_name)(struct weston_touch_device *device);
502
503 /** Retrieve the current calibration matrix. */
504 void (*get_calibration)(struct weston_touch_device *device,
505 struct weston_touch_device_matrix *cal);
506
507 /** Set a new calibration matrix. */
508 void (*set_calibration)(struct weston_touch_device *device,
509 const struct weston_touch_device_matrix *cal);
510};
511
Louis-Francis Ratté-Bouliannec4689ff2017-11-28 20:42:47 -0500512enum weston_touch_mode {
513 /** Normal touch event handling */
514 WESTON_TOUCH_MODE_NORMAL,
515
516 /** Prepare moving to WESTON_TOUCH_MODE_CALIB.
517 *
518 * Move to WESTON_TOUCH_MODE_CALIB as soon as no touches are down on
519 * any seat. Until then, all touch events are routed normally.
520 */
521 WESTON_TOUCH_MODE_PREP_CALIB,
522
523 /** Calibration mode
524 *
525 * Only a single weston_touch_device forwards events to the calibrator
526 * all other touch device cause a calibrator "wrong device" event to
527 * be sent.
528 */
529 WESTON_TOUCH_MODE_CALIB,
530
531 /** Prepare moving to WESTON_TOUCH_MODE_NORMAL.
532 *
533 * Move to WESTON_TOUCH_MODE_NORMAL as soon as no touches are down on
534 * any seat. Until then, touch events are routed as in
535 * WESTON_TOUCH_MODE_CALIB except "wrong device" events are not sent.
536 */
537 WESTON_TOUCH_MODE_PREP_NORMAL
538};
539
Louis-Francis Ratté-Boulianne6ef59c92017-11-28 20:42:47 -0500540/** Represents a physical touchscreen input device */
541struct weston_touch_device {
542 char *syspath; /**< unique name */
543
544 struct weston_touch *aggregate; /**< weston_touch this is part of */
545 struct wl_list link; /**< in weston_touch::device_list */
546 struct wl_signal destroy_signal; /**< destroy notifier */
547
548 void *backend_data; /**< backend-specific private */
549
550 const struct weston_touch_device_ops *ops;
Louis-Francis Ratté-Boulianne83630982017-11-28 20:42:47 -0500551 struct weston_touch_device_matrix saved_calibration;
Louis-Francis Ratté-Boulianne6ef59c92017-11-28 20:42:47 -0500552};
553
554/** Represents a set of touchscreen devices aggregated under a seat */
Kristian Høgsberge329f362013-05-06 22:19:57 -0400555struct weston_touch {
Kristian Høgsberge3148752013-05-06 23:19:49 -0400556 struct weston_seat *seat;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400557
Louis-Francis Ratté-Boulianne6ef59c92017-11-28 20:42:47 -0500558 struct wl_list device_list; /* struct weston_touch_device::link */
559
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400560 struct wl_list resource_list;
Neil Roberts96d790e2013-09-19 17:32:00 +0100561 struct wl_list focus_resource_list;
Jason Ekstranda7af7042013-10-12 22:38:11 -0500562 struct weston_view *focus;
Giulio Camuffo576fe2a2013-11-20 18:00:24 +0100563 struct wl_listener focus_view_listener;
564 struct wl_listener focus_resource_listener;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400565 uint32_t focus_serial;
566 struct wl_signal focus_signal;
567
Jonas Ådahl9484b692013-12-02 22:05:03 +0100568 uint32_t num_tp;
569
Kristian Høgsberge329f362013-05-06 22:19:57 -0400570 struct weston_touch_grab *grab;
571 struct weston_touch_grab default_grab;
Neil Roberts306fe082013-10-03 16:43:06 +0100572 int grab_touch_id;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400573 wl_fixed_t grab_x, grab_y;
574 uint32_t grab_serial;
Alexandros Frantzis9448deb2017-11-16 18:20:58 +0200575 struct timespec grab_time;
Alexandros Frantzisd7157842018-02-20 14:07:03 +0200576
577 struct wl_list timestamps_list;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400578};
579
Jonas Ådahld2510102014-10-05 21:39:14 +0200580void
581weston_pointer_motion_to_abs(struct weston_pointer *pointer,
582 struct weston_pointer_motion_event *event,
583 wl_fixed_t *x, wl_fixed_t *y);
584
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400585void
Alexandros Frantzis84b31f82017-11-24 18:01:46 +0200586weston_pointer_send_motion(struct weston_pointer *pointer,
587 const struct timespec *time,
Quentin Glidiccde13452016-08-12 10:41:32 +0200588 struct weston_pointer_motion_event *event);
589bool
590weston_pointer_has_focus_resource(struct weston_pointer *pointer);
591void
592weston_pointer_send_button(struct weston_pointer *pointer,
Alexandros Frantzis215bedc2017-11-16 18:20:55 +0200593 const struct timespec *time,
594 uint32_t button, uint32_t state_w);
Quentin Glidiccde13452016-08-12 10:41:32 +0200595void
Jonas Ådahl0336ca02014-10-04 16:28:29 +0200596weston_pointer_send_axis(struct weston_pointer *pointer,
Alexandros Frantzis80321942017-11-16 18:20:56 +0200597 const struct timespec *time,
Peter Hutterer89b6a492016-01-18 15:58:17 +1000598 struct weston_pointer_axis_event *event);
Jonas Ådahl0336ca02014-10-04 16:28:29 +0200599void
Peter Hutterer87743e92016-01-18 16:38:22 +1000600weston_pointer_send_axis_source(struct weston_pointer *pointer,
601 uint32_t source);
602void
603weston_pointer_send_frame(struct weston_pointer *pointer);
604
605void
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400606weston_pointer_set_focus(struct weston_pointer *pointer,
Jason Ekstranda7af7042013-10-12 22:38:11 -0500607 struct weston_view *view,
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400608 wl_fixed_t sx, wl_fixed_t sy);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400609void
Derek Foremanf9318d12015-05-11 15:40:11 -0500610weston_pointer_clear_focus(struct weston_pointer *pointer);
611void
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400612weston_pointer_start_grab(struct weston_pointer *pointer,
613 struct weston_pointer_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400614void
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400615weston_pointer_end_grab(struct weston_pointer *pointer);
Rob Bradford806d8c02013-06-25 18:56:41 +0100616void
617weston_pointer_clamp(struct weston_pointer *pointer,
618 wl_fixed_t *fx, wl_fixed_t *fy);
Giulio Camuffo1959ab82013-11-14 23:42:52 +0100619void
620weston_pointer_move(struct weston_pointer *pointer,
Jonas Ådahld2510102014-10-05 21:39:14 +0200621 struct weston_pointer_motion_event *event);
Giulio Camuffocdb4d292013-11-14 23:42:53 +0100622void
623weston_pointer_set_default_grab(struct weston_pointer *pointer,
624 const struct weston_pointer_grab_interface *interface);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400625
Jonas Ådahld3414f22016-07-22 17:56:31 +0800626void
627weston_pointer_constraint_destroy(struct weston_pointer_constraint *constraint);
628
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400629void
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400630weston_keyboard_set_focus(struct weston_keyboard *keyboard,
Kristian Høgsbergfe7aa902013-05-08 09:54:37 -0400631 struct weston_surface *surface);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400632void
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400633weston_keyboard_start_grab(struct weston_keyboard *device,
634 struct weston_keyboard_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400635void
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400636weston_keyboard_end_grab(struct weston_keyboard *keyboard);
Giulio Camuffo6ef444d2014-08-28 19:44:09 +0300637int
638/*
639 * 'mask' and 'value' should be a bitwise mask of one or more
640 * valued of the weston_keyboard_locks enum.
641 */
642weston_keyboard_set_locks(struct weston_keyboard *keyboard,
643 uint32_t mask, uint32_t value);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400644
Quentin Glidiccde13452016-08-12 10:41:32 +0200645bool
646weston_keyboard_has_focus_resource(struct weston_keyboard *keyboard);
647void
648weston_keyboard_send_key(struct weston_keyboard *keyboard,
Alexandros Frantzis47e79c82017-11-16 18:20:57 +0200649 const struct timespec *time, uint32_t key,
Quentin Glidiccde13452016-08-12 10:41:32 +0200650 enum wl_keyboard_key_state state);
651void
652weston_keyboard_send_modifiers(struct weston_keyboard *keyboard,
653 uint32_t serial, uint32_t mods_depressed,
654 uint32_t mods_latched,
655 uint32_t mods_locked, uint32_t group);
656
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400657void
Derek Foreman4c93c082015-04-30 16:45:41 -0500658weston_touch_set_focus(struct weston_touch *touch,
Jason Ekstranda7af7042013-10-12 22:38:11 -0500659 struct weston_view *view);
Michael Fua2bb7912013-07-23 15:51:06 +0800660void
Louis-Francis Ratté-Boulianne8549e162017-11-28 20:42:47 -0500661weston_touch_start_grab(struct weston_touch *touch,
Kristian Høgsberge329f362013-05-06 22:19:57 -0400662 struct weston_touch_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400663void
Kristian Høgsberge329f362013-05-06 22:19:57 -0400664weston_touch_end_grab(struct weston_touch *touch);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400665
Quentin Glidiccde13452016-08-12 10:41:32 +0200666bool
667weston_touch_has_focus_resource(struct weston_touch *touch);
668void
Alexandros Frantzis9448deb2017-11-16 18:20:58 +0200669weston_touch_send_down(struct weston_touch *touch, const struct timespec *time,
Quentin Glidiccde13452016-08-12 10:41:32 +0200670 int touch_id, wl_fixed_t x, wl_fixed_t y);
671void
Alexandros Frantzis27a51b82017-11-16 18:20:59 +0200672weston_touch_send_up(struct weston_touch *touch, const struct timespec *time,
673 int touch_id);
Quentin Glidiccde13452016-08-12 10:41:32 +0200674void
Alexandros Frantzis7d2abcf2017-11-16 18:21:00 +0200675weston_touch_send_motion(struct weston_touch *touch,
676 const struct timespec *time, int touch_id,
677 wl_fixed_t x, wl_fixed_t y);
Quentin Glidiccde13452016-08-12 10:41:32 +0200678void
679weston_touch_send_frame(struct weston_touch *touch);
680
Louis-Francis Ratté-Boulianne6ef59c92017-11-28 20:42:47 -0500681struct weston_touch_device *
682weston_touch_create_touch_device(struct weston_touch *touch,
683 const char *syspath,
684 void *backend_data,
685 const struct weston_touch_device_ops *ops);
686
687void
688weston_touch_device_destroy(struct weston_touch_device *device);
689
690bool
691weston_touch_device_can_calibrate(struct weston_touch_device *device);
692
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400693void
Kristian Høgsberge3148752013-05-06 23:19:49 -0400694wl_data_device_set_keyboard_focus(struct weston_seat *seat);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400695
696int
697wl_data_device_manager_init(struct wl_display *display);
698
699
700void
Kristian Høgsberge3148752013-05-06 23:19:49 -0400701weston_seat_set_selection(struct weston_seat *seat,
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700702 struct weston_data_source *source, uint32_t serial);
Giulio Camuffodddf9e62015-05-01 12:59:35 +0300703void
704weston_seat_send_selection(struct weston_seat *seat, struct wl_client *client);
705
Kristian Høgsberg85de9c22013-09-04 20:44:26 -0700706int
Xiong Zhangfd51e7b2013-11-25 18:42:49 +0800707weston_pointer_start_drag(struct weston_pointer *pointer,
Kristian Høgsberg85de9c22013-09-04 20:44:26 -0700708 struct weston_data_source *source,
709 struct weston_surface *icon,
710 struct wl_client *client);
Xiong Zhangfd51e7b2013-11-25 18:42:49 +0800711int
712weston_touch_start_drag(struct weston_touch *touch,
713 struct weston_data_source *source,
714 struct weston_surface *icon,
715 struct wl_client *client);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400716
Daniel Stoned65b9092012-05-30 16:32:05 +0100717struct weston_xkb_info {
718 struct xkb_keymap *keymap;
Daniel Stoneb7452fe2012-06-01 12:14:06 +0100719 size_t keymap_size;
Derek Foreman76829fc2017-06-28 12:17:46 -0500720 char *keymap_string;
Andrew Wedgbury9a6f02a2013-09-05 13:31:40 +0000721 int32_t ref_count;
Daniel Stoneabb9dcd2012-06-22 13:21:33 +0100722 xkb_mod_index_t shift_mod;
723 xkb_mod_index_t caps_mod;
Daniel Stoned65b9092012-05-30 16:32:05 +0100724 xkb_mod_index_t ctrl_mod;
725 xkb_mod_index_t alt_mod;
Daniel Stoneabb9dcd2012-06-22 13:21:33 +0100726 xkb_mod_index_t mod2_mod;
727 xkb_mod_index_t mod3_mod;
Daniel Stoned65b9092012-05-30 16:32:05 +0100728 xkb_mod_index_t super_mod;
Daniel Stoneabb9dcd2012-06-22 13:21:33 +0100729 xkb_mod_index_t mod5_mod;
Daniel Stoned65b9092012-05-30 16:32:05 +0100730 xkb_led_index_t num_led;
731 xkb_led_index_t caps_led;
732 xkb_led_index_t scroll_led;
733};
734
Jan Arne Petersena75a7892013-01-16 21:26:50 +0100735struct weston_keyboard {
Kristian Høgsberge3148752013-05-06 23:19:49 -0400736 struct weston_seat *seat;
Jan Arne Petersena75a7892013-01-16 21:26:50 +0100737
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400738 struct wl_list resource_list;
Neil Roberts96d790e2013-09-19 17:32:00 +0100739 struct wl_list focus_resource_list;
Kristian Høgsbergfe7aa902013-05-08 09:54:37 -0400740 struct weston_surface *focus;
Giulio Camuffo576fe2a2013-11-20 18:00:24 +0100741 struct wl_listener focus_resource_listener;
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400742 uint32_t focus_serial;
743 struct wl_signal focus_signal;
744
745 struct weston_keyboard_grab *grab;
746 struct weston_keyboard_grab default_grab;
747 uint32_t grab_key;
748 uint32_t grab_serial;
Alexandros Frantzis47e79c82017-11-16 18:20:57 +0200749 struct timespec grab_time;
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400750
751 struct wl_array keys;
752
753 struct {
754 uint32_t mods_depressed;
755 uint32_t mods_latched;
756 uint32_t mods_locked;
757 uint32_t group;
758 } modifiers;
759
760 struct weston_keyboard_grab input_method_grab;
Jan Arne Petersena75a7892013-01-16 21:26:50 +0100761 struct wl_resource *input_method_resource;
Jonas Ådahl7395ea02013-12-03 09:14:26 +0100762
763 struct weston_xkb_info *xkb_info;
764 struct {
765 struct xkb_state *state;
766 enum weston_led leds;
767 } xkb_state;
768 struct xkb_keymap *pending_keymap;
Alexandros Frantzis2b442482018-02-20 14:05:50 +0200769
770 struct wl_list timestamps_list;
Jan Arne Petersena75a7892013-01-16 21:26:50 +0100771};
772
Daniel Stone37816df2012-05-16 18:45:18 +0100773struct weston_seat {
Kristian Høgsberge3148752013-05-06 23:19:49 -0400774 struct wl_list base_resource_list;
775
Kristian Høgsbergaaadc772013-07-08 16:20:31 -0400776 struct wl_global *global;
Derek Foreman1281a362015-07-31 16:55:32 -0500777 struct weston_pointer *pointer_state;
778 struct weston_keyboard *keyboard_state;
779 struct weston_touch *touch_state;
Jonas Ådahld6e1c342013-10-17 23:04:05 +0200780 int pointer_device_count;
781 int keyboard_device_count;
782 int touch_device_count;
Kristian Høgsberge3148752013-05-06 23:19:49 -0400783
Rob Bradford66bd9f52013-06-25 18:56:42 +0100784 struct weston_output *output; /* constraint */
785
Giulio Camuffo5085a752013-03-25 21:42:45 +0100786 struct wl_signal destroy_signal;
Jason Ekstranda4ab5422014-04-02 19:53:45 -0500787 struct wl_signal updated_caps_signal;
Daniel Stone74419a22012-05-30 16:32:02 +0100788
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500789 struct weston_compositor *compositor;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500790 struct wl_list link;
Daniel Stone496ca172012-05-30 16:31:42 +0100791 enum weston_keyboard_modifier modifier_state;
Kristian Høgsbergfe7aa902013-05-08 09:54:37 -0400792 struct weston_surface *saved_kbd_focus;
Ander Conselvan de Oliveira71b1d0c2012-03-16 17:25:11 +0200793 struct wl_listener saved_kbd_focus_listener;
Kristian Høgsberg054c50a2013-05-08 15:27:47 -0400794 struct wl_list drag_resource_list;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500795
Kristian Høgsberge3148752013-05-06 23:19:49 -0400796 uint32_t selection_serial;
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700797 struct weston_data_source *selection_data_source;
Kristian Høgsberge3148752013-05-06 23:19:49 -0400798 struct wl_listener selection_data_source_listener;
799 struct wl_signal selection_signal;
800
Daniel Stone8c8164f2012-05-30 16:31:45 +0100801 void (*led_update)(struct weston_seat *ws, enum weston_led leds);
802
Jan Arne Petersene829adc2012-08-10 16:47:22 +0200803 struct input_method *input_method;
Rob Bradford9af5f9e2013-05-31 18:09:50 +0100804 char *seat_name;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500805};
806
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500807enum {
Bryce Harringtonc2be8572015-12-11 13:11:37 -0800808 WESTON_COMPOSITOR_ACTIVE, /* normal rendering and events */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500809 WESTON_COMPOSITOR_IDLE, /* shell->unlock called on activity */
Philipp Brüschweiler57edf7f2013-03-29 13:01:56 +0100810 WESTON_COMPOSITOR_OFFSCREEN, /* no rendering, no frame events */
Bryce Harrington873a3f82016-08-30 12:05:01 -0700811 WESTON_COMPOSITOR_SLEEPING /* same as offscreen, but also set dpms
812 * to off */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500813};
814
Giulio Camuffo412e6a52014-07-09 22:12:56 +0300815struct weston_layer_entry {
816 struct wl_list link;
817 struct weston_layer *layer;
818};
819
Quentin Glidic82681572016-12-17 13:40:51 +0100820/**
821 * Higher value means higher in the stack.
822 *
823 * These values are based on well-known concepts in a classic desktop
824 * environment. Third-party modules based on libweston are encouraged to use
825 * them to integrate better with other projects.
826 *
827 * A fully integrated environment can use any value, based on these or not,
828 * at their discretion.
829 */
830enum weston_layer_position {
831 /*
832 * Special value to make the layer invisible and still rendered.
833 * This is used by compositors wanting e.g. minimized surfaces to still
834 * receive frame callbacks.
835 */
836 WESTON_LAYER_POSITION_HIDDEN = 0x00000000,
837
838 /*
839 * There should always be a background layer with a surface covering
840 * the visible area.
841 *
842 * If the compositor handles the background itself, it should use
843 * BACKGROUND.
844 *
845 * If the compositor supports runtime-loadable modules to set the
846 * background, it should put a solid color surface at (BACKGROUND - 1)
847 * and modules must use BACKGROUND.
848 */
849 WESTON_LAYER_POSITION_BACKGROUND = 0x00000002,
850
851 /* For "desktop widgets" and applications like conky. */
852 WESTON_LAYER_POSITION_BOTTOM_UI = 0x30000000,
853
854 /* For regular applications, only one layer should have this value
855 * to ensure proper stacking control. */
856 WESTON_LAYER_POSITION_NORMAL = 0x50000000,
857
858 /* For desktop UI, like panels. */
859 WESTON_LAYER_POSITION_UI = 0x80000000,
860
861 /* For fullscreen applications that should cover UI. */
862 WESTON_LAYER_POSITION_FULLSCREEN = 0xb0000000,
863
864 /* For special UI like on-screen keyboard that fullscreen applications
865 * will need. */
866 WESTON_LAYER_POSITION_TOP_UI = 0xe0000000,
867
868 /* For the lock surface. */
869 WESTON_LAYER_POSITION_LOCK = 0xffff0000,
870
871 /* Values reserved for libweston internal usage */
872 WESTON_LAYER_POSITION_CURSOR = 0xfffffffe,
873 WESTON_LAYER_POSITION_FADE = 0xffffffff,
874};
875
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -0500876struct weston_layer {
Quentin Glidic82681572016-12-17 13:40:51 +0100877 struct weston_compositor *compositor;
878 struct wl_list link; /* weston_compositor::layer_list */
879 enum weston_layer_position position;
Giulio Camuffo95ec0f92014-07-09 22:12:57 +0300880 pixman_box32_t mask;
Quentin Glidic82681572016-12-17 13:40:51 +0100881 struct weston_layer_entry view_list;
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -0500882};
883
Kristian Høgsberg65a11e12012-08-03 11:30:18 -0400884struct weston_plane {
Xiong Zhang97116532013-10-23 13:58:31 +0800885 struct weston_compositor *compositor;
Pekka Paalanen502f5e02015-02-23 14:08:25 +0200886 pixman_region32_t damage; /**< in global coords */
Ander Conselvan de Oliveirae1bd5a02013-03-05 17:30:29 +0200887 pixman_region32_t clip;
Kristian Høgsberg65a11e12012-08-03 11:30:18 -0400888 int32_t x, y;
Ander Conselvan de Oliveira8ad19822013-03-05 17:30:27 +0200889 struct wl_list link;
Kristian Høgsberg65a11e12012-08-03 11:30:18 -0400890};
891
Kristian Høgsbergfa1be022012-09-05 22:49:55 -0400892struct weston_renderer {
John Kåre Alsakera95b2d62012-11-13 19:10:21 +0100893 int (*read_pixels)(struct weston_output *output,
894 pixman_format_code_t format, void *pixels,
895 uint32_t x, uint32_t y,
896 uint32_t width, uint32_t height);
Kristian Høgsbergfa1be022012-09-05 22:49:55 -0400897 void (*repaint_output)(struct weston_output *output,
898 pixman_region32_t *output_damage);
899 void (*flush_damage)(struct weston_surface *surface);
Jason Ekstrand6bd62942013-06-20 20:38:23 -0500900 void (*attach)(struct weston_surface *es, struct weston_buffer *buffer);
John Kåre Alsaker878f4492012-11-13 19:10:23 +0100901 void (*surface_set_color)(struct weston_surface *surface,
902 float red, float green,
903 float blue, float alpha);
Vasily Khoruzhick52cfd612013-01-08 19:09:01 +0300904 void (*destroy)(struct weston_compositor *ec);
Pekka Paalanenc647ed72015-02-09 13:16:57 +0200905
906
907 /** See weston_surface_get_content_size() */
908 void (*surface_get_content_size)(struct weston_surface *surface,
909 int *width, int *height);
910
911 /** See weston_surface_copy_content() */
912 int (*surface_copy_content)(struct weston_surface *surface,
913 void *target, size_t size,
914 int src_x, int src_y,
915 int width, int height);
Pekka Paalanen230f3b12014-09-29 14:18:40 -0400916
917 /** See weston_compositor_import_dmabuf() */
918 bool (*import_dmabuf)(struct weston_compositor *ec,
919 struct linux_dmabuf_buffer *buffer);
Varad Gautam0775cd12016-11-23 14:03:20 +0530920
Emil Velikovfbf165f2017-12-05 14:26:16 +0000921 /** On error sets num_formats to zero */
922 void (*query_dmabuf_formats)(struct weston_compositor *ec,
Varad Gautam0775cd12016-11-23 14:03:20 +0530923 int **formats, int *num_formats);
924
Emil Velikovfbf165f2017-12-05 14:26:16 +0000925 /** On error sets num_modifiers to zero */
926 void (*query_dmabuf_modifiers)(struct weston_compositor *ec,
Varad Gautam0775cd12016-11-23 14:03:20 +0530927 int format, uint64_t **modifiers,
928 int *num_modifiers);
Kristian Høgsbergfa1be022012-09-05 22:49:55 -0400929};
930
Pekka Paalanen7bb65102013-05-22 18:03:04 +0300931enum weston_capability {
932 /* backend/renderer supports arbitrary rotation */
933 WESTON_CAP_ROTATION_ANY = 0x0001,
Pekka Paalanen4fc5dd02013-05-22 18:03:05 +0300934
935 /* screencaptures need to be y-flipped */
936 WESTON_CAP_CAPTURE_YFLIP = 0x0002,
Jason Ekstrand9fc71512014-04-02 19:53:46 -0500937
Bryce Harringtona86c3ee2015-03-18 18:42:00 -0700938 /* backend/renderer has a separate cursor plane */
Jason Ekstrand9fc71512014-04-02 19:53:46 -0500939 WESTON_CAP_CURSOR_PLANE = 0x0004,
940
941 /* backend supports setting arbitrary resolutions */
942 WESTON_CAP_ARBITRARY_MODES = 0x0008,
Pekka Paalanen380adf52015-02-16 14:39:11 +0200943
944 /* renderer supports weston_view_set_mask() clipping */
945 WESTON_CAP_VIEW_CLIP_MASK = 0x0010,
Alexandros Frantzisacff29b2018-10-19 12:14:11 +0300946
947 /* renderer supports explicit synchronization */
948 WESTON_CAP_EXPLICIT_SYNC = 0x0020,
Pekka Paalanen7bb65102013-05-22 18:03:04 +0300949};
950
Giulio Camuffoe3c0d8a2015-10-17 19:24:13 +0300951/* Configuration struct for a backend.
952 *
953 * This struct carries the configuration for a backend, and it's
954 * passed to the backend's init entry point. The backend will
955 * likely want to subclass this in order to handle backend specific
956 * data.
Bryce Harrington20b66c32016-04-15 20:28:29 -0700957 *
Marius Vladae263412019-06-06 23:10:49 +0300958 * \rststar
959 * .. note:
Bryce Harrington20b66c32016-04-15 20:28:29 -0700960 *
Marius Vladae263412019-06-06 23:10:49 +0300961 * Alternate designs were proposed (Feb 2016) for using opaque structures[1]
962 * and for section+key/value getter/setters[2]. The rationale for selecting
963 * the transparent structure design is based on several assumptions[3] which
964 * may require re-evaluating the design choice if they fail to hold.
965 *
966 * 1. https://lists.freedesktop.org/archives/wayland-devel/2016-February/026989.html
967 * 2. https://lists.freedesktop.org/archives/wayland-devel/2016-February/026929.html
968 * 3. https://lists.freedesktop.org/archives/wayland-devel/2016-February/027228.html
969 *
970 * \endrststar
Giulio Camuffoe3c0d8a2015-10-17 19:24:13 +0300971 */
972struct weston_backend_config {
Bryce Harrington20b66c32016-04-15 20:28:29 -0700973 /** Major version for the backend-specific config struct
974 *
975 * This version must match exactly what the backend expects, otherwise
976 * the struct is incompatible.
977 */
978 uint32_t struct_version;
979
980 /** Minor version of the backend-specific config struct
981 *
982 * This must be set to sizeof(struct backend-specific config).
983 * If the value here is smaller than what the backend expects, the
984 * extra config members will assume their default values.
985 *
986 * A value greater than what the backend expects is incompatible.
987 */
988 size_t struct_size;
Giulio Camuffoe3c0d8a2015-10-17 19:24:13 +0300989};
990
Giulio Camuffo954f1832014-10-11 18:27:30 +0300991struct weston_backend {
Giulio Camuffoe3c0d8a2015-10-17 19:24:13 +0300992 void (*destroy)(struct weston_compositor *compositor);
Daniel Stoneb1f166d2017-03-01 11:34:10 +0000993
994 /** Begin a repaint sequence
995 *
996 * Provides the backend with explicit markers around repaint
997 * sequences, which may allow the backend to aggregate state
998 * application. This call will be bracketed by the repaint_flush (on
999 * success), or repaint_cancel (when any output in the grouping fails
1000 * repaint).
1001 *
1002 * Returns an opaque pointer, which the backend may use as private
1003 * data referring to the repaint cycle.
1004 */
1005 void * (*repaint_begin)(struct weston_compositor *compositor);
1006
1007 /** Cancel a repaint sequence
1008 *
1009 * Cancels a repaint sequence, when an error has occurred during
1010 * one output's repaint; see repaint_begin.
1011 *
1012 * @param repaint_data Data returned by repaint_begin
1013 */
1014 void (*repaint_cancel)(struct weston_compositor *compositor,
1015 void *repaint_data);
1016
1017 /** Conclude a repaint sequence
1018 *
1019 * Called on successful completion of a repaint sequence; see
1020 * repaint_begin.
1021 *
1022 * @param repaint_data Data returned by repaint_begin
1023 */
1024 void (*repaint_flush)(struct weston_compositor *compositor,
1025 void *repaint_data);
Pekka Paalanen992a8cb2017-08-16 10:39:17 +03001026
1027 /** Allocate a new output
1028 *
1029 * @param compositor The compositor.
1030 * @param name Name for the new output.
1031 *
1032 * Allocates a new output structure that embeds a weston_output,
1033 * initializes it, and returns the pointer to the weston_output
1034 * member.
1035 *
1036 * Must set weston_output members @c destroy, @c enable and @c disable.
1037 */
1038 struct weston_output *
1039 (*create_output)(struct weston_compositor *compositor,
1040 const char *name);
Robert Beckett8d23ab72019-06-13 16:55:44 +01001041
1042 /** Notify of device addition/removal
1043 *
1044 * @param compositor The compositor.
1045 * @param device The device that has changed.
1046 * @param added Where it was added (or removed)
1047 *
1048 * Called when a device has been added/removed from the session.
1049 * The backend can decide what to do based on whether it is a
1050 * device that it is controlling or not.
1051 */
1052 void (*device_changed)(struct weston_compositor *compositor,
1053 dev_t device, bool added);
Giulio Camuffo954f1832014-10-11 18:27:30 +03001054};
1055
Louis-Francis Ratté-Boulianne83630982017-11-28 20:42:47 -05001056/** Callback for saving calibration
1057 *
1058 * \param compositor The compositor.
1059 * \param device The physical touch device to save for.
1060 * \param calibration The new calibration from a client.
1061 * \return -1 on failure, 0 on success.
1062 *
1063 * Failure will prevent taking the new calibration into use.
1064 */
1065typedef int (*weston_touch_calibration_save_func)(
1066 struct weston_compositor *compositor,
1067 struct weston_touch_device *device,
1068 const struct weston_touch_device_matrix *calibration);
1069struct weston_touch_calibrator;
1070
Quentin Glidic955cec02016-08-12 10:41:35 +02001071struct weston_desktop_xwayland;
1072struct weston_desktop_xwayland_interface;
Pekka Paalanena5630ea2017-10-12 13:13:42 +02001073struct weston_debug_compositor;
Quentin Glidic955cec02016-08-12 10:41:35 +02001074
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001075struct weston_compositor {
Kristian Høgsberg02e79dc2012-04-12 09:55:26 -04001076 struct wl_signal destroy_signal;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001077
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001078 struct wl_display *wl_display;
Quentin Glidic955cec02016-08-12 10:41:35 +02001079 struct weston_desktop_xwayland *xwayland;
1080 const struct weston_desktop_xwayland_interface *xwayland_interface;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001081
Tiago Vignattifb2adba2013-06-12 15:43:21 -03001082 /* surface signals */
Kristian Høgsbergf03a04a2014-04-06 22:04:50 -07001083 struct wl_signal create_surface_signal;
Kristian Høgsberg02e79dc2012-04-12 09:55:26 -04001084 struct wl_signal activate_signal;
Tiago Vignattifb2adba2013-06-12 15:43:21 -03001085 struct wl_signal transform_signal;
1086
Tiago Vignatti1d01b012012-09-27 17:48:36 +03001087 struct wl_signal kill_signal;
Ander Conselvan de Oliveiraa4575632013-02-21 18:35:23 +02001088 struct wl_signal idle_signal;
1089 struct wl_signal wake_signal;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001090
Jan Arne Petersen42feced2012-06-21 21:52:17 +02001091 struct wl_signal show_input_panel_signal;
1092 struct wl_signal hide_input_panel_signal;
Jan Arne Petersen14da96b2013-04-18 16:47:28 +02001093 struct wl_signal update_input_panel_signal;
Jan Arne Petersen42feced2012-06-21 21:52:17 +02001094
Jan Arne Petersen674fd1d2012-11-18 19:06:42 +01001095 struct wl_signal seat_created_signal;
Richard Hughes59d5da72013-05-01 21:52:11 +01001096 struct wl_signal output_created_signal;
Ander Conselvan de Oliveiraf84327a2014-01-29 18:47:51 +02001097 struct wl_signal output_destroyed_signal;
Ander Conselvan de Oliveiraa8a9baf2014-01-29 18:47:52 +02001098 struct wl_signal output_moved_signal;
David Fort0de859e2016-05-27 23:22:57 +02001099 struct wl_signal output_resized_signal; /* callback argument: resized output */
Jan Arne Petersen674fd1d2012-11-18 19:06:42 +01001100
Pekka Paalanen8dc6db82018-03-20 13:29:40 +02001101 /* Signal for output changes triggered by configuration from frontend
1102 * or head state changes from backend.
1103 */
1104 struct wl_signal output_heads_changed_signal; /* arg: weston_output */
1105
Kristian Høgsberg61741a22013-09-17 16:02:57 -07001106 struct wl_signal session_signal;
1107 int session_active;
1108
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -05001109 struct weston_layer fade_layer;
1110 struct weston_layer cursor_layer;
1111
Armin Krezovića01ab6d2016-09-30 14:11:02 +02001112 struct wl_list pending_output_list;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001113 struct wl_list output_list;
Pekka Paalanen1adcbac2017-08-14 16:05:35 +03001114 struct wl_list head_list; /* struct weston_head::compositor_link */
Daniel Stone37816df2012-05-16 18:45:18 +01001115 struct wl_list seat_list;
Quentin Glidic82681572016-12-17 13:40:51 +01001116 struct wl_list layer_list; /* struct weston_layer::link */
Pekka Paalanen20c7e552016-03-30 14:08:24 +03001117 struct wl_list view_list; /* struct weston_view::link */
Ander Conselvan de Oliveira8ad19822013-03-05 17:30:27 +02001118 struct wl_list plane_list;
Daniel Stone325fc2d2012-05-30 16:31:58 +01001119 struct wl_list key_binding_list;
Daniel Stone96d47c02013-11-19 11:37:12 +01001120 struct wl_list modifier_binding_list;
Daniel Stone325fc2d2012-05-30 16:31:58 +01001121 struct wl_list button_binding_list;
Neil Robertsa28c6932013-10-03 16:43:04 +01001122 struct wl_list touch_binding_list;
Daniel Stone325fc2d2012-05-30 16:31:58 +01001123 struct wl_list axis_binding_list;
Ander Conselvan de Oliveirac509d2b2012-11-08 17:20:45 +02001124 struct wl_list debug_binding_list;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001125
1126 uint32_t state;
1127 struct wl_event_source *idle_source;
1128 uint32_t idle_inhibit;
Philipp Brüschweiler4b409c32013-03-10 14:37:04 +01001129 int idle_time; /* timeout, s */
Daniel Stone6847b852017-03-01 11:34:08 +00001130 struct wl_event_source *repaint_timer;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001131
Giulio Camuffocdb4d292013-11-14 23:42:53 +01001132 const struct weston_pointer_grab_interface *default_pointer_grab;
1133
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001134 /* Repaint state. */
Kristian Høgsberg65a11e12012-08-03 11:30:18 -04001135 struct weston_plane primary_plane;
Pekka Paalanen7bb65102013-05-22 18:03:04 +03001136 uint32_t capabilities; /* combination of enum weston_capability */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001137
Kristian Høgsbergfa1be022012-09-05 22:49:55 -04001138 struct weston_renderer *renderer;
1139
John Kåre Alsakerf9e710b2012-11-13 19:10:22 +01001140 pixman_format_code_t read_format;
Pekka Paalanen52bfbaa2012-04-11 16:19:37 +03001141
Giulio Camuffo954f1832014-10-11 18:27:30 +03001142 struct weston_backend *backend;
Kristian Høgsberg3466bc82012-01-03 11:29:15 -05001143
Kristian Høgsberg05ad1e42013-09-17 14:41:03 -07001144 struct weston_launcher *launcher;
Casey Dahlin58ba1372012-04-19 22:50:08 -04001145
Pekka Paalanen827b5d22016-06-29 11:54:26 +02001146 struct wl_list plugin_api_list; /* struct weston_plugin_api::link */
1147
Casey Dahlin58ba1372012-04-19 22:50:08 -04001148 uint32_t output_id_pool;
Daniel Stone855028f2012-05-01 20:37:10 +01001149
Daniel Stonee379da92012-05-30 16:32:04 +01001150 struct xkb_rule_names xkb_names;
1151 struct xkb_context *xkb_context;
Andrew Wedgbury9a6f02a2013-09-05 13:31:40 +00001152 struct weston_xkb_info *xkb_info;
Matt Roper01a92732013-06-24 16:52:44 +01001153
Jonny Lamb66a41a02014-08-12 14:58:25 +02001154 int32_t kb_repeat_rate;
1155 int32_t kb_repeat_delay;
Pekka Paalanenb5eedad2014-09-23 22:08:45 -04001156
Bob Ham91880f12016-01-12 10:21:47 +00001157 bool vt_switching;
1158
Pekka Paalanenb5eedad2014-09-23 22:08:45 -04001159 clockid_t presentation_clock;
Pekka Paalanen0513a952014-05-21 16:17:27 +03001160 int32_t repaint_msec;
Frederic Plourdec336f062014-10-29 14:44:33 -04001161
Jonas Ådahl94e2e2d2014-10-18 18:42:19 +02001162 unsigned int activate_serial;
1163
Jonas Ådahld3414f22016-07-22 17:56:31 +08001164 struct wl_global *pointer_constraints;
1165
Frederic Plourdec336f062014-10-29 14:44:33 -04001166 int exit_code;
Giulio Camuffo459137b2014-10-11 23:56:24 +03001167
1168 void *user_data;
1169 void (*exit)(struct weston_compositor *c);
Daniel Díaz75b71972016-10-21 14:03:13 -05001170
1171 /* Whether to let the compositor run without any input device. */
1172 bool require_input;
1173
Pekka Paalanen8dc6db82018-03-20 13:29:40 +02001174 /* Signal for a backend to inform a frontend about possible changes
1175 * in head status.
1176 */
Pekka Paalanen37e6c9e2017-08-15 13:00:02 +03001177 struct wl_signal heads_changed_signal;
1178 struct wl_event_source *heads_changed_source;
Louis-Francis Ratté-Bouliannec4689ff2017-11-28 20:42:47 -05001179
Louis-Francis Ratté-Boulianne83630982017-11-28 20:42:47 -05001180 /* Touchscreen calibrator support: */
Louis-Francis Ratté-Bouliannec4689ff2017-11-28 20:42:47 -05001181 enum weston_touch_mode touch_mode;
Louis-Francis Ratté-Boulianne83630982017-11-28 20:42:47 -05001182 struct wl_global *touch_calibration;
1183 weston_touch_calibration_save_func touch_calibration_save;
1184 struct weston_layer calibrator_layer;
1185 struct weston_touch_calibrator *touch_calibrator;
Pekka Paalanena5630ea2017-10-12 13:13:42 +02001186
Marius Vlad3d7d9782019-04-17 12:35:38 +03001187 struct weston_log_context *weston_log_ctx;
Marius Vlad5d5e3352019-04-17 13:05:38 +03001188 struct weston_log_scope *debug_scene;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001189};
1190
Jason Ekstrand6bd62942013-06-20 20:38:23 -05001191struct weston_buffer {
1192 struct wl_resource *resource;
1193 struct wl_signal destroy_signal;
1194 struct wl_listener destroy_listener;
1195
1196 union {
1197 struct wl_shm_buffer *shm_buffer;
Jason Ekstranda85118c2013-06-27 20:17:02 -05001198 void *legacy_buffer;
Jason Ekstrand6bd62942013-06-20 20:38:23 -05001199 };
1200 int32_t width, height;
1201 uint32_t busy_count;
Stanislav Vorobiovbfbb8e52013-08-29 11:36:44 +04001202 int y_inverted;
Jason Ekstrand6bd62942013-06-20 20:38:23 -05001203};
1204
Pekka Paalanende685b82012-12-04 15:58:12 +02001205struct weston_buffer_reference {
Jason Ekstrand6bd62942013-06-20 20:38:23 -05001206 struct weston_buffer *buffer;
Pekka Paalanende685b82012-12-04 15:58:12 +02001207 struct wl_listener destroy_listener;
1208};
1209
Pekka Paalanen1fd9c0f2013-11-26 18:19:41 +01001210struct weston_buffer_viewport {
Pekka Paalanen952b6c82014-03-14 14:38:15 +02001211 struct {
1212 /* wl_surface.set_buffer_transform */
1213 uint32_t transform;
Pekka Paalanen1fd9c0f2013-11-26 18:19:41 +01001214
Pekka Paalanen952b6c82014-03-14 14:38:15 +02001215 /* wl_surface.set_scaling_factor */
1216 int32_t scale;
Jonny Lamb74130762013-11-26 18:19:46 +01001217
Pekka Paalanenf0cad482014-03-14 14:38:16 +02001218 /*
1219 * If src_width != wl_fixed_from_int(-1),
1220 * then and only then src_* are used.
1221 */
Pekka Paalanen952b6c82014-03-14 14:38:15 +02001222 wl_fixed_t src_x, src_y;
1223 wl_fixed_t src_width, src_height;
1224 } buffer;
1225
1226 struct {
Pekka Paalanenf0cad482014-03-14 14:38:16 +02001227 /*
1228 * If width == -1, the size is inferred from the buffer.
1229 */
Pekka Paalanen952b6c82014-03-14 14:38:15 +02001230 int32_t width, height;
1231 } surface;
George Kiagiadakis8f9e87f2014-06-13 18:14:20 +02001232
1233 int changed;
Pekka Paalanen1fd9c0f2013-11-26 18:19:41 +01001234};
1235
Alexandros Frantzis67629672018-10-19 12:14:11 +03001236struct weston_buffer_release {
1237 /* The associated zwp_linux_buffer_release_v1 resource. */
1238 struct wl_resource *resource;
1239 /* How many weston_buffer_release_reference objects point to this
1240 * object. */
1241 uint32_t ref_count;
1242 /* The fence fd, if any, associated with this release. If the fence fd
1243 * is -1 then this is considered an immediate release. */
1244 int fence_fd;
1245};
1246
1247struct weston_buffer_release_reference {
1248 struct weston_buffer_release *buffer_release;
1249 /* Listener for the destruction of the wl_resource associated with the
1250 * referenced buffer_release object. */
1251 struct wl_listener destroy_listener;
1252};
1253
Kristian Høgsberg5e7e6f22012-02-23 16:11:59 -05001254struct weston_region {
Jason Ekstrand8895efc2013-06-14 10:07:56 -05001255 struct wl_resource *resource;
Kristian Høgsberg5e7e6f22012-02-23 16:11:59 -05001256 pixman_region32_t region;
1257};
1258
Jason Ekstranda7af7042013-10-12 22:38:11 -05001259/* Using weston_view transformations
Pekka Paalanen44ab69c2012-02-07 13:18:00 +02001260 *
Jason Ekstranda7af7042013-10-12 22:38:11 -05001261 * To add a transformation to a view, create a struct weston_transform, and
1262 * add it to the list view->geometry.transformation_list. Whenever you
1263 * change the list, anything under view->geometry, or anything in the
Pekka Paalanenc3ce7382013-03-08 14:56:49 +02001264 * weston_transforms linked into the list, you must call
Jason Ekstranda7af7042013-10-12 22:38:11 -05001265 * weston_view_geometry_dirty().
Pekka Paalanen44ab69c2012-02-07 13:18:00 +02001266 *
1267 * The order in the list defines the order of transformations. Let the list
1268 * contain the transformation matrices M1, ..., Mn as head to tail. The
Jason Ekstranda7af7042013-10-12 22:38:11 -05001269 * transformation is applied to view-local coordinate vector p as
Pekka Paalanen44ab69c2012-02-07 13:18:00 +02001270 * P = Mn * ... * M2 * M1 * p
1271 * to produce the global coordinate vector P. The total transform
1272 * Mn * ... * M2 * M1
Jason Ekstranda7af7042013-10-12 22:38:11 -05001273 * is cached in view->transform.matrix, and the inverse of it in
1274 * view->transform.inverse.
Pekka Paalanen44ab69c2012-02-07 13:18:00 +02001275 *
Jason Ekstranda7af7042013-10-12 22:38:11 -05001276 * The list always contains view->transform.position transformation, which
1277 * is the translation by view->geometry.x and y.
Pekka Paalanen44ab69c2012-02-07 13:18:00 +02001278 *
1279 * If you want to apply a transformation in local coordinates, add your
1280 * weston_transform to the head of the list. If you want to apply a
1281 * transformation in global coordinates, add it to the tail of the list.
Pekka Paalanen483243f2013-03-08 14:56:50 +02001282 *
Jason Ekstranda7af7042013-10-12 22:38:11 -05001283 * If view->geometry.parent is set, the total transformation of this
1284 * view will be the parent's total transformation and this transformation
Pekka Paalanen483243f2013-03-08 14:56:50 +02001285 * combined:
1286 * Mparent * Mn * ... * M2 * M1
Pekka Paalanen44ab69c2012-02-07 13:18:00 +02001287 */
1288
Jason Ekstranda7af7042013-10-12 22:38:11 -05001289struct weston_view {
1290 struct weston_surface *surface;
1291 struct wl_list surface_link;
Jason Ekstrand26ed73c2013-06-06 22:34:41 -05001292 struct wl_signal destroy_signal;
Jason Ekstranda7af7042013-10-12 22:38:11 -05001293
Pekka Paalanen20c7e552016-03-30 14:08:24 +03001294 struct wl_list link; /* weston_compositor::view_list */
Pekka Paalanen8844bf22015-02-18 16:30:47 +02001295 struct weston_layer_entry layer_link; /* part of geometry */
Kristian Høgsberg65a11e12012-08-03 11:30:18 -04001296 struct weston_plane *plane;
Pekka Paalanen2d6e5512015-02-18 16:06:46 +02001297
1298 /* For weston_layer inheritance from another view */
Giulio Camuffo95ec0f92014-07-09 22:12:57 +03001299 struct weston_view *parent_view;
Jason Ekstranda7af7042013-10-12 22:38:11 -05001300
Jonas Ådahl94e2e2d2014-10-18 18:42:19 +02001301 unsigned int click_to_activate_serial;
1302
Pekka Paalanen51723d52015-02-17 13:10:01 +02001303 pixman_region32_t clip; /* See weston_view_damage_below() */
Jason Ekstranda7af7042013-10-12 22:38:11 -05001304 float alpha; /* part of geometry, see below */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001305
John Kåre Alsaker878f4492012-11-13 19:10:23 +01001306 void *renderer_state;
1307
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +02001308 /* Surface geometry state, mutable.
Pekka Paalanenc3ce7382013-03-08 14:56:49 +02001309 * If you change anything, call weston_surface_geometry_dirty().
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +02001310 * That includes the transformations referenced from the list.
1311 */
Pekka Paalanenc61eca62012-01-06 14:10:06 +02001312 struct {
John Kåre Alsaker490d02a2012-09-30 02:57:21 +02001313 float x, y; /* surface translation on display */
Pekka Paalanenba3cf952012-01-25 16:22:05 +02001314
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +02001315 /* struct weston_transform */
1316 struct wl_list transformation_list;
Pekka Paalanen483243f2013-03-08 14:56:50 +02001317
1318 /* managed by weston_surface_set_transform_parent() */
Jason Ekstranda7af7042013-10-12 22:38:11 -05001319 struct weston_view *parent;
Pekka Paalanen483243f2013-03-08 14:56:50 +02001320 struct wl_listener parent_destroy_listener;
1321 struct wl_list child_list; /* geometry.parent_link */
1322 struct wl_list parent_link;
Pekka Paalanen380adf52015-02-16 14:39:11 +02001323
1324 /* managed by weston_view_set_mask() */
1325 bool scissor_enabled;
1326 pixman_region32_t scissor; /* always a simple rect */
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +02001327 } geometry;
1328
1329 /* State derived from geometry state, read-only.
Jason Ekstranda7af7042013-10-12 22:38:11 -05001330 * This is updated by weston_view_update_transform().
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +02001331 */
1332 struct {
Pekka Paalanenc3ce7382013-03-08 14:56:49 +02001333 int dirty;
1334
Pekka Paalanenfbd00f12015-02-19 11:49:18 +02001335 /* Approximations in global coordinates:
1336 * - boundingbox is guaranteed to include the whole view in
1337 * the smallest possible single rectangle.
1338 * - opaque is guaranteed to be fully opaque, though not
1339 * necessarily include all opaque areas.
1340 */
Pekka Paalanen6720d8f2012-01-25 15:17:40 +02001341 pixman_region32_t boundingbox;
Pekka Paalanen730d87e2012-02-09 16:39:38 +02001342 pixman_region32_t opaque;
Pekka Paalanen6720d8f2012-01-25 15:17:40 +02001343
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +02001344 /* matrix and inverse are used only if enabled = 1.
1345 * If enabled = 0, use x, y, width, height directly.
1346 */
1347 int enabled;
Pekka Paalanen061b7472012-01-12 15:00:57 +02001348 struct weston_matrix matrix;
Pekka Paalanend1f0ab62012-01-20 10:47:57 +02001349 struct weston_matrix inverse;
Pekka Paalanencd403622012-01-25 13:37:39 +02001350
1351 struct weston_transform position; /* matrix from x, y */
Pekka Paalanenc61eca62012-01-06 14:10:06 +02001352 } transform;
1353
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001354 /*
Pekka Paalanen130ae6e2016-03-30 14:33:33 +03001355 * The primary output for this view.
1356 * Used for picking the output for driving internal animations on the
1357 * view, inheriting the primary output for related views in shells, etc.
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001358 */
1359 struct weston_output *output;
Semi Malinene7a52fb2018-04-26 11:08:10 +02001360 struct wl_listener output_destroy_listener;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001361
Casey Dahlin9074db52012-04-19 22:50:09 -04001362 /*
1363 * A more complete representation of all outputs this surface is
1364 * displayed on.
1365 */
1366 uint32_t output_mask;
Pekka Paalanenbf0e0312014-12-17 16:20:41 +02001367
1368 /* Per-surface Presentation feedback flags, controlled by backend. */
1369 uint32_t psf_flags;
Armin Krezovićf8486c32016-06-30 06:04:28 +02001370
1371 bool is_mapped;
Jason Ekstranda7af7042013-10-12 22:38:11 -05001372};
1373
Jason Ekstrand7b982072014-05-20 14:33:03 -05001374struct weston_surface_state {
1375 /* wl_surface.attach */
1376 int newly_attached;
1377 struct weston_buffer *buffer;
1378 struct wl_listener buffer_destroy_listener;
1379 int32_t sx;
1380 int32_t sy;
1381
1382 /* wl_surface.damage */
Derek Foreman152254b2015-11-26 14:17:48 -06001383 pixman_region32_t damage_surface;
1384 /* wl_surface.damage_buffer */
1385 pixman_region32_t damage_buffer;
Jason Ekstrand7b982072014-05-20 14:33:03 -05001386
1387 /* wl_surface.set_opaque_region */
1388 pixman_region32_t opaque;
1389
1390 /* wl_surface.set_input_region */
1391 pixman_region32_t input;
1392
1393 /* wl_surface.frame */
1394 struct wl_list frame_callback_list;
1395
Pekka Paalanen133e4392014-09-23 22:08:46 -04001396 /* presentation.feedback */
1397 struct wl_list feedback_list;
1398
Jason Ekstrand7b982072014-05-20 14:33:03 -05001399 /* wl_surface.set_buffer_transform */
1400 /* wl_surface.set_scaling_factor */
Pekka Paalanene95ad5c2016-04-15 14:47:08 +03001401 /* wp_viewport.set_source */
1402 /* wp_viewport.set_destination */
Jason Ekstrand7b982072014-05-20 14:33:03 -05001403 struct weston_buffer_viewport buffer_viewport;
Alexandros Frantzisacff29b2018-10-19 12:14:11 +03001404
1405 /* zwp_surface_synchronization_v1.set_acquire_fence */
1406 int acquire_fence_fd;
Alexandros Frantzis67629672018-10-19 12:14:11 +03001407
1408 /* zwp_surface_synchronization_v1.get_release */
1409 struct weston_buffer_release_reference buffer_release_ref;
Jason Ekstrand7b982072014-05-20 14:33:03 -05001410};
1411
Jonas Ådahlf7deb6a2016-07-22 17:50:26 +08001412struct weston_surface_activation_data {
1413 struct weston_surface *surface;
1414 struct weston_seat *seat;
1415};
1416
Jonas Ådahld3414f22016-07-22 17:56:31 +08001417struct weston_pointer_constraint {
1418 struct wl_list link;
1419
1420 struct weston_surface *surface;
1421 struct weston_view *view;
1422 struct wl_resource *resource;
1423 struct weston_pointer_grab grab;
1424 struct weston_pointer *pointer;
1425 uint32_t lifetime;
1426
1427 pixman_region32_t region;
1428 pixman_region32_t region_pending;
1429 bool region_is_pending;
1430
1431 wl_fixed_t hint_x;
1432 wl_fixed_t hint_y;
1433 wl_fixed_t hint_x_pending;
1434 wl_fixed_t hint_y_pending;
1435 bool hint_is_pending;
1436
1437 struct wl_listener pointer_destroy_listener;
1438 struct wl_listener surface_destroy_listener;
1439 struct wl_listener surface_commit_listener;
1440 struct wl_listener surface_activate_listener;
1441};
1442
Jason Ekstranda7af7042013-10-12 22:38:11 -05001443struct weston_surface {
1444 struct wl_resource *resource;
Pekka Paalanenca790762015-04-17 14:23:38 +03001445 struct wl_signal destroy_signal; /* callback argument: this surface */
Jason Ekstranda7af7042013-10-12 22:38:11 -05001446 struct weston_compositor *compositor;
Jonas Ådahl5d9ca272016-07-22 17:48:03 +08001447 struct wl_signal commit_signal;
Pekka Paalanene508ce62015-02-19 13:59:55 +02001448
1449 /** Damage in local coordinates from the client, for tex upload. */
Jason Ekstranda7af7042013-10-12 22:38:11 -05001450 pixman_region32_t damage;
Pekka Paalanene508ce62015-02-19 13:59:55 +02001451
Jason Ekstranda7af7042013-10-12 22:38:11 -05001452 pixman_region32_t opaque; /* part of geometry, see below */
1453 pixman_region32_t input;
1454 int32_t width, height;
1455 int32_t ref_count;
1456
1457 /* Not for long-term storage. This exists for book-keeping while
1458 * iterating over surfaces and views
1459 */
Derek Foreman060cf112015-11-18 16:32:26 -06001460 bool touched;
Jason Ekstranda7af7042013-10-12 22:38:11 -05001461
1462 void *renderer_state;
1463
1464 struct wl_list views;
1465
1466 /*
1467 * Which output to vsync this surface to.
Pekka Paalanen130ae6e2016-03-30 14:33:33 +03001468 * Used to determine whether to send or queue frame events, and for
1469 * other client-visible syncing/throttling tied to the output
1470 * repaint cycle.
Jason Ekstranda7af7042013-10-12 22:38:11 -05001471 */
1472 struct weston_output *output;
1473
1474 /*
1475 * A more complete representation of all outputs this surface is
1476 * displayed on.
1477 */
1478 uint32_t output_mask;
Casey Dahlin9074db52012-04-19 22:50:09 -04001479
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001480 struct wl_list frame_callback_list;
Pekka Paalanen133e4392014-09-23 22:08:46 -04001481 struct wl_list feedback_list;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001482
Pekka Paalanende685b82012-12-04 15:58:12 +02001483 struct weston_buffer_reference buffer_ref;
Pekka Paalanen1fd9c0f2013-11-26 18:19:41 +01001484 struct weston_buffer_viewport buffer_viewport;
Pekka Paalanen0b4c5352014-03-14 14:38:17 +02001485 int32_t width_from_buffer; /* before applying viewport */
1486 int32_t height_from_buffer;
Derek Foreman0fd6d4e2014-10-10 09:36:45 -05001487 bool keep_buffer; /* for backends to prevent early release */
Alex Wu8811bf92012-02-28 18:07:54 +08001488
Pekka Paalanene95ad5c2016-04-15 14:47:08 +03001489 /* wp_viewport resource for this surface */
Pekka Paalanenb0420ae2014-01-08 15:39:17 +02001490 struct wl_resource *viewport_resource;
Jonny Lamb74130762013-11-26 18:19:46 +01001491
Pekka Paalanen5df44de2012-10-10 12:49:23 +03001492 /* All the pending state, that wl_surface.commit will apply. */
Jason Ekstrand7b982072014-05-20 14:33:03 -05001493 struct weston_surface_state pending;
Pekka Paalanen5df44de2012-10-10 12:49:23 +03001494
Jason Ekstrand1e059042014-10-16 10:55:19 -05001495 /* Matrices representating of the full transformation between
1496 * buffer and surface coordinates. These matrices are updated
1497 * using the weston_surface_build_buffer_matrix function. */
1498 struct weston_matrix buffer_to_surface_matrix;
1499 struct weston_matrix surface_to_buffer_matrix;
1500
Ander Conselvan de Oliveira093bfa32012-03-27 17:36:41 +03001501 /*
Jasper St. Pierred67b52a2014-04-28 11:19:27 -04001502 * If non-NULL, this function will be called on
1503 * wl_surface::commit after a new buffer has been set up for
1504 * this surface. The integer params are the sx and sy
1505 * parameters supplied to wl_surface::attach.
Ander Conselvan de Oliveira093bfa32012-03-27 17:36:41 +03001506 */
Quentin Glidic2edc3d52016-08-12 10:41:33 +02001507 void (*committed)(struct weston_surface *es, int32_t sx, int32_t sy);
1508 void *committed_private;
Pekka Paalanen8274d902014-08-06 19:36:51 +03001509 int (*get_label)(struct weston_surface *surface, char *buf, size_t len);
Pekka Paalanene67858b2013-04-25 13:57:42 +03001510
1511 /* Parent's list of its sub-surfaces, weston_subsurface:parent_link.
1512 * Contains also the parent itself as a dummy weston_subsurface,
1513 * if the list is not empty.
1514 */
1515 struct wl_list subsurface_list; /* weston_subsurface::parent_link */
1516 struct wl_list subsurface_list_pending; /* ...::parent_link_pending */
Pekka Paalanen50b67472014-10-01 15:02:41 +03001517
1518 /*
1519 * For tracking protocol role assignments. Different roles may
1520 * have the same configure hook, e.g. in shell.c. Configure hook
1521 * may get reset, this will not.
1522 * XXX: map configure functions 1:1 to roles, and never reset it,
1523 * and replace role_name with configure.
1524 */
1525 const char *role_name;
Pekka Paalanenb5026542014-11-12 15:09:24 +02001526
1527 struct weston_timeline_object timeline;
Armin Krezovićf8486c32016-06-30 06:04:28 +02001528
1529 bool is_mapped;
Philipp Zabel195dade2018-09-03 19:44:59 +02001530 bool is_opaque;
Jonas Ådahld3414f22016-07-22 17:56:31 +08001531
1532 /* An list of per seat pointer constraints. */
1533 struct wl_list pointer_constraints;
Alexandros Frantzis27d7c392018-10-19 12:14:11 +03001534
1535 /* zwp_surface_synchronization_v1 resource for this surface */
1536 struct wl_resource *synchronization_resource;
Alexandros Frantzisacff29b2018-10-19 12:14:11 +03001537 int acquire_fence_fd;
Alexandros Frantzis67629672018-10-19 12:14:11 +03001538 struct weston_buffer_release_reference buffer_release_ref;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001539};
1540
Jason Ekstrande9d40e32014-05-20 11:23:53 -05001541struct weston_subsurface {
1542 struct wl_resource *resource;
1543
1544 /* guaranteed to be valid and non-NULL */
1545 struct weston_surface *surface;
1546 struct wl_listener surface_destroy_listener;
1547
1548 /* can be NULL */
1549 struct weston_surface *parent;
1550 struct wl_listener parent_destroy_listener;
1551 struct wl_list parent_link;
1552 struct wl_list parent_link_pending;
1553
1554 struct {
1555 int32_t x;
1556 int32_t y;
1557 int set;
1558 } position;
1559
Jason Ekstrand7b982072014-05-20 14:33:03 -05001560 int has_cached_data;
1561 struct weston_surface_state cached;
1562 struct weston_buffer_reference cached_buffer_ref;
Jason Ekstrande9d40e32014-05-20 11:23:53 -05001563
Emilio Pozuelo Monfort4f3cad72017-01-27 17:30:29 +01001564 /* Sub-surface has been reordered; need to apply damage. */
1565 bool reordered;
1566
Jason Ekstrande9d40e32014-05-20 11:23:53 -05001567 int synchronized;
1568
1569 /* Used for constructing the view tree */
1570 struct wl_list unused_views;
1571};
1572
Daniel Stoned6da09e2012-06-22 13:21:29 +01001573enum weston_key_state_update {
1574 STATE_UPDATE_AUTOMATIC,
1575 STATE_UPDATE_NONE,
1576};
1577
Jonas Ådahl4361b4e2014-10-18 18:20:16 +02001578enum weston_activate_flag {
1579 WESTON_ACTIVATE_FLAG_NONE = 0,
1580 WESTON_ACTIVATE_FLAG_CONFIGURE = 1 << 0,
Jonas Ådahl94e2e2d2014-10-18 18:42:19 +02001581 WESTON_ACTIVATE_FLAG_CLICKED = 1 << 1,
Jonas Ådahl4361b4e2014-10-18 18:20:16 +02001582};
1583
Kristian Høgsberg9ddb8262012-01-04 21:30:29 -05001584void
Kristian Høgsbergaf4f2aa2013-02-15 20:53:20 -05001585weston_version(int *major, int *minor, int *micro);
1586
1587void
Semi Malinene7a52fb2018-04-26 11:08:10 +02001588weston_view_set_output(struct weston_view *view, struct weston_output *output);
1589
1590void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001591weston_view_update_transform(struct weston_view *view);
Pekka Paalanen460099f2012-01-20 16:48:25 +02001592
1593void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001594weston_view_geometry_dirty(struct weston_view *view);
Pekka Paalanenc3ce7382013-03-08 14:56:49 +02001595
1596void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001597weston_view_to_global_fixed(struct weston_view *view,
1598 wl_fixed_t sx, wl_fixed_t sy,
1599 wl_fixed_t *x, wl_fixed_t *y);
Daniel Stonebd3489b2012-05-08 17:17:53 +01001600void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001601weston_view_to_global_float(struct weston_view *view,
1602 float sx, float sy, float *x, float *y);
Pekka Paalanene0f3cb22012-01-24 09:59:29 +02001603
1604void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001605weston_view_from_global_float(struct weston_view *view,
1606 float x, float y, float *vx, float *vy);
Kristian Høgsbergecf6ede2012-09-05 21:59:35 -04001607void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001608weston_view_from_global(struct weston_view *view,
1609 int32_t x, int32_t y, int32_t *vx, int32_t *vy);
Daniel Stonebd3489b2012-05-08 17:17:53 +01001610void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001611weston_view_from_global_fixed(struct weston_view *view,
1612 wl_fixed_t x, wl_fixed_t y,
1613 wl_fixed_t *vx, wl_fixed_t *vy);
Pekka Paalanene0f3cb22012-01-24 09:59:29 +02001614
Derek Foremand1be3122014-09-18 16:46:49 -05001615void
Ander Conselvan de Oliveira0396ba22012-11-28 17:10:26 +02001616weston_surface_to_buffer_float(struct weston_surface *surface,
1617 float x, float y, float *bx, float *by);
1618pixman_box32_t
1619weston_surface_to_buffer_rect(struct weston_surface *surface,
1620 pixman_box32_t rect);
1621
Pekka Paalanene0f3cb22012-01-24 09:59:29 +02001622void
Pekka Paalanene54e31c2015-03-04 14:23:28 +02001623weston_surface_to_buffer_region(struct weston_surface *surface,
1624 pixman_region32_t *surface_region,
1625 pixman_region32_t *buffer_region);
1626
1627void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001628weston_spring_init(struct weston_spring *spring,
1629 double k, double current, double target);
1630void
Alexandros Frantzis8250a612017-11-16 18:20:52 +02001631weston_spring_update(struct weston_spring *spring, const struct timespec *time);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001632int
1633weston_spring_done(struct weston_spring *spring);
1634
1635void
Jonas Ådahl94e2e2d2014-10-18 18:42:19 +02001636weston_view_activate(struct weston_view *view,
1637 struct weston_seat *seat,
1638 uint32_t flags);
1639
1640void
Alexandros Frantzis84b31f82017-11-24 18:01:46 +02001641notify_motion(struct weston_seat *seat, const struct timespec *time,
Jonas Ådahld2510102014-10-05 21:39:14 +02001642 struct weston_pointer_motion_event *event);
Rob Bradfordc088e2c2013-03-27 15:59:43 +00001643void
Alexandros Frantzis84b31f82017-11-24 18:01:46 +02001644notify_motion_absolute(struct weston_seat *seat, const struct timespec *time,
Giulio Camuffo90a6fc62016-03-22 17:44:54 +02001645 double x, double y);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001646void
Alexandros Frantzis215bedc2017-11-16 18:20:55 +02001647notify_button(struct weston_seat *seat, const struct timespec *time,
1648 int32_t button, enum wl_pointer_button_state state);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001649void
Alexandros Frantzis80321942017-11-16 18:20:56 +02001650notify_axis(struct weston_seat *seat, const struct timespec *time,
Peter Hutterer89b6a492016-01-18 15:58:17 +10001651 struct weston_pointer_axis_event *event);
Scott Moreau210d0792012-03-22 10:47:01 -06001652void
Peter Hutterer87743e92016-01-18 16:38:22 +10001653notify_axis_source(struct weston_seat *seat, uint32_t source);
1654
1655void
1656notify_pointer_frame(struct weston_seat *seat);
1657
1658void
Alexandros Frantzis47e79c82017-11-16 18:20:57 +02001659notify_key(struct weston_seat *seat, const struct timespec *time, uint32_t key,
Daniel Stone1b4e11f2012-06-22 13:21:37 +01001660 enum wl_keyboard_key_state state,
1661 enum weston_key_state_update update_state);
Daniel Stone05d58682012-06-22 13:21:38 +01001662void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001663notify_modifiers(struct weston_seat *seat, uint32_t serial);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001664
1665void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001666notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
Giulio Camuffo90a6fc62016-03-22 17:44:54 +02001667 double x, double y);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001668
1669void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001670notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
Daniel Stoned6da09e2012-06-22 13:21:29 +01001671 enum weston_key_state_update update_state);
1672void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001673notify_keyboard_focus_out(struct weston_seat *seat);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001674
1675void
Pekka Paalanenf4062532018-02-26 16:18:29 +02001676notify_touch_normalized(struct weston_touch_device *device,
1677 const struct timespec *time,
1678 int touch_id,
1679 double x, double y,
1680 const struct weston_point2d_device_normalized *norm,
1681 int touch_type);
1682
1683/** Feed in touch down, motion, and up events, non-calibratable device.
1684 *
1685 * @sa notify_touch_cal
1686 */
1687static inline void
Pekka Paalanenbcbce332018-02-26 14:43:00 +02001688notify_touch(struct weston_touch_device *device, const struct timespec *time,
Pekka Paalanenf4062532018-02-26 16:18:29 +02001689 int touch_id, double x, double y, int touch_type)
1690{
1691 notify_touch_normalized(device, time, touch_id, x, y, NULL, touch_type);
1692}
1693
Jonas Ådahl1679f232014-04-12 09:39:51 +02001694void
Pekka Paalanenbcbce332018-02-26 14:43:00 +02001695notify_touch_frame(struct weston_touch_device *device);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001696
1697void
Pekka Paalanenbcbce332018-02-26 14:43:00 +02001698notify_touch_cancel(struct weston_touch_device *device);
Derek Foreman3cc004a2015-11-06 15:56:09 -06001699
1700void
Louis-Francis Ratté-Bouliannec4689ff2017-11-28 20:42:47 -05001701weston_compositor_set_touch_mode_normal(struct weston_compositor *compositor);
1702
1703void
1704weston_compositor_set_touch_mode_calib(struct weston_compositor *compositor);
1705
Louis-Francis Ratté-Boulianne83630982017-11-28 20:42:47 -05001706void
1707touch_calibrator_mode_changed(struct weston_compositor *compositor);
1708
1709void
1710notify_touch_calibrator(struct weston_touch_device *device,
1711 const struct timespec *time, int32_t slot,
1712 const struct weston_point2d_device_normalized *norm,
1713 int touch_type);
1714
1715void
1716notify_touch_calibrator_frame(struct weston_touch_device *device);
1717
1718void
1719notify_touch_calibrator_cancel(struct weston_touch_device *device);
Louis-Francis Ratté-Bouliannec4689ff2017-11-28 20:42:47 -05001720
1721void
Giulio Camuffo412e6a52014-07-09 22:12:56 +03001722weston_layer_entry_insert(struct weston_layer_entry *list,
1723 struct weston_layer_entry *entry);
1724void
1725weston_layer_entry_remove(struct weston_layer_entry *entry);
1726void
Quentin Glidic82681572016-12-17 13:40:51 +01001727weston_layer_init(struct weston_layer *layer,
1728 struct weston_compositor *compositor);
1729void
1730weston_layer_set_position(struct weston_layer *layer,
1731 enum weston_layer_position position);
1732void
1733weston_layer_unset_position(struct weston_layer *layer);
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -05001734
1735void
Giulio Camuffo95ec0f92014-07-09 22:12:57 +03001736weston_layer_set_mask(struct weston_layer *layer, int x, int y, int width, int height);
1737
1738void
1739weston_layer_set_mask_infinite(struct weston_layer *layer);
1740
Daniel Stone3b775632018-07-20 08:38:25 +01001741bool
1742weston_layer_mask_is_infinite(struct weston_layer *layer);
1743
Giulio Camuffo95ec0f92014-07-09 22:12:57 +03001744void
Xiong Zhang97116532013-10-23 13:58:31 +08001745weston_plane_init(struct weston_plane *plane,
1746 struct weston_compositor *ec,
1747 int32_t x, int32_t y);
Kristian Høgsberg65a11e12012-08-03 11:30:18 -04001748void
1749weston_plane_release(struct weston_plane *plane);
1750
1751void
Ander Conselvan de Oliveira8ad19822013-03-05 17:30:27 +02001752weston_compositor_stack_plane(struct weston_compositor *ec,
1753 struct weston_plane *plane,
1754 struct weston_plane *above);
1755
Pekka Paalanen363aa7b2014-12-17 16:20:40 +02001756/* An invalid flag in presented_flags to catch logic errors. */
Pekka Paalanenb00c79b2016-02-18 16:53:27 +02001757#define WP_PRESENTATION_FEEDBACK_INVALID (1U << 31)
Pekka Paalanen363aa7b2014-12-17 16:20:40 +02001758
Ander Conselvan de Oliveira8ad19822013-03-05 17:30:27 +02001759void
Pekka Paalanenb5eedad2014-09-23 22:08:45 -04001760weston_output_finish_frame(struct weston_output *output,
Pekka Paalanen363aa7b2014-12-17 16:20:40 +02001761 const struct timespec *stamp,
1762 uint32_t presented_flags);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001763void
Kristian Høgsberg49952d12012-06-20 00:35:59 -04001764weston_output_schedule_repaint(struct weston_output *output);
1765void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001766weston_output_damage(struct weston_output *output);
1767void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001768weston_compositor_schedule_repaint(struct weston_compositor *compositor);
1769void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001770weston_compositor_damage_all(struct weston_compositor *compositor);
1771void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001772weston_compositor_wake(struct weston_compositor *compositor);
1773void
Philipp Brüschweiler57edf7f2013-03-29 13:01:56 +01001774weston_compositor_offscreen(struct weston_compositor *compositor);
1775void
Ander Conselvan de Oliveira87524b62013-02-21 18:35:22 +02001776weston_compositor_sleep(struct weston_compositor *compositor);
Jason Ekstranda7af7042013-10-12 22:38:11 -05001777struct weston_view *
1778weston_compositor_pick_view(struct weston_compositor *compositor,
1779 wl_fixed_t x, wl_fixed_t y,
1780 wl_fixed_t *sx, wl_fixed_t *sy);
Ander Conselvan de Oliveira30eebc72012-02-15 17:02:57 +02001781
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001782
1783struct weston_binding;
Derek Foreman8ae2db52015-07-15 13:00:36 -05001784typedef void (*weston_key_binding_handler_t)(struct weston_keyboard *keyboard,
Alexandros Frantzis47e79c82017-11-16 18:20:57 +02001785 const struct timespec *time,
1786 uint32_t key,
Daniel Stone325fc2d2012-05-30 16:31:58 +01001787 void *data);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001788struct weston_binding *
Daniel Stone325fc2d2012-05-30 16:31:58 +01001789weston_compositor_add_key_binding(struct weston_compositor *compositor,
1790 uint32_t key,
1791 enum weston_keyboard_modifier modifier,
1792 weston_key_binding_handler_t binding,
1793 void *data);
1794
Derek Foreman8ae2db52015-07-15 13:00:36 -05001795typedef void (*weston_modifier_binding_handler_t)(struct weston_keyboard *keyboard,
Daniel Stone96d47c02013-11-19 11:37:12 +01001796 enum weston_keyboard_modifier modifier,
1797 void *data);
1798struct weston_binding *
1799weston_compositor_add_modifier_binding(struct weston_compositor *compositor,
1800 enum weston_keyboard_modifier modifier,
1801 weston_modifier_binding_handler_t binding,
1802 void *data);
1803
Derek Foreman8ae2db52015-07-15 13:00:36 -05001804typedef void (*weston_button_binding_handler_t)(struct weston_pointer *pointer,
Alexandros Frantzis215bedc2017-11-16 18:20:55 +02001805 const struct timespec *time,
1806 uint32_t button,
Daniel Stone325fc2d2012-05-30 16:31:58 +01001807 void *data);
1808struct weston_binding *
1809weston_compositor_add_button_binding(struct weston_compositor *compositor,
1810 uint32_t button,
1811 enum weston_keyboard_modifier modifier,
1812 weston_button_binding_handler_t binding,
1813 void *data);
1814
Derek Foreman8ae2db52015-07-15 13:00:36 -05001815typedef void (*weston_touch_binding_handler_t)(struct weston_touch *touch,
Alexandros Frantzis9448deb2017-11-16 18:20:58 +02001816 const struct timespec *time,
Neil Robertsa28c6932013-10-03 16:43:04 +01001817 void *data);
1818struct weston_binding *
1819weston_compositor_add_touch_binding(struct weston_compositor *compositor,
1820 enum weston_keyboard_modifier modifier,
1821 weston_touch_binding_handler_t binding,
1822 void *data);
1823
Derek Foreman8ae2db52015-07-15 13:00:36 -05001824typedef void (*weston_axis_binding_handler_t)(struct weston_pointer *pointer,
Alexandros Frantzis80321942017-11-16 18:20:56 +02001825 const struct timespec *time,
Peter Hutterer89b6a492016-01-18 15:58:17 +10001826 struct weston_pointer_axis_event *event,
1827 void *data);
Daniel Stone325fc2d2012-05-30 16:31:58 +01001828struct weston_binding *
1829weston_compositor_add_axis_binding(struct weston_compositor *compositor,
1830 uint32_t axis,
1831 enum weston_keyboard_modifier modifier,
1832 weston_axis_binding_handler_t binding,
1833 void *data);
Ander Conselvan de Oliveirac509d2b2012-11-08 17:20:45 +02001834struct weston_binding *
1835weston_compositor_add_debug_binding(struct weston_compositor *compositor,
1836 uint32_t key,
1837 weston_key_binding_handler_t binding,
1838 void *data);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001839void
1840weston_binding_destroy(struct weston_binding *binding);
1841
1842void
Pekka Paalanen2829f7c2015-02-19 17:02:13 +02001843weston_install_debug_key_binding(struct weston_compositor *compositor,
1844 uint32_t mod);
1845
1846void
Kristian Høgsberg3466bc82012-01-03 11:29:15 -05001847weston_binding_list_destroy_all(struct wl_list *list);
1848
Pekka Paalanen86b53962014-11-19 13:43:32 +02001849void
Daniel Stone325fc2d2012-05-30 16:31:58 +01001850weston_compositor_run_key_binding(struct weston_compositor *compositor,
Derek Foreman99a6a2d2015-07-15 13:00:43 -05001851 struct weston_keyboard *keyboard,
Alexandros Frantzis47e79c82017-11-16 18:20:57 +02001852 const struct timespec *time,
Daniel Stone325fc2d2012-05-30 16:31:58 +01001853 uint32_t key,
1854 enum wl_keyboard_key_state state);
Daniel Stone96d47c02013-11-19 11:37:12 +01001855
1856void
1857weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
Derek Foreman99a6a2d2015-07-15 13:00:43 -05001858 struct weston_keyboard *keyboard,
Daniel Stone96d47c02013-11-19 11:37:12 +01001859 enum weston_keyboard_modifier modifier,
1860 enum wl_keyboard_key_state state);
Daniel Stone325fc2d2012-05-30 16:31:58 +01001861void
1862weston_compositor_run_button_binding(struct weston_compositor *compositor,
Alexandros Frantzis215bedc2017-11-16 18:20:55 +02001863 struct weston_pointer *pointer,
1864 const struct timespec *time,
Daniel Stone325fc2d2012-05-30 16:31:58 +01001865 uint32_t button,
1866 enum wl_pointer_button_state value);
Neil Robertsa28c6932013-10-03 16:43:04 +01001867void
1868weston_compositor_run_touch_binding(struct weston_compositor *compositor,
Alexandros Frantzis9448deb2017-11-16 18:20:58 +02001869 struct weston_touch *touch,
1870 const struct timespec *time,
Neil Robertsa28c6932013-10-03 16:43:04 +01001871 int touch_type);
Rune K. Svendsen14b2fe72013-03-07 21:50:00 +01001872int
Daniel Stone325fc2d2012-05-30 16:31:58 +01001873weston_compositor_run_axis_binding(struct weston_compositor *compositor,
Alexandros Frantzis80321942017-11-16 18:20:56 +02001874 struct weston_pointer *pointer,
1875 const struct timespec *time,
Peter Hutterer89b6a492016-01-18 15:58:17 +10001876 struct weston_pointer_axis_event *event);
Ander Conselvan de Oliveirac509d2b2012-11-08 17:20:45 +02001877int
1878weston_compositor_run_debug_binding(struct weston_compositor *compositor,
Alexandros Frantzis47e79c82017-11-16 18:20:57 +02001879 struct weston_keyboard *keyboard,
1880 const struct timespec *time,
Ander Conselvan de Oliveirac509d2b2012-11-08 17:20:45 +02001881 uint32_t key,
1882 enum wl_keyboard_key_state state);
Daniel Stone325fc2d2012-05-30 16:31:58 +01001883
Giulio Camuffocdb4d292013-11-14 23:42:53 +01001884void
1885weston_compositor_set_default_pointer_grab(struct weston_compositor *compositor,
1886 const struct weston_pointer_grab_interface *interface);
1887
Benjamin Franzkebfeda132012-01-30 14:04:04 +01001888int
1889weston_environment_get_fd(const char *env);
1890
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001891struct weston_surface *
Kristian Høgsberg18c93002012-01-27 11:58:31 -05001892weston_surface_create(struct weston_compositor *compositor);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001893
Jason Ekstranda7af7042013-10-12 22:38:11 -05001894struct weston_view *
1895weston_view_create(struct weston_surface *surface);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001896
1897void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001898weston_view_destroy(struct weston_view *view);
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -05001899
1900void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001901weston_view_set_position(struct weston_view *view,
1902 float x, float y);
1903
1904void
1905weston_view_set_transform_parent(struct weston_view *view,
1906 struct weston_view *parent);
1907
Pekka Paalanen380adf52015-02-16 14:39:11 +02001908void
1909weston_view_set_mask(struct weston_view *view,
1910 int x, int y, int width, int height);
1911
1912void
1913weston_view_set_mask_infinite(struct weston_view *view);
1914
Derek Foreman280e7dd2014-10-03 13:13:42 -05001915bool
Jason Ekstranda7af7042013-10-12 22:38:11 -05001916weston_view_is_mapped(struct weston_view *view);
1917
Philipp Zabel70decd52018-09-03 20:11:15 +02001918bool
1919weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region);
1920
Jason Ekstranda7af7042013-10-12 22:38:11 -05001921void
1922weston_view_schedule_repaint(struct weston_view *view);
Pekka Paalanen483243f2013-03-08 14:56:50 +02001923
Derek Foreman280e7dd2014-10-03 13:13:42 -05001924bool
Ander Conselvan de Oliveirab8ab14f2012-03-27 17:36:36 +03001925weston_surface_is_mapped(struct weston_surface *surface);
1926
Derek Foremand1be3122014-09-18 16:46:49 -05001927void
Jason Ekstrand5c11a332013-12-04 20:32:03 -06001928weston_surface_set_size(struct weston_surface *surface,
1929 int32_t width, int32_t height);
1930
Pekka Paalanen8fb8d3b2012-02-13 13:03:59 +02001931void
Kristian Høgsberg98238702012-08-03 16:29:12 -04001932weston_surface_schedule_repaint(struct weston_surface *surface);
1933
1934void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001935weston_surface_damage(struct weston_surface *surface);
1936
1937void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001938weston_view_damage_below(struct weston_view *view);
Kristian Høgsbergd8bf90c2012-02-23 23:03:14 -05001939
1940void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001941weston_view_move_to_plane(struct weston_view *view,
1942 struct weston_plane *plane);
1943void
1944weston_view_unmap(struct weston_view *view);
1945
Kristian Høgsberg65a11e12012-08-03 11:30:18 -04001946void
Kristian Høgsbergaf7b1ff2012-06-26 21:19:23 -04001947weston_surface_unmap(struct weston_surface *surface);
1948
Pekka Paalanen01388e22013-04-25 13:57:44 +03001949struct weston_surface *
1950weston_surface_get_main_surface(struct weston_surface *surface);
1951
Pekka Paalanen50b67472014-10-01 15:02:41 +03001952int
1953weston_surface_set_role(struct weston_surface *surface,
1954 const char *role_name,
1955 struct wl_resource *error_resource,
1956 uint32_t error_code);
Quentin Glidic9c5dd7e2016-08-12 10:41:37 +02001957const char *
1958weston_surface_get_role(struct weston_surface *surface);
Pekka Paalanen50b67472014-10-01 15:02:41 +03001959
Pekka Paalanen8274d902014-08-06 19:36:51 +03001960void
1961weston_surface_set_label_func(struct weston_surface *surface,
1962 int (*desc)(struct weston_surface *,
1963 char *, size_t));
1964
Pekka Paalanenc647ed72015-02-09 13:16:57 +02001965void
1966weston_surface_get_content_size(struct weston_surface *surface,
1967 int *width, int *height);
1968
Quentin Glidic248dd102016-08-12 10:41:34 +02001969struct weston_geometry
1970weston_surface_get_bounding_box(struct weston_surface *surface);
1971
Pekka Paalanenc647ed72015-02-09 13:16:57 +02001972int
1973weston_surface_copy_content(struct weston_surface *surface,
1974 void *target, size_t size,
1975 int src_x, int src_y,
1976 int width, int height);
1977
Jason Ekstrand6bd62942013-06-20 20:38:23 -05001978struct weston_buffer *
1979weston_buffer_from_resource(struct wl_resource *resource);
1980
Kristian Høgsbergaf7b1ff2012-06-26 21:19:23 -04001981void
Pekka Paalanende685b82012-12-04 15:58:12 +02001982weston_buffer_reference(struct weston_buffer_reference *ref,
Jason Ekstrand6bd62942013-06-20 20:38:23 -05001983 struct weston_buffer *buffer);
Pekka Paalanende685b82012-12-04 15:58:12 +02001984
Alexandros Frantzis409b01f2017-11-16 18:21:01 +02001985void
Alexandros Frantzis67629672018-10-19 12:14:11 +03001986weston_buffer_release_reference(struct weston_buffer_release_reference *ref,
1987 struct weston_buffer_release *buf_release);
1988
1989void
1990weston_buffer_release_move(struct weston_buffer_release_reference *dest,
1991 struct weston_buffer_release_reference *src);
1992
1993void
Alexandros Frantzis409b01f2017-11-16 18:21:01 +02001994weston_compositor_get_time(struct timespec *time);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001995
Daniel Stonece62cb32018-07-20 09:46:24 +01001996char *
1997weston_compositor_print_scene_graph(struct weston_compositor *ec);
1998
Giulio Camuffo459137b2014-10-11 23:56:24 +03001999void
2000weston_compositor_destroy(struct weston_compositor *ec);
2001struct weston_compositor *
Marius Vlad880b4852019-04-07 17:07:58 +03002002weston_compositor_create(struct wl_display *display,
Marius Vlad3d7d9782019-04-17 12:35:38 +03002003 struct weston_log_context *log_ctx, void *user_data);
Pekka Paalanen50dbf382016-06-03 15:23:46 +03002004
2005enum weston_compositor_backend {
2006 WESTON_BACKEND_DRM,
2007 WESTON_BACKEND_FBDEV,
2008 WESTON_BACKEND_HEADLESS,
2009 WESTON_BACKEND_RDP,
2010 WESTON_BACKEND_WAYLAND,
2011 WESTON_BACKEND_X11,
2012};
2013
Pekka Paalanendd186732016-06-03 14:49:54 +03002014int
2015weston_compositor_load_backend(struct weston_compositor *compositor,
Pekka Paalanen50dbf382016-06-03 15:23:46 +03002016 enum weston_compositor_backend backend,
Pekka Paalanendd186732016-06-03 14:49:54 +03002017 struct weston_backend_config *config_base);
Giulio Camuffo459137b2014-10-11 23:56:24 +03002018void
2019weston_compositor_exit(struct weston_compositor *ec);
2020void *
2021weston_compositor_get_user_data(struct weston_compositor *compositor);
Pekka Paalanenb5eedad2014-09-23 22:08:45 -04002022int
2023weston_compositor_set_presentation_clock(struct weston_compositor *compositor,
2024 clockid_t clk_id);
2025int
2026weston_compositor_set_presentation_clock_software(
2027 struct weston_compositor *compositor);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002028void
Pekka Paalanen662f3842015-03-18 12:17:26 +02002029weston_compositor_read_presentation_clock(
2030 const struct weston_compositor *compositor,
2031 struct timespec *ts);
2032
Pekka Paalanen230f3b12014-09-29 14:18:40 -04002033bool
2034weston_compositor_import_dmabuf(struct weston_compositor *compositor,
2035 struct linux_dmabuf_buffer *buffer);
2036
Pekka Paalanen662f3842015-03-18 12:17:26 +02002037void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002038weston_compositor_shutdown(struct weston_compositor *ec);
2039void
Frederic Plourdec336f062014-10-29 14:44:33 -04002040weston_compositor_exit_with_code(struct weston_compositor *compositor,
2041 int exit_code);
2042void
Scott Moreau429490d2012-06-17 18:10:59 -06002043weston_output_init_zoom(struct weston_output *output);
2044void
Jason Ekstranda7af7042013-10-12 22:38:11 -05002045weston_output_update_zoom(struct weston_output *output);
Scott Moreauccbf29d2012-02-22 14:21:41 -07002046void
Derek Foreman22276a52015-07-23 14:55:15 -05002047weston_output_activate_zoom(struct weston_output *output,
2048 struct weston_seat *seat);
Giulio Camuffo412b0242013-11-14 23:42:51 +01002049void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002050weston_output_move(struct weston_output *output, int x, int y);
Armin Krezović40087402016-09-30 14:11:12 +02002051
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002052void
Pekka Paalanen37b7c6e2017-11-07 10:15:01 +02002053weston_output_add_destroy_listener(struct weston_output *output,
2054 struct wl_listener *listener);
2055struct wl_listener *
2056weston_output_get_destroy_listener(struct weston_output *output,
2057 wl_notify_func_t notify);
2058void
Pekka Paalanenae6d35d2017-08-16 12:07:14 +03002059weston_output_release(struct weston_output *output);
Kristian Høgsberg98c774f2013-07-22 14:33:42 -07002060void
Jason Ekstrandb6a3cc72013-10-27 22:25:00 -05002061weston_output_transform_coordinate(struct weston_output *output,
Giulio Camuffo90a6fc62016-03-22 17:44:54 +02002062 double device_x, double device_y,
2063 double *x, double *y);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002064
2065void
Rob Bradford9af5f9e2013-05-31 18:09:50 +01002066weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
2067 const char *seat_name);
Daniel Stone74419a22012-05-30 16:32:02 +01002068void
2069weston_seat_init_pointer(struct weston_seat *seat);
Jonas Ådahld6e1c342013-10-17 23:04:05 +02002070void
2071weston_seat_release_pointer(struct weston_seat *seat);
Kristian Høgsberg2f07ef62013-02-16 14:29:24 -05002072int
Daniel Stonebb1df6a2012-05-30 16:32:06 +01002073weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap);
Daniel Stone74419a22012-05-30 16:32:02 +01002074void
Jonas Ådahld6e1c342013-10-17 23:04:05 +02002075weston_seat_release_keyboard(struct weston_seat *seat);
2076void
Daniel Stone74419a22012-05-30 16:32:02 +01002077weston_seat_init_touch(struct weston_seat *seat);
Kristian Høgsbergb5e26102013-04-18 15:40:10 -04002078void
Jonas Ådahld6e1c342013-10-17 23:04:05 +02002079weston_seat_release_touch(struct weston_seat *seat);
2080void
Kristian Høgsberga71e8b22013-05-06 21:51:21 -04002081weston_seat_repick(struct weston_seat *seat);
Rui Matos65196bc2013-10-10 19:44:19 +02002082void
2083weston_seat_update_keymap(struct weston_seat *seat, struct xkb_keymap *keymap);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002084
2085void
Daniel Stone37816df2012-05-16 18:45:18 +01002086weston_seat_release(struct weston_seat *seat);
Kristian Høgsbergb5e26102013-04-18 15:40:10 -04002087int
Giulio Camuffo0358af42016-06-02 21:48:08 +03002088weston_compositor_set_xkb_rule_names(struct weston_compositor *ec,
2089 struct xkb_rule_names *names);
Kristian Høgsbergb5e26102013-04-18 15:40:10 -04002090void
2091weston_compositor_xkb_destroy(struct weston_compositor *ec);
Kristian Høgsberg3466bc82012-01-03 11:29:15 -05002092
Kristian Høgsberg64eca892012-08-01 00:00:57 -04002093/* String literal of spaces, the same width as the timestamp. */
2094#define STAMP_SPACE " "
2095
Giulio Camuffobe2b11a2016-06-02 21:48:13 +03002096typedef int (*log_func_t)(const char *fmt, va_list ap);
Kristian Høgsberg64eca892012-08-01 00:00:57 -04002097void
Giulio Camuffobe2b11a2016-06-02 21:48:13 +03002098weston_log_set_handler(log_func_t log, log_func_t cont);
Kristian Høgsberg64eca892012-08-01 00:00:57 -04002099int
Kristian Høgsberg082d58c2013-06-18 01:00:27 -04002100weston_vlog(const char *fmt, va_list ap);
2101int
2102weston_vlog_continue(const char *fmt, va_list ap);
2103int
Pekka Paalanend525b562012-08-06 14:57:04 +03002104weston_log(const char *fmt, ...)
2105 __attribute__ ((format (printf, 1, 2)));
Kristian Høgsberg64eca892012-08-01 00:00:57 -04002106int
Pekka Paalanend525b562012-08-06 14:57:04 +03002107weston_log_continue(const char *fmt, ...)
2108 __attribute__ ((format (printf, 1, 2)));
Kristian Høgsberg64eca892012-08-01 00:00:57 -04002109
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002110enum {
2111 TTY_ENTER_VT,
2112 TTY_LEAVE_VT
2113};
2114
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002115struct tty *
Kristian Høgsberg61741a22013-09-17 16:02:57 -07002116tty_create(struct weston_compositor *compositor, int tty_nr);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002117
2118void
2119tty_destroy(struct tty *tty);
2120
Kristian Høgsberg7b884bc2012-07-31 14:32:01 -04002121void
2122tty_reset(struct tty *tty);
2123
Kristian Høgsberg5d1c0c52012-04-10 00:11:50 -04002124int
2125tty_activate_vt(struct tty *tty, int vt);
2126
Giulio Camuffoe9022e72013-12-11 23:45:11 +01002127enum weston_screenshooter_outcome {
2128 WESTON_SCREENSHOOTER_SUCCESS,
2129 WESTON_SCREENSHOOTER_NO_MEMORY,
2130 WESTON_SCREENSHOOTER_BAD_BUFFER
2131};
2132
2133typedef void (*weston_screenshooter_done_func_t)(void *data,
2134 enum weston_screenshooter_outcome outcome);
2135int
2136weston_screenshooter_shoot(struct weston_output *output, struct weston_buffer *buffer,
2137 weston_screenshooter_done_func_t done, void *data);
Giulio Camuffo26f62d42016-06-02 21:48:09 +03002138struct weston_recorder *
2139weston_recorder_start(struct weston_output *output, const char *filename);
2140void
2141weston_recorder_stop(struct weston_recorder *recorder);
Giulio Camuffoe9022e72013-12-11 23:45:11 +01002142
Kristian Høgsberga7ceaff2012-06-03 10:20:13 -04002143struct clipboard *
2144clipboard_create(struct weston_seat *seat);
2145
Jason Ekstranda7af7042013-10-12 22:38:11 -05002146struct weston_view_animation;
2147typedef void (*weston_view_animation_done_func_t)(struct weston_view_animation *animation, void *data);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002148
Louis-Francis Ratté-Boulianneb482dbd2013-11-19 11:37:11 +01002149void
2150weston_view_animation_destroy(struct weston_view_animation *animation);
2151
Jason Ekstranda7af7042013-10-12 22:38:11 -05002152struct weston_view_animation *
2153weston_zoom_run(struct weston_view *view, float start, float stop,
2154 weston_view_animation_done_func_t done, void *data);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002155
Jason Ekstranda7af7042013-10-12 22:38:11 -05002156struct weston_view_animation *
2157weston_fade_run(struct weston_view *view,
Ander Conselvan de Oliveiraee416052013-02-21 18:35:17 +02002158 float start, float end, float k,
Jason Ekstranda7af7042013-10-12 22:38:11 -05002159 weston_view_animation_done_func_t done, void *data);
Daniel Stonea67e6b92013-11-19 11:37:13 +01002160
2161struct weston_view_animation *
2162weston_move_scale_run(struct weston_view *view, int dx, int dy,
Quentin Glidic24d306c2016-08-10 15:53:33 +02002163 float start, float end, bool reverse,
Daniel Stonea67e6b92013-11-19 11:37:13 +01002164 weston_view_animation_done_func_t done, void *data);
2165
Quentin Glidic24d306c2016-08-10 15:53:33 +02002166struct weston_view_animation *
2167weston_move_run(struct weston_view *view, int dx, int dy,
2168 float start, float end, bool reverse,
2169 weston_view_animation_done_func_t done, void *data);
2170
Ander Conselvan de Oliveiraee416052013-02-21 18:35:17 +02002171void
Jason Ekstranda7af7042013-10-12 22:38:11 -05002172weston_fade_update(struct weston_view_animation *fade, float target);
Ander Conselvan de Oliveiraee416052013-02-21 18:35:17 +02002173
Jason Ekstranda7af7042013-10-12 22:38:11 -05002174struct weston_view_animation *
Louis-Francis Ratté-Boulianneb482dbd2013-11-19 11:37:11 +01002175weston_stable_fade_run(struct weston_view *front_view, float start,
2176 struct weston_view *back_view, float end,
2177 weston_view_animation_done_func_t done, void *data);
2178
2179struct weston_view_animation *
Jason Ekstranda7af7042013-10-12 22:38:11 -05002180weston_slide_run(struct weston_view *view, float start, float stop,
2181 weston_view_animation_done_func_t done, void *data);
Juan Zhaoe10d2792012-04-25 19:09:52 +08002182
Alex Wu8811bf92012-02-28 18:07:54 +08002183void
2184weston_surface_set_color(struct weston_surface *surface,
John Kåre Alsaker490d02a2012-09-30 02:57:21 +02002185 float red, float green, float blue, float alpha);
Alex Wu8811bf92012-02-28 18:07:54 +08002186
2187void
2188weston_surface_destroy(struct weston_surface *surface);
2189
Alex Wu2dda6042012-04-17 17:20:47 +08002190int
Derek Foreman6ae7bc92014-11-04 10:47:33 -06002191weston_output_mode_set_native(struct weston_output *output,
2192 struct weston_mode *mode,
2193 int32_t scale);
2194int
2195weston_output_mode_switch_to_temporary(struct weston_output *output,
2196 struct weston_mode *mode,
2197 int32_t scale);
2198int
2199weston_output_mode_switch_to_native(struct weston_output *output);
Alex Wu2dda6042012-04-17 17:20:47 +08002200
Ander Conselvan de Oliveira11f8d402012-10-29 18:19:24 +02002201int
2202noop_renderer_init(struct weston_compositor *ec);
Ander Conselvan de Oliveira11f8d402012-10-29 18:19:24 +02002203
Giulio Camuffo954f1832014-10-11 18:27:30 +03002204int
Jonas Ådahl30d61d82014-10-22 21:21:17 +02002205weston_input_init(struct weston_compositor *compositor);
2206
2207int
Quentin Glidic23e1d6f2016-12-02 14:08:44 +01002208weston_backend_init(struct weston_compositor *c,
2209 struct weston_backend_config *config_base);
Kristian Høgsbergb00a9d32012-09-11 14:06:27 -04002210int
Quentin Glidic3d7ca3b2016-12-02 14:20:35 +01002211weston_module_init(struct weston_compositor *compositor);
Kristian Høgsbergb00a9d32012-09-11 14:06:27 -04002212
Ander Conselvan de Oliveira409eebf2012-12-05 15:14:04 +02002213void
2214weston_transformed_coord(int width, int height,
2215 enum wl_output_transform transform,
Alexander Larssonedddbd12013-05-24 13:09:43 +02002216 int32_t scale,
Ander Conselvan de Oliveira409eebf2012-12-05 15:14:04 +02002217 float sx, float sy, float *bx, float *by);
2218pixman_box32_t
2219weston_transformed_rect(int width, int height,
2220 enum wl_output_transform transform,
Alexander Larssonedddbd12013-05-24 13:09:43 +02002221 int32_t scale,
Ander Conselvan de Oliveira409eebf2012-12-05 15:14:04 +02002222 pixman_box32_t rect);
Jason Ekstrand33ff6362013-10-27 22:25:01 -05002223void
Derek Foremanbc9a61c2015-11-18 16:32:30 -06002224weston_matrix_transform_region(pixman_region32_t *dest,
2225 struct weston_matrix *matrix,
2226 pixman_region32_t *src);
2227void
Jason Ekstrand33ff6362013-10-27 22:25:01 -05002228weston_transformed_region(int width, int height,
2229 enum wl_output_transform transform,
2230 int32_t scale,
2231 pixman_region32_t *src, pixman_region32_t *dest);
Ander Conselvan de Oliveira409eebf2012-12-05 15:14:04 +02002232
Ander Conselvan de Oliveira97f29522013-10-14 15:57:11 +03002233void *
2234weston_load_module(const char *name, const char *entrypoint);
2235
Daniel Stonee03c1112016-11-24 20:45:45 +00002236size_t
2237weston_module_path_from_env(const char *name, char *path, size_t path_len);
2238
Derek Foreman64a3df02014-10-23 12:24:18 -05002239int
2240weston_parse_transform(const char *transform, uint32_t *out);
2241
2242const char *
2243weston_transform_to_string(uint32_t output_transform);
2244
Derek Foreman1281a362015-07-31 16:55:32 -05002245struct weston_keyboard *
2246weston_seat_get_keyboard(struct weston_seat *seat);
2247
2248struct weston_pointer *
2249weston_seat_get_pointer(struct weston_seat *seat);
2250
2251struct weston_touch *
2252weston_seat_get_touch(struct weston_seat *seat);
2253
Bryce Harrington24f917e2016-06-29 19:04:07 -07002254void
2255weston_seat_set_keyboard_focus(struct weston_seat *seat,
2256 struct weston_surface *surface);
2257
Derek Foremanf8f7fd62017-06-28 11:41:43 -05002258void
2259weston_keyboard_send_keymap(struct weston_keyboard *kbd,
2260 struct wl_resource *resource);
2261
Giulio Camuffo9c764df2016-06-29 11:54:27 +02002262int
2263weston_compositor_load_xwayland(struct weston_compositor *compositor);
2264
Armin Krezovića01ab6d2016-09-30 14:11:02 +02002265void
Pekka Paalanen992a8cb2017-08-16 10:39:17 +03002266weston_head_init(struct weston_head *head, const char *name);
2267
2268void
2269weston_head_release(struct weston_head *head);
2270
2271void
2272weston_compositor_add_head(struct weston_compositor *compositor,
2273 struct weston_head *head);
2274
2275void
Pekka Paalanen01f60212017-03-24 15:39:24 +02002276weston_head_set_monitor_strings(struct weston_head *head,
2277 const char *make,
2278 const char *model,
2279 const char *serialno);
2280
2281void
Philipp Zabelc18ffd32018-08-30 17:38:03 +02002282weston_head_set_non_desktop(struct weston_head *head, bool non_desktop);
2283
2284void
Pekka Paalanen01f60212017-03-24 15:39:24 +02002285weston_head_set_physical_size(struct weston_head *head,
2286 int32_t mm_width, int32_t mm_height);
2287
2288void
2289weston_head_set_subpixel(struct weston_head *head,
2290 enum wl_output_subpixel sp);
2291
2292void
Pekka Paalanen7fe858b2017-08-14 15:45:14 +03002293weston_head_set_connection_status(struct weston_head *head, bool connected);
2294
2295void
Pekka Paalanen01f60212017-03-24 15:39:24 +02002296weston_head_set_internal(struct weston_head *head);
2297
Pekka Paalanen7fe858b2017-08-14 15:45:14 +03002298bool
2299weston_head_is_connected(struct weston_head *head);
2300
Pekka Paalanen8e552fd2018-02-15 15:18:20 +02002301bool
2302weston_head_is_enabled(struct weston_head *head);
2303
Pekka Paalanene19970f2017-08-28 14:11:02 +03002304bool
2305weston_head_is_device_changed(struct weston_head *head);
2306
Philipp Zabelc18ffd32018-08-30 17:38:03 +02002307bool
2308weston_head_is_non_desktop(struct weston_head *head);
2309
Pekka Paalanene19970f2017-08-28 14:11:02 +03002310void
2311weston_head_reset_device_changed(struct weston_head *head);
2312
Pekka Paalanen992a8cb2017-08-16 10:39:17 +03002313const char *
2314weston_head_get_name(struct weston_head *head);
2315
2316struct weston_output *
2317weston_head_get_output(struct weston_head *head);
2318
2319void
2320weston_head_detach(struct weston_head *head);
2321
Pekka Paalanen2e1bedb2017-10-10 11:21:58 +03002322void
2323weston_head_add_destroy_listener(struct weston_head *head,
2324 struct wl_listener *listener);
2325
2326struct wl_listener *
2327weston_head_get_destroy_listener(struct weston_head *head,
2328 wl_notify_func_t notify);
2329
Pekka Paalanen1adcbac2017-08-14 16:05:35 +03002330struct weston_head *
2331weston_compositor_iterate_heads(struct weston_compositor *compositor,
2332 struct weston_head *iter);
2333
Pekka Paalanen01f60212017-03-24 15:39:24 +02002334void
Pekka Paalanen37e6c9e2017-08-15 13:00:02 +03002335weston_compositor_add_heads_changed_listener(struct weston_compositor *compositor,
2336 struct wl_listener *listener);
2337
Pekka Paalanen992a8cb2017-08-16 10:39:17 +03002338struct weston_output *
Pekka Paalanen1ae9d082017-11-02 14:11:53 +02002339weston_compositor_find_output_by_name(struct weston_compositor *compositor,
2340 const char *name);
2341
2342struct weston_output *
2343weston_compositor_create_output(struct weston_compositor *compositor,
2344 const char *name);
2345
2346struct weston_output *
Pekka Paalanen992a8cb2017-08-16 10:39:17 +03002347weston_compositor_create_output_with_head(struct weston_compositor *compositor,
2348 struct weston_head *head);
2349
2350void
2351weston_output_destroy(struct weston_output *output);
2352
2353int
2354weston_output_attach_head(struct weston_output *output,
2355 struct weston_head *head);
2356
2357struct weston_head *
2358weston_output_iterate_heads(struct weston_output *output,
2359 struct weston_head *iter);
2360
Pekka Paalanen37e6c9e2017-08-15 13:00:02 +03002361void
Armin Krezovića01ab6d2016-09-30 14:11:02 +02002362weston_output_set_scale(struct weston_output *output,
2363 int32_t scale);
2364
2365void
2366weston_output_set_transform(struct weston_output *output,
2367 uint32_t transform);
2368
2369void
Armin Krezović40087402016-09-30 14:11:12 +02002370weston_output_init(struct weston_output *output,
Pekka Paalanen26ac2e12017-04-03 13:18:13 +03002371 struct weston_compositor *compositor,
2372 const char *name);
Armin Krezovića01ab6d2016-09-30 14:11:02 +02002373
2374void
2375weston_compositor_add_pending_output(struct weston_output *output,
2376 struct weston_compositor *compositor);
2377
2378int
2379weston_output_enable(struct weston_output *output);
2380
2381void
2382weston_output_disable(struct weston_output *output);
2383
2384void
Pekka Paalanen8a8dcac2017-08-17 17:29:36 +03002385weston_compositor_flush_heads_changed(struct weston_compositor *compositor);
Armin Krezovića01ab6d2016-09-30 14:11:02 +02002386
Pekka Paalanen055c1132017-03-27 16:31:25 +03002387struct weston_head *
2388weston_head_from_resource(struct wl_resource *resource);
Pekka Paalanen9ffb2502017-03-27 15:14:32 +03002389
Pekka Paalanencf0a4762017-04-04 16:36:07 +03002390struct weston_head *
2391weston_output_get_first_head(struct weston_output *output);
2392
Louis-Francis Ratté-Boulianne83630982017-11-28 20:42:47 -05002393int
2394weston_compositor_enable_touch_calibrator(struct weston_compositor *compositor,
2395 weston_touch_calibration_save_func save);
2396
Marius Vlad3d7d9782019-04-17 12:35:38 +03002397struct weston_log_context *
2398weston_log_ctx_compositor_create(void);
Marius Vlad880b4852019-04-07 17:07:58 +03002399
Pekka Paalanena5630ea2017-10-12 13:13:42 +02002400int
Marius Vlad3d7d9782019-04-17 12:35:38 +03002401weston_log_ctx_compositor_setup(struct weston_compositor *compositor,
2402 struct weston_log_context *log_ctx);
Pekka Paalanena5630ea2017-10-12 13:13:42 +02002403
2404void
Marius Vlad3d7d9782019-04-17 12:35:38 +03002405weston_log_ctx_compositor_destroy(struct weston_compositor *compositor);
Pekka Paalanena5630ea2017-10-12 13:13:42 +02002406
Vasilis Liaskovitis486b4632018-10-10 16:14:55 +02002407void
2408weston_buffer_send_server_error(struct weston_buffer *buffer,
2409 const char *msg);
2410
Giulio Camuffo7fe01b12013-03-28 18:02:42 +01002411#ifdef __cplusplus
2412}
2413#endif
2414
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05002415#endif