7d1d68e41a818d1ddeda4316ba9dace8e5fd7af9
[profile/ivi/weston-ivi-shell.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_OFFSCREEN,    /* no rendering, no frame events */
266         WESTON_COMPOSITOR_SLEEPING      /* same as offscreen, but also set dmps
267                                          * to off */
268 };
269
270 struct weston_layer {
271         struct wl_list surface_list;
272         struct wl_list link;
273 };
274
275 struct weston_plane {
276         pixman_region32_t damage;
277         pixman_region32_t clip;
278         int32_t x, y;
279         struct wl_list link;
280 };
281
282 struct weston_renderer {
283         int (*read_pixels)(struct weston_output *output,
284                                pixman_format_code_t format, void *pixels,
285                                uint32_t x, uint32_t y,
286                                uint32_t width, uint32_t height);
287         void (*repaint_output)(struct weston_output *output,
288                                pixman_region32_t *output_damage);
289         void (*flush_damage)(struct weston_surface *surface);
290         void (*attach)(struct weston_surface *es, struct wl_buffer *buffer);
291         int (*create_surface)(struct weston_surface *surface);
292         void (*surface_set_color)(struct weston_surface *surface,
293                                float red, float green,
294                                float blue, float alpha);
295         void (*destroy_surface)(struct weston_surface *surface);
296         void (*destroy)(struct weston_compositor *ec);
297 };
298
299 struct weston_compositor {
300         struct wl_signal destroy_signal;
301
302         struct wl_display *wl_display;
303         struct weston_shell_interface shell_interface;
304
305         struct wl_signal activate_signal;
306         struct wl_signal kill_signal;
307         struct wl_signal idle_signal;
308         struct wl_signal wake_signal;
309
310         struct wl_signal show_input_panel_signal;
311         struct wl_signal hide_input_panel_signal;
312
313         struct wl_signal seat_created_signal;
314
315         struct wl_event_loop *input_loop;
316         struct wl_event_source *input_loop_source;
317
318         struct weston_layer fade_layer;
319         struct weston_layer cursor_layer;
320
321         struct wl_list output_list;
322         struct wl_list seat_list;
323         struct wl_list layer_list;
324         struct wl_list surface_list;
325         struct wl_list plane_list;
326         struct wl_list key_binding_list;
327         struct wl_list button_binding_list;
328         struct wl_list axis_binding_list;
329         struct wl_list debug_binding_list;
330
331         uint32_t state;
332         struct wl_event_source *idle_source;
333         uint32_t idle_inhibit;
334         int idle_time;                  /* timeout, s */
335
336         /* Repaint state. */
337         struct wl_array vertices;
338         struct wl_array indices; /* only used in compositor-wayland */
339         struct wl_array vtxcnt;
340         struct weston_plane primary_plane;
341         int fan_debug;
342
343         uint32_t focus;
344
345         struct weston_renderer *renderer;
346
347         pixman_format_code_t read_format;
348
349         void (*destroy)(struct weston_compositor *ec);
350         void (*restore)(struct weston_compositor *ec);
351         int (*authenticate)(struct weston_compositor *c, uint32_t id);
352
353         void (*ping_handler)(struct weston_surface *surface, uint32_t serial);
354
355         int launcher_sock;
356
357         uint32_t output_id_pool;
358
359         struct xkb_rule_names xkb_names;
360         struct xkb_context *xkb_context;
361         struct weston_xkb_info xkb_info;
362 };
363
364 struct weston_buffer_reference {
365         struct wl_buffer *buffer;
366         struct wl_listener destroy_listener;
367 };
368
369 struct weston_region {
370         struct wl_resource resource;
371         pixman_region32_t region;
372 };
373
374 /* Using weston_surface transformations
375  *
376  * To add a transformation to a surface, create a struct weston_transform, and
377  * add it to the list surface->geometry.transformation_list. Whenever you
378  * change the list, anything under surface->geometry, or anything in the
379  * weston_transforms linked into the list, you must call
380  * weston_surface_geometry_dirty().
381  *
382  * The order in the list defines the order of transformations. Let the list
383  * contain the transformation matrices M1, ..., Mn as head to tail. The
384  * transformation is applied to surface-local coordinate vector p as
385  *    P = Mn * ... * M2 * M1 * p
386  * to produce the global coordinate vector P. The total transform
387  *    Mn * ... * M2 * M1
388  * is cached in surface->transform.matrix, and the inverse of it in
389  * surface->transform.inverse.
390  *
391  * The list always contains surface->transform.position transformation, which
392  * is the translation by surface->geometry.x and y.
393  *
394  * If you want to apply a transformation in local coordinates, add your
395  * weston_transform to the head of the list. If you want to apply a
396  * transformation in global coordinates, add it to the tail of the list.
397  *
398  * If surface->geometry.parent is set, the total transformation of this
399  * surface will be the parent's total transformation and this transformation
400  * combined:
401  *    Mparent * Mn * ... * M2 * M1
402  */
403
404 struct weston_surface {
405         struct wl_surface surface;
406         struct weston_compositor *compositor;
407         pixman_region32_t clip;
408         pixman_region32_t damage;
409         pixman_region32_t opaque;        /* part of geometry, see below */
410         pixman_region32_t input;
411         struct wl_list link;
412         struct wl_list layer_link;
413         float alpha;                     /* part of geometry, see below */
414         struct weston_plane *plane;
415
416         void *renderer_state;
417
418         /* Surface geometry state, mutable.
419          * If you change anything, call weston_surface_geometry_dirty().
420          * That includes the transformations referenced from the list.
421          */
422         struct {
423                 float x, y; /* surface translation on display */
424                 int32_t width, height;
425
426                 /* struct weston_transform */
427                 struct wl_list transformation_list;
428
429                 /* managed by weston_surface_set_transform_parent() */
430                 struct weston_surface *parent;
431                 struct wl_listener parent_destroy_listener;
432                 struct wl_list child_list; /* geometry.parent_link */
433                 struct wl_list parent_link;
434         } geometry;
435
436         /* State derived from geometry state, read-only.
437          * This is updated by weston_surface_update_transform().
438          */
439         struct {
440                 int dirty;
441
442                 pixman_region32_t boundingbox;
443                 pixman_region32_t opaque;
444
445                 /* matrix and inverse are used only if enabled = 1.
446                  * If enabled = 0, use x, y, width, height directly.
447                  */
448                 int enabled;
449                 struct weston_matrix matrix;
450                 struct weston_matrix inverse;
451
452                 struct weston_transform position; /* matrix from x, y */
453         } transform;
454
455         /*
456          * Which output to vsync this surface to.
457          * Used to determine, whether to send or queue frame events.
458          * Must be NULL, if 'link' is not in weston_compositor::surface_list.
459          */
460         struct weston_output *output;
461
462         /*
463          * A more complete representation of all outputs this surface is
464          * displayed on.
465          */
466         uint32_t output_mask;
467
468         struct wl_list frame_callback_list;
469
470         struct weston_buffer_reference buffer_ref;
471         uint32_t buffer_transform;
472         int keep_buffer; /* bool for backends to prevent early release */
473
474         /* All the pending state, that wl_surface.commit will apply. */
475         struct {
476                 /* wl_surface.attach */
477                 int newly_attached;
478                 struct wl_buffer *buffer;
479                 struct wl_listener buffer_destroy_listener;
480                 int32_t sx;
481                 int32_t sy;
482
483                 /* wl_surface.damage */
484                 pixman_region32_t damage;
485
486                 /* wl_surface.set_opaque_region */
487                 pixman_region32_t opaque;
488
489                 /* wl_surface.set_input_region */
490                 pixman_region32_t input;
491
492                 /* wl_surface.frame */
493                 struct wl_list frame_callback_list;
494
495                 /* wl_surface.set_buffer_transform */
496                 uint32_t buffer_transform;
497         } pending;
498
499         /*
500          * If non-NULL, this function will be called on surface::attach after
501          * a new buffer has been set up for this surface. The integer params
502          * are the sx and sy paramerters supplied to surface::attach .
503          */
504         void (*configure)(struct weston_surface *es, int32_t sx, int32_t sy, int32_t width, int32_t height);
505         void *configure_private;
506 };
507
508 enum weston_key_state_update {
509         STATE_UPDATE_AUTOMATIC,
510         STATE_UPDATE_NONE,
511 };
512
513 void
514 weston_version(int *major, int *minor, int *micro);
515
516 void
517 weston_surface_update_transform(struct weston_surface *surface);
518
519 void
520 weston_surface_geometry_dirty(struct weston_surface *surface);
521
522 void
523 weston_surface_to_global_fixed(struct weston_surface *surface,
524                                wl_fixed_t sx, wl_fixed_t sy,
525                                wl_fixed_t *x, wl_fixed_t *y);
526 void
527 weston_surface_to_global_float(struct weston_surface *surface,
528                                float sx, float sy, float *x, float *y);
529
530 void
531 weston_surface_from_global_float(struct weston_surface *surface,
532                                  float x, float y, float *sx, float *sy);
533 void
534 weston_surface_from_global(struct weston_surface *surface,
535                            int32_t x, int32_t y, int32_t *sx, int32_t *sy);
536 void
537 weston_surface_from_global_fixed(struct weston_surface *surface,
538                                  wl_fixed_t x, wl_fixed_t y,
539                                  wl_fixed_t *sx, wl_fixed_t *sy);
540 int32_t
541 weston_surface_buffer_width(struct weston_surface *surface);
542 int32_t
543 weston_surface_buffer_height(struct weston_surface *surface);
544
545 WL_EXPORT void
546 weston_surface_to_buffer_float(struct weston_surface *surface,
547                                float x, float y, float *bx, float *by);
548 pixman_box32_t
549 weston_surface_to_buffer_rect(struct weston_surface *surface,
550                               pixman_box32_t rect);
551
552 void
553 weston_spring_init(struct weston_spring *spring,
554                    double k, double current, double target);
555 void
556 weston_spring_update(struct weston_spring *spring, uint32_t msec);
557 int
558 weston_spring_done(struct weston_spring *spring);
559
560 void
561 weston_surface_activate(struct weston_surface *surface,
562                         struct weston_seat *seat);
563 void
564 notify_motion(struct weston_seat *seat, uint32_t time,
565               wl_fixed_t dx, wl_fixed_t dy);
566 void
567 notify_motion_absolute(struct weston_seat *seat, uint32_t time,
568                        wl_fixed_t x, wl_fixed_t y);
569 void
570 notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
571               enum wl_pointer_button_state state);
572 void
573 notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
574             wl_fixed_t value);
575 void
576 notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
577            enum wl_keyboard_key_state state,
578            enum weston_key_state_update update_state);
579 void
580 notify_modifiers(struct weston_seat *seat, uint32_t serial);
581
582 void
583 notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
584                      wl_fixed_t x, wl_fixed_t y);
585
586 void
587 notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
588                          enum weston_key_state_update update_state);
589 void
590 notify_keyboard_focus_out(struct weston_seat *seat);
591
592 void
593 notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
594              wl_fixed_t x, wl_fixed_t y, int touch_type);
595
596 void
597 weston_layer_init(struct weston_layer *layer, struct wl_list *below);
598
599 void
600 weston_plane_init(struct weston_plane *plane, int32_t x, int32_t y);
601 void
602 weston_plane_release(struct weston_plane *plane);
603
604 void
605 weston_compositor_stack_plane(struct weston_compositor *ec,
606                               struct weston_plane *plane,
607                               struct weston_plane *above);
608
609 void
610 weston_output_finish_frame(struct weston_output *output, uint32_t msecs);
611 void
612 weston_output_schedule_repaint(struct weston_output *output);
613 void
614 weston_output_damage(struct weston_output *output);
615 void
616 weston_compositor_schedule_repaint(struct weston_compositor *compositor);
617 void
618 weston_compositor_fade(struct weston_compositor *compositor, float tint);
619 void
620 weston_compositor_damage_all(struct weston_compositor *compositor);
621 void
622 weston_compositor_unlock(struct weston_compositor *compositor);
623 void
624 weston_compositor_wake(struct weston_compositor *compositor);
625 void
626 weston_compositor_offscreen(struct weston_compositor *compositor);
627 void
628 weston_compositor_sleep(struct weston_compositor *compositor);
629 void
630 weston_compositor_update_drag_surfaces(struct weston_compositor *compositor);
631
632
633 struct weston_binding;
634 typedef void (*weston_key_binding_handler_t)(struct wl_seat *seat,
635                                              uint32_t time, uint32_t key,
636                                              void *data);
637 struct weston_binding *
638 weston_compositor_add_key_binding(struct weston_compositor *compositor,
639                                   uint32_t key,
640                                   enum weston_keyboard_modifier modifier,
641                                   weston_key_binding_handler_t binding,
642                                   void *data);
643
644 typedef void (*weston_button_binding_handler_t)(struct wl_seat *seat,
645                                                 uint32_t time, uint32_t button,
646                                                 void *data);
647 struct weston_binding *
648 weston_compositor_add_button_binding(struct weston_compositor *compositor,
649                                      uint32_t button,
650                                      enum weston_keyboard_modifier modifier,
651                                      weston_button_binding_handler_t binding,
652                                      void *data);
653
654 typedef void (*weston_axis_binding_handler_t)(struct wl_seat *seat,
655                                               uint32_t time, uint32_t axis,
656                                               wl_fixed_t value, void *data);
657 struct weston_binding *
658 weston_compositor_add_axis_binding(struct weston_compositor *compositor,
659                                    uint32_t axis,
660                                    enum weston_keyboard_modifier modifier,
661                                    weston_axis_binding_handler_t binding,
662                                    void *data);
663 struct weston_binding *
664 weston_compositor_add_debug_binding(struct weston_compositor *compositor,
665                                     uint32_t key,
666                                     weston_key_binding_handler_t binding,
667                                     void *data);
668 void
669 weston_binding_destroy(struct weston_binding *binding);
670
671 void
672 weston_binding_list_destroy_all(struct wl_list *list);
673
674 void
675 weston_compositor_run_key_binding(struct weston_compositor *compositor,
676                                   struct weston_seat *seat, uint32_t time,
677                                   uint32_t key,
678                                   enum wl_keyboard_key_state state);
679 void
680 weston_compositor_run_button_binding(struct weston_compositor *compositor,
681                                      struct weston_seat *seat, uint32_t time,
682                                      uint32_t button,
683                                      enum wl_pointer_button_state value);
684 int
685 weston_compositor_run_axis_binding(struct weston_compositor *compositor,
686                                    struct weston_seat *seat, uint32_t time,
687                                    uint32_t axis, int32_t value);
688 int
689 weston_compositor_run_debug_binding(struct weston_compositor *compositor,
690                                     struct weston_seat *seat, uint32_t time,
691                                     uint32_t key,
692                                     enum wl_keyboard_key_state state);
693
694 int
695 weston_environment_get_fd(const char *env);
696
697 struct wl_list *
698 weston_compositor_top(struct weston_compositor *compositor);
699
700 struct weston_surface *
701 weston_surface_create(struct weston_compositor *compositor);
702
703 void
704 weston_surface_configure(struct weston_surface *surface,
705                          float x, float y, int width, int height);
706
707 void
708 weston_surface_restack(struct weston_surface *surface, struct wl_list *below);
709
710 void
711 weston_surface_set_position(struct weston_surface *surface,
712                             float x, float y);
713
714 void
715 weston_surface_set_transform_parent(struct weston_surface *surface,
716                                     struct weston_surface *parent);
717
718 int
719 weston_surface_is_mapped(struct weston_surface *surface);
720
721 void
722 weston_surface_schedule_repaint(struct weston_surface *surface);
723
724 void
725 weston_surface_damage(struct weston_surface *surface);
726
727 void
728 weston_surface_damage_below(struct weston_surface *surface);
729
730 void
731 weston_surface_move_to_plane(struct weston_surface *surface,
732                              struct weston_plane *plane);
733 void
734 weston_surface_unmap(struct weston_surface *surface);
735
736 void
737 weston_buffer_reference(struct weston_buffer_reference *ref,
738                         struct wl_buffer *buffer);
739
740 uint32_t
741 weston_compositor_get_time(void);
742
743 int
744 weston_compositor_init(struct weston_compositor *ec, struct wl_display *display,
745                        int *argc, char *argv[], const char *config_file);
746 void
747 weston_compositor_shutdown(struct weston_compositor *ec);
748 void
749 weston_text_cursor_position_notify(struct weston_surface *surface,
750                                                 wl_fixed_t x, wl_fixed_t y);
751 void
752 weston_output_init_zoom(struct weston_output *output);
753 void
754 weston_output_update_zoom(struct weston_output *output, uint32_t type);
755 void
756 weston_output_update_matrix(struct weston_output *output);
757 void
758 weston_output_move(struct weston_output *output, int x, int y);
759 void
760 weston_output_init(struct weston_output *output, struct weston_compositor *c,
761                    int x, int y, int width, int height, uint32_t transform);
762 void
763 weston_output_destroy(struct weston_output *output);
764
765 void
766 weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec);
767 void
768 weston_seat_init_pointer(struct weston_seat *seat);
769 int
770 weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap);
771 void
772 weston_seat_init_touch(struct weston_seat *seat);
773
774 void
775 weston_seat_release(struct weston_seat *seat);
776
777 /* String literal of spaces, the same width as the timestamp. */
778 #define STAMP_SPACE "               "
779
780 void
781 weston_log_file_open(const char *filename);
782 void
783 weston_log_file_close(void);
784 int
785 weston_log(const char *fmt, ...)
786         __attribute__ ((format (printf, 1, 2)));
787 int
788 weston_log_continue(const char *fmt, ...)
789         __attribute__ ((format (printf, 1, 2)));
790
791 enum {
792         TTY_ENTER_VT,
793         TTY_LEAVE_VT
794 };
795
796 typedef void (*tty_vt_func_t)(struct weston_compositor *compositor, int event);
797
798 struct tty *
799 tty_create(struct weston_compositor *compositor,
800            tty_vt_func_t vt_func, int tty_nr);
801
802 void
803 tty_destroy(struct tty *tty);
804
805 void
806 tty_reset(struct tty *tty);
807
808 int
809 tty_activate_vt(struct tty *tty, int vt);
810
811 void
812 screenshooter_create(struct weston_compositor *ec);
813
814 struct clipboard *
815 clipboard_create(struct weston_seat *seat);
816
817 void
818 text_cursor_position_notifier_create(struct weston_compositor *ec);
819
820 int
821 text_backend_init(struct weston_compositor *ec);
822
823 struct weston_process;
824 typedef void (*weston_process_cleanup_func_t)(struct weston_process *process,
825                                             int status);
826
827 struct weston_process {
828         pid_t pid;
829         weston_process_cleanup_func_t cleanup;
830         struct wl_list link;
831 };
832
833 struct wl_client *
834 weston_client_launch(struct weston_compositor *compositor,
835                      struct weston_process *proc,
836                      const char *path,
837                      weston_process_cleanup_func_t cleanup);
838
839 void
840 weston_watch_process(struct weston_process *process);
841
842 struct weston_surface_animation;
843 typedef void (*weston_surface_animation_done_func_t)(struct weston_surface_animation *animation, void *data);
844
845 struct weston_surface_animation *
846 weston_zoom_run(struct weston_surface *surface, float start, float stop,
847                 weston_surface_animation_done_func_t done, void *data);
848
849 struct weston_surface_animation *
850 weston_fade_run(struct weston_surface *surface,
851                 float start, float end, float k,
852                 weston_surface_animation_done_func_t done, void *data);
853 void
854 weston_fade_update(struct weston_surface_animation *fade,
855                    float start, float end, float k);
856
857 struct weston_surface_animation *
858 weston_slide_run(struct weston_surface *surface, float start, float stop,
859                  weston_surface_animation_done_func_t done, void *data);
860
861 void
862 weston_surface_set_color(struct weston_surface *surface,
863                          float red, float green, float blue, float alpha);
864
865 void
866 weston_surface_destroy(struct weston_surface *surface);
867
868 int
869 weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode);
870
871 int
872 noop_renderer_init(struct weston_compositor *ec);
873
874 struct weston_compositor *
875 backend_init(struct wl_display *display, int *argc, char *argv[],
876              const char *config_file);
877
878 int
879 module_init(struct weston_compositor *compositor,
880             int *argc, char *argv[], const char *config_file);
881
882 void
883 weston_transformed_coord(int width, int height,
884                          enum wl_output_transform transform,
885                          float sx, float sy, float *bx, float *by);
886 pixman_box32_t
887 weston_transformed_rect(int width, int height,
888                         enum wl_output_transform transform,
889                         pixman_box32_t rect);
890
891 #ifdef  __cplusplus
892 }
893 #endif
894
895 #endif