#ifndef _WINDOW_H_
#define _WINDOW_H_
+#include "config.h"
+
#include <xkbcommon/xkbcommon.h>
#include <wayland-client.h>
#include <cairo.h>
#include "../shared/config-parser.h"
-#include "subsurface-client-protocol.h"
+#include "../shared/zalloc.h"
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
int32_t height;
};
+void *
+fail_on_null(void *p);
+void *
+xmalloc(size_t s);
+void *
+xzalloc(size_t s);
+char *
+xstrdup(const char *s);
+void *
+xrealloc(char *p, size_t s);
+
struct display *
display_create(int *argc, char *argv[]);
struct wl_display *
display_get_display(struct display *display);
+int
+display_has_subcompositor(struct display *display);
+
cairo_device_t *
display_get_cairo_device(struct display *display);
struct wl_compositor *
display_get_compositor(struct display *display);
-struct wl_shell *
-display_get_shell(struct display *display);
-
struct output *
display_get_output(struct display *display);
void
display_set_global_handler(struct display *display,
display_global_handler_t handler);
+void
+display_set_global_handler_remove(struct display *display,
+ display_global_handler_t remove_handler);
void *
display_bind(struct display *display, uint32_t name,
const struct wl_interface *interface, uint32_t version);
#define SURFACE_HINT_RESIZE 0x10
+#define SURFACE_HINT_RGB565 0x100
+
cairo_surface_t *
display_create_surface(struct display *display,
struct wl_surface *surface,
struct input *input,
int32_t x, int32_t y, void *data);
-typedef void (*window_close_handler_t)(struct window *window, void *data);
+typedef void (*window_close_handler_t)(void *data);
typedef void (*window_fullscreen_handler_t)(struct window *window, void *data);
typedef void (*window_output_handler_t)(struct window *window, struct output *output,
int enter, void *data);
+typedef void (*window_state_changed_handler_t)(struct window *window,
+ void *data);
typedef void (*widget_resize_handler_t)(struct widget *widget,
int32_t width, int32_t height,
uint32_t button,
enum wl_pointer_button_state state,
void *data);
+typedef void (*widget_touch_down_handler_t)(struct widget *widget,
+ struct input *input,
+ 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,
+ struct input *input,
+ uint32_t serial,
+ uint32_t time,
+ int32_t id,
+ void *data);
+typedef void (*widget_touch_motion_handler_t)(struct widget *widget,
+ struct input *input,
+ uint32_t time,
+ int32_t id,
+ float x,
+ float y,
+ void *data);
+typedef void (*widget_touch_frame_handler_t)(struct widget *widget,
+ struct input *input, void *data);
+typedef void (*widget_touch_cancel_handler_t)(struct widget *widget,
+ struct input *input, void *data);
typedef void (*widget_axis_handler_t)(struct widget *widget,
struct input *input, uint32_t time,
uint32_t axis,
struct window *
window_create(struct display *display);
struct window *
-window_create_transient(struct display *display, struct window *parent,
- int32_t x, int32_t y, uint32_t flags);
-struct window *
window_create_custom(struct display *display);
+void
+window_set_parent(struct window *window, struct window *parent_window);
+struct window *
+window_get_parent(struct window *window);
+
int
window_has_focus(struct window *window);
-typedef void (*menu_func_t)(struct window *window, int index, void *data);
+typedef void (*menu_func_t)(void *data, struct input *input, int index);
+struct window *
+window_create_menu(struct display *display,
+ struct input *input, uint32_t time,
+ menu_func_t func, const char **entries, int count,
+ void *user_data);
void
window_show_menu(struct display *display,
struct input *input, uint32_t time, struct window *parent,
struct wl_surface *
window_get_wl_surface(struct window *window);
-struct wl_shell_surface *
-window_get_wl_shell_surface(struct window *window);
+struct wl_subsurface *
+widget_get_wl_subsurface(struct widget *widget);
enum window_buffer_type {
WINDOW_BUFFER_TYPE_EGL_WINDOW,
void
window_set_buffer_type(struct window *window, enum window_buffer_type type);
+enum window_buffer_type
+window_get_buffer_type(struct window *window);
+
int
window_is_fullscreen(struct window *window);
void
window_set_fullscreen(struct window *window, int fullscreen);
-void
-window_set_fullscreen_method(struct window *window,
- enum wl_shell_surface_fullscreen_method method);
int
window_is_maximized(struct window *window);
void
window_set_maximized(struct window *window, int maximized);
+int
+window_is_resizing(struct window *window);
+
+void
+window_set_minimized(struct window *window);
+
void
window_set_user_data(struct window *window, void *data);
void
window_set_output_handler(struct window *window,
window_output_handler_t handler);
+void
+window_set_state_changed_handler(struct window *window,
+ window_state_changed_handler_t handler);
void
window_set_title(struct window *window, const char *title);
void
window_set_text_cursor_position(struct window *window, int32_t x, int32_t y);
+enum preferred_format {
+ WINDOW_PREFERRED_FORMAT_NONE,
+ WINDOW_PREFERRED_FORMAT_RGB565
+};
+
+void
+window_set_preferred_format(struct window *window,
+ enum preferred_format format);
+
int
widget_set_tooltip(struct widget *parent, char *entry, float x, float y);
widget_set_button_handler(struct widget *widget,
widget_button_handler_t handler);
void
+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
widget_set_axis_handler(struct widget *widget,
widget_axis_handler_t handler);
-
void
widget_schedule_redraw(struct widget *widget);
+void
+widget_set_use_cairo(struct widget *widget, int use_cairo);
struct widget *
-frame_create(struct window *window, void *data);
+window_frame_create(struct window *window, void *data);
void
-frame_set_child_size(struct widget *widget, int child_width, int child_height);
+window_frame_set_child_size(struct widget *widget, int child_width,
+ int child_height);
void
input_set_pointer_image(struct input *input, int pointer);
void
input_get_position(struct input *input, int32_t *x, int32_t *y);
+int
+input_get_touch(struct input *input, int32_t id, float *x, float *y);
+
#define MOD_SHIFT_MASK 0x01
#define MOD_ALT_MASK 0x02
#define MOD_CONTROL_MASK 0x04
input_get_modifiers(struct input *input);
void
+touch_grab(struct input *input, int32_t touch_id);
+
+void
+touch_ungrab(struct input *input);
+
+void
input_grab(struct input *input, struct widget *widget, uint32_t button);
void
void
input_receive_drag_data(struct input *input, const char *mime_type,
data_func_t func, void *user_data);
+int
+input_receive_drag_data_to_fd(struct input *input,
+ const char *mime_type, int fd);
int
input_receive_selection_data(struct input *input, const char *mime_type,
uint32_t
output_get_scale(struct output *output);
+const char *
+output_get_make(struct output *output);
+
+const char *
+output_get_model(struct output *output);
+
void
keysym_modifiers_add(struct wl_array *modifiers_map,
const char *name);