summaryrefslogtreecommitdiffstats
path: root/include/client
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-11-18 08:22:37 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-11-18 08:22:53 -0500
commit399220f14bc60581490936d9f1a0fd353bfc9ef5 (patch)
treeec086840b4f340029e775d324279730fda64a9ad /include/client
parentTrack pid of child process from exec (diff)
downloadsway-399220f14bc60581490936d9f1a0fd353bfc9ef5.tar.gz
sway-399220f14bc60581490936d9f1a0fd353bfc9ef5.tar.zst
sway-399220f14bc60581490936d9f1a0fd353bfc9ef5.zip
Fix up wayland client implementation
Now it receives frame callbacks and renders properly, and is double buffered and such.
Diffstat (limited to 'include/client')
-rw-r--r--include/client/buffer.h8
-rw-r--r--include/client/client.h47
2 files changed, 55 insertions, 0 deletions
diff --git a/include/client/buffer.h b/include/client/buffer.h
new file mode 100644
index 00000000..aa8d68a1
--- /dev/null
+++ b/include/client/buffer.h
@@ -0,0 +1,8 @@
1#ifndef _BUFFER_H
2#define _BUFFER_H
3
4#include "client/client.h"
5
6struct buffer *get_next_buffer(struct client_state *state);
7
8#endif
diff --git a/include/client/client.h b/include/client/client.h
new file mode 100644
index 00000000..bac2c1a6
--- /dev/null
+++ b/include/client/client.h
@@ -0,0 +1,47 @@
1#ifndef _CLIENT_H
2#define _CLIENT_H
3
4#include <wayland-client.h>
5#include <cairo/cairo.h>
6#include <pango/pangocairo.h>
7#include <stdbool.h>
8#include "list.h"
9
10struct output_state {
11 struct wl_output *output;
12 uint32_t flags;
13 uint32_t width, height;
14};
15
16struct buffer {
17 struct wl_buffer *buffer;
18 cairo_surface_t *surface;
19 cairo_t *cairo;
20 PangoContext *pango;
21 uint32_t width, height;
22 bool busy;
23};
24
25struct client_state {
26 struct wl_compositor *compositor;
27 struct wl_display *display;
28 struct wl_pointer *pointer;
29 struct wl_seat *seat;
30 struct wl_shell *shell;
31 struct wl_shm *shm;
32 struct buffer buffers[2];
33 struct buffer *buffer;
34 struct wl_surface *surface;
35 struct wl_shell_surface *shell_surface;
36 struct wl_callback *frame_cb;
37 uint32_t width, height;
38 cairo_t *cairo;
39 list_t *outputs;
40};
41
42struct client_state *client_setup(uint32_t width, uint32_t height);
43void client_teardown(struct client_state *state);
44int client_prerender(struct client_state *state);
45int client_render(struct client_state *state);
46
47#endif