summaryrefslogtreecommitdiff
path: root/src/window.h
blob: 82886be9a444cd8c416354604526f7d60b8a758a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include "utils.h"

struct eventloop_s;

typedef u32 window_id_t;

enum window_error_e : u8 {
  WINDOW_ERROR_NONE = 0,
  WINDOW_ERROR_WL_SURFACE_CREATION,
  WINDOW_ERROR_XDG_SURFACE_CREATION,
  WINDOW_ERROR_XDG_TOPLEVEL_CREATION,
};

struct window_s {
  struct eventloop_s* loop;
  window_id_t id;

  wl_surface_t surface;
  xdg_surface_t xdg_surface;
  xdg_toplevel_t xdg_toplevel;
};

enum window_error_e wayc_window_init(struct window_s* window, const char* name,
                                     struct eventloop_s* loop);
void wayc_window_deinit(struct window_s* window);
void wayc_window_redraw(struct window_s* window, struct eventloop_s* loop);