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_
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
struct display *
|
2010-06-08 22:59:44 +04:00
|
|
|
display_create(int *argc, char **argv[], const GOptionEntry *option_entries);
|
|
|
|
|
2009-01-27 07:42:46 +03:00
|
|
|
struct wl_compositor *
|
|
|
|
display_get_compositor(struct display *display);
|
|
|
|
|
2010-06-08 22:59:44 +04:00
|
|
|
#ifdef EGL_NO_DISPLAY
|
|
|
|
EGLDisplay
|
|
|
|
display_get_egl_display(struct display *d);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
|
|
|
display_run(struct display *d);
|
|
|
|
|
2009-02-21 22:31:09 +03:00
|
|
|
enum {
|
|
|
|
WINDOW_MODIFIER_SHIFT = 0x01,
|
|
|
|
WINDOW_MODIFIER_ALT = 0x02,
|
|
|
|
WINDOW_MODIFIER_CONTROL = 0x04,
|
|
|
|
};
|
|
|
|
|
2008-12-08 21:50:07 +03:00
|
|
|
typedef void (*window_resize_handler_t)(struct window *window, void *data);
|
2008-12-08 03:59:11 +03:00
|
|
|
typedef void (*window_frame_handler_t)(struct window *window, uint32_t frame, uint32_t timestamp, void *data);
|
2010-06-09 04:34:11 +04:00
|
|
|
typedef void (*window_acknowledge_handler_t)(struct window *window, uint32_t key, uint32_t frame, void *data);
|
2009-02-21 22:31:09 +03:00
|
|
|
typedef void (*window_key_handler_t)(struct window *window, uint32_t key, uint32_t unicode,
|
|
|
|
uint32_t state, uint32_t modifiers, void *data);
|
2009-02-23 07:01:35 +03:00
|
|
|
typedef void (*window_keyboard_focus_handler_t)(struct window *window,
|
|
|
|
struct wl_input_device *device, void *data);
|
2008-12-08 03:59:11 +03:00
|
|
|
|
|
|
|
struct window *
|
2009-01-27 07:42:46 +03:00
|
|
|
window_create(struct display *display, const char *title,
|
2008-12-08 03:59:11 +03:00
|
|
|
int32_t x, int32_t y, int32_t width, int32_t height);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_draw(struct window *window);
|
|
|
|
void
|
2010-01-25 02:10:15 +03:00
|
|
|
window_commit(struct window *window, uint32_t key);
|
|
|
|
void
|
2008-12-08 03:59:11 +03:00
|
|
|
window_get_child_rectangle(struct window *window,
|
|
|
|
struct rectangle *rectangle);
|
|
|
|
void
|
2008-12-08 21:50:07 +03:00
|
|
|
window_set_child_size(struct window *window,
|
|
|
|
struct rectangle *rectangle);
|
|
|
|
void
|
2010-06-08 22:08:30 +04:00
|
|
|
window_copy_image(struct window *window,
|
|
|
|
struct rectangle *rectangle,
|
|
|
|
void *image);
|
|
|
|
|
|
|
|
void
|
|
|
|
window_move(struct window *window, int32_t x, int32_t y);
|
2008-12-08 03:59:11 +03:00
|
|
|
|
2009-01-15 19:37:43 +03:00
|
|
|
cairo_surface_t *
|
|
|
|
window_create_surface(struct window *window,
|
|
|
|
struct rectangle *rectangle);
|
|
|
|
|
2010-06-08 22:08:30 +04:00
|
|
|
cairo_surface_t *
|
|
|
|
window_get_surface(struct window *window);
|
|
|
|
|
2009-01-15 19:37:43 +03:00
|
|
|
void
|
|
|
|
window_copy_surface(struct window *window,
|
|
|
|
struct rectangle *rectangle,
|
|
|
|
cairo_surface_t *surface);
|
|
|
|
|
2008-12-22 20:14:50 +03:00
|
|
|
void
|
|
|
|
window_set_fullscreen(struct window *window, int fullscreen);
|
|
|
|
|
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,
|
|
|
|
window_resize_handler_t handler, void *data);
|
|
|
|
void
|
|
|
|
window_set_frame_handler(struct window *window,
|
|
|
|
window_frame_handler_t handler, void *data);
|
|
|
|
void
|
|
|
|
window_set_acknowledge_handler(struct window *window,
|
|
|
|
window_acknowledge_handler_t handler, void *data);
|
2008-12-08 08:01:36 +03:00
|
|
|
void
|
|
|
|
window_set_key_handler(struct window *window,
|
|
|
|
window_key_handler_t handler, void *data);
|
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,
|
|
|
|
window_keyboard_focus_handler_t handler,
|
|
|
|
void *data);
|
2010-06-08 22:08:30 +04:00
|
|
|
|
2010-06-09 04:34:11 +04:00
|
|
|
void
|
|
|
|
window_set_acknowledge_handler(struct window *window,
|
|
|
|
window_acknowledge_handler_t handler, void *data);
|
|
|
|
|
2010-06-08 22:08:30 +04:00
|
|
|
void
|
|
|
|
window_set_frame_handler(struct window *window,
|
|
|
|
window_frame_handler_t handler, void *data);
|
2010-06-08 22:59:44 +04:00
|
|
|
|
2008-12-08 03:59:11 +03:00
|
|
|
#endif
|