blob: 97719a7cea6184d93daaa6516f8c635c58c09e0d [file] [log] [blame]
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -05001/*
2 * Copyright © 2008 Kristian Høgsberg
3 *
Bryce Harrington1f6b0d12015-06-10 22:48:59 -07004 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050010 *
Bryce Harrington1f6b0d12015-06-10 22:48:59 -070011 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050022 */
23
24#ifndef _WINDOW_H_
25#define _WINDOW_H_
26
Andrew Wedgbury9cd661e2014-04-07 12:40:35 +010027#include "config.h"
28
Daniel Stone9d4f0302012-02-15 16:33:21 +000029#include <xkbcommon/xkbcommon.h>
Fred Morcosc4b8c452010-11-28 19:31:55 +010030#include <wayland-client.h>
Benjamin Franzkecff904e2011-02-18 23:00:55 +010031#include <cairo.h>
Jon Cruz4678bab2015-06-15 15:37:07 -070032#include "shared/config-parser.h"
33#include "shared/zalloc.h"
34#include "shared/platform.h"
Fred Morcosc4b8c452010-11-28 19:31:55 +010035
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050036struct window;
Kristian Høgsbergc51f7992012-01-08 15:09:53 -050037struct widget;
Kristian Høgsberge28d05b2011-09-20 21:43:54 -040038struct display;
39struct input;
Kristian Høgsberg53ff2f62011-11-26 17:27:37 -050040struct output;
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050041
Kristian Høgsberg3a696272011-09-14 17:33:48 -040042struct task {
43 void (*run)(struct task *task, uint32_t events);
44 struct wl_list link;
45};
46
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -050047struct rectangle {
48 int32_t x;
49 int32_t y;
50 int32_t width;
51 int32_t height;
52};
53
Kristian Høgsberg43c28ee2009-01-26 23:42:46 -050054struct display *
Kristian Høgsberg4172f662013-02-20 15:27:49 -050055display_create(int *argc, char *argv[]);
Kristian Høgsberg7824d812010-06-08 14:59:44 -040056
Pekka Paalanen999c5b52011-11-30 10:52:38 +020057void
Pekka Paalanenfe6079a2011-12-15 15:20:04 +020058display_destroy(struct display *display);
59
60void
Pekka Paalanen999c5b52011-11-30 10:52:38 +020061display_set_user_data(struct display *display, void *data);
62
63void *
64display_get_user_data(struct display *display);
65
Kristian Høgsberg9d69f8e2010-09-03 14:46:38 -040066struct wl_display *
67display_get_display(struct display *display);
68
Kristian Høgsbergb20b0092013-08-15 11:54:03 -070069int
70display_has_subcompositor(struct display *display);
71
Kristian Høgsberg1cc5ac32013-04-11 21:47:41 -040072cairo_device_t *
73display_get_cairo_device(struct display *display);
74
Kristian Høgsberg43c28ee2009-01-26 23:42:46 -050075struct wl_compositor *
76display_get_compositor(struct display *display);
77
Kristian Høgsberg53ff2f62011-11-26 17:27:37 -050078struct output *
79display_get_output(struct display *display);
80
Kristian Høgsbergeae5de72012-04-11 22:42:15 -040081uint32_t
82display_get_serial(struct display *display);
83
Kristian Høgsbergfa80e112012-10-10 21:34:26 -040084typedef void (*display_global_handler_t)(struct display *display,
85 uint32_t name,
86 const char *interface,
87 uint32_t version, void *data);
88
89void
90display_set_global_handler(struct display *display,
91 display_global_handler_t handler);
Xiong Zhang83d8ee72013-10-23 13:58:35 +080092void
93display_set_global_handler_remove(struct display *display,
94 display_global_handler_t remove_handler);
Kristian Høgsbergfa80e112012-10-10 21:34:26 -040095void *
96display_bind(struct display *display, uint32_t name,
97 const struct wl_interface *interface, uint32_t version);
98
Pekka Paalanen999c5b52011-11-30 10:52:38 +020099typedef void (*display_output_handler_t)(struct output *output, void *data);
100
101/*
102 * The output configure handler is called, when a new output is connected
103 * and we know its current mode, or when the current mode changes.
104 * Test and set the output user data in your handler to know, if the
105 * output is new. Note: 'data' in the configure handler is the display
106 * user data.
107 */
108void
109display_set_output_configure_handler(struct display *display,
110 display_output_handler_t handler);
111
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400112struct wl_data_source *
113display_create_data_source(struct display *display);
114
Kristian Høgsberg7824d812010-06-08 14:59:44 -0400115#ifdef EGL_NO_DISPLAY
116EGLDisplay
117display_get_egl_display(struct display *d);
Kristian Høgsberg2b43bd72010-11-08 15:45:55 -0500118
Benjamin Franzkecff904e2011-02-18 23:00:55 +0100119EGLConfig
Benjamin Franzke0c991632011-09-27 21:57:31 +0200120display_get_argb_egl_config(struct display *d);
Benjamin Franzkecff904e2011-02-18 23:00:55 +0100121
Benjamin Franzke1a89f282011-10-07 09:33:06 +0200122int
Benjamin Franzkecff904e2011-02-18 23:00:55 +0100123display_acquire_window_surface(struct display *display,
124 struct window *window,
125 EGLContext ctx);
126void
Benjamin Franzke0c991632011-09-27 21:57:31 +0200127display_release_window_surface(struct display *display,
128 struct window *window);
nobled98354172011-01-05 17:48:15 +0000129#endif
Kristian Høgsberg7824d812010-06-08 14:59:44 -0400130
Kristian Høgsberg3be87d12011-05-13 13:45:17 -0400131#define SURFACE_OPAQUE 0x01
Ander Conselvan de Oliveira210eb9d2012-05-25 16:03:06 +0300132#define SURFACE_SHM 0x02
Kristian Høgsberg3be87d12011-05-13 13:45:17 -0400133
Pekka Paalanen02bba7c2013-02-13 16:17:15 +0200134#define SURFACE_HINT_RESIZE 0x10
135
Tomeu Vizosobee45a12013-08-06 20:05:54 +0200136#define SURFACE_HINT_RGB565 0x100
137
Kristian Høgsbergdcb71b62010-06-15 17:16:35 -0400138cairo_surface_t *
139display_create_surface(struct display *display,
Benjamin Franzke6693ac22011-02-10 12:04:30 +0100140 struct wl_surface *surface,
Kristian Høgsberg3be87d12011-05-13 13:45:17 -0400141 struct rectangle *rectangle,
142 uint32_t flags);
Kristian Høgsbergdcb71b62010-06-15 17:16:35 -0400143
Kristian Høgsberg9a686242010-08-18 15:28:04 -0400144struct wl_buffer *
145display_get_buffer_for_surface(struct display *display,
146 cairo_surface_t *surface);
147
Ander Conselvan de Oliveira1042dc12012-05-22 15:39:42 +0300148struct wl_cursor_image *
149display_get_pointer_image(struct display *display, int pointer);
Kristian Høgsberg9a686242010-08-18 15:28:04 -0400150
Kristian Høgsberg7824d812010-06-08 14:59:44 -0400151void
Kristian Høgsberg3a696272011-09-14 17:33:48 -0400152display_defer(struct display *display, struct task *task);
153
154void
155display_watch_fd(struct display *display,
156 int fd, uint32_t events, struct task *task);
157
158void
Dima Ryazanova85292e2012-11-29 00:27:09 -0800159display_unwatch_fd(struct display *display, int fd);
160
161void
Kristian Høgsberg7824d812010-06-08 14:59:44 -0400162display_run(struct display *d);
163
Pekka Paalanen826d7952011-12-15 10:14:07 +0200164void
165display_exit(struct display *d);
166
Carlos Garnacho9c931792016-01-18 23:52:12 +0100167int
168display_get_data_device_manager_version(struct display *d);
169
Ander Conselvan de Oliveiradc8c8fc2012-05-25 16:01:41 +0300170enum cursor_type {
171 CURSOR_BOTTOM_LEFT,
172 CURSOR_BOTTOM_RIGHT,
173 CURSOR_BOTTOM,
174 CURSOR_DRAGGING,
175 CURSOR_LEFT_PTR,
176 CURSOR_LEFT,
177 CURSOR_RIGHT,
178 CURSOR_TOP_LEFT,
179 CURSOR_TOP_RIGHT,
180 CURSOR_TOP,
181 CURSOR_IBEAM,
182 CURSOR_HAND1,
Kristian Høgsbergf3370522012-06-20 23:04:41 -0400183 CURSOR_WATCH,
Carlos Garnacho5ccf0472016-01-15 21:14:25 +0100184 CURSOR_DND_MOVE,
185 CURSOR_DND_COPY,
186 CURSOR_DND_FORBIDDEN,
Kristian Høgsbergf3370522012-06-20 23:04:41 -0400187
188 CURSOR_BLANK
Kristian Høgsberg9a686242010-08-18 15:28:04 -0400189};
190
Kristian Høgsberg67cac8a2011-01-19 14:20:33 -0500191typedef void (*window_key_handler_t)(struct window *window, struct input *input,
192 uint32_t time, uint32_t key, uint32_t unicode,
Daniel Stonec9785ea2012-05-30 16:31:52 +0100193 enum wl_keyboard_key_state state, void *data);
Tim Wiederhakedc3f8172011-01-17 17:25:34 +0100194
Kristian Høgsberg3c248cc2009-02-22 23:01:35 -0500195typedef void (*window_keyboard_focus_handler_t)(struct window *window,
Kristian Høgsberg808fd412010-07-20 17:06:19 -0400196 struct input *device, void *data);
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500197
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400198typedef void (*window_data_handler_t)(struct window *window,
Kristian Høgsbergeae5de72012-04-11 22:42:15 -0400199 struct input *input,
Kristian Høgsberg80680c72012-05-10 12:21:37 -0400200 float x, float y,
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400201 const char **types,
202 void *data);
203
204typedef void (*window_drop_handler_t)(struct window *window,
205 struct input *input,
206 int32_t x, int32_t y, void *data);
207
Jasper St. Pierrebf175902013-11-12 20:19:58 -0500208typedef void (*window_close_handler_t)(void *data);
Kristian Høgsberg67ace202012-07-23 21:56:31 -0400209typedef void (*window_fullscreen_handler_t)(struct window *window, void *data);
Kristian Høgsberg4f7dcd62012-01-06 21:59:05 -0500210
Ander Conselvan de Oliveira15256f62012-11-30 17:34:25 +0200211typedef void (*window_output_handler_t)(struct window *window, struct output *output,
212 int enter, void *data);
Jasper St. Pierrede680992014-04-10 17:23:49 -0700213typedef void (*window_state_changed_handler_t)(struct window *window,
214 void *data);
Ander Conselvan de Oliveira15256f62012-11-30 17:34:25 +0200215
Jonas Ådahle5a1bb42014-11-25 10:25:27 +0800216
217typedef void (*window_locked_pointer_motion_handler_t)(struct window *window,
218 struct input *input,
219 uint32_t time,
220 float x, float y,
221 void *data);
222
223typedef void (*locked_pointer_locked_handler_t)(struct window *window,
224 struct input *input,
225 void *data);
226
227typedef void (*locked_pointer_unlocked_handler_t)(struct window *window,
228 struct input *input,
229 void *data);
230
231typedef void (*confined_pointer_confined_handler_t)(struct window *window,
232 struct input *input,
233 void *data);
234
235typedef void (*confined_pointer_unconfined_handler_t)(struct window *window,
236 struct input *input,
237 void *data);
238
Kristian Høgsbergb67e94b2012-01-10 12:23:19 -0500239typedef void (*widget_resize_handler_t)(struct widget *widget,
240 int32_t width, int32_t height,
241 void *data);
242typedef void (*widget_redraw_handler_t)(struct widget *widget, void *data);
243
Kristian Høgsbergbb901fa2012-01-09 11:22:32 -0500244typedef int (*widget_enter_handler_t)(struct widget *widget,
Kristian Høgsbergeae5de72012-04-11 22:42:15 -0400245 struct input *input,
Kristian Høgsberg80680c72012-05-10 12:21:37 -0400246 float x, float y, void *data);
Kristian Høgsbergee143232012-01-09 08:42:24 -0500247typedef void (*widget_leave_handler_t)(struct widget *widget,
248 struct input *input, void *data);
Kristian Høgsberg04e98342012-01-09 09:36:16 -0500249typedef int (*widget_motion_handler_t)(struct widget *widget,
250 struct input *input, uint32_t time,
Kristian Høgsberg80680c72012-05-10 12:21:37 -0400251 float x, float y, void *data);
Kristian Høgsberga8a0db32012-01-09 11:12:05 -0500252typedef void (*widget_button_handler_t)(struct widget *widget,
253 struct input *input, uint32_t time,
Daniel Stone4dbadb12012-05-30 16:31:51 +0100254 uint32_t button,
255 enum wl_pointer_button_state state,
Daniel Stoneda5b93c2012-05-04 11:21:54 +0100256 void *data);
Rusty Lynch041815a2013-08-08 21:20:38 -0700257typedef void (*widget_touch_down_handler_t)(struct widget *widget,
Rusty Lynch1084da52013-08-15 09:10:08 -0700258 struct input *input,
Rusty Lynch041815a2013-08-08 21:20:38 -0700259 uint32_t serial,
260 uint32_t time,
261 int32_t id,
262 float x,
263 float y,
264 void *data);
265typedef void (*widget_touch_up_handler_t)(struct widget *widget,
Rusty Lynch1084da52013-08-15 09:10:08 -0700266 struct input *input,
Rusty Lynch041815a2013-08-08 21:20:38 -0700267 uint32_t serial,
268 uint32_t time,
269 int32_t id,
270 void *data);
271typedef void (*widget_touch_motion_handler_t)(struct widget *widget,
Rusty Lynch1084da52013-08-15 09:10:08 -0700272 struct input *input,
Rusty Lynch041815a2013-08-08 21:20:38 -0700273 uint32_t time,
274 int32_t id,
275 float x,
276 float y,
277 void *data);
Murray Calavera883ac022015-06-06 13:02:22 +0000278typedef void (*widget_touch_frame_handler_t)(struct widget *widget,
Rusty Lynch1084da52013-08-15 09:10:08 -0700279 struct input *input, void *data);
Murray Calavera883ac022015-06-06 13:02:22 +0000280typedef void (*widget_touch_cancel_handler_t)(struct widget *widget,
Rusty Lynch1084da52013-08-15 09:10:08 -0700281 struct input *input, void *data);
Philipp Brüschweiler7e0cc542012-08-14 11:02:41 +0200282typedef void (*widget_axis_handler_t)(struct widget *widget,
283 struct input *input, uint32_t time,
284 uint32_t axis,
285 wl_fixed_t value,
286 void *data);
Kristian Høgsbergee143232012-01-09 08:42:24 -0500287
Peter Hutterer87743e92016-01-18 16:38:22 +1000288typedef void (*widget_pointer_frame_handler_t)(struct widget *widget,
289 struct input *input,
290 void *data);
291
292typedef void (*widget_axis_source_handler_t)(struct widget *widget,
293 struct input *input,
294 uint32_t source,
295 void *data);
296
297typedef void (*widget_axis_stop_handler_t)(struct widget *widget,
298 struct input *input,
299 uint32_t time,
300 uint32_t axis,
301 void *data);
302
303typedef void (*widget_axis_discrete_handler_t)(struct widget *widget,
304 struct input *input,
305 uint32_t axis,
306 int32_t discrete,
307 void *data);
308
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500309struct window *
Kristian Høgsberg009ac0a2012-01-31 15:24:48 -0500310window_create(struct display *display);
Kristian Høgsberg248c1b62011-01-21 18:03:15 -0500311struct window *
Kristian Høgsberg962342c2012-06-26 16:29:50 -0400312window_create_custom(struct display *display);
Kristian Høgsberg4f7dcd62012-01-06 21:59:05 -0500313
Jasper St. Pierre53686042013-12-09 15:26:25 -0500314void
Jasper St. Pierrec815d622014-04-10 18:37:54 -0700315window_set_parent(struct window *window, struct window *parent_window);
Jasper St. Pierre53686042013-12-09 15:26:25 -0500316struct window *
Jasper St. Pierrec815d622014-04-10 18:37:54 -0700317window_get_parent(struct window *window);
Jasper St. Pierre53686042013-12-09 15:26:25 -0500318
Kristian Høgsberg86adef92012-08-13 22:25:53 -0400319int
320window_has_focus(struct window *window);
321
Jasper St. Pierredda93132014-03-13 12:06:00 -0400322typedef void (*menu_func_t)(void *data, struct input *input, int index);
Kristian Høgsberg4f7dcd62012-01-06 21:59:05 -0500323
Jasper St. Pierrede8bd502014-03-13 11:57:31 -0400324struct window *
325window_create_menu(struct display *display,
326 struct input *input, uint32_t time,
327 menu_func_t func, const char **entries, int count,
328 void *user_data);
Pekka Paalanen6d174cf2012-01-19 15:17:59 +0200329void
330window_show_menu(struct display *display,
331 struct input *input, uint32_t time, struct window *parent,
332 int32_t x, int32_t y,
333 menu_func_t func, const char **entries, int count);
Kristian Høgsberg248c1b62011-01-21 18:03:15 -0500334
335void
Kristian Høgsbergd31fcab2012-01-31 09:53:44 -0500336window_show_frame_menu(struct window *window,
337 struct input *input, uint32_t time);
338
Ander Conselvan de Oliveira6d4cb4e2012-11-30 17:34:24 +0200339int
340window_get_buffer_transform(struct window *window);
341
342void
343window_set_buffer_transform(struct window *window,
344 enum wl_output_transform transform);
345
Alexander Larsson5e9b6522013-05-22 14:41:28 +0200346uint32_t
347window_get_buffer_scale(struct window *window);
348
349void
350window_set_buffer_scale(struct window *window,
Alexander Larssonedddbd12013-05-24 13:09:43 +0200351 int32_t scale);
Alexander Larsson5e9b6522013-05-22 14:41:28 +0200352
Alexander Larssond68f5232013-05-22 14:41:33 +0200353uint32_t
354window_get_output_scale(struct window *window);
355
Kristian Høgsbergd31fcab2012-01-31 09:53:44 -0500356void
Kristian Høgsberg248c1b62011-01-21 18:03:15 -0500357window_destroy(struct window *window);
358
Kristian Høgsbergc51f7992012-01-08 15:09:53 -0500359struct widget *
360window_add_widget(struct window *window, void *data);
Kristian Høgsberge28d05b2011-09-20 21:43:54 -0400361
Pekka Paalanen35e82632013-04-25 13:57:48 +0300362enum subsurface_mode {
363 SUBSURFACE_SYNCHRONIZED,
364 SUBSURFACE_DESYNCHRONIZED
365};
366
367struct widget *
368window_add_subsurface(struct window *window, void *data,
369 enum subsurface_mode default_mode);
370
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400371typedef void (*data_func_t)(void *data, size_t len,
372 int32_t x, int32_t y, void *user_data);
373
Kristian Høgsbergbcee9a42011-10-12 00:36:16 -0400374struct display *
375window_get_display(struct window *window);
Kristian Høgsberg248c1b62011-01-21 18:03:15 -0500376void
Kristian Høgsberg82da52b2010-12-17 09:53:12 -0500377window_move(struct window *window, struct input *input, uint32_t time);
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500378void
Kristian Høgsbergbb977002012-01-10 19:11:42 -0500379window_get_allocation(struct window *window, struct rectangle *allocation);
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500380void
Kristian Høgsberg80d746f2010-06-14 23:52:50 -0400381window_schedule_redraw(struct window *window);
Kristian Høgsbergb67e94b2012-01-10 12:23:19 -0500382void
383window_schedule_resize(struct window *window, int width, int height);
Kristian Høgsberga85fe3c2010-06-08 14:08:30 -0400384
Jonas Ådahle5a1bb42014-11-25 10:25:27 +0800385int
386window_lock_pointer(struct window *window, struct input *input);
387
388void
389window_unlock_pointer(struct window *window);
390
391void
392widget_set_locked_pointer_cursor_hint(struct widget *widget,
393 float x, float y);
394
395int
Jonas Ådahlfdcdda32015-05-08 14:17:24 +0800396window_confine_pointer_to_rectangles(struct window *window,
397 struct input *input,
398 struct rectangle *rectangles,
399 int num_rectangles);
400
401void
402window_update_confine_rectangles(struct window *window,
403 struct rectangle *rectangles,
404 int num_rectangles);
405
406int
Jonas Ådahle5a1bb42014-11-25 10:25:27 +0800407window_confine_pointer_to_widget(struct window *window,
408 struct widget *widget,
409 struct input *input);
410
411void
412window_unconfine_pointer(struct window *window);
413
Kristian Høgsberg0ac16f02009-01-15 11:37:43 -0500414cairo_surface_t *
Kristian Høgsberga85fe3c2010-06-08 14:08:30 -0400415window_get_surface(struct window *window);
416
Benjamin Franzkeec4d3422011-03-14 12:07:26 +0100417struct wl_surface *
418window_get_wl_surface(struct window *window);
419
Neil Roberts5e10a042013-09-09 00:40:17 +0100420struct wl_subsurface *
421widget_get_wl_subsurface(struct widget *widget);
422
Kristian Høgsbergd0c3b9d2010-10-25 11:40:03 -0400423enum window_buffer_type {
Benjamin Franzke6693ac22011-02-10 12:04:30 +0100424 WINDOW_BUFFER_TYPE_EGL_WINDOW,
Kristian Høgsbergd0c3b9d2010-10-25 11:40:03 -0400425 WINDOW_BUFFER_TYPE_SHM,
426};
427
428void
Benjamin Franzkebde55ec2011-03-07 15:08:09 +0100429display_surface_damage(struct display *display, cairo_surface_t *cairo_surface,
430 int32_t x, int32_t y, int32_t width, int32_t height);
431
432void
Kristian Høgsbergd0c3b9d2010-10-25 11:40:03 -0400433window_set_buffer_type(struct window *window, enum window_buffer_type type);
434
Manuel Bachmanncd186fb2014-04-04 10:04:18 +0200435enum window_buffer_type
436window_get_buffer_type(struct window *window);
437
Kristian Høgsberg1671e112012-10-10 11:36:24 -0400438int
439window_is_fullscreen(struct window *window);
440
Kristian Høgsberg9d69f8e2010-09-03 14:46:38 -0400441void
Kristian Høgsberg0395f302008-12-22 12:14:50 -0500442window_set_fullscreen(struct window *window, int fullscreen);
443
Kristian Høgsberg1671e112012-10-10 11:36:24 -0400444int
445window_is_maximized(struct window *window);
446
Kristian Høgsberg0395f302008-12-22 12:14:50 -0500447void
Kristian Høgsbergd6bcd7d2012-02-16 15:53:46 -0500448window_set_maximized(struct window *window, int maximized);
449
Jasper St. Pierrede680992014-04-10 17:23:49 -0700450int
451window_is_resizing(struct window *window);
452
Kristian Høgsbergd6bcd7d2012-02-16 15:53:46 -0500453void
Jasper St. Pierre5a183322014-02-18 19:18:42 -0500454window_set_minimized(struct window *window);
455
456void
Kristian Høgsbergc8c37342010-06-25 11:19:22 -0400457window_set_user_data(struct window *window, void *data);
458
Kristian Høgsberge9d37bd2010-09-02 20:22:42 -0400459void *
460window_get_user_data(struct window *window);
461
Kristian Høgsbergc8c37342010-06-25 11:19:22 -0400462void
Kristian Høgsberg6e83d582008-12-08 00:01:36 -0500463window_set_key_handler(struct window *window,
Kristian Høgsbergc8c37342010-06-25 11:19:22 -0400464 window_key_handler_t handler);
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500465
Kristian Høgsberg3c248cc2009-02-22 23:01:35 -0500466void
467window_set_keyboard_focus_handler(struct window *window,
Kristian Høgsbergc8c37342010-06-25 11:19:22 -0400468 window_keyboard_focus_handler_t handler);
Kristian Høgsberga85fe3c2010-06-08 14:08:30 -0400469
470void
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400471window_set_data_handler(struct window *window,
472 window_data_handler_t handler);
473
474void
475window_set_drop_handler(struct window *window,
476 window_drop_handler_t handler);
477
478void
Kristian Høgsberg4f7dcd62012-01-06 21:59:05 -0500479window_set_close_handler(struct window *window,
480 window_close_handler_t handler);
Kristian Høgsberg67ace202012-07-23 21:56:31 -0400481void
482window_set_fullscreen_handler(struct window *window,
483 window_fullscreen_handler_t handler);
Ander Conselvan de Oliveira15256f62012-11-30 17:34:25 +0200484void
485window_set_output_handler(struct window *window,
486 window_output_handler_t handler);
Jasper St. Pierrede680992014-04-10 17:23:49 -0700487void
488window_set_state_changed_handler(struct window *window,
489 window_state_changed_handler_t handler);
Kristian Høgsberg4f7dcd62012-01-06 21:59:05 -0500490
491void
Jonas Ådahle5a1bb42014-11-25 10:25:27 +0800492window_set_pointer_locked_handler(struct window *window,
493 locked_pointer_locked_handler_t locked,
494 locked_pointer_unlocked_handler_t unlocked);
495
496void
497window_set_pointer_confined_handler(struct window *window,
498 confined_pointer_confined_handler_t confined,
499 confined_pointer_unconfined_handler_t unconfined);
500
501void
502window_set_locked_pointer_motion_handler(
503 struct window *window, window_locked_pointer_motion_handler_t handler);
504
505void
Callum Lowcayef57a9b2011-01-14 20:46:23 +1300506window_set_title(struct window *window, const char *title);
507
508const char *
509window_get_title(struct window *window);
510
Scott Moreau7a1b32a2012-05-27 14:25:02 -0600511void
512window_set_text_cursor_position(struct window *window, int32_t x, int32_t y);
513
Tomeu Vizosobee45a12013-08-06 20:05:54 +0200514enum preferred_format {
515 WINDOW_PREFERRED_FORMAT_NONE,
516 WINDOW_PREFERRED_FORMAT_RGB565
517};
518
519void
520window_set_preferred_format(struct window *window,
521 enum preferred_format format);
522
Tiago Vignatti82db9d82012-05-23 22:06:27 +0300523int
524widget_set_tooltip(struct widget *parent, char *entry, float x, float y);
525
526void
527widget_destroy_tooltip(struct widget *parent);
528
Kristian Høgsberg441338c2012-01-10 13:52:34 -0500529struct widget *
530widget_add_widget(struct widget *parent, void *data);
Tiago Vignatti82db9d82012-05-23 22:06:27 +0300531
Kristian Høgsberg441338c2012-01-10 13:52:34 -0500532void
533widget_destroy(struct widget *widget);
Kristian Høgsberg9a686242010-08-18 15:28:04 -0400534void
Kristian Høgsbergbf74d522012-11-30 14:54:35 -0500535widget_set_default_cursor(struct widget *widget, int cursor);
536void
Kristian Høgsbergc51f7992012-01-08 15:09:53 -0500537widget_get_allocation(struct widget *widget, struct rectangle *allocation);
Kristian Høgsberge28d05b2011-09-20 21:43:54 -0400538
539void
Kristian Høgsbergc51f7992012-01-08 15:09:53 -0500540widget_set_allocation(struct widget *widget,
541 int32_t x, int32_t y, int32_t width, int32_t height);
Kristian Høgsbergbb977002012-01-10 19:11:42 -0500542void
543widget_set_size(struct widget *widget, int32_t width, int32_t height);
544void
Kristian Høgsberg010f98b2012-02-23 17:30:45 -0500545widget_set_transparent(struct widget *widget, int transparent);
546void
Kristian Høgsbergbb977002012-01-10 19:11:42 -0500547widget_schedule_resize(struct widget *widget, int32_t width, int32_t height);
Kristian Høgsberge28d05b2011-09-20 21:43:54 -0400548
549void *
Kristian Høgsbergc51f7992012-01-08 15:09:53 -0500550widget_get_user_data(struct widget *widget);
Kristian Høgsberge28d05b2011-09-20 21:43:54 -0400551
Pekka Paalanen0c4445b2013-02-13 16:17:23 +0200552cairo_t *
553widget_cairo_create(struct widget *widget);
554
Pekka Paalanen7ff7a802013-04-25 13:57:50 +0300555struct wl_surface *
556widget_get_wl_surface(struct widget *widget);
557
558uint32_t
559widget_get_last_time(struct widget *widget);
560
561void
562widget_input_region_add(struct widget *widget, const struct rectangle *rect);
563
Kristian Høgsberge28d05b2011-09-20 21:43:54 -0400564void
Kristian Høgsbergb67e94b2012-01-10 12:23:19 -0500565widget_set_redraw_handler(struct widget *widget,
566 widget_redraw_handler_t handler);
567void
568widget_set_resize_handler(struct widget *widget,
569 widget_resize_handler_t handler);
570void
Kristian Høgsbergee143232012-01-09 08:42:24 -0500571widget_set_enter_handler(struct widget *widget,
572 widget_enter_handler_t handler);
573void
574widget_set_leave_handler(struct widget *widget,
575 widget_leave_handler_t handler);
Kristian Høgsberg04e98342012-01-09 09:36:16 -0500576void
577widget_set_motion_handler(struct widget *widget,
578 widget_motion_handler_t handler);
Kristian Høgsberg9a13dab2012-01-08 15:18:19 -0500579void
Kristian Høgsberga8a0db32012-01-09 11:12:05 -0500580widget_set_button_handler(struct widget *widget,
581 widget_button_handler_t handler);
Philipp Brüschweiler7e0cc542012-08-14 11:02:41 +0200582void
Rusty Lynch041815a2013-08-08 21:20:38 -0700583widget_set_touch_down_handler(struct widget *widget,
584 widget_touch_down_handler_t handler);
585void
586widget_set_touch_up_handler(struct widget *widget,
587 widget_touch_up_handler_t handler);
588void
589widget_set_touch_motion_handler(struct widget *widget,
590 widget_touch_motion_handler_t handler);
591void
592widget_set_touch_frame_handler(struct widget *widget,
593 widget_touch_frame_handler_t handler);
594void
595widget_set_touch_cancel_handler(struct widget *widget,
596 widget_touch_cancel_handler_t handler);
597void
Philipp Brüschweiler7e0cc542012-08-14 11:02:41 +0200598widget_set_axis_handler(struct widget *widget,
599 widget_axis_handler_t handler);
Kristian Høgsberga8a0db32012-01-09 11:12:05 -0500600void
Peter Hutterer87743e92016-01-18 16:38:22 +1000601widget_set_pointer_frame_handler(struct widget *widget,
602 widget_pointer_frame_handler_t handler);
603void
604widget_set_axis_handlers(struct widget *widget,
605 widget_axis_handler_t axis_handler,
606 widget_axis_source_handler_t axis_source_handler,
607 widget_axis_stop_handler_t axis_stop_handler,
608 widget_axis_discrete_handler_t axis_discrete_handler);
609
610void
Kristian Høgsberg9a13dab2012-01-08 15:18:19 -0500611widget_schedule_redraw(struct widget *widget);
Neil Roberts97b747c2013-12-19 16:17:12 +0000612void
613widget_set_use_cairo(struct widget *widget, int use_cairo);
Kristian Høgsberg9a13dab2012-01-08 15:18:19 -0500614
Kristian Høgsberg29af3eb2012-01-10 22:41:05 -0500615struct widget *
Jason Ekstrandee7fefc2013-10-13 19:08:38 -0500616window_frame_create(struct window *window, void *data);
Pekka Paalanen0c4445b2013-02-13 16:17:23 +0200617
Kristian Høgsberga1627922012-06-20 17:30:03 -0400618void
Jason Ekstrandee7fefc2013-10-13 19:08:38 -0500619window_frame_set_child_size(struct widget *widget, int child_width,
620 int child_height);
Kristian Høgsberg29af3eb2012-01-10 22:41:05 -0500621
Kristian Høgsberg9a13dab2012-01-08 15:18:19 -0500622void
Kristian Høgsberg5a4e9ff2012-06-04 16:04:07 -0400623input_set_pointer_image(struct input *input, int pointer);
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400624
625void
Kristian Høgsberg9a686242010-08-18 15:28:04 -0400626input_get_position(struct input *input, int32_t *x, int32_t *y);
627
Kristian Høgsbergef9c8eb2014-01-07 12:57:59 -0800628int
629input_get_touch(struct input *input, int32_t id, float *x, float *y);
630
Kristian Høgsberg70163132012-05-08 15:55:39 -0400631#define MOD_SHIFT_MASK 0x01
632#define MOD_ALT_MASK 0x02
633#define MOD_CONTROL_MASK 0x04
634
Kristian Høgsberg67cac8a2011-01-19 14:20:33 -0500635uint32_t
636input_get_modifiers(struct input *input);
637
Kristian Høgsberg831dd522012-01-10 23:46:33 -0500638void
Xiong Zhangbf3c1c62013-11-25 18:42:51 +0800639touch_grab(struct input *input, int32_t touch_id);
640
641void
642touch_ungrab(struct input *input);
643
644void
Kristian Høgsberg831dd522012-01-10 23:46:33 -0500645input_grab(struct input *input, struct widget *widget, uint32_t button);
646
647void
Kristian Høgsbergeae5de72012-04-11 22:42:15 -0400648input_ungrab(struct input *input);
Kristian Høgsberg831dd522012-01-10 23:46:33 -0500649
Kristian Høgsbergb6323512012-01-11 00:04:42 -0500650struct widget *
651input_get_focus_widget(struct input *input);
652
Kristian Høgsbergd56bd902012-06-05 09:58:51 -0400653struct display *
654input_get_display(struct input *input);
655
Daniel Stone37816df2012-05-16 18:45:18 +0100656struct wl_seat *
657input_get_seat(struct input *input);
Kristian Høgsberg1d7ffd32010-08-25 16:34:05 -0400658
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400659struct wl_data_device *
660input_get_data_device(struct input *input);
661
Kristian Høgsberg6bccebe2011-01-21 16:23:09 -0500662void
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400663input_set_selection(struct input *input,
664 struct wl_data_source *source, uint32_t time);
665
666void
Kristian Høgsbergeae5de72012-04-11 22:42:15 -0400667input_accept(struct input *input, const char *type);
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400668
669
670void
671input_receive_drag_data(struct input *input, const char *mime_type,
672 data_func_t func, void *user_data);
Kristian Høgsberg0749e3f2013-09-04 20:41:06 -0700673int
674input_receive_drag_data_to_fd(struct input *input,
675 const char *mime_type, int fd);
Kristian Høgsberg47fe08a2011-10-28 12:26:06 -0400676
677int
678input_receive_selection_data(struct input *input, const char *mime_type,
679 data_func_t func, void *data);
Kristian Høgsberge7aaec32011-12-27 13:50:04 -0500680int
681input_receive_selection_data_to_fd(struct input *input,
682 const char *mime_type, int fd);
Kristian Høgsberg58eec362011-01-19 14:27:42 -0500683
Kristian Høgsberg53ff2f62011-11-26 17:27:37 -0500684void
Pekka Paalanen999c5b52011-11-30 10:52:38 +0200685output_set_user_data(struct output *output, void *data);
686
687void *
688output_get_user_data(struct output *output);
689
690void
691output_set_destroy_handler(struct output *output,
692 display_output_handler_t handler);
693
694void
Kristian Høgsberg53ff2f62011-11-26 17:27:37 -0500695output_get_allocation(struct output *output, struct rectangle *allocation);
696
Pekka Paalanen999c5b52011-11-30 10:52:38 +0200697struct wl_output *
698output_get_wl_output(struct output *output);
Kristian Høgsberg53ff2f62011-11-26 17:27:37 -0500699
Ander Conselvan de Oliveira15256f62012-11-30 17:34:25 +0200700enum wl_output_transform
701output_get_transform(struct output *output);
702
Alexander Larssonafd319a2013-05-22 14:41:27 +0200703uint32_t
704output_get_scale(struct output *output);
705
Jason Ekstrand738715d2014-04-02 19:53:50 -0500706const char *
707output_get_make(struct output *output);
708
709const char *
710output_get_model(struct output *output);
711
Jan Arne Petersencd997062012-11-18 19:06:44 +0100712void
713keysym_modifiers_add(struct wl_array *modifiers_map,
714 const char *name);
715
716xkb_mod_mask_t
717keysym_modifiers_get_mask(struct wl_array *modifiers_map,
718 const char *name);
719
Kristian Høgsberg0c4457f2008-12-07 19:59:11 -0500720#endif