diff options
Diffstat (limited to 'include/swaynag/swaynag.h')
-rw-r--r-- | include/swaynag/swaynag.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/include/swaynag/swaynag.h b/include/swaynag/swaynag.h new file mode 100644 index 00000000..1bf8b640 --- /dev/null +++ b/include/swaynag/swaynag.h | |||
@@ -0,0 +1,100 @@ | |||
1 | #ifndef _SWAYNAG_SWAYNAG_H | ||
2 | #define _SWAYNAG_SWAYNAG_H | ||
3 | #include <stdint.h> | ||
4 | #include <strings.h> | ||
5 | #include "list.h" | ||
6 | #include "pool-buffer.h" | ||
7 | #include "swaynag/types.h" | ||
8 | #include "xdg-output-unstable-v1-client-protocol.h" | ||
9 | |||
10 | #define SWAYNAG_MAX_HEIGHT 500 | ||
11 | |||
12 | struct swaynag; | ||
13 | |||
14 | enum swaynag_action_type { | ||
15 | SWAYNAG_ACTION_DISMISS, | ||
16 | SWAYNAG_ACTION_EXPAND, | ||
17 | SWAYNAG_ACTION_COMMAND, | ||
18 | }; | ||
19 | |||
20 | struct swaynag_pointer { | ||
21 | struct wl_pointer *pointer; | ||
22 | uint32_t serial; | ||
23 | struct wl_cursor_theme *cursor_theme; | ||
24 | struct wl_cursor_image *cursor_image; | ||
25 | struct wl_surface *cursor_surface; | ||
26 | int x; | ||
27 | int y; | ||
28 | }; | ||
29 | |||
30 | struct swaynag_output { | ||
31 | char *name; | ||
32 | struct wl_output *wl_output; | ||
33 | uint32_t wl_name; | ||
34 | uint32_t scale; | ||
35 | struct swaynag *swaynag; | ||
36 | struct wl_list link; | ||
37 | }; | ||
38 | |||
39 | struct swaynag_button { | ||
40 | char *text; | ||
41 | enum swaynag_action_type type; | ||
42 | char *action; | ||
43 | int x; | ||
44 | int y; | ||
45 | int width; | ||
46 | int height; | ||
47 | }; | ||
48 | |||
49 | struct swaynag_details { | ||
50 | bool visible; | ||
51 | char *message; | ||
52 | |||
53 | int x; | ||
54 | int y; | ||
55 | int width; | ||
56 | int height; | ||
57 | |||
58 | int offset; | ||
59 | int visible_lines; | ||
60 | int total_lines; | ||
61 | struct swaynag_button button_details; | ||
62 | struct swaynag_button button_up; | ||
63 | struct swaynag_button button_down; | ||
64 | }; | ||
65 | |||
66 | struct swaynag { | ||
67 | bool run_display; | ||
68 | int querying_outputs; | ||
69 | |||
70 | struct wl_display *display; | ||
71 | struct wl_compositor *compositor; | ||
72 | struct wl_seat *seat; | ||
73 | struct wl_shm *shm; | ||
74 | struct swaynag_pointer pointer; | ||
75 | struct zxdg_output_manager_v1 *xdg_output_manager; | ||
76 | struct wl_list outputs; // swaynag_output::link | ||
77 | struct swaynag_output *output; | ||
78 | struct zwlr_layer_shell_v1 *layer_shell; | ||
79 | struct zwlr_layer_surface_v1 *layer_surface; | ||
80 | struct wl_surface *surface; | ||
81 | |||
82 | uint32_t width; | ||
83 | uint32_t height; | ||
84 | int32_t scale; | ||
85 | struct pool_buffer buffers[2]; | ||
86 | struct pool_buffer *current_buffer; | ||
87 | |||
88 | struct swaynag_type *type; | ||
89 | char *message; | ||
90 | list_t *buttons; | ||
91 | struct swaynag_details details; | ||
92 | }; | ||
93 | |||
94 | void swaynag_setup(struct swaynag *swaynag); | ||
95 | |||
96 | void swaynag_run(struct swaynag *swaynag); | ||
97 | |||
98 | void swaynag_destroy(struct swaynag *swaynag); | ||
99 | |||
100 | #endif | ||