summaryrefslogtreecommitdiff
path: root/src/client.h
blob: 4814fdb43c7a2387f8089bcb2751f62de3e2c588 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef CLIENT_H
#define CLIENT_H

#include <stdbool.h>
#include <stdint.h>
#include "egl.h"
#include "gl.h"

struct surface {
	struct egl egl;
	struct gl gl;
	struct wl_surface *wl_surface;
	int32_t width;
	int32_t height;
	bool redraw;
};

struct image {
	uint8_t *buffer;
	uint32_t width;
	uint32_t height;
};

struct color {
	float r;
	float g;
	float b;
	float a;
};

struct client_state {
	/* Globals */
	struct wl_display *wl_display;
	struct wl_registry *wl_registry;
	struct wl_compositor *wl_compositor;
	struct wl_subcompositor *wl_subcompositor;
	struct wl_seat *wl_seat;
	struct wl_output *wl_output;
	struct xdg_wm_base *xdg_wm_base;

	uint32_t wl_display_name;
	uint32_t wl_registry_name;
	uint32_t wl_compositor_name;
	uint32_t wl_subcompositor_name;
	uint32_t wl_seat_name;
	uint32_t wl_output_name;
	uint32_t xdg_wm_base_name;

	/* Objects */
	struct wl_keyboard *wl_keyboard;

	/* State */
	bool closed;
	struct {
		struct surface surface;
		struct xdg_surface *xdg_surface;
		struct xdg_toplevel *xdg_toplevel;
		struct image background_image;
		struct color background_color;
		struct {
			struct surface surface;
			struct wl_subsurface *wl_subsurface;
			struct image image;
		} entry;
		uint32_t scale;
	} window;

	/* Keyboard state */
	struct xkb_state *xkb_state;
	struct xkb_context *xkb_context;
	struct xkb_keymap *xkb_keymap;
};

#endif /* CLIENT_H */