diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-07-25 21:57:19 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-08-01 22:47:54 -0400 |
commit | 88bc4b528ef3e1af3598b513dd5c1572dd09ec23 (patch) | |
tree | 535543a1e5bc6d59c96af249f3d3c9953a68a2aa /include | |
parent | Arrange output in arrange_layers and commit dirty (diff) | |
download | sway-88bc4b528ef3e1af3598b513dd5c1572dd09ec23.tar.gz sway-88bc4b528ef3e1af3598b513dd5c1572dd09ec23.tar.zst sway-88bc4b528ef3e1af3598b513dd5c1572dd09ec23.zip |
Implements swaynagbar
Diffstat (limited to 'include')
-rw-r--r-- | include/swaynagbar/nagbar.h | 88 | ||||
-rw-r--r-- | include/swaynagbar/render.h | 6 |
2 files changed, 94 insertions, 0 deletions
diff --git a/include/swaynagbar/nagbar.h b/include/swaynagbar/nagbar.h new file mode 100644 index 00000000..07a0d51e --- /dev/null +++ b/include/swaynagbar/nagbar.h | |||
@@ -0,0 +1,88 @@ | |||
1 | #ifndef _SWAY_NAGBAR_NAGBAR_H | ||
2 | #define _SWAY_NAGBAR_NAGNAR_H | ||
3 | #include <stdint.h> | ||
4 | #include "list.h" | ||
5 | #include "pool-buffer.h" | ||
6 | #include "xdg-output-unstable-v1-client-protocol.h" | ||
7 | |||
8 | #define NAGBAR_BAR_BORDER_THICKNESS 2 | ||
9 | #define NAGBAR_MESSAGE_PADDING 8 | ||
10 | #define NAGBAR_BUTTON_BORDER_THICKNESS 3 | ||
11 | #define NAGBAR_BUTTON_GAP 20 | ||
12 | #define NAGBAR_BUTTON_GAP_CLOSE 15 | ||
13 | #define NAGBAR_BUTTON_MARGIN_RIGHT 2 | ||
14 | #define NAGBAR_BUTTON_PADDING 3 | ||
15 | |||
16 | enum sway_nagbar_type { | ||
17 | NAGBAR_ERROR, | ||
18 | NAGBAR_WARNING, | ||
19 | }; | ||
20 | |||
21 | struct sway_nagbar_colors { | ||
22 | uint32_t button_background; | ||
23 | uint32_t background; | ||
24 | uint32_t text; | ||
25 | uint32_t border; | ||
26 | uint32_t border_bottom; | ||
27 | }; | ||
28 | |||
29 | struct sway_nagbar_pointer { | ||
30 | struct wl_pointer *pointer; | ||
31 | struct wl_cursor_theme *cursor_theme; | ||
32 | struct wl_cursor_image *cursor_image; | ||
33 | struct wl_surface *cursor_surface; | ||
34 | int x; | ||
35 | int y; | ||
36 | }; | ||
37 | |||
38 | struct sway_nagbar_output { | ||
39 | char *name; | ||
40 | struct wl_output *wl_output; | ||
41 | uint32_t wl_name; | ||
42 | }; | ||
43 | |||
44 | struct sway_nagbar_button { | ||
45 | char *text; | ||
46 | char *action; | ||
47 | int x; | ||
48 | int y; | ||
49 | int width; | ||
50 | int height; | ||
51 | }; | ||
52 | |||
53 | struct sway_nagbar { | ||
54 | bool run_display; | ||
55 | int querying_outputs; | ||
56 | |||
57 | struct wl_display *display; | ||
58 | struct wl_compositor *compositor; | ||
59 | struct wl_seat *seat; | ||
60 | struct wl_shm *shm; | ||
61 | struct sway_nagbar_pointer pointer; | ||
62 | struct zxdg_output_manager_v1 *xdg_output_manager; | ||
63 | struct sway_nagbar_output output; | ||
64 | struct zwlr_layer_shell_v1 *layer_shell; | ||
65 | struct zwlr_layer_surface_v1 *layer_surface; | ||
66 | struct wl_surface *surface; | ||
67 | |||
68 | uint32_t width; | ||
69 | uint32_t height; | ||
70 | int32_t scale; | ||
71 | struct pool_buffer buffers[2]; | ||
72 | struct pool_buffer *current_buffer; | ||
73 | |||
74 | enum sway_nagbar_type type; | ||
75 | struct sway_nagbar_colors colors; | ||
76 | uint32_t anchors; | ||
77 | char *message; | ||
78 | char *font; | ||
79 | list_t *buttons; | ||
80 | }; | ||
81 | |||
82 | void nagbar_setup(struct sway_nagbar *nagbar); | ||
83 | |||
84 | void nagbar_run(struct sway_nagbar *nagbar); | ||
85 | |||
86 | void nagbar_destroy(struct sway_nagbar *nagbar); | ||
87 | |||
88 | #endif | ||
diff --git a/include/swaynagbar/render.h b/include/swaynagbar/render.h new file mode 100644 index 00000000..d9429f7f --- /dev/null +++ b/include/swaynagbar/render.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _SWAY_NAGBAR_RENDER_H | ||
2 | #define _SWAY_NAGBAR_RENDER_H | ||
3 | |||
4 | void render_frame(struct sway_nagbar *nagbar); | ||
5 | |||
6 | #endif | ||