summaryrefslogtreecommitdiffstats
path: root/include/client
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-11-19 07:58:57 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-11-19 07:58:57 -0500
commitb4e5e1381f909b173a171fb3941610aec989df48 (patch)
treef7dcf63dc6f4ac05c8fbb86da37d52766f210130 /include/client
parentFix background extensions (diff)
downloadsway-b4e5e1381f909b173a171fb3941610aec989df48.tar.gz
sway-b4e5e1381f909b173a171fb3941610aec989df48.tar.zst
sway-b4e5e1381f909b173a171fb3941610aec989df48.zip
Refactor the crap out of wayland clients
And create a background surface on every output when invoking swaybg.
Diffstat (limited to 'include/client')
-rw-r--r--include/client/buffer.h4
-rw-r--r--include/client/registry.h28
-rw-r--r--include/client/window.h (renamed from include/client/client.h)26
3 files changed, 37 insertions, 21 deletions
diff --git a/include/client/buffer.h b/include/client/buffer.h
index aa8d68a1..eb9973ed 100644
--- a/include/client/buffer.h
+++ b/include/client/buffer.h
@@ -1,8 +1,8 @@
1#ifndef _BUFFER_H 1#ifndef _BUFFER_H
2#define _BUFFER_H 2#define _BUFFER_H
3 3
4#include "client/client.h" 4#include "client/window.h"
5 5
6struct buffer *get_next_buffer(struct client_state *state); 6struct buffer *get_next_buffer(struct window *state);
7 7
8#endif 8#endif
diff --git a/include/client/registry.h b/include/client/registry.h
new file mode 100644
index 00000000..68a9bc02
--- /dev/null
+++ b/include/client/registry.h
@@ -0,0 +1,28 @@
1#ifndef _SWAY_CLIENT_REGISTRY_H
2#define _SWAY_CLIENT_REGISTRY_H
3
4#include <wayland-client.h>
5#include "wayland-desktop-shell-client-protocol.h"
6#include "list.h"
7
8struct output_state {
9 struct wl_output *output;
10 uint32_t flags;
11 uint32_t width, height;
12};
13
14struct registry {
15 struct wl_compositor *compositor;
16 struct wl_display *display;
17 struct wl_pointer *pointer;
18 struct wl_seat *seat;
19 struct wl_shell *shell;
20 struct wl_shm *shm;
21 struct desktop_shell *desktop_shell;
22 list_t *outputs;
23};
24
25struct registry *registry_poll(void);
26void registry_teardown(struct registry *registry);
27
28#endif
diff --git a/include/client/client.h b/include/client/window.h
index 30ec25c0..af954003 100644
--- a/include/client/client.h
+++ b/include/client/window.h
@@ -7,12 +7,7 @@
7#include <pango/pangocairo.h> 7#include <pango/pangocairo.h>
8#include <stdbool.h> 8#include <stdbool.h>
9#include "list.h" 9#include "list.h"
10 10#include "client/registry.h"
11struct output_state {
12 struct wl_output *output;
13 uint32_t flags;
14 uint32_t width, height;
15};
16 11
17struct buffer { 12struct buffer {
18 struct wl_buffer *buffer; 13 struct wl_buffer *buffer;
@@ -30,28 +25,21 @@ struct cursor {
30 struct wl_poitner *pointer; 25 struct wl_poitner *pointer;
31}; 26};
32 27
33struct client_state { 28struct window {
34 struct wl_compositor *compositor; 29 struct registry *registry;
35 struct wl_display *display;
36 struct wl_pointer *pointer;
37 struct wl_seat *seat;
38 struct wl_shell *shell;
39 struct wl_shm *shm;
40 struct buffer buffers[2]; 30 struct buffer buffers[2];
41 struct buffer *buffer; 31 struct buffer *buffer;
42 struct wl_surface *surface; 32 struct wl_surface *surface;
43 struct wl_shell_surface *shell_surface; 33 struct wl_shell_surface *shell_surface;
44 struct wl_callback *frame_cb; 34 struct wl_callback *frame_cb;
45 struct desktop_shell *desktop_shell;
46 struct cursor cursor; 35 struct cursor cursor;
47 uint32_t width, height; 36 uint32_t width, height;
48 cairo_t *cairo; 37 cairo_t *cairo;
49 list_t *outputs;
50}; 38};
51 39
52struct client_state *client_setup(uint32_t width, uint32_t height, bool shell_surface); 40struct window *window_setup(struct registry *registry, uint32_t width, uint32_t height, bool shell_surface);
53void client_teardown(struct client_state *state); 41void window_teardown(struct window *state);
54int client_prerender(struct client_state *state); 42int window_prerender(struct window *state);
55int client_render(struct client_state *state); 43int window_render(struct window *state);
56 44
57#endif 45#endif