blob: cf3578789ae8b361519e0a706070bffefeb5d6ed [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
35typedef void (*window_resize_handler_t)(struct window *window, int32_t width, int32_t height, void *data);
36typedef void (*window_frame_handler_t)(struct window *window, uint32_t frame, uint32_t timestamp, void *data);
37typedef void (*window_acknowledge_handler_t)(struct window *window, uint32_t key, void *data);
38
39struct window *
40window_create(struct wl_display *display, int fd,
41 const char *title,
42 int32_t x, int32_t y, int32_t width, int32_t height);
43
44void
45window_set_minimum_size(struct window *window, uint32_t width, int32_t height);
46
47void
48window_draw(struct window *window);
49void
50window_get_child_rectangle(struct window *window,
51 struct rectangle *rectangle);
52void
53window_copy(struct window *window,
54 struct rectangle *rectangle,
55 uint32_t name, uint32_t stride);
56
57void
58window_set_resize_handler(struct window *window,
59 window_resize_handler_t handler, void *data);
60void
61window_set_frame_handler(struct window *window,
62 window_frame_handler_t handler, void *data);
63void
64window_set_acknowledge_handler(struct window *window,
65 window_acknowledge_handler_t handler, void *data);
66
67#endif