blob: a8f5853066035decc766c6aedfe3e72d211981c9 [file] [log] [blame]
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -05001/*
2 * Copyright © 2008 Kristian Høgsberg
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22
23#ifndef _WINDOW_H_
24#define _WINDOW_H_
25
26struct window;
27
28struct rectangle {
29 int32_t x;
30 int32_t y;
31 int32_t width;
32 int32_t height;
33};
34
Kristian Høgsberg43c28ee2009-01-26 23:42:46 -050035struct display;
36
37struct display *
38display_create(struct wl_display *display, int fd);
39struct wl_compositor *
40display_get_compositor(struct display *display);
41
Kristian Høgsberg22106762008-12-08 13:50:07 -050042typedef void (*window_resize_handler_t)(struct window *window, void *data);
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050043typedef void (*window_frame_handler_t)(struct window *window, uint32_t frame, uint32_t timestamp, void *data);
44typedef void (*window_acknowledge_handler_t)(struct window *window, uint32_t key, void *data);
Kristian Høgsberg6e83d582008-12-08 00:01:36 -050045typedef void (*window_key_handler_t)(struct window *window, uint32_t key, uint32_t state, void *data);
46
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050047
48struct window *
Kristian Høgsberg43c28ee2009-01-26 23:42:46 -050049window_create(struct display *display, const char *title,
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050050 int32_t x, int32_t y, int32_t width, int32_t height);
51
52void
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050053window_draw(struct window *window);
54void
55window_get_child_rectangle(struct window *window,
56 struct rectangle *rectangle);
57void
Kristian Høgsberg22106762008-12-08 13:50:07 -050058window_set_child_size(struct window *window,
59 struct rectangle *rectangle);
60void
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050061window_copy(struct window *window,
62 struct rectangle *rectangle,
63 uint32_t name, uint32_t stride);
64
Kristian Høgsberg0ac16f02009-01-15 11:37:43 -050065cairo_surface_t *
66window_create_surface(struct window *window,
67 struct rectangle *rectangle);
68
69void
70window_copy_surface(struct window *window,
71 struct rectangle *rectangle,
72 cairo_surface_t *surface);
73
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050074void
Kristian Høgsberg0395f302008-12-22 12:14:50 -050075window_set_fullscreen(struct window *window, int fullscreen);
76
77void
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050078window_set_resize_handler(struct window *window,
79 window_resize_handler_t handler, void *data);
80void
81window_set_frame_handler(struct window *window,
82 window_frame_handler_t handler, void *data);
83void
84window_set_acknowledge_handler(struct window *window,
85 window_acknowledge_handler_t handler, void *data);
Kristian Høgsberg6e83d582008-12-08 00:01:36 -050086void
87window_set_key_handler(struct window *window,
88 window_key_handler_t handler, void *data);
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050089
90#endif