2008-12-08 03:59:11 +03:00
|
|
|
/*
|
|
|
|
* Copyright © 2008 Kristian Høgsberg
|
|
|
|
*
|
2015-06-11 08:48:59 +03:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2008-12-08 03:59:11 +03:00
|
|
|
*
|
2015-06-11 08:48:59 +03:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
2008-12-08 03:59:11 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _WINDOW_H_
|
|
|
|
#define _WINDOW_H_
|
|
|
|
|
2014-04-07 15:40:35 +04:00
|
|
|
#include "config.h"
|
|
|
|
|
2016-07-19 14:16:27 +03:00
|
|
|
#include <stdint.h>
|
2018-03-09 12:54:40 +03:00
|
|
|
#include <time.h>
|
2012-02-15 20:33:21 +04:00
|
|
|
#include <xkbcommon/xkbcommon.h>
|
2010-11-28 21:31:55 +03:00
|
|
|
#include <wayland-client.h>
|
2011-02-19 01:00:55 +03:00
|
|
|
#include <cairo.h>
|
2015-06-16 01:37:07 +03:00
|
|
|
#include "shared/config-parser.h"
|
|
|
|
#include "shared/zalloc.h"
|
|
|
|
#include "shared/platform.h"
|
2010-11-28 21:31:55 +03:00
|
|
|
|
2008-12-08 03:59:11 +03:00
|
|
|
struct window;
|
2012-01-09 00:09:53 +04:00
|
|
|
struct widget;
|
2011-09-21 05:43:54 +04:00
|
|
|
struct display;
|
|
|
|
struct input;
|
2011-11-27 02:27:37 +04:00
|
|
|
struct output;
|
2008-12-08 03:59:11 +03:00
|
|
|
|
2011-09-15 01:33:48 +04:00
|
|
|
struct task {
|
|
|
|
void (*run)(struct task *task, uint32_t events);
|
|
|
|
struct wl_list link;
|
|
|
|
};
|
|
|
|
|
2008-12-08 03:59:11 +03:00
|
|
|
struct rectangle {
|
|
|
|
int32_t x;
|
|
|
|
int32_t y;
|
|
|
|
int32_t width;
|
|
|
|
int32_t height;
|
|
|
|
};
|
|
|
|
|
2009-01-27 07:42:46 +03:00
|
|
|
struct display *
|
2013-02-21 00:27:49 +04:00
|
|
|
display_create(int *argc, char *argv[]);
|
2010-06-08 22:59:44 +04:00
|
|
|
|
2011-12-15 17:20:04 +04:00
|
|
|
void
|
|
|
|
display_destroy(struct display *display);
|
|
|
|
|
2011-11-30 12:52:38 +04:00
|
|
|
void
|
|
|
|
display_set_user_data(struct display *display, void *data);
|
|
|
|
|
|
|
|
void *
|
|
|
|
display_get_user_data(struct display *display);
|
|
|
|
|
2010-09-03 22:46:38 +04:00
|
|
|
struct wl_display *
|
|
|
|
display_get_display(struct display *display);
|
|
|
|
|
2013-08-15 22:54:03 +04:00
|
|
|
int
|
|
|
|
display_has_subcompositor(struct display *display);
|
|
|
|
|
2013-04-12 05:47:41 +04:00
|
|
|
cairo_device_t *
|
|
|
|
display_get_cairo_device(struct display *display);
|
|
|
|
|
2009-01-27 07:42:46 +03:00
|
|
|
struct wl_compositor *
|
|
|
|
display_get_compositor(struct display *display);
|
|
|
|
|
2011-11-27 02:27:37 +04:00
|
|
|
struct output *
|
|
|
|
display_get_output(struct display *display);
|
|
|
|
|
2012-04-12 06:42:15 +04:00
|
|
|
uint32_t
|
|
|
|
display_get_serial(struct display *display);
|
|
|
|
|
2012-10-11 05:34:26 +04:00
|
|
|
typedef void (*display_global_handler_t)(struct display *display,
|
|
|
|
uint32_t name,
|
|
|
|
const char *interface,
|
|
|
|
uint32_t version, void *data);
|
|
|
|
|
|
|
|
void
|
|
|
|
display_set_global_handler(struct display *display,
|
|
|
|
display_global_handler_t handler);
|
2013-10-23 09:58:35 +04:00
|
|
|
void
|
|
|
|
display_set_global_handler_remove(struct display *display,
|
|
|
|
display_global_handler_t remove_handler);
|
2012-10-11 05:34:26 +04:00
|
|
|
void *
|
|
|
|
display_bind(struct display *display, uint32_t name,
|
|
|
|
const struct wl_interface *interface, uint32_t version);
|
|
|
|
|
2011-11-30 12:52:38 +04:00
|
|
|
typedef void (*display_output_handler_t)(struct output *output, void *data);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The output configure handler is called, when a new output is connected
|
|
|
|
* and we know its current mode, or when the current mode changes.
|
|
|
|
* Test and set the output user data in your handler to know, if the
|
|
|
|
* output is new. Note: 'data' in the configure handler is the display
|
|
|
|
* user data.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
display_set_output_configure_handler(struct display *display,
|
|
|
|
display_output_handler_t handler);
|
|
|
|
|
2011-10-28 20:26:06 +04:00
|
|
|
struct wl_data_source *
|
|
|
|
display_create_data_source(struct display *display);
|
|
|
|
|
2010-06-08 22:59:44 +04:00
|
|
|
#ifdef EGL_NO_DISPLAY
|
|
|
|
EGLDisplay
|
|
|
|
display_get_egl_display(struct display *d);
|
2010-11-08 23:45:55 +03:00
|
|
|
|
2011-09-27 23:57:31 +04:00
|
|
|
EGLConfig
|
|
|
|
display_get_argb_egl_config(struct display *d);
|
2011-02-19 01:00:55 +03:00
|
|
|
|
2011-10-07 11:33:06 +04:00
|
|
|
int
|
2011-02-19 01:00:55 +03:00
|
|
|
display_acquire_window_surface(struct display *display,
|
|
|
|
struct window *window,
|
|
|
|
EGLContext ctx);
|
|
|
|
void
|
2011-09-27 23:57:31 +04:00
|
|
|
display_release_window_surface(struct display *display,
|
|
|
|
struct window *window);
|
2011-01-05 20:48:15 +03:00
|
|
|
#endif
|
2010-06-08 22:59:44 +04:00
|
|
|
|
2011-05-13 21:45:17 +04:00
|
|
|
#define SURFACE_OPAQUE 0x01
|
2012-05-25 17:03:06 +04:00
|
|
|
#define SURFACE_SHM 0x02
|
2011-05-13 21:45:17 +04:00
|
|
|
|
2013-02-13 18:17:15 +04:00
|
|
|
#define SURFACE_HINT_RESIZE 0x10
|
|
|
|
|
2013-08-06 22:05:54 +04:00
|
|
|
#define SURFACE_HINT_RGB565 0x100
|
|
|
|
|
2010-06-16 01:16:35 +04:00
|
|
|
cairo_surface_t *
|
|
|
|
display_create_surface(struct display *display,
|
2011-02-10 14:04:30 +03:00
|
|
|
struct wl_surface *surface,
|
2011-05-13 21:45:17 +04:00
|
|
|
struct rectangle *rectangle,
|
|
|
|
uint32_t flags);
|
2010-06-16 01:16:35 +04:00
|
|
|
|
2010-08-18 23:28:04 +04:00
|
|
|
struct wl_buffer *
|
|
|
|
display_get_buffer_for_surface(struct display *display,
|
|
|
|
cairo_surface_t *surface);
|
|
|
|
|
2012-05-22 16:39:42 +04:00
|
|
|
struct wl_cursor_image *
|
|
|
|
display_get_pointer_image(struct display *display, int pointer);
|
2010-08-18 23:28:04 +04:00
|
|
|
|
2011-09-15 01:33:48 +04:00
|
|
|
void
|
|
|
|
display_defer(struct display *display, struct task *task);
|
|
|
|
|
|
|
|
void
|
|
|
|
display_watch_fd(struct display *display,
|
|
|
|
int fd, uint32_t events, struct task *task);
|
|
|
|
|
2012-11-29 12:27:09 +04:00
|
|
|
void
|
|
|
|
display_unwatch_fd(struct display *display, int fd);
|
|
|
|
|
2010-06-08 22:59:44 +04:00
|
|
|
void
|
|
|
|
display_run(struct display *d);
|
|
|
|
|
2011-12-15 12:14:07 +04:00
|
|
|
void
|
|
|
|
display_exit(struct display *d);
|
|
|
|
|
2016-01-19 01:52:12 +03:00
|
|
|
int
|
|
|
|
display_get_data_device_manager_version(struct display *d);
|
|
|
|
|
2012-05-25 17:01:41 +04:00
|
|
|
enum cursor_type {
|
|
|
|
CURSOR_BOTTOM_LEFT,
|
|
|
|
CURSOR_BOTTOM_RIGHT,
|
|
|
|
CURSOR_BOTTOM,
|
|
|
|
CURSOR_DRAGGING,
|
|
|
|
CURSOR_LEFT_PTR,
|
|
|
|
CURSOR_LEFT,
|
|
|
|
CURSOR_RIGHT,
|
|
|
|
CURSOR_TOP_LEFT,
|
|
|
|
CURSOR_TOP_RIGHT,
|
|
|
|
CURSOR_TOP,
|
|
|
|
CURSOR_IBEAM,
|
|
|
|
CURSOR_HAND1,
|
2012-06-21 07:04:41 +04:00
|
|
|
CURSOR_WATCH,
|
2016-01-15 23:14:25 +03:00
|
|
|
CURSOR_DND_MOVE,
|
|
|
|
CURSOR_DND_COPY,
|
|
|
|
CURSOR_DND_FORBIDDEN,
|
2012-06-21 07:04:41 +04:00
|
|
|
|
|
|
|
CURSOR_BLANK
|
2010-08-18 23:28:04 +04:00
|
|
|
};
|
|
|
|
|
2011-01-19 22:20:33 +03:00
|
|
|
typedef void (*window_key_handler_t)(struct window *window, struct input *input,
|
|
|
|
uint32_t time, uint32_t key, uint32_t unicode,
|
2012-05-30 19:31:52 +04:00
|
|
|
enum wl_keyboard_key_state state, void *data);
|
2011-01-17 19:25:34 +03:00
|
|
|
|
2009-02-23 07:01:35 +03:00
|
|
|
typedef void (*window_keyboard_focus_handler_t)(struct window *window,
|
2010-07-21 01:06:19 +04:00
|
|
|
struct input *device, void *data);
|
2008-12-08 03:59:11 +03:00
|
|
|
|
2011-10-28 20:26:06 +04:00
|
|
|
typedef void (*window_data_handler_t)(struct window *window,
|
2012-04-12 06:42:15 +04:00
|
|
|
struct input *input,
|
2012-05-10 20:21:37 +04:00
|
|
|
float x, float y,
|
2011-10-28 20:26:06 +04:00
|
|
|
const char **types,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
typedef void (*window_drop_handler_t)(struct window *window,
|
|
|
|
struct input *input,
|
|
|
|
int32_t x, int32_t y, void *data);
|
|
|
|
|
2013-11-13 05:19:58 +04:00
|
|
|
typedef void (*window_close_handler_t)(void *data);
|
2012-07-24 05:56:31 +04:00
|
|
|
typedef void (*window_fullscreen_handler_t)(struct window *window, void *data);
|
2012-01-07 06:59:05 +04:00
|
|
|
|
2012-11-30 19:34:25 +04:00
|
|
|
typedef void (*window_output_handler_t)(struct window *window, struct output *output,
|
|
|
|
int enter, void *data);
|
2014-04-11 04:23:49 +04:00
|
|
|
typedef void (*window_state_changed_handler_t)(struct window *window,
|
|
|
|
void *data);
|
2012-11-30 19:34:25 +04:00
|
|
|
|
2014-11-25 05:25:27 +03:00
|
|
|
|
|
|
|
typedef void (*window_locked_pointer_motion_handler_t)(struct window *window,
|
|
|
|
struct input *input,
|
|
|
|
uint32_t time,
|
|
|
|
float x, float y,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
typedef void (*locked_pointer_locked_handler_t)(struct window *window,
|
|
|
|
struct input *input,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
typedef void (*locked_pointer_unlocked_handler_t)(struct window *window,
|
|
|
|
struct input *input,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
typedef void (*confined_pointer_confined_handler_t)(struct window *window,
|
|
|
|
struct input *input,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
typedef void (*confined_pointer_unconfined_handler_t)(struct window *window,
|
|
|
|
struct input *input,
|
|
|
|
void *data);
|
|
|
|
|
2012-01-10 21:23:19 +04:00
|
|
|
typedef void (*widget_resize_handler_t)(struct widget *widget,
|
|
|
|
int32_t width, int32_t height,
|
|
|
|
void *data);
|
|
|
|
typedef void (*widget_redraw_handler_t)(struct widget *widget, void *data);
|
|
|
|
|
2012-01-09 20:22:32 +04:00
|
|
|
typedef int (*widget_enter_handler_t)(struct widget *widget,
|
2012-04-12 06:42:15 +04:00
|
|
|
struct input *input,
|
2012-05-10 20:21:37 +04:00
|
|
|
float x, float y, void *data);
|
2012-01-09 17:42:24 +04:00
|
|
|
typedef void (*widget_leave_handler_t)(struct widget *widget,
|
|
|
|
struct input *input, void *data);
|
2012-01-09 18:36:16 +04:00
|
|
|
typedef int (*widget_motion_handler_t)(struct widget *widget,
|
|
|
|
struct input *input, uint32_t time,
|
2012-05-10 20:21:37 +04:00
|
|
|
float x, float y, void *data);
|
2012-01-09 20:12:05 +04:00
|
|
|
typedef void (*widget_button_handler_t)(struct widget *widget,
|
|
|
|
struct input *input, uint32_t time,
|
2012-05-30 19:31:51 +04:00
|
|
|
uint32_t button,
|
|
|
|
enum wl_pointer_button_state state,
|
2012-05-04 14:21:54 +04:00
|
|
|
void *data);
|
2013-08-09 08:20:38 +04:00
|
|
|
typedef void (*widget_touch_down_handler_t)(struct widget *widget,
|
2013-08-15 20:10:08 +04:00
|
|
|
struct input *input,
|
2013-08-09 08:20:38 +04:00
|
|
|
uint32_t serial,
|
|
|
|
uint32_t time,
|
|
|
|
int32_t id,
|
|
|
|
float x,
|
|
|
|
float y,
|
|
|
|
void *data);
|
|
|
|
typedef void (*widget_touch_up_handler_t)(struct widget *widget,
|
2013-08-15 20:10:08 +04:00
|
|
|
struct input *input,
|
2013-08-09 08:20:38 +04:00
|
|
|
uint32_t serial,
|
|
|
|
uint32_t time,
|
|
|
|
int32_t id,
|
|
|
|
void *data);
|
|
|
|
typedef void (*widget_touch_motion_handler_t)(struct widget *widget,
|
2013-08-15 20:10:08 +04:00
|
|
|
struct input *input,
|
2013-08-09 08:20:38 +04:00
|
|
|
uint32_t time,
|
|
|
|
int32_t id,
|
|
|
|
float x,
|
|
|
|
float y,
|
|
|
|
void *data);
|
2015-06-06 16:02:22 +03:00
|
|
|
typedef void (*widget_touch_frame_handler_t)(struct widget *widget,
|
2013-08-15 20:10:08 +04:00
|
|
|
struct input *input, void *data);
|
2015-06-06 16:02:22 +03:00
|
|
|
typedef void (*widget_touch_cancel_handler_t)(struct widget *widget,
|
2013-08-15 20:10:08 +04:00
|
|
|
struct input *input, void *data);
|
2012-08-14 13:02:41 +04:00
|
|
|
typedef void (*widget_axis_handler_t)(struct widget *widget,
|
|
|
|
struct input *input, uint32_t time,
|
|
|
|
uint32_t axis,
|
|
|
|
wl_fixed_t value,
|
|
|
|
void *data);
|
2012-01-09 17:42:24 +04:00
|
|
|
|
2016-01-18 09:38:22 +03:00
|
|
|
typedef void (*widget_pointer_frame_handler_t)(struct widget *widget,
|
|
|
|
struct input *input,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
typedef void (*widget_axis_source_handler_t)(struct widget *widget,
|
|
|
|
struct input *input,
|
|
|
|
uint32_t source,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
typedef void (*widget_axis_stop_handler_t)(struct widget *widget,
|
|
|
|
struct input *input,
|
|
|
|
uint32_t time,
|
|
|
|
uint32_t axis,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
typedef void (*widget_axis_discrete_handler_t)(struct widget *widget,
|
|
|
|
struct input *input,
|
|
|
|
uint32_t axis,
|
|
|
|
int32_t discrete,
|
|
|
|
void *data);
|
|
|
|
|
2008-12-08 03:59:11 +03:00
|
|
|
struct window *
|
2012-02-01 00:24:48 +04:00
|
|
|
window_create(struct display *display);
|
2011-01-22 02:03:15 +03:00
|
|
|
struct window *
|
2012-06-27 00:29:50 +04:00
|
|
|
window_create_custom(struct display *display);
|
2012-01-07 06:59:05 +04:00
|
|
|
|
2013-12-10 00:26:25 +04:00
|
|
|
void
|
2014-04-11 05:37:54 +04:00
|
|
|
window_set_parent(struct window *window, struct window *parent_window);
|
2013-12-10 00:26:25 +04:00
|
|
|
struct window *
|
2014-04-11 05:37:54 +04:00
|
|
|
window_get_parent(struct window *window);
|
2013-12-10 00:26:25 +04:00
|
|
|
|
2012-08-14 06:25:53 +04:00
|
|
|
int
|
|
|
|
window_has_focus(struct window *window);
|
|
|
|
|
2014-03-13 20:06:00 +04:00
|
|
|
typedef void (*menu_func_t)(void *data, struct input *input, int index);
|
2012-01-07 06:59:05 +04:00
|
|
|
|
2012-01-19 17:17:59 +04:00
|
|
|
void
|
|
|
|
window_show_menu(struct display *display,
|
|
|
|
struct input *input, uint32_t time, struct window *parent,
|
|
|
|
int32_t x, int32_t y,
|
|
|
|
menu_func_t func, const char **entries, int count);
|
2011-01-22 02:03:15 +03:00
|
|
|
|
2012-01-31 18:53:44 +04:00
|
|
|
void
|
|
|
|
window_show_frame_menu(struct window *window,
|
|
|
|
struct input *input, uint32_t time);
|
|
|
|
|
2012-11-30 19:34:24 +04:00
|
|
|
int
|
|
|
|
window_get_buffer_transform(struct window *window);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_set_buffer_transform(struct window *window,
|
|
|
|
enum wl_output_transform transform);
|
|
|
|
|
2013-05-22 16:41:28 +04:00
|
|
|
uint32_t
|
|
|
|
window_get_buffer_scale(struct window *window);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_set_buffer_scale(struct window *window,
|
2013-05-24 15:09:43 +04:00
|
|
|
int32_t scale);
|
2013-05-22 16:41:28 +04:00
|
|
|
|
2013-05-22 16:41:33 +04:00
|
|
|
uint32_t
|
|
|
|
window_get_output_scale(struct window *window);
|
|
|
|
|
2011-01-22 02:03:15 +03:00
|
|
|
void
|
|
|
|
window_destroy(struct window *window);
|
|
|
|
|
2012-01-09 00:09:53 +04:00
|
|
|
struct widget *
|
|
|
|
window_add_widget(struct window *window, void *data);
|
2011-09-21 05:43:54 +04:00
|
|
|
|
2013-04-25 14:57:48 +04:00
|
|
|
enum subsurface_mode {
|
|
|
|
SUBSURFACE_SYNCHRONIZED,
|
|
|
|
SUBSURFACE_DESYNCHRONIZED
|
|
|
|
};
|
|
|
|
|
|
|
|
struct widget *
|
|
|
|
window_add_subsurface(struct window *window, void *data,
|
|
|
|
enum subsurface_mode default_mode);
|
|
|
|
|
2011-10-28 20:26:06 +04:00
|
|
|
typedef void (*data_func_t)(void *data, size_t len,
|
|
|
|
int32_t x, int32_t y, void *user_data);
|
|
|
|
|
2011-10-12 08:36:16 +04:00
|
|
|
struct display *
|
|
|
|
window_get_display(struct window *window);
|
2010-12-17 17:53:12 +03:00
|
|
|
void
|
|
|
|
window_move(struct window *window, struct input *input, uint32_t time);
|
2008-12-08 03:59:11 +03:00
|
|
|
void
|
2012-01-11 04:11:42 +04:00
|
|
|
window_get_allocation(struct window *window, struct rectangle *allocation);
|
2011-05-13 21:45:17 +04:00
|
|
|
void
|
2010-06-15 07:52:50 +04:00
|
|
|
window_schedule_redraw(struct window *window);
|
2012-01-10 21:23:19 +04:00
|
|
|
void
|
|
|
|
window_schedule_resize(struct window *window, int width, int height);
|
2010-06-08 22:08:30 +04:00
|
|
|
|
2014-11-25 05:25:27 +03:00
|
|
|
int
|
|
|
|
window_lock_pointer(struct window *window, struct input *input);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_unlock_pointer(struct window *window);
|
|
|
|
|
|
|
|
void
|
|
|
|
widget_set_locked_pointer_cursor_hint(struct widget *widget,
|
|
|
|
float x, float y);
|
|
|
|
|
2015-05-08 09:17:24 +03:00
|
|
|
int
|
|
|
|
window_confine_pointer_to_rectangles(struct window *window,
|
|
|
|
struct input *input,
|
|
|
|
struct rectangle *rectangles,
|
|
|
|
int num_rectangles);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_update_confine_rectangles(struct window *window,
|
|
|
|
struct rectangle *rectangles,
|
|
|
|
int num_rectangles);
|
|
|
|
|
2014-11-25 05:25:27 +03:00
|
|
|
int
|
|
|
|
window_confine_pointer_to_widget(struct window *window,
|
|
|
|
struct widget *widget,
|
|
|
|
struct input *input);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_unconfine_pointer(struct window *window);
|
|
|
|
|
2010-06-08 22:08:30 +04:00
|
|
|
cairo_surface_t *
|
|
|
|
window_get_surface(struct window *window);
|
|
|
|
|
2011-03-14 14:07:26 +03:00
|
|
|
struct wl_surface *
|
|
|
|
window_get_wl_surface(struct window *window);
|
|
|
|
|
2013-09-09 03:40:17 +04:00
|
|
|
struct wl_subsurface *
|
|
|
|
widget_get_wl_subsurface(struct widget *widget);
|
|
|
|
|
2010-10-25 19:40:03 +04:00
|
|
|
enum window_buffer_type {
|
2011-02-10 14:04:30 +03:00
|
|
|
WINDOW_BUFFER_TYPE_EGL_WINDOW,
|
2010-10-25 19:40:03 +04:00
|
|
|
WINDOW_BUFFER_TYPE_SHM,
|
|
|
|
};
|
|
|
|
|
2011-03-07 17:08:09 +03:00
|
|
|
void
|
|
|
|
display_surface_damage(struct display *display, cairo_surface_t *cairo_surface,
|
|
|
|
int32_t x, int32_t y, int32_t width, int32_t height);
|
|
|
|
|
2010-10-25 19:40:03 +04:00
|
|
|
void
|
|
|
|
window_set_buffer_type(struct window *window, enum window_buffer_type type);
|
|
|
|
|
2014-04-04 12:04:18 +04:00
|
|
|
enum window_buffer_type
|
|
|
|
window_get_buffer_type(struct window *window);
|
|
|
|
|
2012-10-10 19:36:24 +04:00
|
|
|
int
|
|
|
|
window_is_fullscreen(struct window *window);
|
|
|
|
|
2008-12-22 20:14:50 +03:00
|
|
|
void
|
|
|
|
window_set_fullscreen(struct window *window, int fullscreen);
|
|
|
|
|
2012-10-10 19:36:24 +04:00
|
|
|
int
|
|
|
|
window_is_maximized(struct window *window);
|
|
|
|
|
2012-02-17 00:53:46 +04:00
|
|
|
void
|
|
|
|
window_set_maximized(struct window *window, int maximized);
|
|
|
|
|
2014-04-11 04:23:49 +04:00
|
|
|
int
|
|
|
|
window_is_resizing(struct window *window);
|
|
|
|
|
2014-02-19 04:18:42 +04:00
|
|
|
void
|
|
|
|
window_set_minimized(struct window *window);
|
|
|
|
|
2010-06-25 19:19:22 +04:00
|
|
|
void
|
|
|
|
window_set_user_data(struct window *window, void *data);
|
|
|
|
|
2010-09-03 04:22:42 +04:00
|
|
|
void *
|
|
|
|
window_get_user_data(struct window *window);
|
|
|
|
|
2008-12-08 08:01:36 +03:00
|
|
|
void
|
|
|
|
window_set_key_handler(struct window *window,
|
2010-06-25 19:19:22 +04:00
|
|
|
window_key_handler_t handler);
|
2008-12-08 03:59:11 +03:00
|
|
|
|
2009-02-23 07:01:35 +03:00
|
|
|
void
|
|
|
|
window_set_keyboard_focus_handler(struct window *window,
|
2010-06-25 19:19:22 +04:00
|
|
|
window_keyboard_focus_handler_t handler);
|
2010-06-08 22:08:30 +04:00
|
|
|
|
2011-10-28 20:26:06 +04:00
|
|
|
void
|
|
|
|
window_set_data_handler(struct window *window,
|
|
|
|
window_data_handler_t handler);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_set_drop_handler(struct window *window,
|
|
|
|
window_drop_handler_t handler);
|
|
|
|
|
2012-01-07 06:59:05 +04:00
|
|
|
void
|
|
|
|
window_set_close_handler(struct window *window,
|
|
|
|
window_close_handler_t handler);
|
2012-07-24 05:56:31 +04:00
|
|
|
void
|
|
|
|
window_set_fullscreen_handler(struct window *window,
|
|
|
|
window_fullscreen_handler_t handler);
|
2012-11-30 19:34:25 +04:00
|
|
|
void
|
|
|
|
window_set_output_handler(struct window *window,
|
|
|
|
window_output_handler_t handler);
|
2014-04-11 04:23:49 +04:00
|
|
|
void
|
|
|
|
window_set_state_changed_handler(struct window *window,
|
|
|
|
window_state_changed_handler_t handler);
|
2012-01-07 06:59:05 +04:00
|
|
|
|
2014-11-25 05:25:27 +03:00
|
|
|
void
|
|
|
|
window_set_pointer_locked_handler(struct window *window,
|
|
|
|
locked_pointer_locked_handler_t locked,
|
|
|
|
locked_pointer_unlocked_handler_t unlocked);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_set_pointer_confined_handler(struct window *window,
|
|
|
|
confined_pointer_confined_handler_t confined,
|
|
|
|
confined_pointer_unconfined_handler_t unconfined);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_set_locked_pointer_motion_handler(
|
|
|
|
struct window *window, window_locked_pointer_motion_handler_t handler);
|
|
|
|
|
2011-01-14 10:46:23 +03:00
|
|
|
void
|
|
|
|
window_set_title(struct window *window, const char *title);
|
|
|
|
|
|
|
|
const char *
|
|
|
|
window_get_title(struct window *window);
|
|
|
|
|
2012-05-28 00:25:02 +04:00
|
|
|
void
|
|
|
|
window_set_text_cursor_position(struct window *window, int32_t x, int32_t y);
|
|
|
|
|
2013-08-06 22:05:54 +04:00
|
|
|
enum preferred_format {
|
|
|
|
WINDOW_PREFERRED_FORMAT_NONE,
|
|
|
|
WINDOW_PREFERRED_FORMAT_RGB565
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
window_set_preferred_format(struct window *window,
|
|
|
|
enum preferred_format format);
|
|
|
|
|
2012-05-23 23:06:27 +04:00
|
|
|
int
|
|
|
|
widget_set_tooltip(struct widget *parent, char *entry, float x, float y);
|
|
|
|
|
|
|
|
void
|
|
|
|
widget_destroy_tooltip(struct widget *parent);
|
|
|
|
|
2012-01-10 22:52:34 +04:00
|
|
|
struct widget *
|
|
|
|
widget_add_widget(struct widget *parent, void *data);
|
2012-05-23 23:06:27 +04:00
|
|
|
|
2012-01-10 22:52:34 +04:00
|
|
|
void
|
|
|
|
widget_destroy(struct widget *widget);
|
2012-11-30 23:54:35 +04:00
|
|
|
void
|
|
|
|
widget_set_default_cursor(struct widget *widget, int cursor);
|
2011-09-21 05:43:54 +04:00
|
|
|
void
|
2012-01-09 00:09:53 +04:00
|
|
|
widget_get_allocation(struct widget *widget, struct rectangle *allocation);
|
2011-09-21 05:43:54 +04:00
|
|
|
|
|
|
|
void
|
2012-01-09 00:09:53 +04:00
|
|
|
widget_set_allocation(struct widget *widget,
|
|
|
|
int32_t x, int32_t y, int32_t width, int32_t height);
|
2012-01-11 04:11:42 +04:00
|
|
|
void
|
|
|
|
widget_set_size(struct widget *widget, int32_t width, int32_t height);
|
|
|
|
void
|
2012-02-24 02:30:45 +04:00
|
|
|
widget_set_transparent(struct widget *widget, int transparent);
|
|
|
|
void
|
2012-01-11 04:11:42 +04:00
|
|
|
widget_schedule_resize(struct widget *widget, int32_t width, int32_t height);
|
2011-09-21 05:43:54 +04:00
|
|
|
|
|
|
|
void *
|
2012-01-09 00:09:53 +04:00
|
|
|
widget_get_user_data(struct widget *widget);
|
2011-09-21 05:43:54 +04:00
|
|
|
|
2013-02-13 18:17:23 +04:00
|
|
|
cairo_t *
|
|
|
|
widget_cairo_create(struct widget *widget);
|
|
|
|
|
clients: add subsurfaces demo
Add a demo program with:
- a main surface (green)
- a Cairo-image sub-surface (red)
- a raw GLESv2 widget (triangle)
Sub-surface input region is set empty to avoid problems in toytoolkit.
If Cairo links to libGL, then we will end up with also libGLESv2 linked
to subsurfaces program, and both libs getting really used, which leads
to disaster.
Do not build subsurfaces demo, if Cairo links to libGL and cairo-egl is
usable.
The GL rendering loop is not tied to the toytoolkit or the widget, but
runs directly from its own frame callback. Therefore it runs
independent of the rest of the application. This also relies on one of
two things:
- eglSwapInterval(0) is implemented, and therefore eglSwapBuffers never
blocks indefinitely, or
- toytoolkit has a workaround, that guarantees that eglSwapBuffers will
return soon, when we force a repaint on resize.
Otherwise the demo will deadlock.
The code is separated into three sections:
1. The library component, using only EGL, GLESv2, and libwayland-client
APIs, and not aware of any toolkit details of the parent application.
This runs independently until the parent application tells otherwise.
2. The glue code: a toytoolkit application widget, who has its own
rendering machinery.
3. The application written in toytoolkit.
This patch also adds new toytoolkit interfaces:
- widget_get_wl_surface()
- widget_get_last_time()
- widget_input_region_add()
Toytoolkit applications have not had a possibility to change the input
region. The frame widget (decorations) set the input region on its own
when used, otherwise the default input region of everything has been
used. If a window does not have a frame widget, it can now use
widget_input_region_add() to set a custom input region.
These are not window methods, because a widget may lie on a different
wl_surface (sub-surface) than the window.
Changes in v3:
- replace set_commit_mode with set_sync and set_desync
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:50 +04:00
|
|
|
struct wl_surface *
|
|
|
|
widget_get_wl_surface(struct widget *widget);
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
widget_get_last_time(struct widget *widget);
|
|
|
|
|
|
|
|
void
|
|
|
|
widget_input_region_add(struct widget *widget, const struct rectangle *rect);
|
|
|
|
|
2012-01-10 21:23:19 +04:00
|
|
|
void
|
|
|
|
widget_set_redraw_handler(struct widget *widget,
|
|
|
|
widget_redraw_handler_t handler);
|
|
|
|
void
|
|
|
|
widget_set_resize_handler(struct widget *widget,
|
|
|
|
widget_resize_handler_t handler);
|
2012-01-09 00:18:19 +04:00
|
|
|
void
|
2012-01-09 17:42:24 +04:00
|
|
|
widget_set_enter_handler(struct widget *widget,
|
|
|
|
widget_enter_handler_t handler);
|
|
|
|
void
|
|
|
|
widget_set_leave_handler(struct widget *widget,
|
|
|
|
widget_leave_handler_t handler);
|
2012-01-09 18:36:16 +04:00
|
|
|
void
|
|
|
|
widget_set_motion_handler(struct widget *widget,
|
|
|
|
widget_motion_handler_t handler);
|
2012-01-09 00:18:19 +04:00
|
|
|
void
|
2012-01-09 20:12:05 +04:00
|
|
|
widget_set_button_handler(struct widget *widget,
|
|
|
|
widget_button_handler_t handler);
|
2012-08-14 13:02:41 +04:00
|
|
|
void
|
2013-08-09 08:20:38 +04:00
|
|
|
widget_set_touch_down_handler(struct widget *widget,
|
|
|
|
widget_touch_down_handler_t handler);
|
|
|
|
void
|
|
|
|
widget_set_touch_up_handler(struct widget *widget,
|
|
|
|
widget_touch_up_handler_t handler);
|
|
|
|
void
|
|
|
|
widget_set_touch_motion_handler(struct widget *widget,
|
|
|
|
widget_touch_motion_handler_t handler);
|
|
|
|
void
|
|
|
|
widget_set_touch_frame_handler(struct widget *widget,
|
|
|
|
widget_touch_frame_handler_t handler);
|
|
|
|
void
|
|
|
|
widget_set_touch_cancel_handler(struct widget *widget,
|
|
|
|
widget_touch_cancel_handler_t handler);
|
|
|
|
void
|
2012-08-14 13:02:41 +04:00
|
|
|
widget_set_axis_handler(struct widget *widget,
|
|
|
|
widget_axis_handler_t handler);
|
2012-01-09 20:12:05 +04:00
|
|
|
void
|
2016-01-18 09:38:22 +03:00
|
|
|
widget_set_pointer_frame_handler(struct widget *widget,
|
|
|
|
widget_pointer_frame_handler_t handler);
|
|
|
|
void
|
|
|
|
widget_set_axis_handlers(struct widget *widget,
|
|
|
|
widget_axis_handler_t axis_handler,
|
|
|
|
widget_axis_source_handler_t axis_source_handler,
|
|
|
|
widget_axis_stop_handler_t axis_stop_handler,
|
|
|
|
widget_axis_discrete_handler_t axis_discrete_handler);
|
|
|
|
|
2017-11-30 00:38:44 +03:00
|
|
|
void
|
|
|
|
window_inhibit_redraw(struct window *window);
|
|
|
|
void
|
|
|
|
window_uninhibit_redraw(struct window *window);
|
2016-01-18 09:38:22 +03:00
|
|
|
void
|
2012-01-09 00:18:19 +04:00
|
|
|
widget_schedule_redraw(struct widget *widget);
|
2013-12-19 20:17:12 +04:00
|
|
|
void
|
|
|
|
widget_set_use_cairo(struct widget *widget, int use_cairo);
|
2012-01-09 00:18:19 +04:00
|
|
|
|
2012-01-11 07:41:05 +04:00
|
|
|
struct widget *
|
2013-10-14 04:08:38 +04:00
|
|
|
window_frame_create(struct window *window, void *data);
|
2013-02-13 18:17:23 +04:00
|
|
|
|
2012-06-21 01:30:03 +04:00
|
|
|
void
|
2013-10-14 04:08:38 +04:00
|
|
|
window_frame_set_child_size(struct widget *widget, int child_width,
|
|
|
|
int child_height);
|
2012-01-11 07:41:05 +04:00
|
|
|
|
2011-10-28 20:26:06 +04:00
|
|
|
void
|
2012-06-05 00:04:07 +04:00
|
|
|
input_set_pointer_image(struct input *input, int pointer);
|
2011-10-28 20:26:06 +04:00
|
|
|
|
2010-08-18 23:28:04 +04:00
|
|
|
void
|
|
|
|
input_get_position(struct input *input, int32_t *x, int32_t *y);
|
|
|
|
|
2014-01-08 00:57:59 +04:00
|
|
|
int
|
|
|
|
input_get_touch(struct input *input, int32_t id, float *x, float *y);
|
|
|
|
|
2012-05-08 23:55:39 +04:00
|
|
|
#define MOD_SHIFT_MASK 0x01
|
|
|
|
#define MOD_ALT_MASK 0x02
|
|
|
|
#define MOD_CONTROL_MASK 0x04
|
|
|
|
|
2011-01-19 22:20:33 +03:00
|
|
|
uint32_t
|
|
|
|
input_get_modifiers(struct input *input);
|
|
|
|
|
2013-11-25 14:42:51 +04:00
|
|
|
void
|
|
|
|
touch_grab(struct input *input, int32_t touch_id);
|
|
|
|
|
|
|
|
void
|
|
|
|
touch_ungrab(struct input *input);
|
|
|
|
|
2012-01-11 08:46:33 +04:00
|
|
|
void
|
|
|
|
input_grab(struct input *input, struct widget *widget, uint32_t button);
|
|
|
|
|
|
|
|
void
|
2012-04-12 06:42:15 +04:00
|
|
|
input_ungrab(struct input *input);
|
2012-01-11 08:46:33 +04:00
|
|
|
|
2012-01-11 09:04:42 +04:00
|
|
|
struct widget *
|
|
|
|
input_get_focus_widget(struct input *input);
|
|
|
|
|
2012-06-05 17:58:51 +04:00
|
|
|
struct display *
|
|
|
|
input_get_display(struct input *input);
|
|
|
|
|
2012-05-16 21:45:18 +04:00
|
|
|
struct wl_seat *
|
|
|
|
input_get_seat(struct input *input);
|
2010-08-26 00:34:05 +04:00
|
|
|
|
2011-10-28 20:26:06 +04:00
|
|
|
struct wl_data_device *
|
|
|
|
input_get_data_device(struct input *input);
|
|
|
|
|
2011-01-22 00:23:09 +03:00
|
|
|
void
|
2011-10-28 20:26:06 +04:00
|
|
|
input_set_selection(struct input *input,
|
|
|
|
struct wl_data_source *source, uint32_t time);
|
|
|
|
|
|
|
|
void
|
2012-04-12 06:42:15 +04:00
|
|
|
input_accept(struct input *input, const char *type);
|
2011-10-28 20:26:06 +04:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
input_receive_drag_data(struct input *input, const char *mime_type,
|
|
|
|
data_func_t func, void *user_data);
|
2013-09-05 07:41:06 +04:00
|
|
|
int
|
|
|
|
input_receive_drag_data_to_fd(struct input *input,
|
|
|
|
const char *mime_type, int fd);
|
2011-10-28 20:26:06 +04:00
|
|
|
|
|
|
|
int
|
|
|
|
input_receive_selection_data(struct input *input, const char *mime_type,
|
|
|
|
data_func_t func, void *data);
|
2011-12-27 22:50:04 +04:00
|
|
|
int
|
|
|
|
input_receive_selection_data_to_fd(struct input *input,
|
|
|
|
const char *mime_type, int fd);
|
2011-01-19 22:27:42 +03:00
|
|
|
|
2011-11-30 12:52:38 +04:00
|
|
|
void
|
|
|
|
output_set_user_data(struct output *output, void *data);
|
|
|
|
|
|
|
|
void *
|
|
|
|
output_get_user_data(struct output *output);
|
|
|
|
|
|
|
|
void
|
|
|
|
output_set_destroy_handler(struct output *output,
|
|
|
|
display_output_handler_t handler);
|
|
|
|
|
2011-11-27 02:27:37 +04:00
|
|
|
void
|
|
|
|
output_get_allocation(struct output *output, struct rectangle *allocation);
|
|
|
|
|
2011-11-30 12:52:38 +04:00
|
|
|
struct wl_output *
|
|
|
|
output_get_wl_output(struct output *output);
|
2011-11-27 02:27:37 +04:00
|
|
|
|
2012-11-30 19:34:25 +04:00
|
|
|
enum wl_output_transform
|
|
|
|
output_get_transform(struct output *output);
|
|
|
|
|
2013-05-22 16:41:27 +04:00
|
|
|
uint32_t
|
|
|
|
output_get_scale(struct output *output);
|
|
|
|
|
2014-04-03 04:53:50 +04:00
|
|
|
const char *
|
|
|
|
output_get_make(struct output *output);
|
|
|
|
|
|
|
|
const char *
|
|
|
|
output_get_model(struct output *output);
|
|
|
|
|
2012-11-18 22:06:44 +04:00
|
|
|
void
|
|
|
|
keysym_modifiers_add(struct wl_array *modifiers_map,
|
|
|
|
const char *name);
|
|
|
|
|
|
|
|
xkb_mod_mask_t
|
|
|
|
keysym_modifiers_get_mask(struct wl_array *modifiers_map,
|
|
|
|
const char *name);
|
|
|
|
|
2018-03-09 12:54:40 +03:00
|
|
|
struct toytimer;
|
|
|
|
typedef void (*toytimer_cb)(struct toytimer *);
|
|
|
|
|
|
|
|
struct toytimer {
|
|
|
|
struct display *display;
|
|
|
|
struct task tsk;
|
|
|
|
int fd;
|
|
|
|
toytimer_cb callback;
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
toytimer_init(struct toytimer *tt, clockid_t clock, struct display *display,
|
|
|
|
toytimer_cb callback);
|
|
|
|
|
|
|
|
void
|
|
|
|
toytimer_fini(struct toytimer *tt);
|
|
|
|
|
|
|
|
void
|
|
|
|
toytimer_arm(struct toytimer *tt, const struct itimerspec *its);
|
|
|
|
|
|
|
|
void
|
|
|
|
toytimer_arm_once_usec(struct toytimer *tt, uint32_t usec);
|
|
|
|
|
|
|
|
void
|
|
|
|
toytimer_disarm(struct toytimer *tt);
|
|
|
|
|
2008-12-08 03:59:11 +03:00
|
|
|
#endif
|