blob: 6921d7d6e3b23405d58fd5c06bc0055b07fb9b04 [file] [log] [blame]
Marius Vlada72e3712019-07-10 13:46:39 +03001/*
2 * Copyright © 2008-2011 Kristian Høgsberg
3 * Copyright © 2017, 2018 General Electric Company
4 * Copyright © 2012, 2017-2019 Collabora, Ltd.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial
16 * portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
28#ifndef LIBWESTON_INTERNAL_H
29#define LIBWESTON_INTERNAL_H
30
31/*
32 * This is the internal (private) part of libweston. All symbols found here
33 * are, and should be only (with a few exceptions) used within the internal
34 * parts of libweston. Notable exception(s) include a few files in tests/ that
35 * need access to these functions, screen-share file from compositor/ and those
36 * remoting/. Those will require some further fixing as to avoid including this
37 * private header.
38 *
39 * Eventually, these symbols should reside naturally into their own scope. New
40 * features should either provide their own (internal) header or use this one.
41 */
42
43
44/* weston_buffer */
45
46void
47weston_buffer_send_server_error(struct weston_buffer *buffer,
48 const char *msg);
49void
50weston_buffer_reference(struct weston_buffer_reference *ref,
51 struct weston_buffer *buffer);
52
53void
54weston_buffer_release_move(struct weston_buffer_release_reference *dest,
55 struct weston_buffer_release_reference *src);
56
57void
58weston_buffer_release_reference(struct weston_buffer_release_reference *ref,
59 struct weston_buffer_release *buf_release);
60
Marius Vlad56f3a682019-07-10 14:48:39 +030061/* weston_bindings */
62void
Marius Vlad56f3a682019-07-10 14:48:39 +030063weston_binding_list_destroy_all(struct wl_list *list);
64
65/* weston_compositor */
66
67void
68touch_calibrator_mode_changed(struct weston_compositor *compositor);
69
70int
71noop_renderer_init(struct weston_compositor *ec);
72
73void
74weston_compositor_add_head(struct weston_compositor *compositor,
75 struct weston_head *head);
76void
77weston_compositor_add_pending_output(struct weston_output *output,
78 struct weston_compositor *compositor);
Marius Vlad56f3a682019-07-10 14:48:39 +030079bool
80weston_compositor_import_dmabuf(struct weston_compositor *compositor,
81 struct linux_dmabuf_buffer *buffer);
Marius Vlad5a701542019-11-16 20:26:52 +020082bool
83weston_compositor_dmabuf_can_scanout(struct weston_compositor *compositor,
84 struct linux_dmabuf_buffer *buffer);
Marius Vlad56f3a682019-07-10 14:48:39 +030085void
86weston_compositor_offscreen(struct weston_compositor *compositor);
87
88char *
89weston_compositor_print_scene_graph(struct weston_compositor *ec);
90
91void
92weston_compositor_read_presentation_clock(
93 const struct weston_compositor *compositor,
94 struct timespec *ts);
95
96int
97weston_compositor_run_axis_binding(struct weston_compositor *compositor,
98 struct weston_pointer *pointer,
99 const struct timespec *time,
100 struct weston_pointer_axis_event *event);
101void
102weston_compositor_run_button_binding(struct weston_compositor *compositor,
103 struct weston_pointer *pointer,
104 const struct timespec *time,
105 uint32_t button,
106 enum wl_pointer_button_state value);
107int
108weston_compositor_run_debug_binding(struct weston_compositor *compositor,
109 struct weston_keyboard *keyboard,
110 const struct timespec *time,
111 uint32_t key,
112 enum wl_keyboard_key_state state);
113void
114weston_compositor_run_key_binding(struct weston_compositor *compositor,
115 struct weston_keyboard *keyboard,
116 const struct timespec *time,
117 uint32_t key,
118 enum wl_keyboard_key_state state);
119void
120weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
121 struct weston_keyboard *keyboard,
122 enum weston_keyboard_modifier modifier,
123 enum wl_keyboard_key_state state);
124void
125weston_compositor_run_touch_binding(struct weston_compositor *compositor,
126 struct weston_touch *touch,
127 const struct timespec *time,
128 int touch_type);
129void
130weston_compositor_stack_plane(struct weston_compositor *ec,
131 struct weston_plane *plane,
132 struct weston_plane *above);
133void
134weston_compositor_set_touch_mode_normal(struct weston_compositor *compositor);
135
136void
137weston_compositor_set_touch_mode_calib(struct weston_compositor *compositor);
138
139int
140weston_compositor_set_presentation_clock(struct weston_compositor *compositor,
141 clockid_t clk_id);
142int
143weston_compositor_set_presentation_clock_software(
144 struct weston_compositor *compositor);
145void
146weston_compositor_shutdown(struct weston_compositor *ec);
147
148void
149weston_compositor_xkb_destroy(struct weston_compositor *ec);
150
151int
152weston_input_init(struct weston_compositor *compositor);
153
Ankit Nautiyal93dde242019-07-08 11:46:42 +0530154/* weston_output */
155
156void
157weston_output_disable_planes_incr(struct weston_output *output);
158
159void
160weston_output_disable_planes_decr(struct weston_output *output);
161
Marius Vlad58cac082019-07-10 16:29:05 +0300162/* weston_plane */
163
164void
165weston_plane_init(struct weston_plane *plane,
166 struct weston_compositor *ec,
167 int32_t x, int32_t y);
168void
169weston_plane_release(struct weston_plane *plane);
Marius Vlad0bf3f5a2019-07-10 17:32:42 +0300170
171/* weston_seat */
172
173struct clipboard *
174clipboard_create(struct weston_seat *seat);
175
176void
177weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
178 const char *seat_name);
179
180void
181weston_seat_repick(struct weston_seat *seat);
182
183void
184weston_seat_release(struct weston_seat *seat);
185
186void
187weston_seat_send_selection(struct weston_seat *seat, struct wl_client *client);
188
189void
190weston_seat_init_pointer(struct weston_seat *seat);
191
192int
193weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap);
194
195void
196weston_seat_init_touch(struct weston_seat *seat);
197
198void
199weston_seat_release_keyboard(struct weston_seat *seat);
200
201void
202weston_seat_release_pointer(struct weston_seat *seat);
203
204void
205weston_seat_release_touch(struct weston_seat *seat);
206
207void
208weston_seat_update_keymap(struct weston_seat *seat, struct xkb_keymap *keymap);
209
210void
211wl_data_device_set_keyboard_focus(struct weston_seat *seat);
212
Marius Vlad9eb20642019-07-10 18:23:43 +0300213/* weston_pointer */
214
215void
216weston_pointer_clamp(struct weston_pointer *pointer,
217 wl_fixed_t *fx, wl_fixed_t *fy);
218void
219weston_pointer_set_default_grab(struct weston_pointer *pointer,
220 const struct weston_pointer_grab_interface *interface);
221
222void
223weston_pointer_constraint_destroy(struct weston_pointer_constraint *constraint);
224
225/* weston_keyboard */
226bool
227weston_keyboard_has_focus_resource(struct weston_keyboard *keyboard);
228
229/* weston_touch */
230
231struct weston_touch_device *
232weston_touch_create_touch_device(struct weston_touch *touch,
233 const char *syspath,
234 void *backend_data,
235 const struct weston_touch_device_ops *ops);
236
237void
238weston_touch_device_destroy(struct weston_touch_device *device);
239
240bool
241weston_touch_has_focus_resource(struct weston_touch *touch);
242
243int
244weston_touch_start_drag(struct weston_touch *touch,
245 struct weston_data_source *source,
246 struct weston_surface *icon,
247 struct wl_client *client);
248
249
250/* weston_touch_device */
251
252bool
253weston_touch_device_can_calibrate(struct weston_touch_device *device);
254
Marius Vladf1a65942019-07-10 20:42:45 +0300255/* weston_surface */
256void
257weston_surface_to_buffer_float(struct weston_surface *surface,
258 float x, float y, float *bx, float *by);
259pixman_box32_t
260weston_surface_to_buffer_rect(struct weston_surface *surface,
261 pixman_box32_t rect);
262
263void
264weston_surface_to_buffer_region(struct weston_surface *surface,
265 pixman_region32_t *surface_region,
266 pixman_region32_t *buffer_region);
267void
268weston_surface_schedule_repaint(struct weston_surface *surface);
Marius Vlad4e1d0972019-07-10 20:56:04 +0300269
270/* weston_spring */
271
272void
273weston_spring_init(struct weston_spring *spring,
274 double k, double current, double target);
275int
276weston_spring_done(struct weston_spring *spring);
277
278void
279weston_spring_update(struct weston_spring *spring, const struct timespec *time);
Marius Vlad7e4f58f2019-07-10 21:06:15 +0300280
281/* weston_view */
282
283void
284weston_view_to_global_fixed(struct weston_view *view,
285 wl_fixed_t sx, wl_fixed_t sy,
286 wl_fixed_t *x, wl_fixed_t *y);
287void
288weston_view_from_global_float(struct weston_view *view,
289 float x, float y, float *vx, float *vy);
290bool
291weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region);
292
Marius Vlad5f6bee42019-09-11 16:41:04 +0300293bool
294weston_view_has_valid_buffer(struct weston_view *ev);
295
Marius Vlad47e3d1e2019-09-11 16:53:08 +0300296bool
297weston_view_matches_output_entirely(struct weston_view *ev,
298 struct weston_output *output);
Marius Vlad7e4f58f2019-07-10 21:06:15 +0300299void
300weston_view_move_to_plane(struct weston_view *view,
301 struct weston_plane *plane);
302
Marius Vlad3ff296e2019-07-10 21:27:49 +0300303void
304weston_transformed_coord(int width, int height,
305 enum wl_output_transform transform,
306 int32_t scale,
307 float sx, float sy, float *bx, float *by);
308pixman_box32_t
309weston_transformed_rect(int width, int height,
310 enum wl_output_transform transform,
311 int32_t scale,
312 pixman_box32_t rect);
313void
314weston_transformed_region(int width, int height,
315 enum wl_output_transform transform,
316 int32_t scale,
317 pixman_region32_t *src, pixman_region32_t *dest);
318void
319weston_matrix_transform_region(pixman_region32_t *dest,
320 struct weston_matrix *matrix,
321 pixman_region32_t *src);
322
Marius Vlada9b69b42019-07-10 21:31:20 +0300323/* protected_surface */
324void
325weston_protected_surface_send_event(struct protected_surface *psurface,
326 enum weston_hdcp_protection protection);
327
Leandro Ribeiro78f01922020-12-01 16:39:47 -0300328/* weston_drm_format */
329
330struct weston_drm_format {
331 uint32_t format;
332 struct wl_array modifiers;
333};
334
335struct weston_drm_format_array {
336 struct wl_array arr;
337};
338
339struct weston_drm_format_array *
340weston_drm_format_array_create(void);
341
342void
343weston_drm_format_array_init(struct weston_drm_format_array *formats);
344
345void
346weston_drm_format_array_destroy(struct weston_drm_format_array *formats);
347
348void
349weston_drm_format_array_fini(struct weston_drm_format_array *formats);
350
351int
352weston_drm_format_array_replace(struct weston_drm_format_array *formats,
353 const struct weston_drm_format_array *source_formats);
354
355struct weston_drm_format *
356weston_drm_format_array_add_format(struct weston_drm_format_array *formats,
357 uint32_t format);
358
359void
360weston_drm_format_array_remove_latest_format(struct weston_drm_format_array *formats);
361
362struct weston_drm_format *
363weston_drm_format_array_find_format(const struct weston_drm_format_array *formats,
364 uint32_t format);
365
366bool
367weston_drm_format_array_equal(const struct weston_drm_format_array *formats_A,
368 const struct weston_drm_format_array *formats_B);
369
370int
371weston_drm_format_array_join(struct weston_drm_format_array *formats_A,
372 const struct weston_drm_format_array *formats_B);
373
374struct weston_drm_format_array *
375weston_drm_format_array_intersect(const struct weston_drm_format_array *formats_A,
376 const struct weston_drm_format_array *formats_B);
377
378int
379weston_drm_format_array_subtract(struct weston_drm_format_array *formats_A,
380 const struct weston_drm_format_array *formats_B);
381
382int
383weston_drm_format_add_modifier(struct weston_drm_format *format,
384 uint64_t modifier);
385
386bool
387weston_drm_format_has_modifier(const struct weston_drm_format *format,
388 uint64_t modifier);
389
390const uint64_t *
391weston_drm_format_get_modifiers(const struct weston_drm_format *format,
392 unsigned int *count_out);
393
Marius Vlad0260fed2019-07-11 14:54:46 +0300394/* others */
395int
396wl_data_device_manager_init(struct wl_display *display);
397
Marius Vlada72e3712019-07-10 13:46:39 +0300398#endif