#ifndef WAYLAND_WINDOW_H
#define WAYLAND_WINDOW_H

#include <wayland-client.h>

/* Data for a single Wayland window (one surface) */
struct wayland_window {
    struct wl_surface *wl_surface;
    struct wl_buffer *buffer;
    struct wl_callback *frame_callback;
    struct xdg_surface *xdg_surface;
    struct xdg_toplevel *xdg_toplevel;
    uint8_t *data;
    int16_t width;
    int16_t height;
    int need_close;
    uint8_t color;
};

/* Initialize windowing for the given window structure. Caller provides the struct (on stack or heap) */
int window_init(struct wl_display *display, struct wayland_window *win);

/* Returns non-zero if the window requested to close */
int window_should_close(struct wayland_window *win);

/* Destroy window and related resources */
void window_destroy(struct wayland_window *win);

#endif
