• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
46 void
47 weston_buffer_send_server_error(struct weston_buffer *buffer,
48 				const char *msg);
49 void
50 weston_buffer_reference(struct weston_buffer_reference *ref,
51 			struct weston_buffer *buffer);
52 
53 void
54 weston_buffer_release_move(struct weston_buffer_release_reference *dest,
55 			   struct weston_buffer_release_reference *src);
56 
57 void
58 weston_buffer_release_reference(struct weston_buffer_release_reference *ref,
59 				struct weston_buffer_release *buf_release);
60 
61 /* weston_bindings */
62 void
63 weston_binding_list_destroy_all(struct wl_list *list);
64 
65 /* weston_compositor */
66 
67 void
68 touch_calibrator_mode_changed(struct weston_compositor *compositor);
69 
70 // OHOS remove noop
71 // int
72 // noop_renderer_init(struct weston_compositor *ec);
73 
74 void
75 weston_compositor_add_head(struct weston_compositor *compositor,
76 			   struct weston_head *head);
77 void
78 weston_compositor_add_pending_output(struct weston_output *output,
79 				     struct weston_compositor *compositor);
80 bool
81 weston_compositor_import_dmabuf(struct weston_compositor *compositor,
82 				struct linux_dmabuf_buffer *buffer);
83 bool
84 weston_compositor_dmabuf_can_scanout(struct weston_compositor *compositor,
85 					struct linux_dmabuf_buffer *buffer);
86 void
87 weston_compositor_offscreen(struct weston_compositor *compositor);
88 
89 // OHOS remove logger
90 // char *
91 // weston_compositor_print_scene_graph(struct weston_compositor *ec);
92 
93 void
94 weston_compositor_read_presentation_clock(
95 			const struct weston_compositor *compositor,
96 			struct timespec *ts);
97 
98 int
99 weston_compositor_run_axis_binding(struct weston_compositor *compositor,
100 				   struct weston_pointer *pointer,
101 				   const struct timespec *time,
102 				   struct weston_pointer_axis_event *event);
103 void
104 weston_compositor_run_button_binding(struct weston_compositor *compositor,
105 				     struct weston_pointer *pointer,
106 				     const struct timespec *time,
107 				     uint32_t button,
108 				     enum wl_pointer_button_state value);
109 int
110 weston_compositor_run_debug_binding(struct weston_compositor *compositor,
111 				    struct weston_keyboard *keyboard,
112 				    const struct timespec *time,
113 				    uint32_t key,
114 				    enum wl_keyboard_key_state state);
115 void
116 weston_compositor_run_key_binding(struct weston_compositor *compositor,
117 				  struct weston_keyboard *keyboard,
118 				  const struct timespec *time,
119 				  uint32_t key,
120 				  enum wl_keyboard_key_state state);
121 void
122 weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
123 				       struct weston_keyboard *keyboard,
124 				       enum weston_keyboard_modifier modifier,
125 				       enum wl_keyboard_key_state state);
126 void
127 weston_compositor_run_touch_binding(struct weston_compositor *compositor,
128 				    struct weston_touch *touch,
129 				    const struct timespec *time,
130 				    int touch_type);
131 void
132 weston_compositor_stack_plane(struct weston_compositor *ec,
133 			      struct weston_plane *plane,
134 			      struct weston_plane *above);
135 void
136 weston_compositor_set_touch_mode_normal(struct weston_compositor *compositor);
137 
138 void
139 weston_compositor_set_touch_mode_calib(struct weston_compositor *compositor);
140 
141 int
142 weston_compositor_set_presentation_clock(struct weston_compositor *compositor,
143 					 clockid_t clk_id);
144 int
145 weston_compositor_set_presentation_clock_software(
146 					struct weston_compositor *compositor);
147 void
148 weston_compositor_shutdown(struct weston_compositor *ec);
149 
150 void
151 weston_compositor_xkb_destroy(struct weston_compositor *ec);
152 
153 int
154 weston_input_init(struct weston_compositor *compositor);
155 
156 /* weston_output */
157 
158 void
159 weston_output_disable_planes_incr(struct weston_output *output);
160 
161 void
162 weston_output_disable_planes_decr(struct weston_output *output);
163 
164 /* weston_plane */
165 
166 void
167 weston_plane_init(struct weston_plane *plane,
168 			struct weston_compositor *ec,
169 			int32_t x, int32_t y);
170 void
171 weston_plane_release(struct weston_plane *plane);
172 
173 /* weston_seat */
174 
175 struct clipboard *
176 clipboard_create(struct weston_seat *seat);
177 
178 void
179 weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
180 		 const char *seat_name);
181 
182 void
183 weston_seat_repick(struct weston_seat *seat);
184 
185 void
186 weston_seat_release(struct weston_seat *seat);
187 
188 void
189 weston_seat_send_selection(struct weston_seat *seat, struct wl_client *client);
190 
191 void
192 weston_seat_init_pointer(struct weston_seat *seat);
193 
194 int
195 weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap);
196 
197 void
198 weston_seat_init_touch(struct weston_seat *seat);
199 
200 void
201 weston_seat_release_keyboard(struct weston_seat *seat);
202 
203 void
204 weston_seat_release_pointer(struct weston_seat *seat);
205 
206 void
207 weston_seat_release_touch(struct weston_seat *seat);
208 
209 void
210 weston_seat_update_keymap(struct weston_seat *seat, struct xkb_keymap *keymap);
211 
212 void
213 wl_data_device_set_keyboard_focus(struct weston_seat *seat);
214 
215 /* weston_pointer */
216 
217 void
218 weston_pointer_clamp(struct weston_pointer *pointer,
219 		     wl_fixed_t *fx, wl_fixed_t *fy);
220 void
221 weston_pointer_set_default_grab(struct weston_pointer *pointer,
222 			        const struct weston_pointer_grab_interface *interface);
223 
224 void
225 weston_pointer_constraint_destroy(struct weston_pointer_constraint *constraint);
226 
227 /* weston_keyboard */
228 bool
229 weston_keyboard_has_focus_resource(struct weston_keyboard *keyboard);
230 
231 /* weston_touch */
232 
233 struct weston_touch_device *
234 weston_touch_create_touch_device(struct weston_touch *touch,
235 				 const char *syspath,
236 				 void *backend_data,
237 				 const struct weston_touch_device_ops *ops);
238 
239 void
240 weston_touch_device_destroy(struct weston_touch_device *device);
241 
242 bool
243 weston_touch_has_focus_resource(struct weston_touch *touch);
244 
245 int
246 weston_touch_start_drag(struct weston_touch *touch,
247 			struct weston_data_source *source,
248 			struct weston_surface *icon,
249 			struct wl_client *client);
250 
251 
252 /* weston_touch_device */
253 
254 bool
255 weston_touch_device_can_calibrate(struct weston_touch_device *device);
256 
257 /* weston_surface */
258 void
259 weston_surface_to_buffer_float(struct weston_surface *surface,
260 			       float x, float y, float *bx, float *by);
261 pixman_box32_t
262 weston_surface_to_buffer_rect(struct weston_surface *surface,
263 			      pixman_box32_t rect);
264 
265 void
266 weston_surface_to_buffer_region(struct weston_surface *surface,
267 				pixman_region32_t *surface_region,
268 				pixman_region32_t *buffer_region);
269 void
270 weston_surface_schedule_repaint(struct weston_surface *surface);
271 
272 /* weston_spring */
273 
274 void
275 weston_spring_init(struct weston_spring *spring,
276 		   double k, double current, double target);
277 int
278 weston_spring_done(struct weston_spring *spring);
279 
280 void
281 weston_spring_update(struct weston_spring *spring, const struct timespec *time);
282 
283 /* weston_view */
284 
285 void
286 weston_view_to_global_fixed(struct weston_view *view,
287 			    wl_fixed_t sx, wl_fixed_t sy,
288 			    wl_fixed_t *x, wl_fixed_t *y);
289 void
290 weston_view_from_global_float(struct weston_view *view,
291 			      float x, float y, float *vx, float *vy);
292 bool
293 weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region);
294 
295 bool
296 weston_view_has_valid_buffer(struct weston_view *ev);
297 
298 bool
299 weston_view_matches_output_entirely(struct weston_view *ev,
300 				    struct weston_output *output);
301 void
302 weston_view_move_to_plane(struct weston_view *view,
303 			  struct weston_plane *plane);
304 
305 void
306 weston_transformed_coord(int width, int height,
307 			 enum wl_output_transform transform,
308 			 int32_t scale,
309 			 float sx, float sy, float *bx, float *by);
310 pixman_box32_t
311 weston_transformed_rect(int width, int height,
312 			enum wl_output_transform transform,
313 			int32_t scale,
314 			pixman_box32_t rect);
315 void
316 weston_transformed_region(int width, int height,
317 			  enum wl_output_transform transform,
318 			  int32_t scale,
319 			  pixman_region32_t *src, pixman_region32_t *dest);
320 void
321 weston_matrix_transform_region(pixman_region32_t *dest,
322 			       struct weston_matrix *matrix,
323 			       pixman_region32_t *src);
324 
325 /* protected_surface */
326 void
327 weston_protected_surface_send_event(struct protected_surface *psurface,
328 				    enum weston_hdcp_protection protection);
329 
330 /* others */
331 int
332 wl_data_device_manager_init(struct wl_display *display);
333 
334 #endif
335