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),
71 enum weston_keyboard_locks {
72 WESTON_NUM_LOCK = (1 << 0),
73 WESTON_CAPS_LOCK = (1 << 1),
77 LED_NUM_LOCK = (1 << 0),
78 LED_CAPS_LOCK = (1 << 1),
79 LED_SCROLL_LOCK = (1 << 2),
84 int32_t width, height;
89 struct weston_shell_client {
90 void (*send_configure)(struct weston_surface *surface, int32_t width, int32_t height);
93 struct weston_shell_interface {
94 void *shell; /* either desktop or tablet */
96 struct shell_surface *(*create_shell_surface)(void *shell,
97 struct weston_surface *surface,
98 const struct weston_shell_client *client);
99 struct weston_view *(*get_primary_view)(void *shell,
100 struct shell_surface *shsurf);
102 void (*set_toplevel)(struct shell_surface *shsurf);
104 void (*set_transient)(struct shell_surface *shsurf,
105 struct weston_surface *parent,
106 int x, int y, uint32_t flags);
107 void (*set_fullscreen)(struct shell_surface *shsurf,
110 struct weston_output *output);
111 void (*set_xwayland)(struct shell_surface *shsurf,
112 int x, int y, uint32_t flags);
113 int (*move)(struct shell_surface *shsurf, struct weston_seat *ws);
114 int (*resize)(struct shell_surface *shsurf,
115 struct weston_seat *ws, uint32_t edges);
116 void (*set_title)(struct shell_surface *shsurf,
118 void (*set_window_geometry)(struct shell_surface *shsurf,
119 int32_t x, int32_t y,
120 int32_t width, int32_t height);
123 struct weston_animation {
124 void (*frame)(struct weston_animation *animation,
125 struct weston_output *output, uint32_t msecs);
131 WESTON_SPRING_OVERSHOOT,
136 struct weston_spring {
147 struct weston_fixed_point {
151 struct weston_output_zoom {
156 float trans_x, trans_y;
157 struct weston_animation animation_z;
158 struct weston_spring spring_z;
159 struct weston_animation animation_xy;
160 struct weston_spring spring_xy;
161 struct weston_fixed_point from;
162 struct weston_fixed_point to;
163 struct weston_fixed_point current;
164 struct wl_listener motion_listener;
167 /* bit compatible with drm definitions. */
175 enum weston_mode_switch_op {
176 WESTON_MODE_SWITCH_SET_NATIVE,
177 WESTON_MODE_SWITCH_SET_TEMPORARY,
178 WESTON_MODE_SWITCH_RESTORE_NATIVE
181 struct weston_output {
187 struct weston_seat *seat;
190 void *renderer_state;
193 struct wl_list resource_list;
194 struct wl_global *global;
195 struct weston_compositor *compositor;
196 struct weston_matrix matrix;
197 struct wl_list animation_list;
198 int32_t x, y, width, height;
199 int32_t mm_width, mm_height;
200 pixman_region32_t region;
201 pixman_region32_t previous_damage;
203 int repaint_scheduled;
204 struct weston_output_zoom zoom;
206 struct wl_signal frame_signal;
207 struct wl_signal destroy_signal;
211 uint32_t default_output;
214 char *make, *model, *serial_number;
217 int32_t native_scale;
218 int32_t current_scale;
219 int32_t original_scale;
221 struct weston_mode *native_mode;
222 struct weston_mode *current_mode;
223 struct weston_mode *original_mode;
224 struct wl_list mode_list;
226 void (*start_repaint_loop)(struct weston_output *output);
227 int (*repaint)(struct weston_output *output,
228 pixman_region32_t *damage);
229 void (*destroy)(struct weston_output *output);
230 void (*assign_planes)(struct weston_output *output);
231 int (*switch_mode)(struct weston_output *output, struct weston_mode *mode);
233 /* backlight values are on 0-255 range, where higher is brighter */
234 int32_t backlight_current;
235 void (*set_backlight)(struct weston_output *output, uint32_t value);
236 void (*set_dpms)(struct weston_output *output, enum dpms_enum level);
238 int connection_internal;
240 void (*set_gamma)(struct weston_output *output,
247 struct weston_pointer_grab;
248 struct weston_pointer_grab_interface {
249 void (*focus)(struct weston_pointer_grab *grab);
250 void (*motion)(struct weston_pointer_grab *grab, uint32_t time,
251 wl_fixed_t x, wl_fixed_t y);
252 void (*button)(struct weston_pointer_grab *grab,
253 uint32_t time, uint32_t button, uint32_t state);
254 void (*cancel)(struct weston_pointer_grab *grab);
257 struct weston_pointer_grab {
258 const struct weston_pointer_grab_interface *interface;
259 struct weston_pointer *pointer;
262 struct weston_keyboard_grab;
263 struct weston_keyboard_grab_interface {
264 void (*key)(struct weston_keyboard_grab *grab, uint32_t time,
265 uint32_t key, uint32_t state);
266 void (*modifiers)(struct weston_keyboard_grab *grab, uint32_t serial,
267 uint32_t mods_depressed, uint32_t mods_latched,
268 uint32_t mods_locked, uint32_t group);
269 void (*cancel)(struct weston_keyboard_grab *grab);
272 struct weston_keyboard_grab {
273 const struct weston_keyboard_grab_interface *interface;
274 struct weston_keyboard *keyboard;
277 struct weston_touch_grab;
278 struct weston_touch_grab_interface {
279 void (*down)(struct weston_touch_grab *grab,
284 void (*up)(struct weston_touch_grab *grab,
287 void (*motion)(struct weston_touch_grab *grab,
292 void (*frame)(struct weston_touch_grab *grab);
293 void (*cancel)(struct weston_touch_grab *grab);
296 struct weston_touch_grab {
297 const struct weston_touch_grab_interface *interface;
298 struct weston_touch *touch;
301 struct weston_data_offer {
302 struct wl_resource *resource;
303 struct weston_data_source *source;
304 struct wl_listener source_destroy_listener;
307 struct weston_data_source {
308 struct wl_resource *resource;
309 struct wl_signal destroy_signal;
310 struct wl_array mime_types;
312 void (*accept)(struct weston_data_source *source,
313 uint32_t serial, const char *mime_type);
314 void (*send)(struct weston_data_source *source,
315 const char *mime_type, int32_t fd);
316 void (*cancel)(struct weston_data_source *source);
319 struct weston_pointer {
320 struct weston_seat *seat;
322 struct wl_list resource_list;
323 struct wl_list focus_resource_list;
324 struct weston_view *focus;
325 uint32_t focus_serial;
326 struct wl_listener focus_view_listener;
327 struct wl_listener focus_resource_listener;
328 struct wl_signal focus_signal;
329 struct wl_signal motion_signal;
331 struct weston_view *sprite;
332 struct wl_listener sprite_destroy_listener;
333 int32_t hotspot_x, hotspot_y;
335 struct weston_pointer_grab *grab;
336 struct weston_pointer_grab default_grab;
337 wl_fixed_t grab_x, grab_y;
338 uint32_t grab_button;
339 uint32_t grab_serial;
344 uint32_t button_count;
346 struct wl_listener output_destroy_listener;
350 struct weston_touch {
351 struct weston_seat *seat;
353 struct wl_list resource_list;
354 struct wl_list focus_resource_list;
355 struct weston_view *focus;
356 struct wl_listener focus_view_listener;
357 struct wl_listener focus_resource_listener;
358 uint32_t focus_serial;
359 struct wl_signal focus_signal;
363 struct weston_touch_grab *grab;
364 struct weston_touch_grab default_grab;
366 wl_fixed_t grab_x, grab_y;
367 uint32_t grab_serial;
371 struct weston_pointer *
372 weston_pointer_create(struct weston_seat *seat);
374 weston_pointer_destroy(struct weston_pointer *pointer);
376 weston_pointer_set_focus(struct weston_pointer *pointer,
377 struct weston_view *view,
378 wl_fixed_t sx, wl_fixed_t sy);
380 weston_pointer_start_grab(struct weston_pointer *pointer,
381 struct weston_pointer_grab *grab);
383 weston_pointer_end_grab(struct weston_pointer *pointer);
385 weston_pointer_clamp(struct weston_pointer *pointer,
386 wl_fixed_t *fx, wl_fixed_t *fy);
388 weston_pointer_move(struct weston_pointer *pointer,
389 wl_fixed_t x, wl_fixed_t y);
391 weston_pointer_set_default_grab(struct weston_pointer *pointer,
392 const struct weston_pointer_grab_interface *interface);
394 struct weston_keyboard *
395 weston_keyboard_create(void);
397 weston_keyboard_destroy(struct weston_keyboard *keyboard);
399 weston_keyboard_set_focus(struct weston_keyboard *keyboard,
400 struct weston_surface *surface);
402 weston_keyboard_start_grab(struct weston_keyboard *device,
403 struct weston_keyboard_grab *grab);
405 weston_keyboard_end_grab(struct weston_keyboard *keyboard);
408 * 'mask' and 'value' should be a bitwise mask of one or more
409 * valued of the weston_keyboard_locks enum.
411 weston_keyboard_set_locks(struct weston_keyboard *keyboard,
412 uint32_t mask, uint32_t value);
414 struct weston_touch *
415 weston_touch_create(void);
417 weston_touch_destroy(struct weston_touch *touch);
419 weston_touch_set_focus(struct weston_seat *seat,
420 struct weston_view *view);
422 weston_touch_start_grab(struct weston_touch *device,
423 struct weston_touch_grab *grab);
425 weston_touch_end_grab(struct weston_touch *touch);
428 wl_data_device_set_keyboard_focus(struct weston_seat *seat);
431 wl_data_device_manager_init(struct wl_display *display);
435 weston_seat_set_selection(struct weston_seat *seat,
436 struct weston_data_source *source, uint32_t serial);
438 weston_pointer_start_drag(struct weston_pointer *pointer,
439 struct weston_data_source *source,
440 struct weston_surface *icon,
441 struct wl_client *client);
443 weston_touch_start_drag(struct weston_touch *touch,
444 struct weston_data_source *source,
445 struct weston_surface *icon,
446 struct wl_client *client);
448 struct weston_xkb_info {
449 struct xkb_keymap *keymap;
454 xkb_mod_index_t shift_mod;
455 xkb_mod_index_t caps_mod;
456 xkb_mod_index_t ctrl_mod;
457 xkb_mod_index_t alt_mod;
458 xkb_mod_index_t mod2_mod;
459 xkb_mod_index_t mod3_mod;
460 xkb_mod_index_t super_mod;
461 xkb_mod_index_t mod5_mod;
462 xkb_led_index_t num_led;
463 xkb_led_index_t caps_led;
464 xkb_led_index_t scroll_led;
467 struct weston_keyboard {
468 struct weston_seat *seat;
470 struct wl_list resource_list;
471 struct wl_list focus_resource_list;
472 struct weston_surface *focus;
473 struct wl_listener focus_resource_listener;
474 uint32_t focus_serial;
475 struct wl_signal focus_signal;
477 struct weston_keyboard_grab *grab;
478 struct weston_keyboard_grab default_grab;
480 uint32_t grab_serial;
483 struct wl_array keys;
486 uint32_t mods_depressed;
487 uint32_t mods_latched;
488 uint32_t mods_locked;
492 struct weston_keyboard_grab input_method_grab;
493 struct wl_resource *input_method_resource;
495 struct weston_xkb_info *xkb_info;
497 struct xkb_state *state;
498 enum weston_led leds;
500 struct xkb_keymap *pending_keymap;
504 struct wl_list base_resource_list;
506 struct wl_global *global;
507 struct weston_pointer *pointer;
508 struct weston_keyboard *keyboard;
509 struct weston_touch *touch;
510 int pointer_device_count;
511 int keyboard_device_count;
512 int touch_device_count;
514 struct wl_signal destroy_signal;
515 struct wl_signal updated_caps_signal;
517 struct weston_compositor *compositor;
519 enum weston_keyboard_modifier modifier_state;
520 struct weston_surface *saved_kbd_focus;
521 struct wl_listener saved_kbd_focus_listener;
522 struct wl_list drag_resource_list;
524 uint32_t selection_serial;
525 struct weston_data_source *selection_data_source;
526 struct wl_listener selection_data_source_listener;
527 struct wl_signal selection_signal;
529 void (*led_update)(struct weston_seat *ws, enum weston_led leds);
532 struct input_method *input_method;
537 WESTON_COMPOSITOR_ACTIVE,
538 WESTON_COMPOSITOR_IDLE, /* shell->unlock called on activity */
539 WESTON_COMPOSITOR_OFFSCREEN, /* no rendering, no frame events */
540 WESTON_COMPOSITOR_SLEEPING /* same as offscreen, but also set dmps
544 struct weston_layer_entry {
546 struct weston_layer *layer;
549 struct weston_layer {
550 struct weston_layer_entry view_list;
555 struct weston_plane {
556 struct weston_compositor *compositor;
557 pixman_region32_t damage;
558 pixman_region32_t clip;
563 struct weston_renderer {
564 int (*read_pixels)(struct weston_output *output,
565 pixman_format_code_t format, void *pixels,
566 uint32_t x, uint32_t y,
567 uint32_t width, uint32_t height);
568 void (*repaint_output)(struct weston_output *output,
569 pixman_region32_t *output_damage);
570 void (*flush_damage)(struct weston_surface *surface);
571 void (*attach)(struct weston_surface *es, struct weston_buffer *buffer);
572 void (*surface_set_color)(struct weston_surface *surface,
573 float red, float green,
574 float blue, float alpha);
575 void (*destroy)(struct weston_compositor *ec);
578 enum weston_capability {
579 /* backend/renderer supports arbitrary rotation */
580 WESTON_CAP_ROTATION_ANY = 0x0001,
582 /* screencaptures need to be y-flipped */
583 WESTON_CAP_CAPTURE_YFLIP = 0x0002,
585 /* backend/renderer has a seperate cursor plane */
586 WESTON_CAP_CURSOR_PLANE = 0x0004,
588 /* backend supports setting arbitrary resolutions */
589 WESTON_CAP_ARBITRARY_MODES = 0x0008,
592 struct weston_compositor {
593 struct wl_signal destroy_signal;
595 struct wl_display *wl_display;
596 struct weston_shell_interface shell_interface;
597 struct weston_config *config;
599 /* surface signals */
600 struct wl_signal create_surface_signal;
601 struct wl_signal activate_signal;
602 struct wl_signal transform_signal;
604 struct wl_signal kill_signal;
605 struct wl_signal idle_signal;
606 struct wl_signal wake_signal;
608 struct wl_signal show_input_panel_signal;
609 struct wl_signal hide_input_panel_signal;
610 struct wl_signal update_input_panel_signal;
612 struct wl_signal seat_created_signal;
613 struct wl_signal output_created_signal;
614 struct wl_signal output_destroyed_signal;
615 struct wl_signal output_moved_signal;
617 struct wl_event_loop *input_loop;
618 struct wl_event_source *input_loop_source;
620 struct wl_signal session_signal;
623 struct weston_layer fade_layer;
624 struct weston_layer cursor_layer;
626 struct wl_list output_list;
627 struct wl_list seat_list;
628 struct wl_list layer_list;
629 struct wl_list view_list;
630 struct wl_list plane_list;
631 struct wl_list key_binding_list;
632 struct wl_list modifier_binding_list;
633 struct wl_list button_binding_list;
634 struct wl_list touch_binding_list;
635 struct wl_list axis_binding_list;
636 struct wl_list debug_binding_list;
638 struct weston_output *default_output;
641 struct wl_event_source *idle_source;
642 uint32_t idle_inhibit;
643 int idle_time; /* timeout, s */
645 const struct weston_pointer_grab_interface *default_pointer_grab;
648 struct weston_plane primary_plane;
649 uint32_t capabilities; /* combination of enum weston_capability */
651 struct weston_renderer *renderer;
653 pixman_format_code_t read_format;
655 void (*destroy)(struct weston_compositor *ec);
656 void (*restore)(struct weston_compositor *ec);
657 int (*authenticate)(struct weston_compositor *c, uint32_t id);
659 struct weston_launcher *launcher;
661 uint32_t output_id_pool;
663 struct xkb_rule_names xkb_names;
664 struct xkb_context *xkb_context;
665 struct weston_xkb_info *xkb_info;
667 /* Raw keyboard processing (no libxkbcommon initialization or handling) */
670 int32_t kb_repeat_rate;
671 int32_t kb_repeat_delay;
674 struct weston_buffer {
675 struct wl_resource *resource;
676 struct wl_signal destroy_signal;
677 struct wl_listener destroy_listener;
680 struct wl_shm_buffer *shm_buffer;
683 int32_t width, height;
688 struct weston_buffer_reference {
689 struct weston_buffer *buffer;
690 struct wl_listener destroy_listener;
693 struct weston_buffer_viewport {
695 /* wl_surface.set_buffer_transform */
698 /* wl_surface.set_scaling_factor */
702 * If src_width != wl_fixed_from_int(-1),
703 * then and only then src_* are used.
705 wl_fixed_t src_x, src_y;
706 wl_fixed_t src_width, src_height;
711 * If width == -1, the size is inferred from the buffer.
713 int32_t width, height;
719 struct weston_region {
720 struct wl_resource *resource;
721 pixman_region32_t region;
724 /* Using weston_view transformations
726 * To add a transformation to a view, create a struct weston_transform, and
727 * add it to the list view->geometry.transformation_list. Whenever you
728 * change the list, anything under view->geometry, or anything in the
729 * weston_transforms linked into the list, you must call
730 * weston_view_geometry_dirty().
732 * The order in the list defines the order of transformations. Let the list
733 * contain the transformation matrices M1, ..., Mn as head to tail. The
734 * transformation is applied to view-local coordinate vector p as
735 * P = Mn * ... * M2 * M1 * p
736 * to produce the global coordinate vector P. The total transform
738 * is cached in view->transform.matrix, and the inverse of it in
739 * view->transform.inverse.
741 * The list always contains view->transform.position transformation, which
742 * is the translation by view->geometry.x and y.
744 * If you want to apply a transformation in local coordinates, add your
745 * weston_transform to the head of the list. If you want to apply a
746 * transformation in global coordinates, add it to the tail of the list.
748 * If view->geometry.parent is set, the total transformation of this
749 * view will be the parent's total transformation and this transformation
751 * Mparent * Mn * ... * M2 * M1
755 struct weston_surface *surface;
756 struct wl_list surface_link;
757 struct wl_signal destroy_signal;
760 struct weston_layer_entry layer_link;
761 struct weston_plane *plane;
762 struct weston_view *parent_view;
764 pixman_region32_t clip;
765 float alpha; /* part of geometry, see below */
767 void *renderer_state;
769 /* Surface geometry state, mutable.
770 * If you change anything, call weston_surface_geometry_dirty().
771 * That includes the transformations referenced from the list.
774 float x, y; /* surface translation on display */
776 /* struct weston_transform */
777 struct wl_list transformation_list;
779 /* managed by weston_surface_set_transform_parent() */
780 struct weston_view *parent;
781 struct wl_listener parent_destroy_listener;
782 struct wl_list child_list; /* geometry.parent_link */
783 struct wl_list parent_link;
786 /* State derived from geometry state, read-only.
787 * This is updated by weston_view_update_transform().
792 pixman_region32_t boundingbox;
793 pixman_region32_t opaque;
794 pixman_region32_t masked_boundingbox;
795 pixman_region32_t masked_opaque;
797 /* matrix and inverse are used only if enabled = 1.
798 * If enabled = 0, use x, y, width, height directly.
801 struct weston_matrix matrix;
802 struct weston_matrix inverse;
804 struct weston_transform position; /* matrix from x, y */
808 * Which output to vsync this surface to.
809 * Used to determine, whether to send or queue frame events.
810 * Must be NULL, if 'link' is not in weston_compositor::surface_list.
812 struct weston_output *output;
815 * A more complete representation of all outputs this surface is
818 uint32_t output_mask;
821 struct weston_surface_state {
822 /* wl_surface.attach */
824 struct weston_buffer *buffer;
825 struct wl_listener buffer_destroy_listener;
829 /* wl_surface.damage */
830 pixman_region32_t damage;
832 /* wl_surface.set_opaque_region */
833 pixman_region32_t opaque;
835 /* wl_surface.set_input_region */
836 pixman_region32_t input;
838 /* wl_surface.frame */
839 struct wl_list frame_callback_list;
841 /* wl_surface.set_buffer_transform */
842 /* wl_surface.set_scaling_factor */
843 /* wl_viewport.set */
844 struct weston_buffer_viewport buffer_viewport;
847 struct weston_surface {
848 struct wl_resource *resource;
849 struct wl_signal destroy_signal;
850 struct weston_compositor *compositor;
851 pixman_region32_t damage;
852 pixman_region32_t opaque; /* part of geometry, see below */
853 pixman_region32_t input;
854 int32_t width, height;
857 /* Not for long-term storage. This exists for book-keeping while
858 * iterating over surfaces and views
862 void *renderer_state;
864 struct wl_list views;
867 * Which output to vsync this surface to.
868 * Used to determine, whether to send or queue frame events.
869 * Must be NULL, if 'link' is not in weston_compositor::surface_list.
871 struct weston_output *output;
874 * A more complete representation of all outputs this surface is
877 uint32_t output_mask;
879 struct wl_list frame_callback_list;
881 struct weston_buffer_reference buffer_ref;
882 struct weston_buffer_viewport buffer_viewport;
883 int32_t width_from_buffer; /* before applying viewport */
884 int32_t height_from_buffer;
885 int keep_buffer; /* bool for backends to prevent early release */
887 /* wl_viewport resource for this surface */
888 struct wl_resource *viewport_resource;
890 /* All the pending state, that wl_surface.commit will apply. */
891 struct weston_surface_state pending;
894 * If non-NULL, this function will be called on
895 * wl_surface::commit after a new buffer has been set up for
896 * this surface. The integer params are the sx and sy
897 * parameters supplied to wl_surface::attach.
899 void (*configure)(struct weston_surface *es, int32_t sx, int32_t sy);
900 void *configure_private;
902 /* Parent's list of its sub-surfaces, weston_subsurface:parent_link.
903 * Contains also the parent itself as a dummy weston_subsurface,
904 * if the list is not empty.
906 struct wl_list subsurface_list; /* weston_subsurface::parent_link */
907 struct wl_list subsurface_list_pending; /* ...::parent_link_pending */
910 struct weston_subsurface {
911 struct wl_resource *resource;
913 /* guaranteed to be valid and non-NULL */
914 struct weston_surface *surface;
915 struct wl_listener surface_destroy_listener;
918 struct weston_surface *parent;
919 struct wl_listener parent_destroy_listener;
920 struct wl_list parent_link;
921 struct wl_list parent_link_pending;
930 struct weston_surface_state cached;
931 struct weston_buffer_reference cached_buffer_ref;
935 /* Used for constructing the view tree */
936 struct wl_list unused_views;
939 enum weston_key_state_update {
940 STATE_UPDATE_AUTOMATIC,
945 weston_version(int *major, int *minor, int *micro);
948 weston_view_update_transform(struct weston_view *view);
951 weston_view_geometry_dirty(struct weston_view *view);
954 weston_view_to_global_fixed(struct weston_view *view,
955 wl_fixed_t sx, wl_fixed_t sy,
956 wl_fixed_t *x, wl_fixed_t *y);
958 weston_view_to_global_float(struct weston_view *view,
959 float sx, float sy, float *x, float *y);
962 weston_view_from_global_float(struct weston_view *view,
963 float x, float y, float *vx, float *vy);
965 weston_view_from_global(struct weston_view *view,
966 int32_t x, int32_t y, int32_t *vx, int32_t *vy);
968 weston_view_from_global_fixed(struct weston_view *view,
969 wl_fixed_t x, wl_fixed_t y,
970 wl_fixed_t *vx, wl_fixed_t *vy);
973 weston_surface_to_buffer_float(struct weston_surface *surface,
974 float x, float y, float *bx, float *by);
976 weston_surface_to_buffer(struct weston_surface *surface,
977 int sx, int sy, int *bx, int *by);
979 weston_surface_to_buffer_rect(struct weston_surface *surface,
980 pixman_box32_t rect);
983 weston_spring_init(struct weston_spring *spring,
984 double k, double current, double target);
986 weston_spring_update(struct weston_spring *spring, uint32_t msec);
988 weston_spring_done(struct weston_spring *spring);
991 weston_surface_activate(struct weston_surface *surface,
992 struct weston_seat *seat);
994 notify_motion(struct weston_seat *seat, uint32_t time,
995 wl_fixed_t dx, wl_fixed_t dy);
997 notify_motion_absolute(struct weston_seat *seat, uint32_t time,
998 wl_fixed_t x, wl_fixed_t y);
1000 notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
1001 enum wl_pointer_button_state state);
1003 notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
1006 notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
1007 enum wl_keyboard_key_state state,
1008 enum weston_key_state_update update_state);
1010 notify_modifiers(struct weston_seat *seat, uint32_t serial);
1013 notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
1014 wl_fixed_t x, wl_fixed_t y);
1017 notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
1018 enum weston_key_state_update update_state);
1020 notify_keyboard_focus_out(struct weston_seat *seat);
1023 notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
1024 wl_fixed_t x, wl_fixed_t y, int touch_type);
1026 notify_touch_frame(struct weston_seat *seat);
1029 weston_layer_entry_insert(struct weston_layer_entry *list,
1030 struct weston_layer_entry *entry);
1032 weston_layer_entry_remove(struct weston_layer_entry *entry);
1034 weston_layer_init(struct weston_layer *layer, struct wl_list *below);
1037 weston_layer_set_mask(struct weston_layer *layer, int x, int y, int width, int height);
1040 weston_layer_set_mask_infinite(struct weston_layer *layer);
1043 weston_plane_init(struct weston_plane *plane,
1044 struct weston_compositor *ec,
1045 int32_t x, int32_t y);
1047 weston_plane_release(struct weston_plane *plane);
1050 weston_compositor_stack_plane(struct weston_compositor *ec,
1051 struct weston_plane *plane,
1052 struct weston_plane *above);
1055 weston_output_finish_frame(struct weston_output *output, uint32_t msecs);
1057 weston_output_schedule_repaint(struct weston_output *output);
1059 weston_output_damage(struct weston_output *output);
1061 weston_compositor_schedule_repaint(struct weston_compositor *compositor);
1063 weston_compositor_fade(struct weston_compositor *compositor, float tint);
1065 weston_compositor_damage_all(struct weston_compositor *compositor);
1067 weston_compositor_unlock(struct weston_compositor *compositor);
1069 weston_compositor_wake(struct weston_compositor *compositor);
1071 weston_compositor_offscreen(struct weston_compositor *compositor);
1073 weston_compositor_sleep(struct weston_compositor *compositor);
1074 struct weston_view *
1075 weston_compositor_pick_view(struct weston_compositor *compositor,
1076 wl_fixed_t x, wl_fixed_t y,
1077 wl_fixed_t *sx, wl_fixed_t *sy);
1080 struct weston_binding;
1081 typedef void (*weston_key_binding_handler_t)(struct weston_seat *seat,
1082 uint32_t time, uint32_t key,
1084 struct weston_binding *
1085 weston_compositor_add_key_binding(struct weston_compositor *compositor,
1087 enum weston_keyboard_modifier modifier,
1088 weston_key_binding_handler_t binding,
1091 typedef void (*weston_modifier_binding_handler_t)(struct weston_seat *seat,
1092 enum weston_keyboard_modifier modifier,
1094 struct weston_binding *
1095 weston_compositor_add_modifier_binding(struct weston_compositor *compositor,
1096 enum weston_keyboard_modifier modifier,
1097 weston_modifier_binding_handler_t binding,
1100 typedef void (*weston_button_binding_handler_t)(struct weston_seat *seat,
1101 uint32_t time, uint32_t button,
1103 struct weston_binding *
1104 weston_compositor_add_button_binding(struct weston_compositor *compositor,
1106 enum weston_keyboard_modifier modifier,
1107 weston_button_binding_handler_t binding,
1110 typedef void (*weston_touch_binding_handler_t)(struct weston_seat *seat,
1113 struct weston_binding *
1114 weston_compositor_add_touch_binding(struct weston_compositor *compositor,
1115 enum weston_keyboard_modifier modifier,
1116 weston_touch_binding_handler_t binding,
1119 typedef void (*weston_axis_binding_handler_t)(struct weston_seat *seat,
1120 uint32_t time, uint32_t axis,
1121 wl_fixed_t value, void *data);
1122 struct weston_binding *
1123 weston_compositor_add_axis_binding(struct weston_compositor *compositor,
1125 enum weston_keyboard_modifier modifier,
1126 weston_axis_binding_handler_t binding,
1128 struct weston_binding *
1129 weston_compositor_add_debug_binding(struct weston_compositor *compositor,
1131 weston_key_binding_handler_t binding,
1134 weston_binding_destroy(struct weston_binding *binding);
1137 weston_binding_list_destroy_all(struct wl_list *list);
1140 weston_compositor_run_key_binding(struct weston_compositor *compositor,
1141 struct weston_seat *seat, uint32_t time,
1143 enum wl_keyboard_key_state state);
1146 weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
1147 struct weston_seat *seat,
1148 enum weston_keyboard_modifier modifier,
1149 enum wl_keyboard_key_state state);
1151 weston_compositor_run_button_binding(struct weston_compositor *compositor,
1152 struct weston_seat *seat, uint32_t time,
1154 enum wl_pointer_button_state value);
1156 weston_compositor_run_touch_binding(struct weston_compositor *compositor,
1157 struct weston_seat *seat, uint32_t time,
1160 weston_compositor_run_axis_binding(struct weston_compositor *compositor,
1161 struct weston_seat *seat, uint32_t time,
1162 uint32_t axis, int32_t value);
1164 weston_compositor_run_debug_binding(struct weston_compositor *compositor,
1165 struct weston_seat *seat, uint32_t time,
1167 enum wl_keyboard_key_state state);
1170 weston_compositor_set_default_pointer_grab(struct weston_compositor *compositor,
1171 const struct weston_pointer_grab_interface *interface);
1174 weston_environment_get_fd(const char *env);
1177 weston_compositor_top(struct weston_compositor *compositor);
1179 struct weston_surface *
1180 weston_surface_create(struct weston_compositor *compositor);
1182 struct weston_view *
1183 weston_view_create(struct weston_surface *surface);
1186 weston_view_destroy(struct weston_view *view);
1189 weston_view_set_position(struct weston_view *view,
1193 weston_view_set_transform_parent(struct weston_view *view,
1194 struct weston_view *parent);
1197 weston_view_is_mapped(struct weston_view *view);
1200 weston_view_schedule_repaint(struct weston_view *view);
1203 weston_surface_is_mapped(struct weston_surface *surface);
1206 weston_surface_set_size(struct weston_surface *surface,
1207 int32_t width, int32_t height);
1210 weston_surface_schedule_repaint(struct weston_surface *surface);
1213 weston_surface_damage(struct weston_surface *surface);
1216 weston_view_damage_below(struct weston_view *view);
1219 weston_view_move_to_plane(struct weston_view *view,
1220 struct weston_plane *plane);
1222 weston_view_unmap(struct weston_view *view);
1225 weston_surface_unmap(struct weston_surface *surface);
1227 struct weston_surface *
1228 weston_surface_get_main_surface(struct weston_surface *surface);
1230 struct weston_buffer *
1231 weston_buffer_from_resource(struct wl_resource *resource);
1234 weston_buffer_reference(struct weston_buffer_reference *ref,
1235 struct weston_buffer *buffer);
1238 weston_compositor_get_time(void);
1241 weston_compositor_init(struct weston_compositor *ec, struct wl_display *display,
1242 int *argc, char *argv[], struct weston_config *config);
1244 weston_compositor_shutdown(struct weston_compositor *ec);
1246 weston_output_init_zoom(struct weston_output *output);
1248 weston_output_update_zoom(struct weston_output *output);
1250 weston_output_activate_zoom(struct weston_output *output);
1252 weston_output_update_matrix(struct weston_output *output);
1254 weston_output_move(struct weston_output *output, int x, int y);
1256 weston_output_init(struct weston_output *output, struct weston_compositor *c,
1257 int x, int y, int width, int height, uint32_t transform, int32_t scale);
1259 weston_output_destroy(struct weston_output *output);
1261 weston_output_transform_coordinate(struct weston_output *output,
1262 wl_fixed_t device_x, wl_fixed_t device_y,
1263 wl_fixed_t *x, wl_fixed_t *y);
1266 weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
1267 const char *seat_name);
1269 weston_seat_init_pointer(struct weston_seat *seat);
1271 weston_seat_release_pointer(struct weston_seat *seat);
1273 weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap);
1275 weston_seat_release_keyboard(struct weston_seat *seat);
1277 weston_seat_init_touch(struct weston_seat *seat);
1279 weston_seat_release_touch(struct weston_seat *seat);
1281 weston_seat_repick(struct weston_seat *seat);
1283 weston_seat_update_keymap(struct weston_seat *seat, struct xkb_keymap *keymap);
1286 weston_seat_release(struct weston_seat *seat);
1288 weston_compositor_xkb_init(struct weston_compositor *ec,
1289 struct xkb_rule_names *names);
1291 weston_compositor_xkb_destroy(struct weston_compositor *ec);
1293 /* String literal of spaces, the same width as the timestamp. */
1294 #define STAMP_SPACE " "
1297 weston_log_file_open(const char *filename);
1299 weston_log_file_close(void);
1301 weston_vlog(const char *fmt, va_list ap);
1303 weston_vlog_continue(const char *fmt, va_list ap);
1305 weston_log(const char *fmt, ...)
1306 __attribute__ ((format (printf, 1, 2)));
1308 weston_log_continue(const char *fmt, ...)
1309 __attribute__ ((format (printf, 1, 2)));
1317 tty_create(struct weston_compositor *compositor, int tty_nr);
1320 tty_destroy(struct tty *tty);
1323 tty_reset(struct tty *tty);
1326 tty_activate_vt(struct tty *tty, int vt);
1329 screenshooter_create(struct weston_compositor *ec);
1331 enum weston_screenshooter_outcome {
1332 WESTON_SCREENSHOOTER_SUCCESS,
1333 WESTON_SCREENSHOOTER_NO_MEMORY,
1334 WESTON_SCREENSHOOTER_BAD_BUFFER
1337 typedef void (*weston_screenshooter_done_func_t)(void *data,
1338 enum weston_screenshooter_outcome outcome);
1340 weston_screenshooter_shoot(struct weston_output *output, struct weston_buffer *buffer,
1341 weston_screenshooter_done_func_t done, void *data);
1344 clipboard_create(struct weston_seat *seat);
1347 text_backend_init(struct weston_compositor *ec);
1349 struct weston_process;
1350 typedef void (*weston_process_cleanup_func_t)(struct weston_process *process,
1353 struct weston_process {
1355 weston_process_cleanup_func_t cleanup;
1356 struct wl_list link;
1360 weston_client_launch(struct weston_compositor *compositor,
1361 struct weston_process *proc,
1363 weston_process_cleanup_func_t cleanup);
1366 weston_client_start(struct weston_compositor *compositor, const char *path);
1369 weston_watch_process(struct weston_process *process);
1371 struct weston_view_animation;
1372 typedef void (*weston_view_animation_done_func_t)(struct weston_view_animation *animation, void *data);
1375 weston_view_animation_destroy(struct weston_view_animation *animation);
1377 struct weston_view_animation *
1378 weston_zoom_run(struct weston_view *view, float start, float stop,
1379 weston_view_animation_done_func_t done, void *data);
1381 struct weston_view_animation *
1382 weston_fade_run(struct weston_view *view,
1383 float start, float end, float k,
1384 weston_view_animation_done_func_t done, void *data);
1386 struct weston_view_animation *
1387 weston_move_scale_run(struct weston_view *view, int dx, int dy,
1388 float start, float end, int reverse,
1389 weston_view_animation_done_func_t done, void *data);
1392 weston_fade_update(struct weston_view_animation *fade, float target);
1394 struct weston_view_animation *
1395 weston_stable_fade_run(struct weston_view *front_view, float start,
1396 struct weston_view *back_view, float end,
1397 weston_view_animation_done_func_t done, void *data);
1399 struct weston_view_animation *
1400 weston_slide_run(struct weston_view *view, float start, float stop,
1401 weston_view_animation_done_func_t done, void *data);
1404 weston_surface_set_color(struct weston_surface *surface,
1405 float red, float green, float blue, float alpha);
1408 weston_surface_destroy(struct weston_surface *surface);
1411 weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode,
1412 int32_t scale, enum weston_mode_switch_op op);
1415 noop_renderer_init(struct weston_compositor *ec);
1417 struct weston_compositor *
1418 backend_init(struct wl_display *display, int *argc, char *argv[],
1419 struct weston_config *config);
1422 module_init(struct weston_compositor *compositor,
1423 int *argc, char *argv[]);
1426 weston_transformed_coord(int width, int height,
1427 enum wl_output_transform transform,
1429 float sx, float sy, float *bx, float *by);
1431 weston_transformed_rect(int width, int height,
1432 enum wl_output_transform transform,
1434 pixman_box32_t rect);
1436 weston_transformed_region(int width, int height,
1437 enum wl_output_transform transform,
1439 pixman_region32_t *src, pixman_region32_t *dest);
1442 weston_load_module(const char *name, const char *entrypoint);