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