sdk: be C++ friendly
[platform/upstream/weston.git] / src / compositor.h
1 /*
2  * Copyright © 2008-2011 Kristian Høgsberg
3  * Copyright © 2012 Collabora, Ltd.
4  *
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.
14  *
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.
22  */
23
24 #ifndef _WAYLAND_SYSTEM_COMPOSITOR_H_
25 #define _WAYLAND_SYSTEM_COMPOSITOR_H_
26
27 #ifdef  __cplusplus
28 extern "C" {
29 #endif
30
31 #include <pixman.h>
32 #include <xkbcommon/xkbcommon.h>
33 #include <wayland-server.h>
34
35 #include "version.h"
36 #include "matrix.h"
37 #include "config-parser.h"
38
39 #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
40
41 #define container_of(ptr, type, member) ({                              \
42         const __typeof__( ((type *)0)->member ) *__mptr = (ptr);        \
43         (type *)( (char *)__mptr - offsetof(type,member) );})
44
45 struct weston_transform {
46         struct weston_matrix matrix;
47         struct wl_list link;
48 };
49
50 struct weston_surface;
51 struct shell_surface;
52 struct weston_seat;
53 struct weston_output;
54 struct input_method;
55
56 enum weston_keyboard_modifier {
57         MODIFIER_CTRL = (1 << 0),
58         MODIFIER_ALT = (1 << 1),
59         MODIFIER_SUPER = (1 << 2),
60         MODIFIER_SHIFT = (1 << 3),
61 };
62
63 enum weston_led {
64         LED_NUM_LOCK = (1 << 0),
65         LED_CAPS_LOCK = (1 << 1),
66         LED_SCROLL_LOCK = (1 << 2),
67 };
68
69 struct weston_mode {
70         uint32_t flags;
71         int32_t width, height;
72         uint32_t refresh;
73         struct wl_list link;
74 };
75
76 struct weston_shell_client {
77         void (*send_configure)(struct weston_surface *surface,
78                                uint32_t edges, int32_t width, int32_t height);
79 };
80
81 struct weston_shell_interface {
82         void *shell;                    /* either desktop or tablet */
83
84         struct shell_surface *(*create_shell_surface)(void *shell,
85                                                       struct weston_surface *surface,
86                                                       const struct weston_shell_client *client);
87
88         void (*set_toplevel)(struct shell_surface *shsurf);
89
90         void (*set_transient)(struct shell_surface *shsurf,
91                               struct weston_surface *parent,
92                               int x, int y, uint32_t flags);
93         void (*set_fullscreen)(struct shell_surface *shsurf,
94                                uint32_t method,
95                                uint32_t framerate,
96                                struct weston_output *output);
97         int (*move)(struct shell_surface *shsurf, struct weston_seat *ws);
98         int (*resize)(struct shell_surface *shsurf,
99                       struct weston_seat *ws, uint32_t edges);
100
101 };
102
103 struct weston_border {
104         int32_t left, right, top, bottom;
105 };
106
107 struct weston_animation {
108         void (*frame)(struct weston_animation *animation,
109                       struct weston_output *output, uint32_t msecs);
110         int frame_counter;
111         struct wl_list link;
112 };
113
114 struct weston_spring {
115         double k;
116         double friction;
117         double current;
118         double target;
119         double previous;
120         uint32_t timestamp;
121 };
122
123 enum {
124         ZOOM_FOCUS_POINTER,
125         ZOOM_FOCUS_TEXT
126 };
127
128 struct weston_fixed_point {
129         wl_fixed_t x, y;
130 };
131
132 struct weston_output_zoom {
133         int active;
134         uint32_t type;
135         float increment;
136         float level;
137         float max_level;
138         float trans_x, trans_y;
139         struct weston_animation animation_z;
140         struct weston_spring spring_z;
141         struct weston_animation animation_xy;
142         struct weston_spring spring_xy;
143         struct weston_fixed_point from;
144         struct weston_fixed_point to;
145         struct weston_fixed_point current;
146         struct weston_fixed_point text_cursor;
147 };
148
149 /* bit compatible with drm definitions. */
150 enum dpms_enum {
151         WESTON_DPMS_ON,
152         WESTON_DPMS_STANDBY,
153         WESTON_DPMS_SUSPEND,
154         WESTON_DPMS_OFF
155 };
156
157 struct weston_output {
158         uint32_t id;
159
160         void *renderer_state;
161
162         struct wl_list link;
163         struct wl_list resource_list;
164         struct wl_global *global;
165         struct weston_compositor *compositor;
166         struct weston_matrix matrix;
167         struct wl_list animation_list;
168         int32_t x, y, width, height;
169         int32_t mm_width, mm_height;
170         struct weston_border border;
171         pixman_region32_t region;
172         pixman_region32_t previous_damage;
173         int repaint_needed;
174         int repaint_scheduled;
175         struct weston_output_zoom zoom;
176         int dirty;
177         struct wl_signal frame_signal;
178         uint32_t frame_time;
179         int disable_planes;
180
181         char *make, *model;
182         uint32_t subpixel;
183         uint32_t transform;
184         
185         struct weston_mode *current;
186         struct weston_mode *origin;
187         struct wl_list mode_list;
188
189         void (*repaint)(struct weston_output *output,
190                         pixman_region32_t *damage);
191         void (*destroy)(struct weston_output *output);
192         void (*assign_planes)(struct weston_output *output);
193         int (*switch_mode)(struct weston_output *output, struct weston_mode *mode);
194
195         /* backlight values are on 0-255 range, where higher is brighter */
196         uint32_t backlight_current;
197         void (*set_backlight)(struct weston_output *output, uint32_t value);
198         void (*set_dpms)(struct weston_output *output, enum dpms_enum level);
199 };
200
201 struct weston_xkb_info {
202         struct xkb_keymap *keymap;
203         int keymap_fd;
204         size_t keymap_size;
205         char *keymap_area;
206         xkb_mod_index_t shift_mod;
207         xkb_mod_index_t caps_mod;
208         xkb_mod_index_t ctrl_mod;
209         xkb_mod_index_t alt_mod;
210         xkb_mod_index_t mod2_mod;
211         xkb_mod_index_t mod3_mod;
212         xkb_mod_index_t super_mod;
213         xkb_mod_index_t mod5_mod;
214         xkb_led_index_t num_led;
215         xkb_led_index_t caps_led;
216         xkb_led_index_t scroll_led;
217 };
218
219 struct weston_keyboard {
220         struct wl_keyboard keyboard;
221
222         struct wl_keyboard_grab input_method_grab;
223         struct wl_resource *input_method_resource;
224 };
225
226 struct weston_seat {
227         struct wl_seat seat;
228         struct wl_pointer pointer;
229         int has_pointer;
230         struct weston_keyboard keyboard;
231         int has_keyboard;
232         struct wl_touch touch;
233         int has_touch;
234         struct wl_signal destroy_signal;
235
236         struct weston_compositor *compositor;
237         struct weston_surface *sprite;
238         struct wl_listener sprite_destroy_listener;
239         struct weston_surface *drag_surface;
240         struct wl_listener drag_surface_destroy_listener;
241         int32_t hotspot_x, hotspot_y;
242         struct wl_list link;
243         enum weston_keyboard_modifier modifier_state;
244         struct wl_surface *saved_kbd_focus;
245         struct wl_listener saved_kbd_focus_listener;
246
247         uint32_t num_tp;
248
249         struct wl_listener new_drag_icon_listener;
250
251         void (*led_update)(struct weston_seat *ws, enum weston_led leds);
252
253         struct weston_xkb_info xkb_info;
254         struct {
255                 struct xkb_state *state;
256                 enum weston_led leds;
257         } xkb_state;
258
259         struct input_method *input_method;
260 };
261
262 enum {
263         WESTON_COMPOSITOR_ACTIVE,
264         WESTON_COMPOSITOR_IDLE,         /* shell->unlock called on activity */
265         WESTON_COMPOSITOR_SLEEPING      /* no rendering, no frame events */
266 };
267
268 struct weston_layer {
269         struct wl_list surface_list;
270         struct wl_list link;
271 };
272
273 struct weston_plane {
274         pixman_region32_t damage;
275         pixman_region32_t clip;
276         int32_t x, y;
277         struct wl_list link;
278 };
279
280 struct weston_renderer {
281         int (*read_pixels)(struct weston_output *output,
282                                pixman_format_code_t format, void *pixels,
283                                uint32_t x, uint32_t y,
284                                uint32_t width, uint32_t height);
285         void (*repaint_output)(struct weston_output *output,
286                                pixman_region32_t *output_damage);
287         void (*flush_damage)(struct weston_surface *surface);
288         void (*attach)(struct weston_surface *es, struct wl_buffer *buffer);
289         int (*create_surface)(struct weston_surface *surface);
290         void (*surface_set_color)(struct weston_surface *surface,
291                                float red, float green,
292                                float blue, float alpha);
293         void (*destroy_surface)(struct weston_surface *surface);
294         void (*destroy)(struct weston_compositor *ec);
295 };
296
297 struct weston_compositor {
298         struct wl_signal destroy_signal;
299
300         struct wl_display *wl_display;
301         struct weston_shell_interface shell_interface;
302
303         struct wl_signal activate_signal;
304         struct wl_signal kill_signal;
305         struct wl_signal idle_signal;
306         struct wl_signal wake_signal;
307
308         struct wl_signal show_input_panel_signal;
309         struct wl_signal hide_input_panel_signal;
310
311         struct wl_signal seat_created_signal;
312
313         struct wl_event_loop *input_loop;
314         struct wl_event_source *input_loop_source;
315
316         struct weston_layer fade_layer;
317         struct weston_layer cursor_layer;
318
319         struct wl_list output_list;
320         struct wl_list seat_list;
321         struct wl_list layer_list;
322         struct wl_list surface_list;
323         struct wl_list plane_list;
324         struct wl_list key_binding_list;
325         struct wl_list button_binding_list;
326         struct wl_list axis_binding_list;
327         struct wl_list debug_binding_list;
328
329         uint32_t state;
330         struct wl_event_source *idle_source;
331         uint32_t idle_inhibit;
332         int idle_time;                  /* timeout, s */
333
334         /* Repaint state. */
335         struct wl_array vertices;
336         struct wl_array indices; /* only used in compositor-wayland */
337         struct wl_array vtxcnt;
338         struct weston_plane primary_plane;
339         int fan_debug;
340
341         uint32_t focus;
342
343         struct weston_renderer *renderer;
344
345         pixman_format_code_t read_format;
346
347         void (*destroy)(struct weston_compositor *ec);
348         void (*restore)(struct weston_compositor *ec);
349         int (*authenticate)(struct weston_compositor *c, uint32_t id);
350
351         void (*ping_handler)(struct weston_surface *surface, uint32_t serial);
352
353         int launcher_sock;
354
355         uint32_t output_id_pool;
356
357         struct xkb_rule_names xkb_names;
358         struct xkb_context *xkb_context;
359         struct weston_xkb_info xkb_info;
360 };
361
362 struct weston_buffer_reference {
363         struct wl_buffer *buffer;
364         struct wl_listener destroy_listener;
365 };
366
367 struct weston_region {
368         struct wl_resource resource;
369         pixman_region32_t region;
370 };
371
372 /* Using weston_surface transformations
373  *
374  * To add a transformation to a surface, create a struct weston_transform, and
375  * add it to the list surface->geometry.transformation_list. Whenever you
376  * change the list, anything under surface->geometry, or anything in the
377  * weston_transforms linked into the list, you must call
378  * weston_surface_geometry_dirty().
379  *
380  * The order in the list defines the order of transformations. Let the list
381  * contain the transformation matrices M1, ..., Mn as head to tail. The
382  * transformation is applied to surface-local coordinate vector p as
383  *    P = Mn * ... * M2 * M1 * p
384  * to produce the global coordinate vector P. The total transform
385  *    Mn * ... * M2 * M1
386  * is cached in surface->transform.matrix, and the inverse of it in
387  * surface->transform.inverse.
388  *
389  * The list always contains surface->transform.position transformation, which
390  * is the translation by surface->geometry.x and y.
391  *
392  * If you want to apply a transformation in local coordinates, add your
393  * weston_transform to the head of the list. If you want to apply a
394  * transformation in global coordinates, add it to the tail of the list.
395  *
396  * If surface->geometry.parent is set, the total transformation of this
397  * surface will be the parent's total transformation and this transformation
398  * combined:
399  *    Mparent * Mn * ... * M2 * M1
400  */
401
402 struct weston_surface {
403         struct wl_surface surface;
404         struct weston_compositor *compositor;
405         pixman_region32_t clip;
406         pixman_region32_t damage;
407         pixman_region32_t opaque;        /* part of geometry, see below */
408         pixman_region32_t input;
409         struct wl_list link;
410         struct wl_list layer_link;
411         float alpha;                     /* part of geometry, see below */
412         struct weston_plane *plane;
413
414         void *renderer_state;
415
416         /* Surface geometry state, mutable.
417          * If you change anything, call weston_surface_geometry_dirty().
418          * That includes the transformations referenced from the list.
419          */
420         struct {
421                 float x, y; /* surface translation on display */
422                 int32_t width, height;
423
424                 /* struct weston_transform */
425                 struct wl_list transformation_list;
426
427                 /* managed by weston_surface_set_transform_parent() */
428                 struct weston_surface *parent;
429                 struct wl_listener parent_destroy_listener;
430                 struct wl_list child_list; /* geometry.parent_link */
431                 struct wl_list parent_link;
432         } geometry;
433
434         /* State derived from geometry state, read-only.
435          * This is updated by weston_surface_update_transform().
436          */
437         struct {
438                 int dirty;
439
440                 pixman_region32_t boundingbox;
441                 pixman_region32_t opaque;
442
443                 /* matrix and inverse are used only if enabled = 1.
444                  * If enabled = 0, use x, y, width, height directly.
445                  */
446                 int enabled;
447                 struct weston_matrix matrix;
448                 struct weston_matrix inverse;
449
450                 struct weston_transform position; /* matrix from x, y */
451         } transform;
452
453         /*
454          * Which output to vsync this surface to.
455          * Used to determine, whether to send or queue frame events.
456          * Must be NULL, if 'link' is not in weston_compositor::surface_list.
457          */
458         struct weston_output *output;
459
460         /*
461          * A more complete representation of all outputs this surface is
462          * displayed on.
463          */
464         uint32_t output_mask;
465
466         struct wl_list frame_callback_list;
467
468         struct weston_buffer_reference buffer_ref;
469         uint32_t buffer_transform;
470         int keep_buffer; /* bool for backends to prevent early release */
471
472         /* All the pending state, that wl_surface.commit will apply. */
473         struct {
474                 /* wl_surface.attach */
475                 int newly_attached;
476                 struct wl_buffer *buffer;
477                 struct wl_listener buffer_destroy_listener;
478                 int32_t sx;
479                 int32_t sy;
480
481                 /* wl_surface.damage */
482                 pixman_region32_t damage;
483
484                 /* wl_surface.set_opaque_region */
485                 pixman_region32_t opaque;
486
487                 /* wl_surface.set_input_region */
488                 pixman_region32_t input;
489
490                 /* wl_surface.frame */
491                 struct wl_list frame_callback_list;
492
493                 /* wl_surface.set_buffer_transform */
494                 uint32_t buffer_transform;
495         } pending;
496
497         /*
498          * If non-NULL, this function will be called on surface::attach after
499          * a new buffer has been set up for this surface. The integer params
500          * are the sx and sy paramerters supplied to surface::attach .
501          */
502         void (*configure)(struct weston_surface *es, int32_t sx, int32_t sy, int32_t width, int32_t height);
503         void *configure_private;
504 };
505
506 enum weston_key_state_update {
507         STATE_UPDATE_AUTOMATIC,
508         STATE_UPDATE_NONE,
509 };
510
511 void
512 weston_version(int *major, int *minor, int *micro);
513
514 void
515 weston_surface_update_transform(struct weston_surface *surface);
516
517 void
518 weston_surface_geometry_dirty(struct weston_surface *surface);
519
520 void
521 weston_surface_to_global_fixed(struct weston_surface *surface,
522                                wl_fixed_t sx, wl_fixed_t sy,
523                                wl_fixed_t *x, wl_fixed_t *y);
524 void
525 weston_surface_to_global_float(struct weston_surface *surface,
526                                float sx, float sy, float *x, float *y);
527
528 void
529 weston_surface_from_global_float(struct weston_surface *surface,
530                                  float x, float y, float *sx, float *sy);
531 void
532 weston_surface_from_global(struct weston_surface *surface,
533                            int32_t x, int32_t y, int32_t *sx, int32_t *sy);
534 void
535 weston_surface_from_global_fixed(struct weston_surface *surface,
536                                  wl_fixed_t x, wl_fixed_t y,
537                                  wl_fixed_t *sx, wl_fixed_t *sy);
538 int32_t
539 weston_surface_buffer_width(struct weston_surface *surface);
540 int32_t
541 weston_surface_buffer_height(struct weston_surface *surface);
542
543 WL_EXPORT void
544 weston_surface_to_buffer_float(struct weston_surface *surface,
545                                float x, float y, float *bx, float *by);
546 pixman_box32_t
547 weston_surface_to_buffer_rect(struct weston_surface *surface,
548                               pixman_box32_t rect);
549
550 void
551 weston_spring_init(struct weston_spring *spring,
552                    double k, double current, double target);
553 void
554 weston_spring_update(struct weston_spring *spring, uint32_t msec);
555 int
556 weston_spring_done(struct weston_spring *spring);
557
558 void
559 weston_surface_activate(struct weston_surface *surface,
560                         struct weston_seat *seat);
561 void
562 notify_motion(struct weston_seat *seat, uint32_t time,
563               wl_fixed_t dx, wl_fixed_t dy);
564 void
565 notify_motion_absolute(struct weston_seat *seat, uint32_t time,
566                        wl_fixed_t x, wl_fixed_t y);
567 void
568 notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
569               enum wl_pointer_button_state state);
570 void
571 notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
572             wl_fixed_t value);
573 void
574 notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
575            enum wl_keyboard_key_state state,
576            enum weston_key_state_update update_state);
577 void
578 notify_modifiers(struct weston_seat *seat, uint32_t serial);
579
580 void
581 notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
582                      wl_fixed_t x, wl_fixed_t y);
583
584 void
585 notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
586                          enum weston_key_state_update update_state);
587 void
588 notify_keyboard_focus_out(struct weston_seat *seat);
589
590 void
591 notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
592              wl_fixed_t x, wl_fixed_t y, int touch_type);
593
594 void
595 weston_layer_init(struct weston_layer *layer, struct wl_list *below);
596
597 void
598 weston_plane_init(struct weston_plane *plane, int32_t x, int32_t y);
599 void
600 weston_plane_release(struct weston_plane *plane);
601
602 void
603 weston_compositor_stack_plane(struct weston_compositor *ec,
604                               struct weston_plane *plane,
605                               struct weston_plane *above);
606
607 void
608 weston_output_finish_frame(struct weston_output *output, uint32_t msecs);
609 void
610 weston_output_schedule_repaint(struct weston_output *output);
611 void
612 weston_output_damage(struct weston_output *output);
613 void
614 weston_compositor_schedule_repaint(struct weston_compositor *compositor);
615 void
616 weston_compositor_fade(struct weston_compositor *compositor, float tint);
617 void
618 weston_compositor_damage_all(struct weston_compositor *compositor);
619 void
620 weston_compositor_unlock(struct weston_compositor *compositor);
621 void
622 weston_compositor_wake(struct weston_compositor *compositor);
623 void
624 weston_compositor_sleep(struct weston_compositor *compositor);
625 void
626 weston_compositor_update_drag_surfaces(struct weston_compositor *compositor);
627
628
629 struct weston_binding;
630 typedef void (*weston_key_binding_handler_t)(struct wl_seat *seat,
631                                              uint32_t time, uint32_t key,
632                                              void *data);
633 struct weston_binding *
634 weston_compositor_add_key_binding(struct weston_compositor *compositor,
635                                   uint32_t key,
636                                   enum weston_keyboard_modifier modifier,
637                                   weston_key_binding_handler_t binding,
638                                   void *data);
639
640 typedef void (*weston_button_binding_handler_t)(struct wl_seat *seat,
641                                                 uint32_t time, uint32_t button,
642                                                 void *data);
643 struct weston_binding *
644 weston_compositor_add_button_binding(struct weston_compositor *compositor,
645                                      uint32_t button,
646                                      enum weston_keyboard_modifier modifier,
647                                      weston_button_binding_handler_t binding,
648                                      void *data);
649
650 typedef void (*weston_axis_binding_handler_t)(struct wl_seat *seat,
651                                               uint32_t time, uint32_t axis,
652                                               wl_fixed_t value, void *data);
653 struct weston_binding *
654 weston_compositor_add_axis_binding(struct weston_compositor *compositor,
655                                    uint32_t axis,
656                                    enum weston_keyboard_modifier modifier,
657                                    weston_axis_binding_handler_t binding,
658                                    void *data);
659 struct weston_binding *
660 weston_compositor_add_debug_binding(struct weston_compositor *compositor,
661                                     uint32_t key,
662                                     weston_key_binding_handler_t binding,
663                                     void *data);
664 void
665 weston_binding_destroy(struct weston_binding *binding);
666
667 void
668 weston_binding_list_destroy_all(struct wl_list *list);
669
670 void
671 weston_compositor_run_key_binding(struct weston_compositor *compositor,
672                                   struct weston_seat *seat, uint32_t time,
673                                   uint32_t key,
674                                   enum wl_keyboard_key_state state);
675 void
676 weston_compositor_run_button_binding(struct weston_compositor *compositor,
677                                      struct weston_seat *seat, uint32_t time,
678                                      uint32_t button,
679                                      enum wl_pointer_button_state value);
680 int
681 weston_compositor_run_axis_binding(struct weston_compositor *compositor,
682                                    struct weston_seat *seat, uint32_t time,
683                                    uint32_t axis, int32_t value);
684 int
685 weston_compositor_run_debug_binding(struct weston_compositor *compositor,
686                                     struct weston_seat *seat, uint32_t time,
687                                     uint32_t key,
688                                     enum wl_keyboard_key_state state);
689
690 int
691 weston_environment_get_fd(const char *env);
692
693 struct wl_list *
694 weston_compositor_top(struct weston_compositor *compositor);
695
696 struct weston_surface *
697 weston_surface_create(struct weston_compositor *compositor);
698
699 void
700 weston_surface_configure(struct weston_surface *surface,
701                          float x, float y, int width, int height);
702
703 void
704 weston_surface_restack(struct weston_surface *surface, struct wl_list *below);
705
706 void
707 weston_surface_set_position(struct weston_surface *surface,
708                             float x, float y);
709
710 void
711 weston_surface_set_transform_parent(struct weston_surface *surface,
712                                     struct weston_surface *parent);
713
714 int
715 weston_surface_is_mapped(struct weston_surface *surface);
716
717 void
718 weston_surface_schedule_repaint(struct weston_surface *surface);
719
720 void
721 weston_surface_damage(struct weston_surface *surface);
722
723 void
724 weston_surface_damage_below(struct weston_surface *surface);
725
726 void
727 weston_surface_move_to_plane(struct weston_surface *surface,
728                              struct weston_plane *plane);
729 void
730 weston_surface_unmap(struct weston_surface *surface);
731
732 void
733 weston_buffer_reference(struct weston_buffer_reference *ref,
734                         struct wl_buffer *buffer);
735
736 uint32_t
737 weston_compositor_get_time(void);
738
739 int
740 weston_compositor_init(struct weston_compositor *ec, struct wl_display *display,
741                        int *argc, char *argv[], const char *config_file);
742 void
743 weston_compositor_shutdown(struct weston_compositor *ec);
744 void
745 weston_text_cursor_position_notify(struct weston_surface *surface,
746                                                 wl_fixed_t x, wl_fixed_t y);
747 void
748 weston_output_init_zoom(struct weston_output *output);
749 void
750 weston_output_update_zoom(struct weston_output *output, uint32_t type);
751 void
752 weston_output_update_matrix(struct weston_output *output);
753 void
754 weston_output_move(struct weston_output *output, int x, int y);
755 void
756 weston_output_init(struct weston_output *output, struct weston_compositor *c,
757                    int x, int y, int width, int height, uint32_t transform);
758 void
759 weston_output_destroy(struct weston_output *output);
760
761 void
762 weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec);
763 void
764 weston_seat_init_pointer(struct weston_seat *seat);
765 int
766 weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap);
767 void
768 weston_seat_init_touch(struct weston_seat *seat);
769
770 void
771 weston_seat_release(struct weston_seat *seat);
772
773 /* String literal of spaces, the same width as the timestamp. */
774 #define STAMP_SPACE "               "
775
776 void
777 weston_log_file_open(const char *filename);
778 void
779 weston_log_file_close(void);
780 int
781 weston_log(const char *fmt, ...)
782         __attribute__ ((format (printf, 1, 2)));
783 int
784 weston_log_continue(const char *fmt, ...)
785         __attribute__ ((format (printf, 1, 2)));
786
787 enum {
788         TTY_ENTER_VT,
789         TTY_LEAVE_VT
790 };
791
792 typedef void (*tty_vt_func_t)(struct weston_compositor *compositor, int event);
793
794 struct tty *
795 tty_create(struct weston_compositor *compositor,
796            tty_vt_func_t vt_func, int tty_nr);
797
798 void
799 tty_destroy(struct tty *tty);
800
801 void
802 tty_reset(struct tty *tty);
803
804 int
805 tty_activate_vt(struct tty *tty, int vt);
806
807 void
808 screenshooter_create(struct weston_compositor *ec);
809
810 struct clipboard *
811 clipboard_create(struct weston_seat *seat);
812
813 void
814 text_cursor_position_notifier_create(struct weston_compositor *ec);
815
816 int
817 text_backend_init(struct weston_compositor *ec);
818
819 struct weston_process;
820 typedef void (*weston_process_cleanup_func_t)(struct weston_process *process,
821                                             int status);
822
823 struct weston_process {
824         pid_t pid;
825         weston_process_cleanup_func_t cleanup;
826         struct wl_list link;
827 };
828
829 struct wl_client *
830 weston_client_launch(struct weston_compositor *compositor,
831                      struct weston_process *proc,
832                      const char *path,
833                      weston_process_cleanup_func_t cleanup);
834
835 void
836 weston_watch_process(struct weston_process *process);
837
838 struct weston_surface_animation;
839 typedef void (*weston_surface_animation_done_func_t)(struct weston_surface_animation *animation, void *data);
840
841 struct weston_surface_animation *
842 weston_zoom_run(struct weston_surface *surface, float start, float stop,
843                 weston_surface_animation_done_func_t done, void *data);
844
845 struct weston_surface_animation *
846 weston_fade_run(struct weston_surface *surface,
847                 float start, float end, float k,
848                 weston_surface_animation_done_func_t done, void *data);
849 void
850 weston_fade_update(struct weston_surface_animation *fade,
851                    float start, float end, float k);
852
853 struct weston_surface_animation *
854 weston_slide_run(struct weston_surface *surface, float start, float stop,
855                  weston_surface_animation_done_func_t done, void *data);
856
857 void
858 weston_surface_set_color(struct weston_surface *surface,
859                          float red, float green, float blue, float alpha);
860
861 void
862 weston_surface_destroy(struct weston_surface *surface);
863
864 int
865 weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode);
866
867 int
868 noop_renderer_init(struct weston_compositor *ec);
869
870 struct weston_compositor *
871 backend_init(struct wl_display *display, int *argc, char *argv[],
872              const char *config_file);
873
874 int
875 module_init(struct weston_compositor *compositor,
876             int *argc, char *argv[], const char *config_file);
877
878 void
879 weston_transformed_coord(int width, int height,
880                          enum wl_output_transform transform,
881                          float sx, float sy, float *bx, float *by);
882 pixman_box32_t
883 weston_transformed_rect(int width, int height,
884                         enum wl_output_transform transform,
885                         pixman_box32_t rect);
886
887 #ifdef  __cplusplus
888 }
889 #endif
890
891 #endif