blob: a8177341d254682238adb205030a32c611de98db [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
Daniel Stone9d4f0302012-02-15 16:33:21 +000026#include <xkbcommon/xkbcommon.h>
Fred Morcosc4b8c452010-11-28 19:31:55 +010027#include <wayland-client.h>
Benjamin Franzkecff904e2011-02-18 23:00:55 +010028#include <cairo.h>
Kristian Høgsbergbcacef12012-03-11 21:05:57 -040029#include "../shared/config-parser.h"
Peter Huttererf3d62272013-08-08 11:57:05 +100030#include "../shared/zalloc.h"
Pekka Paalanen2396aec2013-04-25 13:57:41 +030031#include "subsurface-client-protocol.h"
Fred Morcosc4b8c452010-11-28 19:31:55 +010032
Kristian Høgsberg5717b6d2012-10-19 17:12:38 -040033#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
34
Kristian Høgsberg8c31a4c2012-10-19 23:05:37 -040035#define container_of(ptr, type, member) ({ \
36 const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
37 (type *)( (char *)__mptr - offsetof(type,member) );})
38
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050039struct window;
Kristian Høgsbergc51f7992012-01-08 15:09:53 -050040struct widget;
Kristian Høgsberge28d05b2011-09-20 21:43:54 -040041struct display;
42struct input;
Kristian Høgsberg53ff2f62011-11-26 17:27:37 -050043struct output;
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050044
Kristian Høgsberg3a696272011-09-14 17:33:48 -040045struct task {
46 void (*run)(struct task *task, uint32_t events);
47 struct wl_list link;
48};
49
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050050struct rectangle {
51 int32_t x;
52 int32_t y;
53 int32_t width;
54 int32_t height;
55};
56
Kristian Høgsbergce278412013-07-25 15:20:20 -070057void *
58fail_on_null(void *p);
59void *
60xmalloc(size_t s);
Peter Huttererf3d62272013-08-08 11:57:05 +100061void *
62xzalloc(size_t s);
Kristian Høgsbergce278412013-07-25 15:20:20 -070063char *
64xstrdup(const char *s);
65
Kristian Høgsberg43c28ee2009-01-26 23:42:46 -050066struct display *
Kristian Høgsberg4172f662013-02-20 15:27:49 -050067display_create(int *argc, char *argv[]);
Kristian Høgsberg7824d812010-06-08 14:59:44 -040068
Pekka Paalanen999c5b52011-11-30 10:52:38 +020069void
Pekka Paalanenfe6079a2011-12-15 15:20:04 +020070display_destroy(struct display *display);
71
72void
Pekka Paalanen999c5b52011-11-30 10:52:38 +020073display_set_user_data(struct display *display, void *data);
74
75void *
76display_get_user_data(struct display *display);
77
Kristian Høgsberg9d69f8e2010-09-03 14:46:38 -040078struct wl_display *
79display_get_display(struct display *display);
80
Kristian Høgsberg1cc5ac32013-04-11 21:47:41 -040081cairo_device_t *
82display_get_cairo_device(struct display *display);
83
Kristian Høgsberg43c28ee2009-01-26 23:42:46 -050084struct wl_compositor *
85display_get_compositor(struct display *display);
86
Kristian Høgsberg58eec362011-01-19 14:27:42 -050087struct wl_shell *
88display_get_shell(struct display *display);
89
Kristian Høgsberg53ff2f62011-11-26 17:27:37 -050090struct output *
91display_get_output(struct display *display);
92
Kristian Høgsbergeae5de72012-04-11 22:42:15 -040093uint32_t
94display_get_serial(struct display *display);
95
Kristian Høgsbergfa80e112012-10-10 21:34:26 -040096typedef void (*display_global_handler_t)(struct display *display,
97 uint32_t name,
98 const char *interface,
99 uint32_t version, void *data);
100
101void
102display_set_global_handler(struct display *display,
103 display_global_handler_t handler);
104void *
105display_bind(struct display *display, uint32_t name,
106 const struct wl_interface *interface, uint32_t version);
107
Pekka Paalanen999c5b52011-11-30 10:52:38 +0200108typedef void (*display_output_handler_t)(struct output *output, void *data);
109
110/*
111 * The output configure handler is called, when a new output is connected
112 * and we know its current mode, or when the current mode changes.
113 * Test and set the output user data in your handler to know, if the
114 * output is new. Note: 'data' in the configure handler is the display
115 * user data.
116 */
117void
118display_set_output_configure_handler(struct display *display,
119 display_output_handler_t handler);
120
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400121struct wl_data_source *
122display_create_data_source(struct display *display);
123
Kristian Høgsberg7824d812010-06-08 14:59:44 -0400124#ifdef EGL_NO_DISPLAY
125EGLDisplay
126display_get_egl_display(struct display *d);
Kristian Høgsberg2b43bd72010-11-08 15:45:55 -0500127
Benjamin Franzkecff904e2011-02-18 23:00:55 +0100128EGLConfig
Benjamin Franzke0c991632011-09-27 21:57:31 +0200129display_get_argb_egl_config(struct display *d);
Benjamin Franzkecff904e2011-02-18 23:00:55 +0100130
Benjamin Franzke1a89f282011-10-07 09:33:06 +0200131int
Benjamin Franzkecff904e2011-02-18 23:00:55 +0100132display_acquire_window_surface(struct display *display,
133 struct window *window,
134 EGLContext ctx);
135void
Benjamin Franzke0c991632011-09-27 21:57:31 +0200136display_release_window_surface(struct display *display,
137 struct window *window);
nobled98354172011-01-05 17:48:15 +0000138#endif
Kristian Høgsberg7824d812010-06-08 14:59:44 -0400139
Kristian Høgsberg3be87d12011-05-13 13:45:17 -0400140#define SURFACE_OPAQUE 0x01
Ander Conselvan de Oliveira210eb9d2012-05-25 16:03:06 +0300141#define SURFACE_SHM 0x02
Kristian Høgsberg3be87d12011-05-13 13:45:17 -0400142
Pekka Paalanen02bba7c2013-02-13 16:17:15 +0200143#define SURFACE_HINT_RESIZE 0x10
144
Tomeu Vizosobee45a12013-08-06 20:05:54 +0200145#define SURFACE_HINT_RGB565 0x100
146
Kristian Høgsbergdcb71b62010-06-15 17:16:35 -0400147cairo_surface_t *
148display_create_surface(struct display *display,
Benjamin Franzke6693ac22011-02-10 12:04:30 +0100149 struct wl_surface *surface,
Kristian Høgsberg3be87d12011-05-13 13:45:17 -0400150 struct rectangle *rectangle,
151 uint32_t flags);
Kristian Høgsbergdcb71b62010-06-15 17:16:35 -0400152
Kristian Høgsberg9a686242010-08-18 15:28:04 -0400153struct wl_buffer *
154display_get_buffer_for_surface(struct display *display,
155 cairo_surface_t *surface);
156
Ander Conselvan de Oliveira1042dc12012-05-22 15:39:42 +0300157struct wl_cursor_image *
158display_get_pointer_image(struct display *display, int pointer);
Kristian Høgsberg9a686242010-08-18 15:28:04 -0400159
Kristian Høgsberg7824d812010-06-08 14:59:44 -0400160void
Kristian Høgsberg3a696272011-09-14 17:33:48 -0400161display_defer(struct display *display, struct task *task);
162
163void
164display_watch_fd(struct display *display,
165 int fd, uint32_t events, struct task *task);
166
167void
Dima Ryazanova85292e2012-11-29 00:27:09 -0800168display_unwatch_fd(struct display *display, int fd);
169
170void
Kristian Høgsberg7824d812010-06-08 14:59:44 -0400171display_run(struct display *d);
172
Pekka Paalanen826d7952011-12-15 10:14:07 +0200173void
174display_exit(struct display *d);
175
Ander Conselvan de Oliveiradc8c8fc2012-05-25 16:01:41 +0300176enum cursor_type {
177 CURSOR_BOTTOM_LEFT,
178 CURSOR_BOTTOM_RIGHT,
179 CURSOR_BOTTOM,
180 CURSOR_DRAGGING,
181 CURSOR_LEFT_PTR,
182 CURSOR_LEFT,
183 CURSOR_RIGHT,
184 CURSOR_TOP_LEFT,
185 CURSOR_TOP_RIGHT,
186 CURSOR_TOP,
187 CURSOR_IBEAM,
188 CURSOR_HAND1,
Kristian Høgsbergf3370522012-06-20 23:04:41 -0400189 CURSOR_WATCH,
190
191 CURSOR_BLANK
Kristian Høgsberg9a686242010-08-18 15:28:04 -0400192};
193
Kristian Høgsberg67cac8a2011-01-19 14:20:33 -0500194typedef void (*window_key_handler_t)(struct window *window, struct input *input,
195 uint32_t time, uint32_t key, uint32_t unicode,
Daniel Stonec9785ea2012-05-30 16:31:52 +0100196 enum wl_keyboard_key_state state, void *data);
Tim Wiederhakedc3f8172011-01-17 17:25:34 +0100197
Kristian Høgsberg3c248cc2009-02-22 23:01:35 -0500198typedef void (*window_keyboard_focus_handler_t)(struct window *window,
Kristian Høgsberg808fd412010-07-20 17:06:19 -0400199 struct input *device, void *data);
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500200
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400201typedef void (*window_data_handler_t)(struct window *window,
Kristian Høgsbergeae5de72012-04-11 22:42:15 -0400202 struct input *input,
Kristian Høgsberg80680c72012-05-10 12:21:37 -0400203 float x, float y,
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400204 const char **types,
205 void *data);
206
207typedef void (*window_drop_handler_t)(struct window *window,
208 struct input *input,
209 int32_t x, int32_t y, void *data);
210
Kristian Høgsberg4f7dcd62012-01-06 21:59:05 -0500211typedef void (*window_close_handler_t)(struct window *window, void *data);
Kristian Høgsberg67ace202012-07-23 21:56:31 -0400212typedef void (*window_fullscreen_handler_t)(struct window *window, void *data);
Kristian Høgsberg4f7dcd62012-01-06 21:59:05 -0500213
Ander Conselvan de Oliveira15256f62012-11-30 17:34:25 +0200214typedef void (*window_output_handler_t)(struct window *window, struct output *output,
215 int enter, void *data);
216
Kristian Høgsbergb67e94b2012-01-10 12:23:19 -0500217typedef void (*widget_resize_handler_t)(struct widget *widget,
218 int32_t width, int32_t height,
219 void *data);
220typedef void (*widget_redraw_handler_t)(struct widget *widget, void *data);
221
Kristian Høgsbergbb901fa2012-01-09 11:22:32 -0500222typedef int (*widget_enter_handler_t)(struct widget *widget,
Kristian Høgsbergeae5de72012-04-11 22:42:15 -0400223 struct input *input,
Kristian Høgsberg80680c72012-05-10 12:21:37 -0400224 float x, float y, void *data);
Kristian Høgsbergee143232012-01-09 08:42:24 -0500225typedef void (*widget_leave_handler_t)(struct widget *widget,
226 struct input *input, void *data);
Kristian Høgsberg04e98342012-01-09 09:36:16 -0500227typedef int (*widget_motion_handler_t)(struct widget *widget,
228 struct input *input, uint32_t time,
Kristian Høgsberg80680c72012-05-10 12:21:37 -0400229 float x, float y, void *data);
Kristian Høgsberga8a0db32012-01-09 11:12:05 -0500230typedef void (*widget_button_handler_t)(struct widget *widget,
231 struct input *input, uint32_t time,
Daniel Stone4dbadb12012-05-30 16:31:51 +0100232 uint32_t button,
233 enum wl_pointer_button_state state,
Daniel Stoneda5b93c2012-05-04 11:21:54 +0100234 void *data);
Rusty Lynch041815a2013-08-08 21:20:38 -0700235typedef void (*widget_touch_down_handler_t)(struct widget *widget,
236 uint32_t serial,
237 uint32_t time,
238 int32_t id,
239 float x,
240 float y,
241 void *data);
242typedef void (*widget_touch_up_handler_t)(struct widget *widget,
243 uint32_t serial,
244 uint32_t time,
245 int32_t id,
246 void *data);
247typedef void (*widget_touch_motion_handler_t)(struct widget *widget,
248 uint32_t time,
249 int32_t id,
250 float x,
251 float y,
252 void *data);
253typedef void (*widget_touch_frame_handler_t)(struct widget *widget,void *data);
254typedef void (*widget_touch_cancel_handler_t)(struct widget *widget, void *data);
Philipp Brüschweiler7e0cc542012-08-14 11:02:41 +0200255typedef void (*widget_axis_handler_t)(struct widget *widget,
256 struct input *input, uint32_t time,
257 uint32_t axis,
258 wl_fixed_t value,
259 void *data);
Kristian Høgsbergee143232012-01-09 08:42:24 -0500260
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500261struct window *
Kristian Høgsberg009ac0a2012-01-31 15:24:48 -0500262window_create(struct display *display);
Kristian Høgsberg248c1b62011-01-21 18:03:15 -0500263struct window *
264window_create_transient(struct display *display, struct window *parent,
Tiago Vignattidec76582012-05-21 16:47:46 +0300265 int32_t x, int32_t y, uint32_t flags);
Kristian Høgsberg962342c2012-06-26 16:29:50 -0400266struct window *
267window_create_custom(struct display *display);
Kristian Høgsberg4f7dcd62012-01-06 21:59:05 -0500268
Kristian Høgsberg86adef92012-08-13 22:25:53 -0400269int
270window_has_focus(struct window *window);
271
Kristian Høgsberg4f7dcd62012-01-06 21:59:05 -0500272typedef void (*menu_func_t)(struct window *window, int index, void *data);
273
Pekka Paalanen6d174cf2012-01-19 15:17:59 +0200274void
275window_show_menu(struct display *display,
276 struct input *input, uint32_t time, struct window *parent,
277 int32_t x, int32_t y,
278 menu_func_t func, const char **entries, int count);
Kristian Høgsberg248c1b62011-01-21 18:03:15 -0500279
280void
Kristian Høgsbergd31fcab2012-01-31 09:53:44 -0500281window_show_frame_menu(struct window *window,
282 struct input *input, uint32_t time);
283
Ander Conselvan de Oliveira6d4cb4e2012-11-30 17:34:24 +0200284int
285window_get_buffer_transform(struct window *window);
286
287void
288window_set_buffer_transform(struct window *window,
289 enum wl_output_transform transform);
290
Alexander Larsson5e9b6522013-05-22 14:41:28 +0200291uint32_t
292window_get_buffer_scale(struct window *window);
293
294void
295window_set_buffer_scale(struct window *window,
Alexander Larssonedddbd12013-05-24 13:09:43 +0200296 int32_t scale);
Alexander Larsson5e9b6522013-05-22 14:41:28 +0200297
Alexander Larssond68f5232013-05-22 14:41:33 +0200298uint32_t
299window_get_output_scale(struct window *window);
300
Kristian Høgsbergd31fcab2012-01-31 09:53:44 -0500301void
Kristian Høgsberg248c1b62011-01-21 18:03:15 -0500302window_destroy(struct window *window);
303
Kristian Høgsbergc51f7992012-01-08 15:09:53 -0500304struct widget *
305window_add_widget(struct window *window, void *data);
Kristian Høgsberge28d05b2011-09-20 21:43:54 -0400306
Pekka Paalanen35e82632013-04-25 13:57:48 +0300307enum subsurface_mode {
308 SUBSURFACE_SYNCHRONIZED,
309 SUBSURFACE_DESYNCHRONIZED
310};
311
312struct widget *
313window_add_subsurface(struct window *window, void *data,
314 enum subsurface_mode default_mode);
315
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400316typedef void (*data_func_t)(void *data, size_t len,
317 int32_t x, int32_t y, void *user_data);
318
Kristian Høgsbergbcee9a42011-10-12 00:36:16 -0400319struct display *
320window_get_display(struct window *window);
Kristian Høgsberg248c1b62011-01-21 18:03:15 -0500321void
Kristian Høgsberg82da52b2010-12-17 09:53:12 -0500322window_move(struct window *window, struct input *input, uint32_t time);
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500323void
Kristian Høgsbergbb977002012-01-10 19:11:42 -0500324window_get_allocation(struct window *window, struct rectangle *allocation);
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500325void
Kristian Høgsberg80d746f2010-06-14 23:52:50 -0400326window_schedule_redraw(struct window *window);
Kristian Høgsbergb67e94b2012-01-10 12:23:19 -0500327void
328window_schedule_resize(struct window *window, int width, int height);
Kristian Høgsberga85fe3c2010-06-08 14:08:30 -0400329
330void
Kristian Høgsbergd0c3b9d2010-10-25 11:40:03 -0400331window_damage(struct window *window, int32_t x, int32_t y,
332 int32_t width, int32_t height);
333
Kristian Høgsberg0ac16f02009-01-15 11:37:43 -0500334cairo_surface_t *
Kristian Høgsberga85fe3c2010-06-08 14:08:30 -0400335window_get_surface(struct window *window);
336
Benjamin Franzkeec4d3422011-03-14 12:07:26 +0100337struct wl_surface *
338window_get_wl_surface(struct window *window);
339
Pekka Paalanen9d1613e2011-11-25 12:09:16 +0200340struct wl_shell_surface *
341window_get_wl_shell_surface(struct window *window);
342
Kristian Høgsbergd0c3b9d2010-10-25 11:40:03 -0400343enum window_buffer_type {
Benjamin Franzke6693ac22011-02-10 12:04:30 +0100344 WINDOW_BUFFER_TYPE_EGL_WINDOW,
Kristian Høgsbergd0c3b9d2010-10-25 11:40:03 -0400345 WINDOW_BUFFER_TYPE_SHM,
346};
347
348void
Benjamin Franzkebde55ec2011-03-07 15:08:09 +0100349display_surface_damage(struct display *display, cairo_surface_t *cairo_surface,
350 int32_t x, int32_t y, int32_t width, int32_t height);
351
352void
Kristian Høgsbergd0c3b9d2010-10-25 11:40:03 -0400353window_set_buffer_type(struct window *window, enum window_buffer_type type);
354
Kristian Høgsberg1671e112012-10-10 11:36:24 -0400355int
356window_is_fullscreen(struct window *window);
357
Kristian Høgsberg9d69f8e2010-09-03 14:46:38 -0400358void
Kristian Høgsberg0395f302008-12-22 12:14:50 -0500359window_set_fullscreen(struct window *window, int fullscreen);
360
Ander Conselvan de Oliveira5403f522012-12-14 13:37:23 -0200361void
362window_set_fullscreen_method(struct window *window,
363 enum wl_shell_surface_fullscreen_method method);
Kristian Høgsberg1671e112012-10-10 11:36:24 -0400364int
365window_is_maximized(struct window *window);
366
Kristian Høgsberg0395f302008-12-22 12:14:50 -0500367void
Kristian Høgsbergd6bcd7d2012-02-16 15:53:46 -0500368window_set_maximized(struct window *window, int maximized);
369
370void
Kristian Høgsbergc8c37342010-06-25 11:19:22 -0400371window_set_user_data(struct window *window, void *data);
372
Kristian Høgsberge9d37bd2010-09-02 20:22:42 -0400373void *
374window_get_user_data(struct window *window);
375
Kristian Høgsbergc8c37342010-06-25 11:19:22 -0400376void
Kristian Høgsberg6e83d582008-12-08 00:01:36 -0500377window_set_key_handler(struct window *window,
Kristian Høgsbergc8c37342010-06-25 11:19:22 -0400378 window_key_handler_t handler);
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500379
Kristian Høgsberg3c248cc2009-02-22 23:01:35 -0500380void
381window_set_keyboard_focus_handler(struct window *window,
Kristian Høgsbergc8c37342010-06-25 11:19:22 -0400382 window_keyboard_focus_handler_t handler);
Kristian Høgsberga85fe3c2010-06-08 14:08:30 -0400383
384void
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400385window_set_data_handler(struct window *window,
386 window_data_handler_t handler);
387
388void
389window_set_drop_handler(struct window *window,
390 window_drop_handler_t handler);
391
392void
Kristian Høgsberg4f7dcd62012-01-06 21:59:05 -0500393window_set_close_handler(struct window *window,
394 window_close_handler_t handler);
Kristian Høgsberg67ace202012-07-23 21:56:31 -0400395void
396window_set_fullscreen_handler(struct window *window,
397 window_fullscreen_handler_t handler);
Ander Conselvan de Oliveira15256f62012-11-30 17:34:25 +0200398void
399window_set_output_handler(struct window *window,
400 window_output_handler_t handler);
Kristian Høgsberg4f7dcd62012-01-06 21:59:05 -0500401
402void
Callum Lowcayef57a9b2011-01-14 20:46:23 +1300403window_set_title(struct window *window, const char *title);
404
405const char *
406window_get_title(struct window *window);
407
Scott Moreau7a1b32a2012-05-27 14:25:02 -0600408void
409window_set_text_cursor_position(struct window *window, int32_t x, int32_t y);
410
Tomeu Vizosobee45a12013-08-06 20:05:54 +0200411enum preferred_format {
412 WINDOW_PREFERRED_FORMAT_NONE,
413 WINDOW_PREFERRED_FORMAT_RGB565
414};
415
416void
417window_set_preferred_format(struct window *window,
418 enum preferred_format format);
419
Tiago Vignatti82db9d82012-05-23 22:06:27 +0300420int
421widget_set_tooltip(struct widget *parent, char *entry, float x, float y);
422
423void
424widget_destroy_tooltip(struct widget *parent);
425
Kristian Høgsberg441338c2012-01-10 13:52:34 -0500426struct widget *
427widget_add_widget(struct widget *parent, void *data);
Tiago Vignatti82db9d82012-05-23 22:06:27 +0300428
Kristian Høgsberg441338c2012-01-10 13:52:34 -0500429void
430widget_destroy(struct widget *widget);
Kristian Høgsberg9a686242010-08-18 15:28:04 -0400431void
Kristian Høgsbergbf74d522012-11-30 14:54:35 -0500432widget_set_default_cursor(struct widget *widget, int cursor);
433void
Kristian Høgsbergc51f7992012-01-08 15:09:53 -0500434widget_get_allocation(struct widget *widget, struct rectangle *allocation);
Kristian Høgsberge28d05b2011-09-20 21:43:54 -0400435
436void
Kristian Høgsbergc51f7992012-01-08 15:09:53 -0500437widget_set_allocation(struct widget *widget,
438 int32_t x, int32_t y, int32_t width, int32_t height);
Kristian Høgsbergbb977002012-01-10 19:11:42 -0500439void
440widget_set_size(struct widget *widget, int32_t width, int32_t height);
441void
Kristian Høgsberg010f98b2012-02-23 17:30:45 -0500442widget_set_transparent(struct widget *widget, int transparent);
443void
Kristian Høgsbergbb977002012-01-10 19:11:42 -0500444widget_schedule_resize(struct widget *widget, int32_t width, int32_t height);
Kristian Høgsberge28d05b2011-09-20 21:43:54 -0400445
446void *
Kristian Høgsbergc51f7992012-01-08 15:09:53 -0500447widget_get_user_data(struct widget *widget);
Kristian Høgsberge28d05b2011-09-20 21:43:54 -0400448
Pekka Paalanen0c4445b2013-02-13 16:17:23 +0200449cairo_t *
450widget_cairo_create(struct widget *widget);
451
Pekka Paalanen7ff7a802013-04-25 13:57:50 +0300452struct wl_surface *
453widget_get_wl_surface(struct widget *widget);
454
455uint32_t
456widget_get_last_time(struct widget *widget);
457
458void
459widget_input_region_add(struct widget *widget, const struct rectangle *rect);
460
Kristian Høgsberge28d05b2011-09-20 21:43:54 -0400461void
Kristian Høgsbergb67e94b2012-01-10 12:23:19 -0500462widget_set_redraw_handler(struct widget *widget,
463 widget_redraw_handler_t handler);
464void
465widget_set_resize_handler(struct widget *widget,
466 widget_resize_handler_t handler);
467void
Kristian Høgsbergee143232012-01-09 08:42:24 -0500468widget_set_enter_handler(struct widget *widget,
469 widget_enter_handler_t handler);
470void
471widget_set_leave_handler(struct widget *widget,
472 widget_leave_handler_t handler);
Kristian Høgsberg04e98342012-01-09 09:36:16 -0500473void
474widget_set_motion_handler(struct widget *widget,
475 widget_motion_handler_t handler);
Kristian Høgsberg9a13dab2012-01-08 15:18:19 -0500476void
Kristian Høgsberga8a0db32012-01-09 11:12:05 -0500477widget_set_button_handler(struct widget *widget,
478 widget_button_handler_t handler);
Philipp Brüschweiler7e0cc542012-08-14 11:02:41 +0200479void
Rusty Lynch041815a2013-08-08 21:20:38 -0700480widget_set_touch_down_handler(struct widget *widget,
481 widget_touch_down_handler_t handler);
482void
483widget_set_touch_up_handler(struct widget *widget,
484 widget_touch_up_handler_t handler);
485void
486widget_set_touch_motion_handler(struct widget *widget,
487 widget_touch_motion_handler_t handler);
488void
489widget_set_touch_frame_handler(struct widget *widget,
490 widget_touch_frame_handler_t handler);
491void
492widget_set_touch_cancel_handler(struct widget *widget,
493 widget_touch_cancel_handler_t handler);
494void
Philipp Brüschweiler7e0cc542012-08-14 11:02:41 +0200495widget_set_axis_handler(struct widget *widget,
496 widget_axis_handler_t handler);
Kristian Høgsberga8a0db32012-01-09 11:12:05 -0500497void
Kristian Høgsberg9a13dab2012-01-08 15:18:19 -0500498widget_schedule_redraw(struct widget *widget);
499
Kristian Høgsberg29af3eb2012-01-10 22:41:05 -0500500struct widget *
501frame_create(struct window *window, void *data);
Pekka Paalanen0c4445b2013-02-13 16:17:23 +0200502
Kristian Høgsberga1627922012-06-20 17:30:03 -0400503void
504frame_set_child_size(struct widget *widget, int child_width, int child_height);
Kristian Høgsberg29af3eb2012-01-10 22:41:05 -0500505
Kristian Høgsberg9a13dab2012-01-08 15:18:19 -0500506void
Kristian Høgsberg5a4e9ff2012-06-04 16:04:07 -0400507input_set_pointer_image(struct input *input, int pointer);
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400508
509void
Kristian Høgsberg9a686242010-08-18 15:28:04 -0400510input_get_position(struct input *input, int32_t *x, int32_t *y);
511
Kristian Høgsberg70163132012-05-08 15:55:39 -0400512#define MOD_SHIFT_MASK 0x01
513#define MOD_ALT_MASK 0x02
514#define MOD_CONTROL_MASK 0x04
515
Kristian Høgsberg67cac8a2011-01-19 14:20:33 -0500516uint32_t
517input_get_modifiers(struct input *input);
518
Kristian Høgsberg831dd522012-01-10 23:46:33 -0500519void
520input_grab(struct input *input, struct widget *widget, uint32_t button);
521
522void
Kristian Høgsbergeae5de72012-04-11 22:42:15 -0400523input_ungrab(struct input *input);
Kristian Høgsberg831dd522012-01-10 23:46:33 -0500524
Kristian Høgsbergb6323512012-01-11 00:04:42 -0500525struct widget *
526input_get_focus_widget(struct input *input);
527
Kristian Høgsbergd56bd902012-06-05 09:58:51 -0400528struct display *
529input_get_display(struct input *input);
530
Daniel Stone37816df2012-05-16 18:45:18 +0100531struct wl_seat *
532input_get_seat(struct input *input);
Kristian Høgsberg1d7ffd32010-08-25 16:34:05 -0400533
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400534struct wl_data_device *
535input_get_data_device(struct input *input);
536
Kristian Høgsberg6bccebe2011-01-21 16:23:09 -0500537void
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400538input_set_selection(struct input *input,
539 struct wl_data_source *source, uint32_t time);
540
541void
Kristian Høgsbergeae5de72012-04-11 22:42:15 -0400542input_accept(struct input *input, const char *type);
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400543
544
545void
546input_receive_drag_data(struct input *input, const char *mime_type,
547 data_func_t func, void *user_data);
548
549int
550input_receive_selection_data(struct input *input, const char *mime_type,
551 data_func_t func, void *data);
Kristian Høgsberge7aaec32011-12-27 13:50:04 -0500552int
553input_receive_selection_data_to_fd(struct input *input,
554 const char *mime_type, int fd);
Kristian Høgsberg58eec362011-01-19 14:27:42 -0500555
Kristian Høgsberg53ff2f62011-11-26 17:27:37 -0500556void
Pekka Paalanen999c5b52011-11-30 10:52:38 +0200557output_set_user_data(struct output *output, void *data);
558
559void *
560output_get_user_data(struct output *output);
561
562void
563output_set_destroy_handler(struct output *output,
564 display_output_handler_t handler);
565
566void
Kristian Høgsberg53ff2f62011-11-26 17:27:37 -0500567output_get_allocation(struct output *output, struct rectangle *allocation);
568
Pekka Paalanen999c5b52011-11-30 10:52:38 +0200569struct wl_output *
570output_get_wl_output(struct output *output);
Kristian Høgsberg53ff2f62011-11-26 17:27:37 -0500571
Ander Conselvan de Oliveira15256f62012-11-30 17:34:25 +0200572enum wl_output_transform
573output_get_transform(struct output *output);
574
Alexander Larssonafd319a2013-05-22 14:41:27 +0200575uint32_t
576output_get_scale(struct output *output);
577
Jan Arne Petersencd997062012-11-18 19:06:44 +0100578void
579keysym_modifiers_add(struct wl_array *modifiers_map,
580 const char *name);
581
582xkb_mod_mask_t
583keysym_modifiers_get_mask(struct wl_array *modifiers_map,
584 const char *name);
585
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500586#endif