2008-12-08 03:59:11 +03:00
|
|
|
/*
|
|
|
|
* Copyright © 2008 Kristian Høgsberg
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
* documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
* the above copyright notice appear in all copies and that both that copyright
|
|
|
|
* notice and this permission notice appear in supporting documentation, and
|
|
|
|
* that the name of the copyright holders not be used in advertising or
|
|
|
|
* publicity pertaining to distribution of the software without specific,
|
|
|
|
* written prior permission. The copyright holders make no representations
|
|
|
|
* about the suitability of this software for any purpose. It is provided "as
|
|
|
|
* is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
|
|
* OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _WINDOW_H_
|
|
|
|
#define _WINDOW_H_
|
|
|
|
|
2011-01-19 22:41:20 +03:00
|
|
|
#include <X11/extensions/XKBcommon.h>
|
2010-11-28 21:31:55 +03:00
|
|
|
#include <glib.h>
|
|
|
|
#include <wayland-client.h>
|
2011-02-19 01:00:55 +03:00
|
|
|
#include <cairo.h>
|
2010-11-28 21:31:55 +03:00
|
|
|
|
2008-12-08 03:59:11 +03:00
|
|
|
struct window;
|
|
|
|
|
|
|
|
struct rectangle {
|
|
|
|
int32_t x;
|
|
|
|
int32_t y;
|
|
|
|
int32_t width;
|
|
|
|
int32_t height;
|
|
|
|
};
|
|
|
|
|
2009-01-27 07:42:46 +03:00
|
|
|
struct display;
|
2010-07-21 01:06:19 +04:00
|
|
|
struct input;
|
2009-01-27 07:42:46 +03:00
|
|
|
|
2011-04-11 21:16:33 +04:00
|
|
|
typedef void (*display_global_handler_t)(struct display *display,
|
|
|
|
const char *interface,
|
|
|
|
uint32_t id,
|
|
|
|
uint32_t version);
|
|
|
|
|
2009-01-27 07:42:46 +03:00
|
|
|
struct display *
|
2011-04-11 21:16:33 +04:00
|
|
|
display_create(int *argc, char **argv[], const GOptionEntry *option_entries,
|
|
|
|
display_global_handler_t handler);
|
2010-06-08 22:59:44 +04:00
|
|
|
|
2010-09-03 22:46:38 +04:00
|
|
|
struct wl_display *
|
|
|
|
display_get_display(struct display *display);
|
|
|
|
|
2009-01-27 07:42:46 +03:00
|
|
|
struct wl_compositor *
|
|
|
|
display_get_compositor(struct display *display);
|
|
|
|
|
2011-01-19 22:27:42 +03:00
|
|
|
struct wl_shell *
|
|
|
|
display_get_shell(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-02-19 01:00:55 +03:00
|
|
|
EGLConfig
|
|
|
|
display_get_egl_config(struct display *d);
|
|
|
|
|
|
|
|
void
|
|
|
|
display_acquire_window_surface(struct display *display,
|
|
|
|
struct window *window,
|
|
|
|
EGLContext ctx);
|
|
|
|
void
|
|
|
|
display_release(struct display *display);
|
|
|
|
|
2011-01-15 01:41:33 +03:00
|
|
|
#ifdef HAVE_CAIRO_EGL
|
2010-11-08 23:45:55 +03:00
|
|
|
EGLImageKHR
|
2011-02-04 22:11:33 +03:00
|
|
|
display_get_image_for_egl_image_surface(struct display *display,
|
|
|
|
cairo_surface_t *surface);
|
2010-06-08 22:59:44 +04:00
|
|
|
#endif
|
2011-01-05 20:48:15 +03:00
|
|
|
#endif
|
2010-06-08 22:59:44 +04:00
|
|
|
|
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,
|
2010-06-16 01:16:35 +04:00
|
|
|
struct rectangle *rectangle);
|
|
|
|
|
2010-08-18 23:28:04 +04:00
|
|
|
struct wl_buffer *
|
|
|
|
display_get_buffer_for_surface(struct display *display,
|
|
|
|
cairo_surface_t *surface);
|
|
|
|
|
|
|
|
cairo_surface_t *
|
|
|
|
display_get_pointer_surface(struct display *display, int pointer,
|
|
|
|
int *width, int *height,
|
|
|
|
int *hotspot_x, int *hotspot_y);
|
|
|
|
|
2010-08-20 01:26:02 +04:00
|
|
|
void
|
|
|
|
display_add_drag_listener(struct display *display,
|
|
|
|
const struct wl_drag_listener *drag_listener,
|
|
|
|
void *data);
|
|
|
|
|
2010-08-28 06:18:00 +04:00
|
|
|
void
|
|
|
|
display_flush_cairo_device(struct display *display);
|
|
|
|
|
2010-06-08 22:59:44 +04:00
|
|
|
void
|
|
|
|
display_run(struct display *d);
|
|
|
|
|
2010-08-18 23:28:04 +04:00
|
|
|
enum pointer_type {
|
|
|
|
POINTER_BOTTOM_LEFT,
|
|
|
|
POINTER_BOTTOM_RIGHT,
|
|
|
|
POINTER_BOTTOM,
|
|
|
|
POINTER_DRAGGING,
|
|
|
|
POINTER_LEFT_PTR,
|
|
|
|
POINTER_LEFT,
|
|
|
|
POINTER_RIGHT,
|
|
|
|
POINTER_TOP_LEFT,
|
|
|
|
POINTER_TOP_RIGHT,
|
|
|
|
POINTER_TOP,
|
|
|
|
POINTER_IBEAM,
|
|
|
|
POINTER_HAND1,
|
|
|
|
};
|
|
|
|
|
2011-01-11 18:00:52 +03:00
|
|
|
typedef void (*window_resize_handler_t)(struct window *window,
|
|
|
|
int32_t width, int32_t height,
|
|
|
|
void *data);
|
2010-06-15 07:52:50 +04:00
|
|
|
typedef void (*window_redraw_handler_t)(struct window *window, void *data);
|
2011-01-17 19:25:34 +03: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,
|
|
|
|
uint32_t 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
|
|
|
|
2010-08-18 23:28:04 +04:00
|
|
|
typedef void (*window_button_handler_t)(struct window *window,
|
|
|
|
struct input *input, uint32_t time,
|
|
|
|
int button, int state, void *data);
|
|
|
|
|
|
|
|
typedef int (*window_motion_handler_t)(struct window *window,
|
|
|
|
struct input *input, uint32_t time,
|
|
|
|
int32_t x, int32_t y,
|
|
|
|
int32_t sx, int32_t sy, void *data);
|
|
|
|
|
2008-12-08 03:59:11 +03:00
|
|
|
struct window *
|
2011-01-22 02:03:15 +03:00
|
|
|
window_create(struct display *display, int32_t width, int32_t height);
|
|
|
|
struct window *
|
|
|
|
window_create_transient(struct display *display, struct window *parent,
|
|
|
|
int32_t x, int32_t y, int32_t width, int32_t height);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_destroy(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
|
|
|
|
window_draw(struct window *window);
|
2011-02-19 01:00:55 +03:00
|
|
|
|
|
|
|
void
|
|
|
|
window_get_allocation(struct window *window,
|
|
|
|
struct rectangle *allocation);
|
|
|
|
|
2008-12-08 03:59:11 +03:00
|
|
|
void
|
2011-01-11 18:00:52 +03:00
|
|
|
window_get_child_allocation(struct window *window,
|
|
|
|
struct rectangle *allocation);
|
2011-01-14 10:46:23 +03:00
|
|
|
|
2008-12-08 03:59:11 +03:00
|
|
|
void
|
2011-01-11 18:00:52 +03:00
|
|
|
window_set_child_size(struct window *window, int32_t width, int32_t height);
|
2008-12-08 21:50:07 +03:00
|
|
|
void
|
2010-06-15 07:52:50 +04:00
|
|
|
window_schedule_redraw(struct window *window);
|
2010-06-08 22:08:30 +04:00
|
|
|
|
2010-10-25 19:40:03 +04:00
|
|
|
void
|
|
|
|
window_damage(struct window *window, int32_t x, int32_t y,
|
|
|
|
int32_t width, int32_t height);
|
|
|
|
|
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);
|
|
|
|
|
2010-09-03 22:46:38 +04:00
|
|
|
void
|
|
|
|
window_flush(struct window *window);
|
|
|
|
|
2010-11-19 23:15:15 +03:00
|
|
|
void
|
|
|
|
window_set_surface(struct window *window, cairo_surface_t *surface);
|
|
|
|
|
2010-10-26 08:02:20 +04:00
|
|
|
void
|
|
|
|
window_create_surface(struct window *window);
|
|
|
|
|
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,
|
2011-02-04 22:11:33 +03:00
|
|
|
WINDOW_BUFFER_TYPE_EGL_IMAGE,
|
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);
|
|
|
|
|
2008-12-22 20:14:50 +03:00
|
|
|
void
|
|
|
|
window_set_fullscreen(struct window *window, int fullscreen);
|
|
|
|
|
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);
|
|
|
|
|
2010-06-15 07:52:50 +04:00
|
|
|
void
|
|
|
|
window_set_redraw_handler(struct window *window,
|
2010-06-25 19:19:22 +04:00
|
|
|
window_redraw_handler_t handler);
|
2010-06-15 07:52:50 +04:00
|
|
|
|
2010-06-08 22:08:30 +04:00
|
|
|
void
|
|
|
|
window_set_decoration(struct window *window, int decoration);
|
|
|
|
|
2008-12-08 03:59:11 +03:00
|
|
|
void
|
|
|
|
window_set_resize_handler(struct window *window,
|
2010-06-25 19:19:22 +04:00
|
|
|
window_resize_handler_t handler);
|
|
|
|
|
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
|
|
|
|
2010-08-18 23:28:04 +04:00
|
|
|
void
|
|
|
|
window_set_button_handler(struct window *window,
|
|
|
|
window_button_handler_t handler);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_set_motion_handler(struct window *window,
|
|
|
|
window_motion_handler_t handler);
|
|
|
|
|
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-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);
|
|
|
|
|
2010-09-03 04:22:42 +04:00
|
|
|
struct wl_drag *
|
2010-11-30 22:01:07 +03:00
|
|
|
window_create_drag(struct window *window);
|
2010-09-03 04:22:42 +04:00
|
|
|
|
2010-11-30 22:01:07 +03:00
|
|
|
void
|
|
|
|
window_activate_drag(struct wl_drag *drag, struct window *window,
|
|
|
|
struct input *input, uint32_t time);
|
2010-08-18 23:28:04 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
input_get_position(struct input *input, int32_t *x, int32_t *y);
|
|
|
|
|
2011-01-19 22:20:33 +03:00
|
|
|
uint32_t
|
|
|
|
input_get_modifiers(struct input *input);
|
|
|
|
|
2010-08-26 00:34:05 +04:00
|
|
|
struct wl_input_device *
|
|
|
|
input_get_input_device(struct input *input);
|
|
|
|
|
2011-01-19 22:27:42 +03:00
|
|
|
int
|
|
|
|
input_offers_mime_type(struct input *input, const char *type);
|
2011-01-22 00:23:09 +03:00
|
|
|
void
|
|
|
|
input_receive_mime_type(struct input *input, const char *type, int fd);
|
2011-01-19 22:27:42 +03:00
|
|
|
|
|
|
|
|
2008-12-08 03:59:11 +03:00
|
|
|
#endif
|