blob: f3e007593495421fb4862f9912f964a18126085a [file] [log] [blame]
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001/*
2 * Copyright © 2008-2011 Kristian Høgsberg
Pekka Paalanend581a8f2012-01-27 16:25:16 +02003 * Copyright © 2012 Collabora, Ltd.
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05004 *
Bryce Harringtona0bbfea2015-06-11 15:35:43 -07005 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050012 *
Bryce Harringtona0bbfea2015-06-11 15:35:43 -070013 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050025 */
26
27#ifndef _WAYLAND_SYSTEM_COMPOSITOR_H_
28#define _WAYLAND_SYSTEM_COMPOSITOR_H_
29
Giulio Camuffo7fe01b12013-03-28 18:02:42 +010030#ifdef __cplusplus
31extern "C" {
32#endif
33
Derek Foreman280e7dd2014-10-03 13:13:42 -050034#include <stdbool.h>
Pekka Paalanenb5eedad2014-09-23 22:08:45 -040035#include <time.h>
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050036#include <pixman.h>
Daniel Stone855028f2012-05-01 20:37:10 +010037#include <xkbcommon/xkbcommon.h>
Kristian Høgsberg3c179332013-08-06 19:27:04 -070038
39#define WL_HIDE_DEPRECATED
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050040#include <wayland-server.h>
41
Kristian Høgsbergaf4f2aa2013-02-15 20:53:20 -050042#include "version.h"
43#include "matrix.h"
44#include "config-parser.h"
Peter Huttererb1bc4a62013-08-08 11:57:04 +100045#include "zalloc.h"
Pekka Paalanenb5026542014-11-12 15:09:24 +020046#include "timeline-object.h"
Pekka Paalanen2eaa11e2012-03-30 15:45:40 +030047
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050048struct weston_transform {
49 struct weston_matrix matrix;
Pekka Paalanenc61eca62012-01-06 14:10:06 +020050 struct wl_list link;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050051};
52
53struct weston_surface;
Jason Ekstrand6bd62942013-06-20 20:38:23 -050054struct weston_buffer;
Tiago Vignattibc052c92012-04-19 16:18:18 +030055struct shell_surface;
Daniel Stone37816df2012-05-16 18:45:18 +010056struct weston_seat;
Scott Moreau062be7e2012-04-20 13:37:33 -060057struct weston_output;
Jan Arne Petersene829adc2012-08-10 16:47:22 +020058struct input_method;
Derek Foremane4d6c832015-08-05 14:48:11 -050059struct weston_pointer;
Pekka Paalanen230f3b12014-09-29 14:18:40 -040060struct linux_dmabuf_buffer;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050061
Daniel Stone496ca172012-05-30 16:31:42 +010062enum weston_keyboard_modifier {
63 MODIFIER_CTRL = (1 << 0),
64 MODIFIER_ALT = (1 << 1),
65 MODIFIER_SUPER = (1 << 2),
Kristian Høgsberg73694c82012-06-28 14:13:10 -040066 MODIFIER_SHIFT = (1 << 3),
Daniel Stone496ca172012-05-30 16:31:42 +010067};
68
Giulio Camuffo6ef444d2014-08-28 19:44:09 +030069enum weston_keyboard_locks {
70 WESTON_NUM_LOCK = (1 << 0),
71 WESTON_CAPS_LOCK = (1 << 1),
72};
73
Daniel Stone8c8164f2012-05-30 16:31:45 +010074enum weston_led {
75 LED_NUM_LOCK = (1 << 0),
76 LED_CAPS_LOCK = (1 << 1),
77 LED_SCROLL_LOCK = (1 << 2),
78};
79
Kristian Høgsberg8334bc12012-01-03 10:29:47 -050080struct weston_mode {
81 uint32_t flags;
82 int32_t width, height;
83 uint32_t refresh;
84 struct wl_list link;
85};
86
Kristian Høgsberga61ca062012-05-22 16:05:52 -040087struct weston_shell_client {
Jasper St. Pierreac985be2014-04-28 11:19:28 -040088 void (*send_configure)(struct weston_surface *surface, int32_t width, int32_t height);
Kristian Høgsberga61ca062012-05-22 16:05:52 -040089};
90
Tiago Vignattibc052c92012-04-19 16:18:18 +030091struct weston_shell_interface {
92 void *shell; /* either desktop or tablet */
93
Kristian Høgsberg45ba8692012-05-21 14:27:33 -040094 struct shell_surface *(*create_shell_surface)(void *shell,
Kristian Høgsberga61ca062012-05-22 16:05:52 -040095 struct weston_surface *surface,
96 const struct weston_shell_client *client);
Jason Ekstranda7af7042013-10-12 22:38:11 -050097 struct weston_view *(*get_primary_view)(void *shell,
98 struct shell_surface *shsurf);
Kristian Høgsberg45ba8692012-05-21 14:27:33 -040099
Tiago Vignattibc052c92012-04-19 16:18:18 +0300100 void (*set_toplevel)(struct shell_surface *shsurf);
Kristian Høgsberg938b8fa2012-05-18 13:46:27 -0400101
Tiago Vignatti491bac12012-05-18 16:37:43 -0400102 void (*set_transient)(struct shell_surface *shsurf,
Kristian Høgsberg8150b192012-06-27 10:22:58 -0400103 struct weston_surface *parent,
Tiago Vignatti491bac12012-05-18 16:37:43 -0400104 int x, int y, uint32_t flags);
Kristian Høgsbergb810eb52013-02-12 20:07:05 -0500105 void (*set_fullscreen)(struct shell_surface *shsurf,
106 uint32_t method,
107 uint32_t framerate,
108 struct weston_output *output);
Tiago Vignattifb2adba2013-06-12 15:43:21 -0300109 void (*set_xwayland)(struct shell_surface *shsurf,
110 int x, int y, uint32_t flags);
Derek Foremane4d6c832015-08-05 14:48:11 -0500111 int (*move)(struct shell_surface *shsurf, struct weston_pointer *pointer);
Kristian Høgsbergc1693f22012-05-22 16:56:23 -0400112 int (*resize)(struct shell_surface *shsurf,
Derek Foremane4d6c832015-08-05 14:48:11 -0500113 struct weston_pointer *pointer, uint32_t edges);
Giulio Camuffo62942ad2013-09-11 18:20:47 +0200114 void (*set_title)(struct shell_surface *shsurf,
115 const char *title);
Jasper St. Pierreccf48fb2014-05-02 10:21:38 -0400116 void (*set_window_geometry)(struct shell_surface *shsurf,
117 int32_t x, int32_t y,
118 int32_t width, int32_t height);
Giulio Camuffo6b4b2412015-01-29 19:06:49 +0200119 void (*set_maximized)(struct shell_surface *shsurf);
Giulio Camuffoa8e9b412015-01-27 19:10:37 +0200120 void (*set_pid)(struct shell_surface *shsurf, pid_t pid);
Tiago Vignattibc052c92012-04-19 16:18:18 +0300121};
122
Scott Moreaue6603982012-06-11 13:07:51 -0600123struct weston_animation {
124 void (*frame)(struct weston_animation *animation,
125 struct weston_output *output, uint32_t msecs);
126 int frame_counter;
127 struct wl_list link;
128};
129
Kristian Høgsberg7eec9b32013-06-17 09:15:22 -0400130enum {
131 WESTON_SPRING_OVERSHOOT,
132 WESTON_SPRING_CLAMP,
133 WESTON_SPRING_BOUNCE
134};
135
Scott Moreaue6603982012-06-11 13:07:51 -0600136struct weston_spring {
137 double k;
138 double friction;
139 double current;
140 double target;
141 double previous;
Kristian Høgsberg091b0962013-06-17 09:23:14 -0400142 double min, max;
Scott Moreaue6603982012-06-11 13:07:51 -0600143 uint32_t timestamp;
Kristian Høgsberg7eec9b32013-06-17 09:15:22 -0400144 uint32_t clip;
Scott Moreaue6603982012-06-11 13:07:51 -0600145};
146
Scott Moreauccbf29d2012-02-22 14:21:41 -0700147struct weston_output_zoom {
Derek Foremana36eb502015-07-23 14:55:12 -0500148 bool active;
Scott Moreauccbf29d2012-02-22 14:21:41 -0700149 float increment;
150 float level;
Scott Moreaue6603982012-06-11 13:07:51 -0600151 float max_level;
Scott Moreauccbf29d2012-02-22 14:21:41 -0700152 float trans_x, trans_y;
Giulio Camuffo6850e7b2015-10-07 20:14:18 +0300153 struct {
154 double x, y;
155 } current;
Derek Foreman22276a52015-07-23 14:55:15 -0500156 struct weston_seat *seat;
Scott Moreaue6603982012-06-11 13:07:51 -0600157 struct weston_animation animation_z;
158 struct weston_spring spring_z;
Giulio Camuffo412b0242013-11-14 23:42:51 +0100159 struct wl_listener motion_listener;
Scott Moreauccbf29d2012-02-22 14:21:41 -0700160};
161
Tiago Vignatti8e53c7f2012-02-29 19:53:50 +0200162/* bit compatible with drm definitions. */
163enum dpms_enum {
164 WESTON_DPMS_ON,
165 WESTON_DPMS_STANDBY,
166 WESTON_DPMS_SUSPEND,
167 WESTON_DPMS_OFF
168};
169
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500170struct weston_output {
Casey Dahlin58ba1372012-04-19 22:50:08 -0400171 uint32_t id;
Richard Hughesafe690c2013-05-02 10:10:04 +0100172 char *name;
Casey Dahlin58ba1372012-04-19 22:50:08 -0400173
John Kåre Alsaker94659272012-11-13 19:10:18 +0100174 void *renderer_state;
175
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500176 struct wl_list link;
Casey Dahlin9074db52012-04-19 22:50:09 -0400177 struct wl_list resource_list;
Benjamin Franzkeb6879402012-04-10 18:28:54 +0200178 struct wl_global *global;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500179 struct weston_compositor *compositor;
Jason Ekstrandfb23df72014-10-16 10:55:21 -0500180
181 /** From global to output buffer coordinates. */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500182 struct weston_matrix matrix;
Derek Foremanc0023212015-03-24 11:36:13 -0500183 /** From output buffer to global coordinates. */
184 struct weston_matrix inverse_matrix;
Jason Ekstrandfb23df72014-10-16 10:55:21 -0500185
Scott Moreau9d1b1122012-06-08 19:40:53 -0600186 struct wl_list animation_list;
Scott Moreau1bad5db2012-08-18 01:04:05 -0600187 int32_t x, y, width, height;
188 int32_t mm_width, mm_height;
Pekka Paalanenefd08c72015-02-23 13:54:49 +0200189
190 /** Output area in global coordinates, simple rect */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500191 pixman_region32_t region;
Pekka Paalanenefd08c72015-02-23 13:54:49 +0200192
Ander Conselvan de Oliveirab8fcca92012-11-16 17:23:52 +0200193 pixman_region32_t previous_damage;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500194 int repaint_needed;
195 int repaint_scheduled;
Pekka Paalanen0513a952014-05-21 16:17:27 +0300196 struct wl_event_source *repaint_timer;
Scott Moreauccbf29d2012-02-22 14:21:41 -0700197 struct weston_output_zoom zoom;
198 int dirty;
Kristian Høgsberg5fb70bf2012-05-24 12:29:46 -0400199 struct wl_signal frame_signal;
Richard Hughes64ddde12013-05-01 21:52:10 +0100200 struct wl_signal destroy_signal;
Zhang, Xiong Yf3012412013-12-13 22:10:53 +0200201 int move_x, move_y;
Pekka Paalanenb5eedad2014-09-23 22:08:45 -0400202 uint32_t frame_time; /* presentation timestamp in milliseconds */
Pekka Paalanen641307c2014-09-23 22:08:47 -0400203 uint64_t msc; /* media stream counter */
Kristian Høgsberg79af73e2012-08-03 15:45:23 -0400204 int disable_planes;
Ander Conselvan de Oliveirae1e23522013-12-13 22:10:55 +0200205 int destroying;
Pekka Paalanen133e4392014-09-23 22:08:46 -0400206 struct wl_list feedback_list;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500207
Richard Hughes2b2092a2013-04-24 14:58:02 +0100208 char *make, *model, *serial_number;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500209 uint32_t subpixel;
Kristian Høgsberg05890dc2012-08-10 10:09:20 -0400210 uint32_t transform;
Hardening57388e42013-09-18 23:56:36 +0200211 int32_t native_scale;
Hardeningff39efa2013-09-18 23:56:35 +0200212 int32_t current_scale;
Hardening57388e42013-09-18 23:56:36 +0200213 int32_t original_scale;
Alexander Larsson4ea95522013-05-22 14:41:37 +0200214
Hardening57388e42013-09-18 23:56:36 +0200215 struct weston_mode *native_mode;
Hardeningff39efa2013-09-18 23:56:35 +0200216 struct weston_mode *current_mode;
217 struct weston_mode *original_mode;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500218 struct wl_list mode_list;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500219
Jonas Ådahle5a12252013-04-05 23:07:11 +0200220 void (*start_repaint_loop)(struct weston_output *output);
David Herrmann1edf44c2013-10-22 17:11:26 +0200221 int (*repaint)(struct weston_output *output,
Kristian Høgsbergd7c17262012-09-05 21:54:15 -0400222 pixman_region32_t *damage);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500223 void (*destroy)(struct weston_output *output);
Jesse Barnes5308a5e2012-02-09 13:12:57 -0800224 void (*assign_planes)(struct weston_output *output);
Alex Wu2dda6042012-04-17 17:20:47 +0800225 int (*switch_mode)(struct weston_output *output, struct weston_mode *mode);
Tiago Vignatti8e53c7f2012-02-29 19:53:50 +0200226
Tiago Vignatti5ab91ad2012-03-12 19:40:09 -0300227 /* backlight values are on 0-255 range, where higher is brighter */
Kristian Høgsberg7c609122013-05-23 20:30:26 -0400228 int32_t backlight_current;
Tiago Vignatti8e53c7f2012-02-29 19:53:50 +0200229 void (*set_backlight)(struct weston_output *output, uint32_t value);
230 void (*set_dpms)(struct weston_output *output, enum dpms_enum level);
Richard Hughese7299962013-05-01 21:52:12 +0100231
Richard Hughesb24e48e2013-05-09 20:31:09 +0100232 int connection_internal;
Richard Hughese7299962013-05-01 21:52:12 +0100233 uint16_t gamma_size;
234 void (*set_gamma)(struct weston_output *output,
235 uint16_t size,
236 uint16_t *r,
237 uint16_t *g,
238 uint16_t *b);
Pekka Paalanenb5026542014-11-12 15:09:24 +0200239
240 struct weston_timeline_object timeline;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500241};
242
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400243struct weston_pointer_grab;
244struct weston_pointer_grab_interface {
Kristian Høgsberg6848c252013-05-08 22:02:59 -0400245 void (*focus)(struct weston_pointer_grab *grab);
Giulio Camuffo1959ab82013-11-14 23:42:52 +0100246 void (*motion)(struct weston_pointer_grab *grab, uint32_t time,
247 wl_fixed_t x, wl_fixed_t y);
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400248 void (*button)(struct weston_pointer_grab *grab,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400249 uint32_t time, uint32_t button, uint32_t state);
Jonas Ådahl0336ca02014-10-04 16:28:29 +0200250 void (*axis)(struct weston_pointer_grab *grab,
251 uint32_t time, uint32_t axis, wl_fixed_t value);
Jonas Ådahl1ea343e2013-10-25 23:18:05 +0200252 void (*cancel)(struct weston_pointer_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400253};
254
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400255struct weston_pointer_grab {
256 const struct weston_pointer_grab_interface *interface;
257 struct weston_pointer *pointer;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400258};
259
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400260struct weston_keyboard_grab;
261struct weston_keyboard_grab_interface {
262 void (*key)(struct weston_keyboard_grab *grab, uint32_t time,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400263 uint32_t key, uint32_t state);
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400264 void (*modifiers)(struct weston_keyboard_grab *grab, uint32_t serial,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400265 uint32_t mods_depressed, uint32_t mods_latched,
266 uint32_t mods_locked, uint32_t group);
Jonas Ådahl1ea343e2013-10-25 23:18:05 +0200267 void (*cancel)(struct weston_keyboard_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400268};
269
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400270struct weston_keyboard_grab {
271 const struct weston_keyboard_grab_interface *interface;
272 struct weston_keyboard *keyboard;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400273};
274
Kristian Høgsberge329f362013-05-06 22:19:57 -0400275struct weston_touch_grab;
276struct weston_touch_grab_interface {
277 void (*down)(struct weston_touch_grab *grab,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400278 uint32_t time,
279 int touch_id,
280 wl_fixed_t sx,
281 wl_fixed_t sy);
Kristian Høgsberge329f362013-05-06 22:19:57 -0400282 void (*up)(struct weston_touch_grab *grab,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400283 uint32_t time,
284 int touch_id);
Kristian Høgsberge329f362013-05-06 22:19:57 -0400285 void (*motion)(struct weston_touch_grab *grab,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400286 uint32_t time,
287 int touch_id,
288 wl_fixed_t sx,
289 wl_fixed_t sy);
Jonas Ådahl1679f232014-04-12 09:39:51 +0200290 void (*frame)(struct weston_touch_grab *grab);
Jonas Ådahl1ea343e2013-10-25 23:18:05 +0200291 void (*cancel)(struct weston_touch_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400292};
293
Kristian Høgsberge329f362013-05-06 22:19:57 -0400294struct weston_touch_grab {
295 const struct weston_touch_grab_interface *interface;
296 struct weston_touch *touch;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400297};
298
Kristian Høgsberg5e76a492013-07-25 16:09:37 -0700299struct weston_data_offer {
Jason Ekstrand8a4a9eb2013-06-14 10:07:55 -0500300 struct wl_resource *resource;
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700301 struct weston_data_source *source;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400302 struct wl_listener source_destroy_listener;
303};
304
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700305struct weston_data_source {
Jason Ekstrand8a4a9eb2013-06-14 10:07:55 -0500306 struct wl_resource *resource;
307 struct wl_signal destroy_signal;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400308 struct wl_array mime_types;
309
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700310 void (*accept)(struct weston_data_source *source,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400311 uint32_t serial, const char *mime_type);
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700312 void (*send)(struct weston_data_source *source,
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400313 const char *mime_type, int32_t fd);
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700314 void (*cancel)(struct weston_data_source *source);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400315};
316
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400317struct weston_pointer {
Kristian Høgsberge3148752013-05-06 23:19:49 -0400318 struct weston_seat *seat;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400319
320 struct wl_list resource_list;
Neil Roberts96d790e2013-09-19 17:32:00 +0100321 struct wl_list focus_resource_list;
Jason Ekstranda7af7042013-10-12 22:38:11 -0500322 struct weston_view *focus;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400323 uint32_t focus_serial;
Giulio Camuffo576fe2a2013-11-20 18:00:24 +0100324 struct wl_listener focus_view_listener;
325 struct wl_listener focus_resource_listener;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400326 struct wl_signal focus_signal;
Giulio Camuffo6fcb3782013-11-14 23:42:50 +0100327 struct wl_signal motion_signal;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400328
Jason Ekstranda7af7042013-10-12 22:38:11 -0500329 struct weston_view *sprite;
Kristian Høgsberg195b8692013-05-08 15:02:05 -0400330 struct wl_listener sprite_destroy_listener;
331 int32_t hotspot_x, hotspot_y;
332
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400333 struct weston_pointer_grab *grab;
334 struct weston_pointer_grab default_grab;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400335 wl_fixed_t grab_x, grab_y;
336 uint32_t grab_button;
337 uint32_t grab_serial;
338 uint32_t grab_time;
339
340 wl_fixed_t x, y;
Kristian Høgsbergdb1fccb2014-02-05 17:14:42 -0800341 wl_fixed_t sx, sy;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400342 uint32_t button_count;
Ander Conselvan de Oliveiraf84327a2014-01-29 18:47:51 +0200343
344 struct wl_listener output_destroy_listener;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400345};
346
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400347
Kristian Høgsberge329f362013-05-06 22:19:57 -0400348struct weston_touch {
Kristian Høgsberge3148752013-05-06 23:19:49 -0400349 struct weston_seat *seat;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400350
351 struct wl_list resource_list;
Neil Roberts96d790e2013-09-19 17:32:00 +0100352 struct wl_list focus_resource_list;
Jason Ekstranda7af7042013-10-12 22:38:11 -0500353 struct weston_view *focus;
Giulio Camuffo576fe2a2013-11-20 18:00:24 +0100354 struct wl_listener focus_view_listener;
355 struct wl_listener focus_resource_listener;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400356 uint32_t focus_serial;
357 struct wl_signal focus_signal;
358
Jonas Ådahl9484b692013-12-02 22:05:03 +0100359 uint32_t num_tp;
360
Kristian Høgsberge329f362013-05-06 22:19:57 -0400361 struct weston_touch_grab *grab;
362 struct weston_touch_grab default_grab;
Neil Roberts306fe082013-10-03 16:43:06 +0100363 int grab_touch_id;
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400364 wl_fixed_t grab_x, grab_y;
365 uint32_t grab_serial;
366 uint32_t grab_time;
367};
368
Kristian Høgsberga4036bb2013-05-07 23:52:07 -0400369struct weston_pointer *
Giulio Camuffocdb4d292013-11-14 23:42:53 +0100370weston_pointer_create(struct weston_seat *seat);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400371void
Kristian Høgsberga4036bb2013-05-07 23:52:07 -0400372weston_pointer_destroy(struct weston_pointer *pointer);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400373void
Jonas Ådahl0336ca02014-10-04 16:28:29 +0200374weston_pointer_send_axis(struct weston_pointer *pointer,
375 uint32_t time, uint32_t axis, wl_fixed_t value);
376void
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400377weston_pointer_set_focus(struct weston_pointer *pointer,
Jason Ekstranda7af7042013-10-12 22:38:11 -0500378 struct weston_view *view,
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400379 wl_fixed_t sx, wl_fixed_t sy);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400380void
Derek Foremanf9318d12015-05-11 15:40:11 -0500381weston_pointer_clear_focus(struct weston_pointer *pointer);
382void
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400383weston_pointer_start_grab(struct weston_pointer *pointer,
384 struct weston_pointer_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400385void
Kristian Høgsberg02bbabb2013-05-06 22:15:05 -0400386weston_pointer_end_grab(struct weston_pointer *pointer);
Rob Bradford806d8c02013-06-25 18:56:41 +0100387void
388weston_pointer_clamp(struct weston_pointer *pointer,
389 wl_fixed_t *fx, wl_fixed_t *fy);
Giulio Camuffo1959ab82013-11-14 23:42:52 +0100390void
391weston_pointer_move(struct weston_pointer *pointer,
392 wl_fixed_t x, wl_fixed_t y);
Giulio Camuffocdb4d292013-11-14 23:42:53 +0100393void
394weston_pointer_set_default_grab(struct weston_pointer *pointer,
395 const struct weston_pointer_grab_interface *interface);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400396
Kristian Høgsberga4036bb2013-05-07 23:52:07 -0400397struct weston_keyboard *
398weston_keyboard_create(void);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400399void
Kristian Høgsberga4036bb2013-05-07 23:52:07 -0400400weston_keyboard_destroy(struct weston_keyboard *keyboard);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400401void
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400402weston_keyboard_set_focus(struct weston_keyboard *keyboard,
Kristian Høgsbergfe7aa902013-05-08 09:54:37 -0400403 struct weston_surface *surface);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400404void
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400405weston_keyboard_start_grab(struct weston_keyboard *device,
406 struct weston_keyboard_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400407void
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400408weston_keyboard_end_grab(struct weston_keyboard *keyboard);
Giulio Camuffo6ef444d2014-08-28 19:44:09 +0300409int
410/*
411 * 'mask' and 'value' should be a bitwise mask of one or more
412 * valued of the weston_keyboard_locks enum.
413 */
414weston_keyboard_set_locks(struct weston_keyboard *keyboard,
415 uint32_t mask, uint32_t value);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400416
Kristian Høgsberga4036bb2013-05-07 23:52:07 -0400417struct weston_touch *
418weston_touch_create(void);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400419void
Kristian Høgsberga4036bb2013-05-07 23:52:07 -0400420weston_touch_destroy(struct weston_touch *touch);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400421void
Derek Foreman4c93c082015-04-30 16:45:41 -0500422weston_touch_set_focus(struct weston_touch *touch,
Jason Ekstranda7af7042013-10-12 22:38:11 -0500423 struct weston_view *view);
Michael Fua2bb7912013-07-23 15:51:06 +0800424void
Kristian Høgsberge329f362013-05-06 22:19:57 -0400425weston_touch_start_grab(struct weston_touch *device,
426 struct weston_touch_grab *grab);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400427void
Kristian Høgsberge329f362013-05-06 22:19:57 -0400428weston_touch_end_grab(struct weston_touch *touch);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400429
430void
Kristian Høgsberge3148752013-05-06 23:19:49 -0400431wl_data_device_set_keyboard_focus(struct weston_seat *seat);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400432
433int
434wl_data_device_manager_init(struct wl_display *display);
435
436
437void
Kristian Høgsberge3148752013-05-06 23:19:49 -0400438weston_seat_set_selection(struct weston_seat *seat,
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700439 struct weston_data_source *source, uint32_t serial);
Giulio Camuffodddf9e62015-05-01 12:59:35 +0300440void
441weston_seat_send_selection(struct weston_seat *seat, struct wl_client *client);
442
Kristian Høgsberg85de9c22013-09-04 20:44:26 -0700443int
Xiong Zhangfd51e7b2013-11-25 18:42:49 +0800444weston_pointer_start_drag(struct weston_pointer *pointer,
Kristian Høgsberg85de9c22013-09-04 20:44:26 -0700445 struct weston_data_source *source,
446 struct weston_surface *icon,
447 struct wl_client *client);
Xiong Zhangfd51e7b2013-11-25 18:42:49 +0800448int
449weston_touch_start_drag(struct weston_touch *touch,
450 struct weston_data_source *source,
451 struct weston_surface *icon,
452 struct wl_client *client);
Kristian Høgsberg2158a882013-04-18 15:07:39 -0400453
Daniel Stoned65b9092012-05-30 16:32:05 +0100454struct weston_xkb_info {
455 struct xkb_keymap *keymap;
Daniel Stoneb7452fe2012-06-01 12:14:06 +0100456 int keymap_fd;
457 size_t keymap_size;
458 char *keymap_area;
Andrew Wedgbury9a6f02a2013-09-05 13:31:40 +0000459 int32_t ref_count;
Daniel Stoneabb9dcd2012-06-22 13:21:33 +0100460 xkb_mod_index_t shift_mod;
461 xkb_mod_index_t caps_mod;
Daniel Stoned65b9092012-05-30 16:32:05 +0100462 xkb_mod_index_t ctrl_mod;
463 xkb_mod_index_t alt_mod;
Daniel Stoneabb9dcd2012-06-22 13:21:33 +0100464 xkb_mod_index_t mod2_mod;
465 xkb_mod_index_t mod3_mod;
Daniel Stoned65b9092012-05-30 16:32:05 +0100466 xkb_mod_index_t super_mod;
Daniel Stoneabb9dcd2012-06-22 13:21:33 +0100467 xkb_mod_index_t mod5_mod;
Daniel Stoned65b9092012-05-30 16:32:05 +0100468 xkb_led_index_t num_led;
469 xkb_led_index_t caps_led;
470 xkb_led_index_t scroll_led;
471};
472
Jan Arne Petersena75a7892013-01-16 21:26:50 +0100473struct weston_keyboard {
Kristian Høgsberge3148752013-05-06 23:19:49 -0400474 struct weston_seat *seat;
Jan Arne Petersena75a7892013-01-16 21:26:50 +0100475
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400476 struct wl_list resource_list;
Neil Roberts96d790e2013-09-19 17:32:00 +0100477 struct wl_list focus_resource_list;
Kristian Høgsbergfe7aa902013-05-08 09:54:37 -0400478 struct weston_surface *focus;
Giulio Camuffo576fe2a2013-11-20 18:00:24 +0100479 struct wl_listener focus_resource_listener;
Kristian Høgsberg29139d42013-04-18 15:25:39 -0400480 uint32_t focus_serial;
481 struct wl_signal focus_signal;
482
483 struct weston_keyboard_grab *grab;
484 struct weston_keyboard_grab default_grab;
485 uint32_t grab_key;
486 uint32_t grab_serial;
487 uint32_t grab_time;
488
489 struct wl_array keys;
490
491 struct {
492 uint32_t mods_depressed;
493 uint32_t mods_latched;
494 uint32_t mods_locked;
495 uint32_t group;
496 } modifiers;
497
498 struct weston_keyboard_grab input_method_grab;
Jan Arne Petersena75a7892013-01-16 21:26:50 +0100499 struct wl_resource *input_method_resource;
Jonas Ådahl7395ea02013-12-03 09:14:26 +0100500
501 struct weston_xkb_info *xkb_info;
502 struct {
503 struct xkb_state *state;
504 enum weston_led leds;
505 } xkb_state;
506 struct xkb_keymap *pending_keymap;
Jan Arne Petersena75a7892013-01-16 21:26:50 +0100507};
508
Daniel Stone37816df2012-05-16 18:45:18 +0100509struct weston_seat {
Kristian Høgsberge3148752013-05-06 23:19:49 -0400510 struct wl_list base_resource_list;
511
Kristian Høgsbergaaadc772013-07-08 16:20:31 -0400512 struct wl_global *global;
Derek Foreman1281a362015-07-31 16:55:32 -0500513 struct weston_pointer *pointer_state;
514 struct weston_keyboard *keyboard_state;
515 struct weston_touch *touch_state;
Jonas Ådahld6e1c342013-10-17 23:04:05 +0200516 int pointer_device_count;
517 int keyboard_device_count;
518 int touch_device_count;
Kristian Høgsberge3148752013-05-06 23:19:49 -0400519
Rob Bradford66bd9f52013-06-25 18:56:42 +0100520 struct weston_output *output; /* constraint */
521
Giulio Camuffo5085a752013-03-25 21:42:45 +0100522 struct wl_signal destroy_signal;
Jason Ekstranda4ab5422014-04-02 19:53:45 -0500523 struct wl_signal updated_caps_signal;
Daniel Stone74419a22012-05-30 16:32:02 +0100524
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500525 struct weston_compositor *compositor;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500526 struct wl_list link;
Daniel Stone496ca172012-05-30 16:31:42 +0100527 enum weston_keyboard_modifier modifier_state;
Kristian Høgsbergfe7aa902013-05-08 09:54:37 -0400528 struct weston_surface *saved_kbd_focus;
Ander Conselvan de Oliveira71b1d0c2012-03-16 17:25:11 +0200529 struct wl_listener saved_kbd_focus_listener;
Kristian Høgsberg054c50a2013-05-08 15:27:47 -0400530 struct wl_list drag_resource_list;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500531
Kristian Høgsberge3148752013-05-06 23:19:49 -0400532 uint32_t selection_serial;
Kristian Høgsberg7ff3bdb2013-07-25 15:52:14 -0700533 struct weston_data_source *selection_data_source;
Kristian Høgsberge3148752013-05-06 23:19:49 -0400534 struct wl_listener selection_data_source_listener;
535 struct wl_signal selection_signal;
536
Daniel Stone8c8164f2012-05-30 16:31:45 +0100537 void (*led_update)(struct weston_seat *ws, enum weston_led leds);
538
Kristian Høgsberg2fce4802014-01-08 16:21:24 -0800539 uint32_t slot_map;
Jan Arne Petersene829adc2012-08-10 16:47:22 +0200540 struct input_method *input_method;
Rob Bradford9af5f9e2013-05-31 18:09:50 +0100541 char *seat_name;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500542};
543
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500544enum {
545 WESTON_COMPOSITOR_ACTIVE,
546 WESTON_COMPOSITOR_IDLE, /* shell->unlock called on activity */
Philipp Brüschweiler57edf7f2013-03-29 13:01:56 +0100547 WESTON_COMPOSITOR_OFFSCREEN, /* no rendering, no frame events */
548 WESTON_COMPOSITOR_SLEEPING /* same as offscreen, but also set dmps
549 * to off */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500550};
551
Giulio Camuffo412e6a52014-07-09 22:12:56 +0300552struct weston_layer_entry {
553 struct wl_list link;
554 struct weston_layer *layer;
555};
556
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -0500557struct weston_layer {
Giulio Camuffo412e6a52014-07-09 22:12:56 +0300558 struct weston_layer_entry view_list;
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -0500559 struct wl_list link;
Giulio Camuffo95ec0f92014-07-09 22:12:57 +0300560 pixman_box32_t mask;
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -0500561};
562
Kristian Høgsberg65a11e12012-08-03 11:30:18 -0400563struct weston_plane {
Xiong Zhang97116532013-10-23 13:58:31 +0800564 struct weston_compositor *compositor;
Pekka Paalanen502f5e02015-02-23 14:08:25 +0200565 pixman_region32_t damage; /**< in global coords */
Ander Conselvan de Oliveirae1bd5a02013-03-05 17:30:29 +0200566 pixman_region32_t clip;
Kristian Høgsberg65a11e12012-08-03 11:30:18 -0400567 int32_t x, y;
Ander Conselvan de Oliveira8ad19822013-03-05 17:30:27 +0200568 struct wl_list link;
Kristian Høgsberg65a11e12012-08-03 11:30:18 -0400569};
570
Kristian Høgsbergfa1be022012-09-05 22:49:55 -0400571struct weston_renderer {
John Kåre Alsakera95b2d62012-11-13 19:10:21 +0100572 int (*read_pixels)(struct weston_output *output,
573 pixman_format_code_t format, void *pixels,
574 uint32_t x, uint32_t y,
575 uint32_t width, uint32_t height);
Kristian Høgsbergfa1be022012-09-05 22:49:55 -0400576 void (*repaint_output)(struct weston_output *output,
577 pixman_region32_t *output_damage);
578 void (*flush_damage)(struct weston_surface *surface);
Jason Ekstrand6bd62942013-06-20 20:38:23 -0500579 void (*attach)(struct weston_surface *es, struct weston_buffer *buffer);
John Kåre Alsaker878f4492012-11-13 19:10:23 +0100580 void (*surface_set_color)(struct weston_surface *surface,
581 float red, float green,
582 float blue, float alpha);
Vasily Khoruzhick52cfd612013-01-08 19:09:01 +0300583 void (*destroy)(struct weston_compositor *ec);
Pekka Paalanenc647ed72015-02-09 13:16:57 +0200584
585
586 /** See weston_surface_get_content_size() */
587 void (*surface_get_content_size)(struct weston_surface *surface,
588 int *width, int *height);
589
590 /** See weston_surface_copy_content() */
591 int (*surface_copy_content)(struct weston_surface *surface,
592 void *target, size_t size,
593 int src_x, int src_y,
594 int width, int height);
Pekka Paalanen230f3b12014-09-29 14:18:40 -0400595
596 /** See weston_compositor_import_dmabuf() */
597 bool (*import_dmabuf)(struct weston_compositor *ec,
598 struct linux_dmabuf_buffer *buffer);
Kristian Høgsbergfa1be022012-09-05 22:49:55 -0400599};
600
Pekka Paalanen7bb65102013-05-22 18:03:04 +0300601enum weston_capability {
602 /* backend/renderer supports arbitrary rotation */
603 WESTON_CAP_ROTATION_ANY = 0x0001,
Pekka Paalanen4fc5dd02013-05-22 18:03:05 +0300604
605 /* screencaptures need to be y-flipped */
606 WESTON_CAP_CAPTURE_YFLIP = 0x0002,
Jason Ekstrand9fc71512014-04-02 19:53:46 -0500607
Bryce Harringtona86c3ee2015-03-18 18:42:00 -0700608 /* backend/renderer has a separate cursor plane */
Jason Ekstrand9fc71512014-04-02 19:53:46 -0500609 WESTON_CAP_CURSOR_PLANE = 0x0004,
610
611 /* backend supports setting arbitrary resolutions */
612 WESTON_CAP_ARBITRARY_MODES = 0x0008,
Pekka Paalanen380adf52015-02-16 14:39:11 +0200613
614 /* renderer supports weston_view_set_mask() clipping */
615 WESTON_CAP_VIEW_CLIP_MASK = 0x0010,
Pekka Paalanen7bb65102013-05-22 18:03:04 +0300616};
617
Giulio Camuffoe3c0d8a2015-10-17 19:24:13 +0300618/* Configuration struct for an output.
619 *
620 * This struct is used to pass the configuration for an output
621 * to the compositor backend when creating a new output.
622 * The backend can subclass this struct to handle backend
623 * specific data.
624 */
625struct weston_backend_output_config {
626 uint32_t transform;
Bryce Harrington32c32112015-10-23 15:29:23 -0700627 uint32_t width;
628 uint32_t height;
629 uint32_t scale;
Giulio Camuffoe3c0d8a2015-10-17 19:24:13 +0300630};
631
632/* Configuration struct for a backend.
633 *
634 * This struct carries the configuration for a backend, and it's
635 * passed to the backend's init entry point. The backend will
636 * likely want to subclass this in order to handle backend specific
637 * data.
638 */
639struct weston_backend_config {
640};
641
Giulio Camuffo954f1832014-10-11 18:27:30 +0300642struct weston_backend {
Giulio Camuffoe3c0d8a2015-10-17 19:24:13 +0300643 void (*destroy)(struct weston_compositor *compositor);
644 void (*restore)(struct weston_compositor *compositor);
645 /* vfunc to create a new output with a given name and config.
646 * backends not supporting the functionality will set this
647 * to NULL.
648 */
649 struct weston_output *
650 (*create_output)(struct weston_compositor *compositor,
651 const char *name,
652 struct weston_backend_output_config *config);
Giulio Camuffo954f1832014-10-11 18:27:30 +0300653};
654
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500655struct weston_compositor {
Kristian Høgsberg02e79dc2012-04-12 09:55:26 -0400656 struct wl_signal destroy_signal;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500657
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500658 struct wl_display *wl_display;
Tiago Vignattibc052c92012-04-19 16:18:18 +0300659 struct weston_shell_interface shell_interface;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400660 struct weston_config *config;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500661
Tiago Vignattifb2adba2013-06-12 15:43:21 -0300662 /* surface signals */
Kristian Høgsbergf03a04a2014-04-06 22:04:50 -0700663 struct wl_signal create_surface_signal;
Kristian Høgsberg02e79dc2012-04-12 09:55:26 -0400664 struct wl_signal activate_signal;
Tiago Vignattifb2adba2013-06-12 15:43:21 -0300665 struct wl_signal transform_signal;
666
Tiago Vignatti1d01b012012-09-27 17:48:36 +0300667 struct wl_signal kill_signal;
Ander Conselvan de Oliveiraa4575632013-02-21 18:35:23 +0200668 struct wl_signal idle_signal;
669 struct wl_signal wake_signal;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500670
Jan Arne Petersen42feced2012-06-21 21:52:17 +0200671 struct wl_signal show_input_panel_signal;
672 struct wl_signal hide_input_panel_signal;
Jan Arne Petersen14da96b2013-04-18 16:47:28 +0200673 struct wl_signal update_input_panel_signal;
Jan Arne Petersen42feced2012-06-21 21:52:17 +0200674
Jan Arne Petersen674fd1d2012-11-18 19:06:42 +0100675 struct wl_signal seat_created_signal;
Richard Hughes59d5da72013-05-01 21:52:11 +0100676 struct wl_signal output_created_signal;
Ander Conselvan de Oliveiraf84327a2014-01-29 18:47:51 +0200677 struct wl_signal output_destroyed_signal;
Ander Conselvan de Oliveiraa8a9baf2014-01-29 18:47:52 +0200678 struct wl_signal output_moved_signal;
Jan Arne Petersen674fd1d2012-11-18 19:06:42 +0100679
Kristian Høgsberg7ea10862012-03-05 17:49:30 -0500680 struct wl_event_loop *input_loop;
681 struct wl_event_source *input_loop_source;
682
Kristian Høgsberg61741a22013-09-17 16:02:57 -0700683 struct wl_signal session_signal;
684 int session_active;
685
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -0500686 struct weston_layer fade_layer;
687 struct weston_layer cursor_layer;
688
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500689 struct wl_list output_list;
Daniel Stone37816df2012-05-16 18:45:18 +0100690 struct wl_list seat_list;
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -0500691 struct wl_list layer_list;
Jason Ekstranda7af7042013-10-12 22:38:11 -0500692 struct wl_list view_list;
Ander Conselvan de Oliveira8ad19822013-03-05 17:30:27 +0200693 struct wl_list plane_list;
Daniel Stone325fc2d2012-05-30 16:31:58 +0100694 struct wl_list key_binding_list;
Daniel Stone96d47c02013-11-19 11:37:12 +0100695 struct wl_list modifier_binding_list;
Daniel Stone325fc2d2012-05-30 16:31:58 +0100696 struct wl_list button_binding_list;
Neil Robertsa28c6932013-10-03 16:43:04 +0100697 struct wl_list touch_binding_list;
Daniel Stone325fc2d2012-05-30 16:31:58 +0100698 struct wl_list axis_binding_list;
Ander Conselvan de Oliveirac509d2b2012-11-08 17:20:45 +0200699 struct wl_list debug_binding_list;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500700
701 uint32_t state;
702 struct wl_event_source *idle_source;
703 uint32_t idle_inhibit;
Philipp Brüschweiler4b409c32013-03-10 14:37:04 +0100704 int idle_time; /* timeout, s */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500705
Giulio Camuffocdb4d292013-11-14 23:42:53 +0100706 const struct weston_pointer_grab_interface *default_pointer_grab;
707
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500708 /* Repaint state. */
Kristian Høgsberg65a11e12012-08-03 11:30:18 -0400709 struct weston_plane primary_plane;
Pekka Paalanen7bb65102013-05-22 18:03:04 +0300710 uint32_t capabilities; /* combination of enum weston_capability */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500711
Kristian Høgsbergfa1be022012-09-05 22:49:55 -0400712 struct weston_renderer *renderer;
713
John Kåre Alsakerf9e710b2012-11-13 19:10:22 +0100714 pixman_format_code_t read_format;
Pekka Paalanen52bfbaa2012-04-11 16:19:37 +0300715
Giulio Camuffo954f1832014-10-11 18:27:30 +0300716 struct weston_backend *backend;
Kristian Høgsberg3466bc82012-01-03 11:29:15 -0500717
Kristian Høgsberg05ad1e42013-09-17 14:41:03 -0700718 struct weston_launcher *launcher;
Casey Dahlin58ba1372012-04-19 22:50:08 -0400719
720 uint32_t output_id_pool;
Daniel Stone855028f2012-05-01 20:37:10 +0100721
Daniel Stonee379da92012-05-30 16:32:04 +0100722 struct xkb_rule_names xkb_names;
723 struct xkb_context *xkb_context;
Andrew Wedgbury9a6f02a2013-09-05 13:31:40 +0000724 struct weston_xkb_info *xkb_info;
Matt Roper01a92732013-06-24 16:52:44 +0100725
726 /* Raw keyboard processing (no libxkbcommon initialization or handling) */
727 int use_xkbcommon;
Jonny Lamb66a41a02014-08-12 14:58:25 +0200728
729 int32_t kb_repeat_rate;
730 int32_t kb_repeat_delay;
Pekka Paalanenb5eedad2014-09-23 22:08:45 -0400731
732 clockid_t presentation_clock;
Pekka Paalanen0513a952014-05-21 16:17:27 +0300733 int32_t repaint_msec;
Frederic Plourdec336f062014-10-29 14:44:33 -0400734
735 int exit_code;
Giulio Camuffo459137b2014-10-11 23:56:24 +0300736
737 void *user_data;
738 void (*exit)(struct weston_compositor *c);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500739};
740
Jason Ekstrand6bd62942013-06-20 20:38:23 -0500741struct weston_buffer {
742 struct wl_resource *resource;
743 struct wl_signal destroy_signal;
744 struct wl_listener destroy_listener;
745
746 union {
747 struct wl_shm_buffer *shm_buffer;
Jason Ekstranda85118c2013-06-27 20:17:02 -0500748 void *legacy_buffer;
Jason Ekstrand6bd62942013-06-20 20:38:23 -0500749 };
750 int32_t width, height;
751 uint32_t busy_count;
Stanislav Vorobiovbfbb8e52013-08-29 11:36:44 +0400752 int y_inverted;
Jason Ekstrand6bd62942013-06-20 20:38:23 -0500753};
754
Pekka Paalanende685b82012-12-04 15:58:12 +0200755struct weston_buffer_reference {
Jason Ekstrand6bd62942013-06-20 20:38:23 -0500756 struct weston_buffer *buffer;
Pekka Paalanende685b82012-12-04 15:58:12 +0200757 struct wl_listener destroy_listener;
758};
759
Pekka Paalanen1fd9c0f2013-11-26 18:19:41 +0100760struct weston_buffer_viewport {
Pekka Paalanen952b6c82014-03-14 14:38:15 +0200761 struct {
762 /* wl_surface.set_buffer_transform */
763 uint32_t transform;
Pekka Paalanen1fd9c0f2013-11-26 18:19:41 +0100764
Pekka Paalanen952b6c82014-03-14 14:38:15 +0200765 /* wl_surface.set_scaling_factor */
766 int32_t scale;
Jonny Lamb74130762013-11-26 18:19:46 +0100767
Pekka Paalanenf0cad482014-03-14 14:38:16 +0200768 /*
769 * If src_width != wl_fixed_from_int(-1),
770 * then and only then src_* are used.
771 */
Pekka Paalanen952b6c82014-03-14 14:38:15 +0200772 wl_fixed_t src_x, src_y;
773 wl_fixed_t src_width, src_height;
774 } buffer;
775
776 struct {
Pekka Paalanenf0cad482014-03-14 14:38:16 +0200777 /*
778 * If width == -1, the size is inferred from the buffer.
779 */
Pekka Paalanen952b6c82014-03-14 14:38:15 +0200780 int32_t width, height;
781 } surface;
George Kiagiadakis8f9e87f2014-06-13 18:14:20 +0200782
783 int changed;
Pekka Paalanen1fd9c0f2013-11-26 18:19:41 +0100784};
785
Kristian Høgsberg5e7e6f22012-02-23 16:11:59 -0500786struct weston_region {
Jason Ekstrand8895efc2013-06-14 10:07:56 -0500787 struct wl_resource *resource;
Kristian Høgsberg5e7e6f22012-02-23 16:11:59 -0500788 pixman_region32_t region;
789};
790
Jason Ekstranda7af7042013-10-12 22:38:11 -0500791/* Using weston_view transformations
Pekka Paalanen44ab69c2012-02-07 13:18:00 +0200792 *
Jason Ekstranda7af7042013-10-12 22:38:11 -0500793 * To add a transformation to a view, create a struct weston_transform, and
794 * add it to the list view->geometry.transformation_list. Whenever you
795 * change the list, anything under view->geometry, or anything in the
Pekka Paalanenc3ce7382013-03-08 14:56:49 +0200796 * weston_transforms linked into the list, you must call
Jason Ekstranda7af7042013-10-12 22:38:11 -0500797 * weston_view_geometry_dirty().
Pekka Paalanen44ab69c2012-02-07 13:18:00 +0200798 *
799 * The order in the list defines the order of transformations. Let the list
800 * contain the transformation matrices M1, ..., Mn as head to tail. The
Jason Ekstranda7af7042013-10-12 22:38:11 -0500801 * transformation is applied to view-local coordinate vector p as
Pekka Paalanen44ab69c2012-02-07 13:18:00 +0200802 * P = Mn * ... * M2 * M1 * p
803 * to produce the global coordinate vector P. The total transform
804 * Mn * ... * M2 * M1
Jason Ekstranda7af7042013-10-12 22:38:11 -0500805 * is cached in view->transform.matrix, and the inverse of it in
806 * view->transform.inverse.
Pekka Paalanen44ab69c2012-02-07 13:18:00 +0200807 *
Jason Ekstranda7af7042013-10-12 22:38:11 -0500808 * The list always contains view->transform.position transformation, which
809 * is the translation by view->geometry.x and y.
Pekka Paalanen44ab69c2012-02-07 13:18:00 +0200810 *
811 * If you want to apply a transformation in local coordinates, add your
812 * weston_transform to the head of the list. If you want to apply a
813 * transformation in global coordinates, add it to the tail of the list.
Pekka Paalanen483243f2013-03-08 14:56:50 +0200814 *
Jason Ekstranda7af7042013-10-12 22:38:11 -0500815 * If view->geometry.parent is set, the total transformation of this
816 * view will be the parent's total transformation and this transformation
Pekka Paalanen483243f2013-03-08 14:56:50 +0200817 * combined:
818 * Mparent * Mn * ... * M2 * M1
Pekka Paalanen44ab69c2012-02-07 13:18:00 +0200819 */
820
Jason Ekstranda7af7042013-10-12 22:38:11 -0500821struct weston_view {
822 struct weston_surface *surface;
823 struct wl_list surface_link;
Jason Ekstrand26ed73c2013-06-06 22:34:41 -0500824 struct wl_signal destroy_signal;
Jason Ekstranda7af7042013-10-12 22:38:11 -0500825
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500826 struct wl_list link;
Pekka Paalanen8844bf22015-02-18 16:30:47 +0200827 struct weston_layer_entry layer_link; /* part of geometry */
Kristian Høgsberg65a11e12012-08-03 11:30:18 -0400828 struct weston_plane *plane;
Pekka Paalanen2d6e5512015-02-18 16:06:46 +0200829
830 /* For weston_layer inheritance from another view */
Giulio Camuffo95ec0f92014-07-09 22:12:57 +0300831 struct weston_view *parent_view;
Jason Ekstranda7af7042013-10-12 22:38:11 -0500832
Pekka Paalanen51723d52015-02-17 13:10:01 +0200833 pixman_region32_t clip; /* See weston_view_damage_below() */
Jason Ekstranda7af7042013-10-12 22:38:11 -0500834 float alpha; /* part of geometry, see below */
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500835
John Kåre Alsaker878f4492012-11-13 19:10:23 +0100836 void *renderer_state;
837
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +0200838 /* Surface geometry state, mutable.
Pekka Paalanenc3ce7382013-03-08 14:56:49 +0200839 * If you change anything, call weston_surface_geometry_dirty().
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +0200840 * That includes the transformations referenced from the list.
841 */
Pekka Paalanenc61eca62012-01-06 14:10:06 +0200842 struct {
John Kåre Alsaker490d02a2012-09-30 02:57:21 +0200843 float x, y; /* surface translation on display */
Pekka Paalanenba3cf952012-01-25 16:22:05 +0200844
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +0200845 /* struct weston_transform */
846 struct wl_list transformation_list;
Pekka Paalanen483243f2013-03-08 14:56:50 +0200847
848 /* managed by weston_surface_set_transform_parent() */
Jason Ekstranda7af7042013-10-12 22:38:11 -0500849 struct weston_view *parent;
Pekka Paalanen483243f2013-03-08 14:56:50 +0200850 struct wl_listener parent_destroy_listener;
851 struct wl_list child_list; /* geometry.parent_link */
852 struct wl_list parent_link;
Pekka Paalanen380adf52015-02-16 14:39:11 +0200853
854 /* managed by weston_view_set_mask() */
855 bool scissor_enabled;
856 pixman_region32_t scissor; /* always a simple rect */
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +0200857 } geometry;
858
859 /* State derived from geometry state, read-only.
Jason Ekstranda7af7042013-10-12 22:38:11 -0500860 * This is updated by weston_view_update_transform().
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +0200861 */
862 struct {
Pekka Paalanenc3ce7382013-03-08 14:56:49 +0200863 int dirty;
864
Pekka Paalanenfbd00f12015-02-19 11:49:18 +0200865 /* Approximations in global coordinates:
866 * - boundingbox is guaranteed to include the whole view in
867 * the smallest possible single rectangle.
868 * - opaque is guaranteed to be fully opaque, though not
869 * necessarily include all opaque areas.
870 */
Pekka Paalanen6720d8f2012-01-25 15:17:40 +0200871 pixman_region32_t boundingbox;
Pekka Paalanen730d87e2012-02-09 16:39:38 +0200872 pixman_region32_t opaque;
Pekka Paalanen6720d8f2012-01-25 15:17:40 +0200873
Pekka Paalanenbc0b7e72012-01-24 09:53:37 +0200874 /* matrix and inverse are used only if enabled = 1.
875 * If enabled = 0, use x, y, width, height directly.
876 */
877 int enabled;
Pekka Paalanen061b7472012-01-12 15:00:57 +0200878 struct weston_matrix matrix;
Pekka Paalanend1f0ab62012-01-20 10:47:57 +0200879 struct weston_matrix inverse;
Pekka Paalanencd403622012-01-25 13:37:39 +0200880
881 struct weston_transform position; /* matrix from x, y */
Pekka Paalanenc61eca62012-01-06 14:10:06 +0200882 } transform;
883
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500884 /*
885 * Which output to vsync this surface to.
886 * Used to determine, whether to send or queue frame events.
887 * Must be NULL, if 'link' is not in weston_compositor::surface_list.
888 */
889 struct weston_output *output;
890
Casey Dahlin9074db52012-04-19 22:50:09 -0400891 /*
892 * A more complete representation of all outputs this surface is
893 * displayed on.
894 */
895 uint32_t output_mask;
Pekka Paalanenbf0e0312014-12-17 16:20:41 +0200896
897 /* Per-surface Presentation feedback flags, controlled by backend. */
898 uint32_t psf_flags;
Jason Ekstranda7af7042013-10-12 22:38:11 -0500899};
900
Jason Ekstrand7b982072014-05-20 14:33:03 -0500901struct weston_surface_state {
902 /* wl_surface.attach */
903 int newly_attached;
904 struct weston_buffer *buffer;
905 struct wl_listener buffer_destroy_listener;
906 int32_t sx;
907 int32_t sy;
908
909 /* wl_surface.damage */
910 pixman_region32_t damage;
911
912 /* wl_surface.set_opaque_region */
913 pixman_region32_t opaque;
914
915 /* wl_surface.set_input_region */
916 pixman_region32_t input;
917
918 /* wl_surface.frame */
919 struct wl_list frame_callback_list;
920
Pekka Paalanen133e4392014-09-23 22:08:46 -0400921 /* presentation.feedback */
922 struct wl_list feedback_list;
923
Jason Ekstrand7b982072014-05-20 14:33:03 -0500924 /* wl_surface.set_buffer_transform */
925 /* wl_surface.set_scaling_factor */
926 /* wl_viewport.set */
927 struct weston_buffer_viewport buffer_viewport;
928};
929
Jason Ekstranda7af7042013-10-12 22:38:11 -0500930struct weston_surface {
931 struct wl_resource *resource;
Pekka Paalanenca790762015-04-17 14:23:38 +0300932 struct wl_signal destroy_signal; /* callback argument: this surface */
Jason Ekstranda7af7042013-10-12 22:38:11 -0500933 struct weston_compositor *compositor;
Pekka Paalanene508ce62015-02-19 13:59:55 +0200934
935 /** Damage in local coordinates from the client, for tex upload. */
Jason Ekstranda7af7042013-10-12 22:38:11 -0500936 pixman_region32_t damage;
Pekka Paalanene508ce62015-02-19 13:59:55 +0200937
Jason Ekstranda7af7042013-10-12 22:38:11 -0500938 pixman_region32_t opaque; /* part of geometry, see below */
939 pixman_region32_t input;
940 int32_t width, height;
941 int32_t ref_count;
942
943 /* Not for long-term storage. This exists for book-keeping while
944 * iterating over surfaces and views
945 */
946 int32_t touched;
947
948 void *renderer_state;
949
950 struct wl_list views;
951
952 /*
953 * Which output to vsync this surface to.
954 * Used to determine, whether to send or queue frame events.
955 * Must be NULL, if 'link' is not in weston_compositor::surface_list.
956 */
957 struct weston_output *output;
958
959 /*
960 * A more complete representation of all outputs this surface is
961 * displayed on.
962 */
963 uint32_t output_mask;
Casey Dahlin9074db52012-04-19 22:50:09 -0400964
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500965 struct wl_list frame_callback_list;
Pekka Paalanen133e4392014-09-23 22:08:46 -0400966 struct wl_list feedback_list;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -0500967
Pekka Paalanende685b82012-12-04 15:58:12 +0200968 struct weston_buffer_reference buffer_ref;
Pekka Paalanen1fd9c0f2013-11-26 18:19:41 +0100969 struct weston_buffer_viewport buffer_viewport;
Pekka Paalanen0b4c5352014-03-14 14:38:17 +0200970 int32_t width_from_buffer; /* before applying viewport */
971 int32_t height_from_buffer;
Derek Foreman0fd6d4e2014-10-10 09:36:45 -0500972 bool keep_buffer; /* for backends to prevent early release */
Alex Wu8811bf92012-02-28 18:07:54 +0800973
Pekka Paalanenb0420ae2014-01-08 15:39:17 +0200974 /* wl_viewport resource for this surface */
975 struct wl_resource *viewport_resource;
Jonny Lamb74130762013-11-26 18:19:46 +0100976
Pekka Paalanen5df44de2012-10-10 12:49:23 +0300977 /* All the pending state, that wl_surface.commit will apply. */
Jason Ekstrand7b982072014-05-20 14:33:03 -0500978 struct weston_surface_state pending;
Pekka Paalanen5df44de2012-10-10 12:49:23 +0300979
Jason Ekstrand1e059042014-10-16 10:55:19 -0500980 /* Matrices representating of the full transformation between
981 * buffer and surface coordinates. These matrices are updated
982 * using the weston_surface_build_buffer_matrix function. */
983 struct weston_matrix buffer_to_surface_matrix;
984 struct weston_matrix surface_to_buffer_matrix;
985
Ander Conselvan de Oliveira093bfa32012-03-27 17:36:41 +0300986 /*
Jasper St. Pierred67b52a2014-04-28 11:19:27 -0400987 * If non-NULL, this function will be called on
988 * wl_surface::commit after a new buffer has been set up for
989 * this surface. The integer params are the sx and sy
990 * parameters supplied to wl_surface::attach.
Ander Conselvan de Oliveira093bfa32012-03-27 17:36:41 +0300991 */
Jason Ekstrand918f2dd2013-12-02 21:01:53 -0600992 void (*configure)(struct weston_surface *es, int32_t sx, int32_t sy);
Giulio Camuffo7fe01b12013-03-28 18:02:42 +0100993 void *configure_private;
Pekka Paalanen8274d902014-08-06 19:36:51 +0300994 int (*get_label)(struct weston_surface *surface, char *buf, size_t len);
Pekka Paalanene67858b2013-04-25 13:57:42 +0300995
996 /* Parent's list of its sub-surfaces, weston_subsurface:parent_link.
997 * Contains also the parent itself as a dummy weston_subsurface,
998 * if the list is not empty.
999 */
1000 struct wl_list subsurface_list; /* weston_subsurface::parent_link */
1001 struct wl_list subsurface_list_pending; /* ...::parent_link_pending */
Pekka Paalanen50b67472014-10-01 15:02:41 +03001002
1003 /*
1004 * For tracking protocol role assignments. Different roles may
1005 * have the same configure hook, e.g. in shell.c. Configure hook
1006 * may get reset, this will not.
1007 * XXX: map configure functions 1:1 to roles, and never reset it,
1008 * and replace role_name with configure.
1009 */
1010 const char *role_name;
Pekka Paalanenb5026542014-11-12 15:09:24 +02001011
1012 struct weston_timeline_object timeline;
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001013};
1014
Jason Ekstrande9d40e32014-05-20 11:23:53 -05001015struct weston_subsurface {
1016 struct wl_resource *resource;
1017
1018 /* guaranteed to be valid and non-NULL */
1019 struct weston_surface *surface;
1020 struct wl_listener surface_destroy_listener;
1021
1022 /* can be NULL */
1023 struct weston_surface *parent;
1024 struct wl_listener parent_destroy_listener;
1025 struct wl_list parent_link;
1026 struct wl_list parent_link_pending;
1027
1028 struct {
1029 int32_t x;
1030 int32_t y;
1031 int set;
1032 } position;
1033
Jason Ekstrand7b982072014-05-20 14:33:03 -05001034 int has_cached_data;
1035 struct weston_surface_state cached;
1036 struct weston_buffer_reference cached_buffer_ref;
Jason Ekstrande9d40e32014-05-20 11:23:53 -05001037
1038 int synchronized;
1039
1040 /* Used for constructing the view tree */
1041 struct wl_list unused_views;
1042};
1043
Daniel Stoned6da09e2012-06-22 13:21:29 +01001044enum weston_key_state_update {
1045 STATE_UPDATE_AUTOMATIC,
1046 STATE_UPDATE_NONE,
1047};
1048
Kristian Høgsberg9ddb8262012-01-04 21:30:29 -05001049void
Kristian Høgsbergaf4f2aa2013-02-15 20:53:20 -05001050weston_version(int *major, int *minor, int *micro);
1051
1052void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001053weston_view_update_transform(struct weston_view *view);
Pekka Paalanen460099f2012-01-20 16:48:25 +02001054
1055void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001056weston_view_geometry_dirty(struct weston_view *view);
Pekka Paalanenc3ce7382013-03-08 14:56:49 +02001057
1058void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001059weston_view_to_global_fixed(struct weston_view *view,
1060 wl_fixed_t sx, wl_fixed_t sy,
1061 wl_fixed_t *x, wl_fixed_t *y);
Daniel Stonebd3489b2012-05-08 17:17:53 +01001062void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001063weston_view_to_global_float(struct weston_view *view,
1064 float sx, float sy, float *x, float *y);
Pekka Paalanene0f3cb22012-01-24 09:59:29 +02001065
1066void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001067weston_view_from_global_float(struct weston_view *view,
1068 float x, float y, float *vx, float *vy);
Kristian Høgsbergecf6ede2012-09-05 21:59:35 -04001069void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001070weston_view_from_global(struct weston_view *view,
1071 int32_t x, int32_t y, int32_t *vx, int32_t *vy);
Daniel Stonebd3489b2012-05-08 17:17:53 +01001072void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001073weston_view_from_global_fixed(struct weston_view *view,
1074 wl_fixed_t x, wl_fixed_t y,
1075 wl_fixed_t *vx, wl_fixed_t *vy);
Pekka Paalanene0f3cb22012-01-24 09:59:29 +02001076
Derek Foremand1be3122014-09-18 16:46:49 -05001077void
Ander Conselvan de Oliveira0396ba22012-11-28 17:10:26 +02001078weston_surface_to_buffer_float(struct weston_surface *surface,
1079 float x, float y, float *bx, float *by);
Derek Foremand1be3122014-09-18 16:46:49 -05001080void
Alexander Larsson4ea95522013-05-22 14:41:37 +02001081weston_surface_to_buffer(struct weston_surface *surface,
Jason Ekstranda7af7042013-10-12 22:38:11 -05001082 int sx, int sy, int *bx, int *by);
Ander Conselvan de Oliveira0396ba22012-11-28 17:10:26 +02001083pixman_box32_t
1084weston_surface_to_buffer_rect(struct weston_surface *surface,
1085 pixman_box32_t rect);
1086
Pekka Paalanene0f3cb22012-01-24 09:59:29 +02001087void
Pekka Paalanene54e31c2015-03-04 14:23:28 +02001088weston_surface_to_buffer_region(struct weston_surface *surface,
1089 pixman_region32_t *surface_region,
1090 pixman_region32_t *buffer_region);
1091
1092void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001093weston_spring_init(struct weston_spring *spring,
1094 double k, double current, double target);
1095void
1096weston_spring_update(struct weston_spring *spring, uint32_t msec);
1097int
1098weston_spring_done(struct weston_spring *spring);
1099
1100void
1101weston_surface_activate(struct weston_surface *surface,
Daniel Stone37816df2012-05-16 18:45:18 +01001102 struct weston_seat *seat);
Kristian Høgsberg68c479a2012-01-25 23:32:28 -05001103void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001104notify_motion(struct weston_seat *seat, uint32_t time,
Rob Bradfordc088e2c2013-03-27 15:59:43 +00001105 wl_fixed_t dx, wl_fixed_t dy);
1106void
1107notify_motion_absolute(struct weston_seat *seat, uint32_t time,
1108 wl_fixed_t x, wl_fixed_t y);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001109void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001110notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
Daniel Stone4dbadb12012-05-30 16:31:51 +01001111 enum wl_pointer_button_state state);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001112void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001113notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
Daniel Stone878f0b72012-05-30 16:31:57 +01001114 wl_fixed_t value);
Scott Moreau210d0792012-03-22 10:47:01 -06001115void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001116notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
Daniel Stone1b4e11f2012-06-22 13:21:37 +01001117 enum wl_keyboard_key_state state,
1118 enum weston_key_state_update update_state);
Daniel Stone05d58682012-06-22 13:21:38 +01001119void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001120notify_modifiers(struct weston_seat *seat, uint32_t serial);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001121
1122void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001123notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
Kristian Høgsberge11bbe42012-05-09 12:19:04 -04001124 wl_fixed_t x, wl_fixed_t y);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001125
1126void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001127notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
Daniel Stoned6da09e2012-06-22 13:21:29 +01001128 enum weston_key_state_update update_state);
1129void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001130notify_keyboard_focus_out(struct weston_seat *seat);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001131
1132void
Kristian Høgsbergcb3eaae2012-08-10 09:50:11 -04001133notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
Kristian Høgsberge11bbe42012-05-09 12:19:04 -04001134 wl_fixed_t x, wl_fixed_t y, int touch_type);
Jonas Ådahl1679f232014-04-12 09:39:51 +02001135void
1136notify_touch_frame(struct weston_seat *seat);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001137
1138void
Giulio Camuffo412e6a52014-07-09 22:12:56 +03001139weston_layer_entry_insert(struct weston_layer_entry *list,
1140 struct weston_layer_entry *entry);
1141void
1142weston_layer_entry_remove(struct weston_layer_entry *entry);
1143void
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -05001144weston_layer_init(struct weston_layer *layer, struct wl_list *below);
1145
1146void
Giulio Camuffo95ec0f92014-07-09 22:12:57 +03001147weston_layer_set_mask(struct weston_layer *layer, int x, int y, int width, int height);
1148
1149void
1150weston_layer_set_mask_infinite(struct weston_layer *layer);
1151
1152void
Xiong Zhang97116532013-10-23 13:58:31 +08001153weston_plane_init(struct weston_plane *plane,
1154 struct weston_compositor *ec,
1155 int32_t x, int32_t y);
Kristian Høgsberg65a11e12012-08-03 11:30:18 -04001156void
1157weston_plane_release(struct weston_plane *plane);
1158
1159void
Ander Conselvan de Oliveira8ad19822013-03-05 17:30:27 +02001160weston_compositor_stack_plane(struct weston_compositor *ec,
1161 struct weston_plane *plane,
1162 struct weston_plane *above);
1163
Pekka Paalanen363aa7b2014-12-17 16:20:40 +02001164/* An invalid flag in presented_flags to catch logic errors. */
1165#define PRESENTATION_FEEDBACK_INVALID (1U << 31)
1166
Ander Conselvan de Oliveira8ad19822013-03-05 17:30:27 +02001167void
Pekka Paalanenb5eedad2014-09-23 22:08:45 -04001168weston_output_finish_frame(struct weston_output *output,
Pekka Paalanen363aa7b2014-12-17 16:20:40 +02001169 const struct timespec *stamp,
1170 uint32_t presented_flags);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001171void
Kristian Høgsberg49952d12012-06-20 00:35:59 -04001172weston_output_schedule_repaint(struct weston_output *output);
1173void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001174weston_output_damage(struct weston_output *output);
1175void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001176weston_compositor_schedule_repaint(struct weston_compositor *compositor);
1177void
1178weston_compositor_fade(struct weston_compositor *compositor, float tint);
1179void
1180weston_compositor_damage_all(struct weston_compositor *compositor);
1181void
1182weston_compositor_unlock(struct weston_compositor *compositor);
1183void
1184weston_compositor_wake(struct weston_compositor *compositor);
1185void
Philipp Brüschweiler57edf7f2013-03-29 13:01:56 +01001186weston_compositor_offscreen(struct weston_compositor *compositor);
1187void
Ander Conselvan de Oliveira87524b62013-02-21 18:35:22 +02001188weston_compositor_sleep(struct weston_compositor *compositor);
Jason Ekstranda7af7042013-10-12 22:38:11 -05001189struct weston_view *
1190weston_compositor_pick_view(struct weston_compositor *compositor,
1191 wl_fixed_t x, wl_fixed_t y,
1192 wl_fixed_t *sx, wl_fixed_t *sy);
Ander Conselvan de Oliveira30eebc72012-02-15 17:02:57 +02001193
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001194
1195struct weston_binding;
Derek Foreman8ae2db52015-07-15 13:00:36 -05001196typedef void (*weston_key_binding_handler_t)(struct weston_keyboard *keyboard,
Daniel Stone325fc2d2012-05-30 16:31:58 +01001197 uint32_t time, uint32_t key,
1198 void *data);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001199struct weston_binding *
Daniel Stone325fc2d2012-05-30 16:31:58 +01001200weston_compositor_add_key_binding(struct weston_compositor *compositor,
1201 uint32_t key,
1202 enum weston_keyboard_modifier modifier,
1203 weston_key_binding_handler_t binding,
1204 void *data);
1205
Derek Foreman8ae2db52015-07-15 13:00:36 -05001206typedef void (*weston_modifier_binding_handler_t)(struct weston_keyboard *keyboard,
Daniel Stone96d47c02013-11-19 11:37:12 +01001207 enum weston_keyboard_modifier modifier,
1208 void *data);
1209struct weston_binding *
1210weston_compositor_add_modifier_binding(struct weston_compositor *compositor,
1211 enum weston_keyboard_modifier modifier,
1212 weston_modifier_binding_handler_t binding,
1213 void *data);
1214
Derek Foreman8ae2db52015-07-15 13:00:36 -05001215typedef void (*weston_button_binding_handler_t)(struct weston_pointer *pointer,
Daniel Stone325fc2d2012-05-30 16:31:58 +01001216 uint32_t time, uint32_t button,
1217 void *data);
1218struct weston_binding *
1219weston_compositor_add_button_binding(struct weston_compositor *compositor,
1220 uint32_t button,
1221 enum weston_keyboard_modifier modifier,
1222 weston_button_binding_handler_t binding,
1223 void *data);
1224
Derek Foreman8ae2db52015-07-15 13:00:36 -05001225typedef void (*weston_touch_binding_handler_t)(struct weston_touch *touch,
Neil Robertsa28c6932013-10-03 16:43:04 +01001226 uint32_t time,
1227 void *data);
1228struct weston_binding *
1229weston_compositor_add_touch_binding(struct weston_compositor *compositor,
1230 enum weston_keyboard_modifier modifier,
1231 weston_touch_binding_handler_t binding,
1232 void *data);
1233
Derek Foreman8ae2db52015-07-15 13:00:36 -05001234typedef void (*weston_axis_binding_handler_t)(struct weston_pointer *pointer,
Daniel Stone325fc2d2012-05-30 16:31:58 +01001235 uint32_t time, uint32_t axis,
Daniel Stone0c1e46e2012-05-30 16:31:59 +01001236 wl_fixed_t value, void *data);
Daniel Stone325fc2d2012-05-30 16:31:58 +01001237struct weston_binding *
1238weston_compositor_add_axis_binding(struct weston_compositor *compositor,
1239 uint32_t axis,
1240 enum weston_keyboard_modifier modifier,
1241 weston_axis_binding_handler_t binding,
1242 void *data);
Ander Conselvan de Oliveirac509d2b2012-11-08 17:20:45 +02001243struct weston_binding *
1244weston_compositor_add_debug_binding(struct weston_compositor *compositor,
1245 uint32_t key,
1246 weston_key_binding_handler_t binding,
1247 void *data);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001248void
1249weston_binding_destroy(struct weston_binding *binding);
1250
1251void
Pekka Paalanen2829f7c2015-02-19 17:02:13 +02001252weston_install_debug_key_binding(struct weston_compositor *compositor,
1253 uint32_t mod);
1254
1255void
Kristian Høgsberg3466bc82012-01-03 11:29:15 -05001256weston_binding_list_destroy_all(struct wl_list *list);
1257
Pekka Paalanen86b53962014-11-19 13:43:32 +02001258void
Daniel Stone325fc2d2012-05-30 16:31:58 +01001259weston_compositor_run_key_binding(struct weston_compositor *compositor,
Derek Foreman99a6a2d2015-07-15 13:00:43 -05001260 struct weston_keyboard *keyboard,
1261 uint32_t time,
Daniel Stone325fc2d2012-05-30 16:31:58 +01001262 uint32_t key,
1263 enum wl_keyboard_key_state state);
Daniel Stone96d47c02013-11-19 11:37:12 +01001264
1265void
1266weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
Derek Foreman99a6a2d2015-07-15 13:00:43 -05001267 struct weston_keyboard *keyboard,
Daniel Stone96d47c02013-11-19 11:37:12 +01001268 enum weston_keyboard_modifier modifier,
1269 enum wl_keyboard_key_state state);
Daniel Stone325fc2d2012-05-30 16:31:58 +01001270void
1271weston_compositor_run_button_binding(struct weston_compositor *compositor,
Derek Foreman99a6a2d2015-07-15 13:00:43 -05001272 struct weston_pointer *pointer, uint32_t time,
Daniel Stone325fc2d2012-05-30 16:31:58 +01001273 uint32_t button,
1274 enum wl_pointer_button_state value);
Neil Robertsa28c6932013-10-03 16:43:04 +01001275void
1276weston_compositor_run_touch_binding(struct weston_compositor *compositor,
Derek Foreman99a6a2d2015-07-15 13:00:43 -05001277 struct weston_touch *touch, uint32_t time,
Neil Robertsa28c6932013-10-03 16:43:04 +01001278 int touch_type);
Rune K. Svendsen14b2fe72013-03-07 21:50:00 +01001279int
Daniel Stone325fc2d2012-05-30 16:31:58 +01001280weston_compositor_run_axis_binding(struct weston_compositor *compositor,
Derek Foreman99a6a2d2015-07-15 13:00:43 -05001281 struct weston_pointer *pointer, uint32_t time,
Daniel Stone325fc2d2012-05-30 16:31:58 +01001282 uint32_t axis, int32_t value);
Ander Conselvan de Oliveirac509d2b2012-11-08 17:20:45 +02001283int
1284weston_compositor_run_debug_binding(struct weston_compositor *compositor,
Derek Foreman99a6a2d2015-07-15 13:00:43 -05001285 struct weston_keyboard *keyboard, uint32_t time,
Ander Conselvan de Oliveirac509d2b2012-11-08 17:20:45 +02001286 uint32_t key,
1287 enum wl_keyboard_key_state state);
Daniel Stone325fc2d2012-05-30 16:31:58 +01001288
Giulio Camuffocdb4d292013-11-14 23:42:53 +01001289void
1290weston_compositor_set_default_pointer_grab(struct weston_compositor *compositor,
1291 const struct weston_pointer_grab_interface *interface);
1292
Benjamin Franzkebfeda132012-01-30 14:04:04 +01001293int
1294weston_environment_get_fd(const char *env);
1295
Kristian Høgsberga82c4862012-01-26 01:03:58 -05001296struct wl_list *
1297weston_compositor_top(struct weston_compositor *compositor);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001298
1299struct weston_surface *
Kristian Høgsberg18c93002012-01-27 11:58:31 -05001300weston_surface_create(struct weston_compositor *compositor);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001301
Jason Ekstranda7af7042013-10-12 22:38:11 -05001302struct weston_view *
1303weston_view_create(struct weston_surface *surface);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001304
1305void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001306weston_view_destroy(struct weston_view *view);
Kristian Høgsberg3be2ce92012-02-29 12:42:35 -05001307
1308void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001309weston_view_set_position(struct weston_view *view,
1310 float x, float y);
1311
1312void
1313weston_view_set_transform_parent(struct weston_view *view,
1314 struct weston_view *parent);
1315
Pekka Paalanen380adf52015-02-16 14:39:11 +02001316void
1317weston_view_set_mask(struct weston_view *view,
1318 int x, int y, int width, int height);
1319
1320void
1321weston_view_set_mask_infinite(struct weston_view *view);
1322
Derek Foreman280e7dd2014-10-03 13:13:42 -05001323bool
Jason Ekstranda7af7042013-10-12 22:38:11 -05001324weston_view_is_mapped(struct weston_view *view);
1325
1326void
1327weston_view_schedule_repaint(struct weston_view *view);
Pekka Paalanen483243f2013-03-08 14:56:50 +02001328
Derek Foreman280e7dd2014-10-03 13:13:42 -05001329bool
Ander Conselvan de Oliveirab8ab14f2012-03-27 17:36:36 +03001330weston_surface_is_mapped(struct weston_surface *surface);
1331
Derek Foremand1be3122014-09-18 16:46:49 -05001332void
Jason Ekstrand5c11a332013-12-04 20:32:03 -06001333weston_surface_set_size(struct weston_surface *surface,
1334 int32_t width, int32_t height);
1335
Pekka Paalanen8fb8d3b2012-02-13 13:03:59 +02001336void
Kristian Høgsberg98238702012-08-03 16:29:12 -04001337weston_surface_schedule_repaint(struct weston_surface *surface);
1338
1339void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001340weston_surface_damage(struct weston_surface *surface);
1341
1342void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001343weston_view_damage_below(struct weston_view *view);
Kristian Høgsbergd8bf90c2012-02-23 23:03:14 -05001344
1345void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001346weston_view_move_to_plane(struct weston_view *view,
1347 struct weston_plane *plane);
1348void
1349weston_view_unmap(struct weston_view *view);
1350
Kristian Høgsberg65a11e12012-08-03 11:30:18 -04001351void
Kristian Høgsbergaf7b1ff2012-06-26 21:19:23 -04001352weston_surface_unmap(struct weston_surface *surface);
1353
Pekka Paalanen01388e22013-04-25 13:57:44 +03001354struct weston_surface *
1355weston_surface_get_main_surface(struct weston_surface *surface);
1356
Pekka Paalanen50b67472014-10-01 15:02:41 +03001357int
1358weston_surface_set_role(struct weston_surface *surface,
1359 const char *role_name,
1360 struct wl_resource *error_resource,
1361 uint32_t error_code);
1362
Pekka Paalanen8274d902014-08-06 19:36:51 +03001363void
1364weston_surface_set_label_func(struct weston_surface *surface,
1365 int (*desc)(struct weston_surface *,
1366 char *, size_t));
1367
Pekka Paalanenc647ed72015-02-09 13:16:57 +02001368void
1369weston_surface_get_content_size(struct weston_surface *surface,
1370 int *width, int *height);
1371
1372int
1373weston_surface_copy_content(struct weston_surface *surface,
1374 void *target, size_t size,
1375 int src_x, int src_y,
1376 int width, int height);
1377
Jason Ekstrand6bd62942013-06-20 20:38:23 -05001378struct weston_buffer *
1379weston_buffer_from_resource(struct wl_resource *resource);
1380
Kristian Høgsbergaf7b1ff2012-06-26 21:19:23 -04001381void
Pekka Paalanende685b82012-12-04 15:58:12 +02001382weston_buffer_reference(struct weston_buffer_reference *ref,
Jason Ekstrand6bd62942013-06-20 20:38:23 -05001383 struct weston_buffer *buffer);
Pekka Paalanende685b82012-12-04 15:58:12 +02001384
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001385uint32_t
1386weston_compositor_get_time(void);
1387
Giulio Camuffo459137b2014-10-11 23:56:24 +03001388void
1389weston_compositor_destroy(struct weston_compositor *ec);
1390struct weston_compositor *
1391weston_compositor_create(struct wl_display *display, void *user_data);
1392void
1393weston_compositor_exit(struct weston_compositor *ec);
1394void *
1395weston_compositor_get_user_data(struct weston_compositor *compositor);
Pekka Paalanenb5eedad2014-09-23 22:08:45 -04001396int
1397weston_compositor_set_presentation_clock(struct weston_compositor *compositor,
1398 clockid_t clk_id);
1399int
1400weston_compositor_set_presentation_clock_software(
1401 struct weston_compositor *compositor);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001402void
Pekka Paalanen662f3842015-03-18 12:17:26 +02001403weston_compositor_read_presentation_clock(
1404 const struct weston_compositor *compositor,
1405 struct timespec *ts);
1406
Pekka Paalanen230f3b12014-09-29 14:18:40 -04001407bool
1408weston_compositor_import_dmabuf(struct weston_compositor *compositor,
1409 struct linux_dmabuf_buffer *buffer);
1410
Pekka Paalanen662f3842015-03-18 12:17:26 +02001411void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001412weston_compositor_shutdown(struct weston_compositor *ec);
1413void
Frederic Plourdec336f062014-10-29 14:44:33 -04001414weston_compositor_exit_with_code(struct weston_compositor *compositor,
1415 int exit_code);
1416void
Scott Moreau429490d2012-06-17 18:10:59 -06001417weston_output_init_zoom(struct weston_output *output);
1418void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001419weston_output_update_zoom(struct weston_output *output);
Scott Moreauccbf29d2012-02-22 14:21:41 -07001420void
Derek Foreman22276a52015-07-23 14:55:15 -05001421weston_output_activate_zoom(struct weston_output *output,
1422 struct weston_seat *seat);
Giulio Camuffo412b0242013-11-14 23:42:51 +01001423void
Scott Moreauccbf29d2012-02-22 14:21:41 -07001424weston_output_update_matrix(struct weston_output *output);
1425void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001426weston_output_move(struct weston_output *output, int x, int y);
1427void
1428weston_output_init(struct weston_output *output, struct weston_compositor *c,
Alexander Larssonedddbd12013-05-24 13:09:43 +02001429 int x, int y, int width, int height, uint32_t transform, int32_t scale);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001430void
Giulio Camuffob1147152015-05-06 21:41:57 +03001431weston_compositor_add_output(struct weston_compositor *compositor,
1432 struct weston_output *output);
1433void
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001434weston_output_destroy(struct weston_output *output);
Kristian Høgsberg98c774f2013-07-22 14:33:42 -07001435void
Jason Ekstrandb6a3cc72013-10-27 22:25:00 -05001436weston_output_transform_coordinate(struct weston_output *output,
1437 wl_fixed_t device_x, wl_fixed_t device_y,
Kristian Høgsberg98c774f2013-07-22 14:33:42 -07001438 wl_fixed_t *x, wl_fixed_t *y);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001439
1440void
Rob Bradford9af5f9e2013-05-31 18:09:50 +01001441weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
1442 const char *seat_name);
Daniel Stone74419a22012-05-30 16:32:02 +01001443void
1444weston_seat_init_pointer(struct weston_seat *seat);
Jonas Ådahld6e1c342013-10-17 23:04:05 +02001445void
1446weston_seat_release_pointer(struct weston_seat *seat);
Kristian Høgsberg2f07ef62013-02-16 14:29:24 -05001447int
Daniel Stonebb1df6a2012-05-30 16:32:06 +01001448weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap);
Daniel Stone74419a22012-05-30 16:32:02 +01001449void
Jonas Ådahld6e1c342013-10-17 23:04:05 +02001450weston_seat_release_keyboard(struct weston_seat *seat);
1451void
Daniel Stone74419a22012-05-30 16:32:02 +01001452weston_seat_init_touch(struct weston_seat *seat);
Kristian Høgsbergb5e26102013-04-18 15:40:10 -04001453void
Jonas Ådahld6e1c342013-10-17 23:04:05 +02001454weston_seat_release_touch(struct weston_seat *seat);
1455void
Kristian Høgsberga71e8b22013-05-06 21:51:21 -04001456weston_seat_repick(struct weston_seat *seat);
Rui Matos65196bc2013-10-10 19:44:19 +02001457void
1458weston_seat_update_keymap(struct weston_seat *seat, struct xkb_keymap *keymap);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001459
1460void
Daniel Stone37816df2012-05-16 18:45:18 +01001461weston_seat_release(struct weston_seat *seat);
Kristian Høgsbergb5e26102013-04-18 15:40:10 -04001462int
1463weston_compositor_xkb_init(struct weston_compositor *ec,
1464 struct xkb_rule_names *names);
1465void
1466weston_compositor_xkb_destroy(struct weston_compositor *ec);
Kristian Høgsberg3466bc82012-01-03 11:29:15 -05001467
Kristian Høgsberg64eca892012-08-01 00:00:57 -04001468/* String literal of spaces, the same width as the timestamp. */
1469#define STAMP_SPACE " "
1470
1471void
1472weston_log_file_open(const char *filename);
1473void
1474weston_log_file_close(void);
1475int
Kristian Høgsberg082d58c2013-06-18 01:00:27 -04001476weston_vlog(const char *fmt, va_list ap);
1477int
1478weston_vlog_continue(const char *fmt, va_list ap);
1479int
Pekka Paalanend525b562012-08-06 14:57:04 +03001480weston_log(const char *fmt, ...)
1481 __attribute__ ((format (printf, 1, 2)));
Kristian Høgsberg64eca892012-08-01 00:00:57 -04001482int
Pekka Paalanend525b562012-08-06 14:57:04 +03001483weston_log_continue(const char *fmt, ...)
1484 __attribute__ ((format (printf, 1, 2)));
Kristian Høgsberg64eca892012-08-01 00:00:57 -04001485
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001486enum {
1487 TTY_ENTER_VT,
1488 TTY_LEAVE_VT
1489};
1490
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001491struct tty *
Kristian Høgsberg61741a22013-09-17 16:02:57 -07001492tty_create(struct weston_compositor *compositor, int tty_nr);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001493
1494void
1495tty_destroy(struct tty *tty);
1496
Kristian Høgsberg7b884bc2012-07-31 14:32:01 -04001497void
1498tty_reset(struct tty *tty);
1499
Kristian Høgsberg5d1c0c52012-04-10 00:11:50 -04001500int
1501tty_activate_vt(struct tty *tty, int vt);
1502
Kristian Høgsberg3466bc82012-01-03 11:29:15 -05001503void
Kristian Høgsberg02e79dc2012-04-12 09:55:26 -04001504screenshooter_create(struct weston_compositor *ec);
Kristian Høgsberg3466bc82012-01-03 11:29:15 -05001505
Giulio Camuffoe9022e72013-12-11 23:45:11 +01001506enum weston_screenshooter_outcome {
1507 WESTON_SCREENSHOOTER_SUCCESS,
1508 WESTON_SCREENSHOOTER_NO_MEMORY,
1509 WESTON_SCREENSHOOTER_BAD_BUFFER
1510};
1511
1512typedef void (*weston_screenshooter_done_func_t)(void *data,
1513 enum weston_screenshooter_outcome outcome);
1514int
1515weston_screenshooter_shoot(struct weston_output *output, struct weston_buffer *buffer,
1516 weston_screenshooter_done_func_t done, void *data);
1517
Kristian Høgsberga7ceaff2012-06-03 10:20:13 -04001518struct clipboard *
1519clipboard_create(struct weston_seat *seat);
1520
Pekka Paalanenaa9536a2015-06-24 16:09:17 +03001521struct text_backend;
1522
1523struct text_backend *
Jan Arne Petersen674fd1d2012-11-18 19:06:42 +01001524text_backend_init(struct weston_compositor *ec);
Jan Arne Petersen1f17be42012-06-21 21:52:18 +02001525
Pekka Paalanenaa9536a2015-06-24 16:09:17 +03001526void
1527text_backend_destroy(struct text_backend *text_backend);
1528
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001529struct weston_process;
1530typedef void (*weston_process_cleanup_func_t)(struct weston_process *process,
1531 int status);
1532
1533struct weston_process {
1534 pid_t pid;
1535 weston_process_cleanup_func_t cleanup;
1536 struct wl_list link;
1537};
1538
1539struct wl_client *
1540weston_client_launch(struct weston_compositor *compositor,
1541 struct weston_process *proc,
1542 const char *path,
1543 weston_process_cleanup_func_t cleanup);
1544
Pekka Paalanen9c1ac7b2014-08-27 12:03:38 +03001545struct wl_client *
1546weston_client_start(struct weston_compositor *compositor, const char *path);
1547
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001548void
1549weston_watch_process(struct weston_process *process);
1550
Jason Ekstranda7af7042013-10-12 22:38:11 -05001551struct weston_view_animation;
1552typedef void (*weston_view_animation_done_func_t)(struct weston_view_animation *animation, void *data);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001553
Louis-Francis Ratté-Boulianneb482dbd2013-11-19 11:37:11 +01001554void
1555weston_view_animation_destroy(struct weston_view_animation *animation);
1556
Jason Ekstranda7af7042013-10-12 22:38:11 -05001557struct weston_view_animation *
1558weston_zoom_run(struct weston_view *view, float start, float stop,
1559 weston_view_animation_done_func_t done, void *data);
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001560
Jason Ekstranda7af7042013-10-12 22:38:11 -05001561struct weston_view_animation *
1562weston_fade_run(struct weston_view *view,
Ander Conselvan de Oliveiraee416052013-02-21 18:35:17 +02001563 float start, float end, float k,
Jason Ekstranda7af7042013-10-12 22:38:11 -05001564 weston_view_animation_done_func_t done, void *data);
Daniel Stonea67e6b92013-11-19 11:37:13 +01001565
1566struct weston_view_animation *
1567weston_move_scale_run(struct weston_view *view, int dx, int dy,
1568 float start, float end, int reverse,
1569 weston_view_animation_done_func_t done, void *data);
1570
Ander Conselvan de Oliveiraee416052013-02-21 18:35:17 +02001571void
Jason Ekstranda7af7042013-10-12 22:38:11 -05001572weston_fade_update(struct weston_view_animation *fade, float target);
Ander Conselvan de Oliveiraee416052013-02-21 18:35:17 +02001573
Jason Ekstranda7af7042013-10-12 22:38:11 -05001574struct weston_view_animation *
Louis-Francis Ratté-Boulianneb482dbd2013-11-19 11:37:11 +01001575weston_stable_fade_run(struct weston_view *front_view, float start,
1576 struct weston_view *back_view, float end,
1577 weston_view_animation_done_func_t done, void *data);
1578
1579struct weston_view_animation *
Jason Ekstranda7af7042013-10-12 22:38:11 -05001580weston_slide_run(struct weston_view *view, float start, float stop,
1581 weston_view_animation_done_func_t done, void *data);
Juan Zhaoe10d2792012-04-25 19:09:52 +08001582
Alex Wu8811bf92012-02-28 18:07:54 +08001583void
1584weston_surface_set_color(struct weston_surface *surface,
John Kåre Alsaker490d02a2012-09-30 02:57:21 +02001585 float red, float green, float blue, float alpha);
Alex Wu8811bf92012-02-28 18:07:54 +08001586
1587void
1588weston_surface_destroy(struct weston_surface *surface);
1589
Alex Wu2dda6042012-04-17 17:20:47 +08001590int
Derek Foreman6ae7bc92014-11-04 10:47:33 -06001591weston_output_mode_set_native(struct weston_output *output,
1592 struct weston_mode *mode,
1593 int32_t scale);
1594int
1595weston_output_mode_switch_to_temporary(struct weston_output *output,
1596 struct weston_mode *mode,
1597 int32_t scale);
1598int
1599weston_output_mode_switch_to_native(struct weston_output *output);
Alex Wu2dda6042012-04-17 17:20:47 +08001600
Ander Conselvan de Oliveira11f8d402012-10-29 18:19:24 +02001601int
1602noop_renderer_init(struct weston_compositor *ec);
Ander Conselvan de Oliveira11f8d402012-10-29 18:19:24 +02001603
Giulio Camuffo954f1832014-10-11 18:27:30 +03001604int
1605backend_init(struct weston_compositor *c,
1606 int *argc, char *argv[],
Giulio Camuffo93daabb2015-10-17 19:24:14 +03001607 struct weston_config *config,
1608 struct weston_backend_config *config_base);
Kristian Høgsbergb00a9d32012-09-11 14:06:27 -04001609int
Kristian Høgsbergcb4685b2013-02-20 15:37:49 -05001610module_init(struct weston_compositor *compositor,
Ossama Othmana50e6e42013-05-14 09:48:26 -07001611 int *argc, char *argv[]);
Kristian Høgsbergb00a9d32012-09-11 14:06:27 -04001612
Ander Conselvan de Oliveira409eebf2012-12-05 15:14:04 +02001613void
1614weston_transformed_coord(int width, int height,
1615 enum wl_output_transform transform,
Alexander Larssonedddbd12013-05-24 13:09:43 +02001616 int32_t scale,
Ander Conselvan de Oliveira409eebf2012-12-05 15:14:04 +02001617 float sx, float sy, float *bx, float *by);
1618pixman_box32_t
1619weston_transformed_rect(int width, int height,
1620 enum wl_output_transform transform,
Alexander Larssonedddbd12013-05-24 13:09:43 +02001621 int32_t scale,
Ander Conselvan de Oliveira409eebf2012-12-05 15:14:04 +02001622 pixman_box32_t rect);
Jason Ekstrand33ff6362013-10-27 22:25:01 -05001623void
1624weston_transformed_region(int width, int height,
1625 enum wl_output_transform transform,
1626 int32_t scale,
1627 pixman_region32_t *src, pixman_region32_t *dest);
Ander Conselvan de Oliveira409eebf2012-12-05 15:14:04 +02001628
Ander Conselvan de Oliveira97f29522013-10-14 15:57:11 +03001629void *
1630weston_load_module(const char *name, const char *entrypoint);
1631
Derek Foreman64a3df02014-10-23 12:24:18 -05001632int
1633weston_parse_transform(const char *transform, uint32_t *out);
1634
1635const char *
1636weston_transform_to_string(uint32_t output_transform);
1637
Derek Foreman1281a362015-07-31 16:55:32 -05001638struct weston_keyboard *
1639weston_seat_get_keyboard(struct weston_seat *seat);
1640
1641struct weston_pointer *
1642weston_seat_get_pointer(struct weston_seat *seat);
1643
1644struct weston_touch *
1645weston_seat_get_touch(struct weston_seat *seat);
1646
Giulio Camuffo7fe01b12013-03-28 18:02:42 +01001647#ifdef __cplusplus
1648}
1649#endif
1650
Kristian Høgsberg8334bc12012-01-03 10:29:47 -05001651#endif