2 * Copyright © 2008-2011 Kristian Høgsberg
3 * Copyright © 2012 Collabora, Ltd.
5 * Permission to use, copy, modify, distribute, and sell this software and
6 * its documentation for any purpose is hereby granted without fee, provided
7 * that the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of the copyright holders not be used in
10 * advertising or publicity pertaining to distribution of the software
11 * without specific, written prior permission. The copyright holders make
12 * no representations about the suitability of this software for any
13 * purpose. It is provided "as is" without express or implied warranty.
15 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
16 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
19 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
20 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 #ifndef _WAYLAND_SYSTEM_COMPOSITOR_H_
25 #define _WAYLAND_SYSTEM_COMPOSITOR_H_
32 #include <xkbcommon/xkbcommon.h>
34 #define WL_HIDE_DEPRECATED
35 #include <wayland-server.h>
39 #include "config-parser.h"
43 #define MIN(x,y) (((x) < (y)) ? (x) : (y))
46 #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
48 #define container_of(ptr, type, member) ({ \
49 const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
50 (type *)( (char *)__mptr - offsetof(type,member) );})
52 struct weston_transform {
53 struct weston_matrix matrix;
57 struct weston_surface;
64 enum weston_keyboard_modifier {
65 MODIFIER_CTRL = (1 << 0),
66 MODIFIER_ALT = (1 << 1),
67 MODIFIER_SUPER = (1 << 2),
68 MODIFIER_SHIFT = (1 << 3),
72 LED_NUM_LOCK = (1 << 0),
73 LED_CAPS_LOCK = (1 << 1),
74 LED_SCROLL_LOCK = (1 << 2),
79 int32_t width, height;
84 struct weston_shell_client {
85 void (*send_configure)(struct weston_surface *surface,
86 uint32_t edges, int32_t width, int32_t height);
89 struct weston_shell_interface {
90 void *shell; /* either desktop or tablet */
92 struct shell_surface *(*create_shell_surface)(void *shell,
93 struct weston_surface *surface,
94 const struct weston_shell_client *client);
95 struct weston_view *(*get_primary_view)(void *shell,
96 struct shell_surface *shsurf);
98 void (*set_toplevel)(struct shell_surface *shsurf);
100 void (*set_transient)(struct shell_surface *shsurf,
101 struct weston_surface *parent,
102 int x, int y, uint32_t flags);
103 void (*set_fullscreen)(struct shell_surface *shsurf,
106 struct weston_output *output);
107 void (*set_xwayland)(struct shell_surface *shsurf,
108 int x, int y, uint32_t flags);
109 int (*move)(struct shell_surface *shsurf, struct weston_seat *ws);
110 int (*resize)(struct shell_surface *shsurf,
111 struct weston_seat *ws, uint32_t edges);
112 void (*set_title)(struct shell_surface *shsurf,
117 struct weston_animation {
118 void (*frame)(struct weston_animation *animation,
119 struct weston_output *output, uint32_t msecs);
125 WESTON_SPRING_OVERSHOOT,
130 struct weston_spring {
141 struct weston_fixed_point {
145 struct weston_output_zoom {
150 float trans_x, trans_y;
151 struct weston_animation animation_z;
152 struct weston_spring spring_z;
153 struct weston_animation animation_xy;
154 struct weston_spring spring_xy;
155 struct weston_fixed_point from;
156 struct weston_fixed_point to;
157 struct weston_fixed_point current;
158 struct wl_listener motion_listener;
161 /* bit compatible with drm definitions. */
169 enum weston_mode_switch_op {
170 WESTON_MODE_SWITCH_SET_NATIVE,
171 WESTON_MODE_SWITCH_SET_TEMPORARY,
172 WESTON_MODE_SWITCH_RESTORE_NATIVE
175 struct weston_output {
179 void *renderer_state;
182 struct wl_list resource_list;
183 struct wl_global *global;
184 struct weston_compositor *compositor;
185 struct weston_matrix matrix;
186 struct wl_list animation_list;
187 int32_t x, y, width, height;
188 int32_t mm_width, mm_height;
189 pixman_region32_t region;
190 pixman_region32_t previous_damage;
192 int repaint_scheduled;
193 struct weston_output_zoom zoom;
195 struct wl_signal frame_signal;
196 struct wl_signal destroy_signal;
200 char *make, *model, *serial_number;
203 int32_t native_scale;
204 int32_t current_scale;
205 int32_t original_scale;
207 struct weston_mode *native_mode;
208 struct weston_mode *current_mode;
209 struct weston_mode *original_mode;
210 struct wl_list mode_list;
212 void (*start_repaint_loop)(struct weston_output *output);
213 int (*repaint)(struct weston_output *output,
214 pixman_region32_t *damage);
215 void (*destroy)(struct weston_output *output);
216 void (*assign_planes)(struct weston_output *output);
217 int (*switch_mode)(struct weston_output *output, struct weston_mode *mode);
219 /* backlight values are on 0-255 range, where higher is brighter */
220 int32_t backlight_current;
221 void (*set_backlight)(struct weston_output *output, uint32_t value);
222 void (*set_dpms)(struct weston_output *output, enum dpms_enum level);
224 int connection_internal;
226 void (*set_gamma)(struct weston_output *output,
233 struct weston_pointer_grab;
234 struct weston_pointer_grab_interface {
235 void (*focus)(struct weston_pointer_grab *grab);
236 void (*motion)(struct weston_pointer_grab *grab, uint32_t time,
237 wl_fixed_t x, wl_fixed_t y);
238 void (*button)(struct weston_pointer_grab *grab,
239 uint32_t time, uint32_t button, uint32_t state);
240 void (*cancel)(struct weston_pointer_grab *grab);
243 struct weston_pointer_grab {
244 const struct weston_pointer_grab_interface *interface;
245 struct weston_pointer *pointer;
248 struct weston_keyboard_grab;
249 struct weston_keyboard_grab_interface {
250 void (*key)(struct weston_keyboard_grab *grab, uint32_t time,
251 uint32_t key, uint32_t state);
252 void (*modifiers)(struct weston_keyboard_grab *grab, uint32_t serial,
253 uint32_t mods_depressed, uint32_t mods_latched,
254 uint32_t mods_locked, uint32_t group);
255 void (*cancel)(struct weston_keyboard_grab *grab);
258 struct weston_keyboard_grab {
259 const struct weston_keyboard_grab_interface *interface;
260 struct weston_keyboard *keyboard;
263 struct weston_touch_grab;
264 struct weston_touch_grab_interface {
265 void (*down)(struct weston_touch_grab *grab,
270 void (*up)(struct weston_touch_grab *grab,
273 void (*motion)(struct weston_touch_grab *grab,
278 void (*cancel)(struct weston_touch_grab *grab);
281 struct weston_touch_grab {
282 const struct weston_touch_grab_interface *interface;
283 struct weston_touch *touch;
286 struct weston_data_offer {
287 struct wl_resource *resource;
288 struct weston_data_source *source;
289 struct wl_listener source_destroy_listener;
292 struct weston_data_source {
293 struct wl_resource *resource;
294 struct wl_signal destroy_signal;
295 struct wl_array mime_types;
297 void (*accept)(struct weston_data_source *source,
298 uint32_t serial, const char *mime_type);
299 void (*send)(struct weston_data_source *source,
300 const char *mime_type, int32_t fd);
301 void (*cancel)(struct weston_data_source *source);
304 struct weston_pointer {
305 struct weston_seat *seat;
307 struct wl_list resource_list;
308 struct wl_list focus_resource_list;
309 struct weston_view *focus;
310 uint32_t focus_serial;
311 struct wl_listener focus_view_listener;
312 struct wl_listener focus_resource_listener;
313 struct wl_signal focus_signal;
314 struct wl_signal motion_signal;
316 struct weston_view *sprite;
317 struct wl_listener sprite_destroy_listener;
318 int32_t hotspot_x, hotspot_y;
320 struct weston_pointer_grab *grab;
321 struct weston_pointer_grab default_grab;
322 wl_fixed_t grab_x, grab_y;
323 uint32_t grab_button;
324 uint32_t grab_serial;
328 uint32_t button_count;
332 struct weston_touch {
333 struct weston_seat *seat;
335 struct wl_list resource_list;
336 struct wl_list focus_resource_list;
337 struct weston_view *focus;
338 struct wl_listener focus_view_listener;
339 struct wl_listener focus_resource_listener;
340 uint32_t focus_serial;
341 struct wl_signal focus_signal;
343 struct weston_touch_grab *grab;
344 struct weston_touch_grab default_grab;
346 wl_fixed_t grab_x, grab_y;
347 uint32_t grab_serial;
351 struct weston_pointer *
352 weston_pointer_create(struct weston_seat *seat);
354 weston_pointer_destroy(struct weston_pointer *pointer);
356 weston_pointer_set_focus(struct weston_pointer *pointer,
357 struct weston_view *view,
358 wl_fixed_t sx, wl_fixed_t sy);
360 weston_pointer_start_grab(struct weston_pointer *pointer,
361 struct weston_pointer_grab *grab);
363 weston_pointer_end_grab(struct weston_pointer *pointer);
365 weston_pointer_clamp(struct weston_pointer *pointer,
366 wl_fixed_t *fx, wl_fixed_t *fy);
368 weston_pointer_move(struct weston_pointer *pointer,
369 wl_fixed_t x, wl_fixed_t y);
371 weston_pointer_set_default_grab(struct weston_pointer *pointer,
372 const struct weston_pointer_grab_interface *interface);
374 struct weston_keyboard *
375 weston_keyboard_create(void);
377 weston_keyboard_destroy(struct weston_keyboard *keyboard);
379 weston_keyboard_set_focus(struct weston_keyboard *keyboard,
380 struct weston_surface *surface);
382 weston_keyboard_start_grab(struct weston_keyboard *device,
383 struct weston_keyboard_grab *grab);
385 weston_keyboard_end_grab(struct weston_keyboard *keyboard);
387 struct weston_touch *
388 weston_touch_create(void);
390 weston_touch_destroy(struct weston_touch *touch);
392 weston_touch_set_focus(struct weston_seat *seat,
393 struct weston_view *view);
395 weston_touch_start_grab(struct weston_touch *device,
396 struct weston_touch_grab *grab);
398 weston_touch_end_grab(struct weston_touch *touch);
401 wl_data_device_set_keyboard_focus(struct weston_seat *seat);
404 wl_data_device_manager_init(struct wl_display *display);
408 weston_seat_set_selection(struct weston_seat *seat,
409 struct weston_data_source *source, uint32_t serial);
411 weston_pointer_start_drag(struct weston_pointer *pointer,
412 struct weston_data_source *source,
413 struct weston_surface *icon,
414 struct wl_client *client);
416 weston_touch_start_drag(struct weston_touch *touch,
417 struct weston_data_source *source,
418 struct weston_surface *icon,
419 struct wl_client *client);
421 struct weston_xkb_info {
422 struct xkb_keymap *keymap;
427 xkb_mod_index_t shift_mod;
428 xkb_mod_index_t caps_mod;
429 xkb_mod_index_t ctrl_mod;
430 xkb_mod_index_t alt_mod;
431 xkb_mod_index_t mod2_mod;
432 xkb_mod_index_t mod3_mod;
433 xkb_mod_index_t super_mod;
434 xkb_mod_index_t mod5_mod;
435 xkb_led_index_t num_led;
436 xkb_led_index_t caps_led;
437 xkb_led_index_t scroll_led;
440 struct weston_keyboard {
441 struct weston_seat *seat;
443 struct wl_list resource_list;
444 struct wl_list focus_resource_list;
445 struct weston_surface *focus;
446 struct wl_listener focus_resource_listener;
447 uint32_t focus_serial;
448 struct wl_signal focus_signal;
450 struct weston_keyboard_grab *grab;
451 struct weston_keyboard_grab default_grab;
453 uint32_t grab_serial;
456 struct wl_array keys;
459 uint32_t mods_depressed;
460 uint32_t mods_latched;
461 uint32_t mods_locked;
465 struct weston_keyboard_grab input_method_grab;
466 struct wl_resource *input_method_resource;
470 struct wl_list base_resource_list;
472 struct wl_global *global;
473 struct weston_pointer *pointer;
474 struct weston_keyboard *keyboard;
475 struct weston_touch *touch;
476 int pointer_device_count;
477 int keyboard_device_count;
478 int touch_device_count;
480 struct weston_output *output; /* constraint */
482 struct wl_signal destroy_signal;
484 struct weston_compositor *compositor;
486 enum weston_keyboard_modifier modifier_state;
487 struct weston_surface *saved_kbd_focus;
488 struct wl_listener saved_kbd_focus_listener;
489 struct wl_list drag_resource_list;
491 uint32_t selection_serial;
492 struct weston_data_source *selection_data_source;
493 struct wl_listener selection_data_source_listener;
494 struct wl_signal selection_signal;
498 void (*led_update)(struct weston_seat *ws, enum weston_led leds);
500 struct weston_xkb_info *xkb_info;
502 struct xkb_state *state;
503 enum weston_led leds;
505 struct xkb_keymap *pending_keymap;
507 struct input_method *input_method;
512 WESTON_COMPOSITOR_ACTIVE,
513 WESTON_COMPOSITOR_IDLE, /* shell->unlock called on activity */
514 WESTON_COMPOSITOR_OFFSCREEN, /* no rendering, no frame events */
515 WESTON_COMPOSITOR_SLEEPING /* same as offscreen, but also set dmps
519 struct weston_layer {
520 struct wl_list view_list;
524 struct weston_plane {
525 struct weston_compositor *compositor;
526 pixman_region32_t damage;
527 pixman_region32_t clip;
532 struct weston_renderer {
533 int (*read_pixels)(struct weston_output *output,
534 pixman_format_code_t format, void *pixels,
535 uint32_t x, uint32_t y,
536 uint32_t width, uint32_t height);
537 void (*repaint_output)(struct weston_output *output,
538 pixman_region32_t *output_damage);
539 void (*flush_damage)(struct weston_surface *surface);
540 void (*attach)(struct weston_surface *es, struct weston_buffer *buffer);
541 void (*surface_set_color)(struct weston_surface *surface,
542 float red, float green,
543 float blue, float alpha);
544 void (*destroy)(struct weston_compositor *ec);
547 enum weston_capability {
548 /* backend/renderer supports arbitrary rotation */
549 WESTON_CAP_ROTATION_ANY = 0x0001,
551 /* screencaptures need to be y-flipped */
552 WESTON_CAP_CAPTURE_YFLIP = 0x0002,
555 struct weston_compositor {
556 struct wl_signal destroy_signal;
558 struct wl_display *wl_display;
559 struct weston_shell_interface shell_interface;
560 struct weston_config *config;
562 /* surface signals */
563 struct wl_signal activate_signal;
564 struct wl_signal transform_signal;
566 struct wl_signal kill_signal;
567 struct wl_signal idle_signal;
568 struct wl_signal wake_signal;
570 struct wl_signal show_input_panel_signal;
571 struct wl_signal hide_input_panel_signal;
572 struct wl_signal update_input_panel_signal;
574 struct wl_signal seat_created_signal;
575 struct wl_signal output_created_signal;
577 struct wl_event_loop *input_loop;
578 struct wl_event_source *input_loop_source;
580 struct wl_signal session_signal;
583 struct weston_layer fade_layer;
584 struct weston_layer cursor_layer;
586 struct wl_list output_list;
587 struct wl_list seat_list;
588 struct wl_list layer_list;
589 struct wl_list view_list;
590 struct wl_list plane_list;
591 struct wl_list key_binding_list;
592 struct wl_list modifier_binding_list;
593 struct wl_list button_binding_list;
594 struct wl_list touch_binding_list;
595 struct wl_list axis_binding_list;
596 struct wl_list debug_binding_list;
599 struct wl_event_source *idle_source;
600 uint32_t idle_inhibit;
601 int idle_time; /* timeout, s */
603 const struct weston_pointer_grab_interface *default_pointer_grab;
606 struct weston_plane primary_plane;
607 uint32_t capabilities; /* combination of enum weston_capability */
609 struct weston_renderer *renderer;
611 pixman_format_code_t read_format;
613 void (*destroy)(struct weston_compositor *ec);
614 void (*restore)(struct weston_compositor *ec);
615 int (*authenticate)(struct weston_compositor *c, uint32_t id);
617 void (*ping_handler)(struct weston_surface *surface, uint32_t serial);
619 struct weston_launcher *launcher;
621 uint32_t output_id_pool;
623 struct xkb_rule_names xkb_names;
624 struct xkb_context *xkb_context;
625 struct weston_xkb_info *xkb_info;
627 /* Raw keyboard processing (no libxkbcommon initialization or handling) */
631 struct weston_buffer {
632 struct wl_resource *resource;
633 struct wl_signal destroy_signal;
634 struct wl_listener destroy_listener;
637 struct wl_shm_buffer *shm_buffer;
640 int32_t width, height;
645 struct weston_buffer_reference {
646 struct weston_buffer *buffer;
647 struct wl_listener destroy_listener;
650 struct weston_buffer_viewport {
651 /* wl_surface.set_buffer_transform */
654 /* wl_surface.set_scaling_factor */
658 struct weston_region {
659 struct wl_resource *resource;
660 pixman_region32_t region;
663 struct weston_subsurface {
664 struct wl_resource *resource;
666 /* guaranteed to be valid and non-NULL */
667 struct weston_surface *surface;
668 struct wl_listener surface_destroy_listener;
671 struct weston_surface *parent;
672 struct wl_listener parent_destroy_listener;
673 struct wl_list parent_link;
674 struct wl_list parent_link_pending;
685 /* wl_surface.attach */
687 struct weston_buffer_reference buffer_ref;
691 /* wl_surface.damage */
692 pixman_region32_t damage;
694 /* wl_surface.set_opaque_region */
695 pixman_region32_t opaque;
697 /* wl_surface.set_input_region */
698 pixman_region32_t input;
700 /* wl_surface.frame */
701 struct wl_list frame_callback_list;
703 /* wl_surface.set_buffer_transform */
704 /* wl_surface.set_buffer_scale */
705 struct weston_buffer_viewport buffer_viewport;
710 /* Used for constructing the view tree */
711 struct wl_list unused_views;
714 /* Using weston_view transformations
716 * To add a transformation to a view, create a struct weston_transform, and
717 * add it to the list view->geometry.transformation_list. Whenever you
718 * change the list, anything under view->geometry, or anything in the
719 * weston_transforms linked into the list, you must call
720 * weston_view_geometry_dirty().
722 * The order in the list defines the order of transformations. Let the list
723 * contain the transformation matrices M1, ..., Mn as head to tail. The
724 * transformation is applied to view-local coordinate vector p as
725 * P = Mn * ... * M2 * M1 * p
726 * to produce the global coordinate vector P. The total transform
728 * is cached in view->transform.matrix, and the inverse of it in
729 * view->transform.inverse.
731 * The list always contains view->transform.position transformation, which
732 * is the translation by view->geometry.x and y.
734 * If you want to apply a transformation in local coordinates, add your
735 * weston_transform to the head of the list. If you want to apply a
736 * transformation in global coordinates, add it to the tail of the list.
738 * If view->geometry.parent is set, the total transformation of this
739 * view will be the parent's total transformation and this transformation
741 * Mparent * Mn * ... * M2 * M1
745 struct weston_surface *surface;
746 struct wl_list surface_link;
747 struct wl_signal destroy_signal;
750 struct wl_list layer_link;
751 struct weston_plane *plane;
753 pixman_region32_t clip;
754 float alpha; /* part of geometry, see below */
756 void *renderer_state;
758 /* Surface geometry state, mutable.
759 * If you change anything, call weston_surface_geometry_dirty().
760 * That includes the transformations referenced from the list.
763 float x, y; /* surface translation on display */
764 int32_t width, height;
766 /* struct weston_transform */
767 struct wl_list transformation_list;
769 /* managed by weston_surface_set_transform_parent() */
770 struct weston_view *parent;
771 struct wl_listener parent_destroy_listener;
772 struct wl_list child_list; /* geometry.parent_link */
773 struct wl_list parent_link;
776 /* State derived from geometry state, read-only.
777 * This is updated by weston_view_update_transform().
782 pixman_region32_t boundingbox;
783 pixman_region32_t opaque;
785 /* matrix and inverse are used only if enabled = 1.
786 * If enabled = 0, use x, y, width, height directly.
789 struct weston_matrix matrix;
790 struct weston_matrix inverse;
792 struct weston_transform position; /* matrix from x, y */
796 * Which output to vsync this surface to.
797 * Used to determine, whether to send or queue frame events.
798 * Must be NULL, if 'link' is not in weston_compositor::surface_list.
800 struct weston_output *output;
803 * A more complete representation of all outputs this surface is
806 uint32_t output_mask;
809 struct weston_surface {
810 struct wl_resource *resource;
811 struct wl_signal destroy_signal;
812 struct weston_compositor *compositor;
813 pixman_region32_t damage;
814 pixman_region32_t opaque; /* part of geometry, see below */
815 pixman_region32_t input;
816 int32_t width, height;
819 /* Not for long-term storage. This exists for book-keeping while
820 * iterating over surfaces and views
824 void *renderer_state;
826 struct wl_list views;
829 * Which output to vsync this surface to.
830 * Used to determine, whether to send or queue frame events.
831 * Must be NULL, if 'link' is not in weston_compositor::surface_list.
833 struct weston_output *output;
836 * A more complete representation of all outputs this surface is
839 uint32_t output_mask;
841 struct wl_list frame_callback_list;
843 struct weston_buffer_reference buffer_ref;
844 struct weston_buffer_viewport buffer_viewport;
845 int keep_buffer; /* bool for backends to prevent early release */
847 /* All the pending state, that wl_surface.commit will apply. */
849 /* wl_surface.attach */
851 struct weston_buffer *buffer;
852 struct wl_listener buffer_destroy_listener;
856 /* wl_surface.damage */
857 pixman_region32_t damage;
859 /* wl_surface.set_opaque_region */
860 pixman_region32_t opaque;
862 /* wl_surface.set_input_region */
863 pixman_region32_t input;
865 /* wl_surface.frame */
866 struct wl_list frame_callback_list;
868 /* wl_surface.set_buffer_transform */
869 /* wl_surface.set_scaling_factor */
870 struct weston_buffer_viewport buffer_viewport;
874 * If non-NULL, this function will be called on surface::attach after
875 * a new buffer has been set up for this surface. The integer params
876 * are the sx and sy paramerters supplied to surface::attach .
878 void (*configure)(struct weston_surface *es, int32_t sx, int32_t sy, int32_t width, int32_t height);
879 void *configure_private;
881 /* Parent's list of its sub-surfaces, weston_subsurface:parent_link.
882 * Contains also the parent itself as a dummy weston_subsurface,
883 * if the list is not empty.
885 struct wl_list subsurface_list; /* weston_subsurface::parent_link */
886 struct wl_list subsurface_list_pending; /* ...::parent_link_pending */
889 enum weston_key_state_update {
890 STATE_UPDATE_AUTOMATIC,
895 weston_version(int *major, int *minor, int *micro);
898 weston_view_update_transform(struct weston_view *view);
901 weston_view_geometry_dirty(struct weston_view *view);
904 weston_view_to_global_fixed(struct weston_view *view,
905 wl_fixed_t sx, wl_fixed_t sy,
906 wl_fixed_t *x, wl_fixed_t *y);
908 weston_view_to_global_float(struct weston_view *view,
909 float sx, float sy, float *x, float *y);
912 weston_view_from_global_float(struct weston_view *view,
913 float x, float y, float *vx, float *vy);
915 weston_view_from_global(struct weston_view *view,
916 int32_t x, int32_t y, int32_t *vx, int32_t *vy);
918 weston_view_from_global_fixed(struct weston_view *view,
919 wl_fixed_t x, wl_fixed_t y,
920 wl_fixed_t *vx, wl_fixed_t *vy);
922 weston_surface_buffer_width(struct weston_surface *surface);
924 weston_surface_buffer_height(struct weston_surface *surface);
927 weston_surface_to_buffer_float(struct weston_surface *surface,
928 float x, float y, float *bx, float *by);
930 weston_surface_to_buffer(struct weston_surface *surface,
931 int sx, int sy, int *bx, int *by);
933 weston_surface_to_buffer_rect(struct weston_surface *surface,
934 pixman_box32_t rect);
937 weston_spring_init(struct weston_spring *spring,
938 double k, double current, double target);
940 weston_spring_update(struct weston_spring *spring, uint32_t msec);
942 weston_spring_done(struct weston_spring *spring);
945 weston_surface_activate(struct weston_surface *surface,
946 struct weston_seat *seat);
948 notify_motion(struct weston_seat *seat, uint32_t time,
949 wl_fixed_t dx, wl_fixed_t dy);
951 notify_motion_absolute(struct weston_seat *seat, uint32_t time,
952 wl_fixed_t x, wl_fixed_t y);
954 notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
955 enum wl_pointer_button_state state);
957 notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
960 notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
961 enum wl_keyboard_key_state state,
962 enum weston_key_state_update update_state);
964 notify_modifiers(struct weston_seat *seat, uint32_t serial);
967 notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
968 wl_fixed_t x, wl_fixed_t y);
971 notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
972 enum weston_key_state_update update_state);
974 notify_keyboard_focus_out(struct weston_seat *seat);
977 notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
978 wl_fixed_t x, wl_fixed_t y, int touch_type);
981 weston_layer_init(struct weston_layer *layer, struct wl_list *below);
984 weston_plane_init(struct weston_plane *plane,
985 struct weston_compositor *ec,
986 int32_t x, int32_t y);
988 weston_plane_release(struct weston_plane *plane);
991 weston_compositor_stack_plane(struct weston_compositor *ec,
992 struct weston_plane *plane,
993 struct weston_plane *above);
996 weston_output_finish_frame(struct weston_output *output, uint32_t msecs);
998 weston_output_schedule_repaint(struct weston_output *output);
1000 weston_output_damage(struct weston_output *output);
1002 weston_compositor_schedule_repaint(struct weston_compositor *compositor);
1004 weston_compositor_fade(struct weston_compositor *compositor, float tint);
1006 weston_compositor_damage_all(struct weston_compositor *compositor);
1008 weston_compositor_unlock(struct weston_compositor *compositor);
1010 weston_compositor_wake(struct weston_compositor *compositor);
1012 weston_compositor_offscreen(struct weston_compositor *compositor);
1014 weston_compositor_sleep(struct weston_compositor *compositor);
1015 struct weston_view *
1016 weston_compositor_pick_view(struct weston_compositor *compositor,
1017 wl_fixed_t x, wl_fixed_t y,
1018 wl_fixed_t *sx, wl_fixed_t *sy);
1021 struct weston_binding;
1022 typedef void (*weston_key_binding_handler_t)(struct weston_seat *seat,
1023 uint32_t time, uint32_t key,
1025 struct weston_binding *
1026 weston_compositor_add_key_binding(struct weston_compositor *compositor,
1028 enum weston_keyboard_modifier modifier,
1029 weston_key_binding_handler_t binding,
1032 typedef void (*weston_modifier_binding_handler_t)(struct weston_seat *seat,
1033 enum weston_keyboard_modifier modifier,
1035 struct weston_binding *
1036 weston_compositor_add_modifier_binding(struct weston_compositor *compositor,
1037 enum weston_keyboard_modifier modifier,
1038 weston_modifier_binding_handler_t binding,
1041 typedef void (*weston_button_binding_handler_t)(struct weston_seat *seat,
1042 uint32_t time, uint32_t button,
1044 struct weston_binding *
1045 weston_compositor_add_button_binding(struct weston_compositor *compositor,
1047 enum weston_keyboard_modifier modifier,
1048 weston_button_binding_handler_t binding,
1051 typedef void (*weston_touch_binding_handler_t)(struct weston_seat *seat,
1054 struct weston_binding *
1055 weston_compositor_add_touch_binding(struct weston_compositor *compositor,
1056 enum weston_keyboard_modifier modifier,
1057 weston_touch_binding_handler_t binding,
1060 typedef void (*weston_axis_binding_handler_t)(struct weston_seat *seat,
1061 uint32_t time, uint32_t axis,
1062 wl_fixed_t value, void *data);
1063 struct weston_binding *
1064 weston_compositor_add_axis_binding(struct weston_compositor *compositor,
1066 enum weston_keyboard_modifier modifier,
1067 weston_axis_binding_handler_t binding,
1069 struct weston_binding *
1070 weston_compositor_add_debug_binding(struct weston_compositor *compositor,
1072 weston_key_binding_handler_t binding,
1075 weston_binding_destroy(struct weston_binding *binding);
1078 weston_binding_list_destroy_all(struct wl_list *list);
1081 weston_compositor_run_key_binding(struct weston_compositor *compositor,
1082 struct weston_seat *seat, uint32_t time,
1084 enum wl_keyboard_key_state state);
1087 weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
1088 struct weston_seat *seat,
1089 enum weston_keyboard_modifier modifier,
1090 enum wl_keyboard_key_state state);
1092 weston_compositor_run_button_binding(struct weston_compositor *compositor,
1093 struct weston_seat *seat, uint32_t time,
1095 enum wl_pointer_button_state value);
1097 weston_compositor_run_touch_binding(struct weston_compositor *compositor,
1098 struct weston_seat *seat, uint32_t time,
1101 weston_compositor_run_axis_binding(struct weston_compositor *compositor,
1102 struct weston_seat *seat, uint32_t time,
1103 uint32_t axis, int32_t value);
1105 weston_compositor_run_debug_binding(struct weston_compositor *compositor,
1106 struct weston_seat *seat, uint32_t time,
1108 enum wl_keyboard_key_state state);
1111 weston_compositor_set_default_pointer_grab(struct weston_compositor *compositor,
1112 const struct weston_pointer_grab_interface *interface);
1115 weston_environment_get_fd(const char *env);
1118 weston_compositor_top(struct weston_compositor *compositor);
1120 struct weston_surface *
1121 weston_surface_create(struct weston_compositor *compositor);
1123 struct weston_view *
1124 weston_view_create(struct weston_surface *surface);
1127 weston_view_destroy(struct weston_view *view);
1130 weston_view_configure(struct weston_view *view,
1131 float x, float y, int width, int height);
1134 weston_view_restack(struct weston_view *surface, struct wl_list *below);
1137 weston_view_set_position(struct weston_view *view,
1141 weston_view_set_transform_parent(struct weston_view *view,
1142 struct weston_view *parent);
1145 weston_view_is_mapped(struct weston_view *view);
1148 weston_view_schedule_repaint(struct weston_view *view);
1151 weston_surface_is_mapped(struct weston_surface *surface);
1154 weston_surface_schedule_repaint(struct weston_surface *surface);
1157 weston_surface_damage(struct weston_surface *surface);
1160 weston_view_damage_below(struct weston_view *view);
1163 weston_view_move_to_plane(struct weston_view *view,
1164 struct weston_plane *plane);
1166 weston_view_unmap(struct weston_view *view);
1169 weston_surface_unmap(struct weston_surface *surface);
1171 struct weston_surface *
1172 weston_surface_get_main_surface(struct weston_surface *surface);
1174 struct weston_buffer *
1175 weston_buffer_from_resource(struct wl_resource *resource);
1178 weston_buffer_reference(struct weston_buffer_reference *ref,
1179 struct weston_buffer *buffer);
1182 weston_compositor_get_time(void);
1185 weston_compositor_init(struct weston_compositor *ec, struct wl_display *display,
1186 int *argc, char *argv[], struct weston_config *config);
1188 weston_compositor_shutdown(struct weston_compositor *ec);
1190 weston_output_init_zoom(struct weston_output *output);
1192 weston_output_update_zoom(struct weston_output *output);
1194 weston_output_activate_zoom(struct weston_output *output);
1196 weston_output_update_matrix(struct weston_output *output);
1198 weston_output_move(struct weston_output *output, int x, int y);
1200 weston_output_init(struct weston_output *output, struct weston_compositor *c,
1201 int x, int y, int width, int height, uint32_t transform, int32_t scale);
1203 weston_output_destroy(struct weston_output *output);
1205 weston_output_transform_coordinate(struct weston_output *output,
1206 wl_fixed_t device_x, wl_fixed_t device_y,
1207 wl_fixed_t *x, wl_fixed_t *y);
1210 weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
1211 const char *seat_name);
1213 weston_seat_init_pointer(struct weston_seat *seat);
1215 weston_seat_release_pointer(struct weston_seat *seat);
1217 weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap);
1219 weston_seat_release_keyboard(struct weston_seat *seat);
1221 weston_seat_init_touch(struct weston_seat *seat);
1223 weston_seat_release_touch(struct weston_seat *seat);
1225 weston_seat_repick(struct weston_seat *seat);
1227 weston_seat_update_keymap(struct weston_seat *seat, struct xkb_keymap *keymap);
1230 weston_seat_release(struct weston_seat *seat);
1232 weston_compositor_xkb_init(struct weston_compositor *ec,
1233 struct xkb_rule_names *names);
1235 weston_compositor_xkb_destroy(struct weston_compositor *ec);
1237 /* String literal of spaces, the same width as the timestamp. */
1238 #define STAMP_SPACE " "
1241 weston_log_file_open(const char *filename);
1243 weston_log_file_close(void);
1245 weston_vlog(const char *fmt, va_list ap);
1247 weston_vlog_continue(const char *fmt, va_list ap);
1249 weston_log(const char *fmt, ...)
1250 __attribute__ ((format (printf, 1, 2)));
1252 weston_log_continue(const char *fmt, ...)
1253 __attribute__ ((format (printf, 1, 2)));
1261 tty_create(struct weston_compositor *compositor, int tty_nr);
1264 tty_destroy(struct tty *tty);
1267 tty_reset(struct tty *tty);
1270 tty_activate_vt(struct tty *tty, int vt);
1273 screenshooter_create(struct weston_compositor *ec);
1276 clipboard_create(struct weston_seat *seat);
1279 text_backend_init(struct weston_compositor *ec);
1281 struct weston_process;
1282 typedef void (*weston_process_cleanup_func_t)(struct weston_process *process,
1285 struct weston_process {
1287 weston_process_cleanup_func_t cleanup;
1288 struct wl_list link;
1292 weston_client_launch(struct weston_compositor *compositor,
1293 struct weston_process *proc,
1295 weston_process_cleanup_func_t cleanup);
1298 weston_watch_process(struct weston_process *process);
1300 struct weston_view_animation;
1301 typedef void (*weston_view_animation_done_func_t)(struct weston_view_animation *animation, void *data);
1304 weston_view_animation_destroy(struct weston_view_animation *animation);
1306 struct weston_view_animation *
1307 weston_zoom_run(struct weston_view *view, float start, float stop,
1308 weston_view_animation_done_func_t done, void *data);
1310 struct weston_view_animation *
1311 weston_fade_run(struct weston_view *view,
1312 float start, float end, float k,
1313 weston_view_animation_done_func_t done, void *data);
1315 struct weston_view_animation *
1316 weston_move_scale_run(struct weston_view *view, int dx, int dy,
1317 float start, float end, int reverse,
1318 weston_view_animation_done_func_t done, void *data);
1321 weston_fade_update(struct weston_view_animation *fade, float target);
1323 struct weston_view_animation *
1324 weston_stable_fade_run(struct weston_view *front_view, float start,
1325 struct weston_view *back_view, float end,
1326 weston_view_animation_done_func_t done, void *data);
1328 struct weston_view_animation *
1329 weston_slide_run(struct weston_view *view, float start, float stop,
1330 weston_view_animation_done_func_t done, void *data);
1333 weston_surface_set_color(struct weston_surface *surface,
1334 float red, float green, float blue, float alpha);
1337 weston_surface_destroy(struct weston_surface *surface);
1340 weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode,
1341 int32_t scale, enum weston_mode_switch_op op);
1344 noop_renderer_init(struct weston_compositor *ec);
1346 struct weston_compositor *
1347 backend_init(struct wl_display *display, int *argc, char *argv[],
1348 struct weston_config *config);
1351 module_init(struct weston_compositor *compositor,
1352 int *argc, char *argv[]);
1355 weston_transformed_coord(int width, int height,
1356 enum wl_output_transform transform,
1358 float sx, float sy, float *bx, float *by);
1360 weston_transformed_rect(int width, int height,
1361 enum wl_output_transform transform,
1363 pixman_box32_t rect);
1365 weston_transformed_region(int width, int height,
1366 enum wl_output_transform transform,
1368 pixman_region32_t *src, pixman_region32_t *dest);
1371 weston_load_module(const char *name, const char *entrypoint);