diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-07-28 23:15:12 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-08-01 22:47:54 -0400 |
commit | a6145914c60351d8e541192c7fe35556f8e02507 (patch) | |
tree | 8bb5cacc6e91ed4483c8a4fd0b903aacb76abf15 /include/swaynag | |
parent | swaynag: split config into own file and fix optind (diff) | |
download | sway-a6145914c60351d8e541192c7fe35556f8e02507.tar.gz sway-a6145914c60351d8e541192c7fe35556f8e02507.tar.zst sway-a6145914c60351d8e541192c7fe35556f8e02507.zip |
swaynag: refactor {sway_,}nagbar to swaynag
Diffstat (limited to 'include/swaynag')
-rw-r--r-- | include/swaynag/config.h | 12 | ||||
-rw-r--r-- | include/swaynag/render.h | 7 | ||||
-rw-r--r-- | include/swaynag/swaynag.h (renamed from include/swaynag/nagbar.h) | 66 | ||||
-rw-r--r-- | include/swaynag/types.h | 18 |
4 files changed, 52 insertions, 51 deletions
diff --git a/include/swaynag/config.h b/include/swaynag/config.h index caa32710..3fd5b3ce 100644 --- a/include/swaynag/config.h +++ b/include/swaynag/config.h | |||
@@ -1,13 +1,13 @@ | |||
1 | #ifndef _SWAY_NAGBAR_CONFIG_H | 1 | #ifndef _SWAYNAG_CONFIG_H |
2 | #define _SWAY_NAGBAR_CONFIG_H | 2 | #define _SWAYNAG_CONFIG_H |
3 | #include "swaynag/nagbar.h" | 3 | #include "swaynag/swaynag.h" |
4 | #include "list.h" | 4 | #include "list.h" |
5 | 5 | ||
6 | int nagbar_parse_options(int argc, char **argv, struct sway_nagbar *nagbar, | 6 | int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag, |
7 | list_t *types, char **config, bool *debug); | 7 | list_t *types, char **config, bool *debug); |
8 | 8 | ||
9 | char *nagbar_get_config_path(void); | 9 | char *swaynag_get_config_path(void); |
10 | 10 | ||
11 | int nagbar_load_config(char *path, struct sway_nagbar *nagbar, list_t *types); | 11 | int swaynag_load_config(char *path, struct swaynag *swaynag, list_t *types); |
12 | 12 | ||
13 | #endif | 13 | #endif |
diff --git a/include/swaynag/render.h b/include/swaynag/render.h index d9429f7f..d09e5929 100644 --- a/include/swaynag/render.h +++ b/include/swaynag/render.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _SWAY_NAGBAR_RENDER_H | 1 | #ifndef _SWAYNAG_RENDER_H |
2 | #define _SWAY_NAGBAR_RENDER_H | 2 | #define _SWAYNAG_RENDER_H |
3 | #include "swaynag/swaynag.h" | ||
3 | 4 | ||
4 | void render_frame(struct sway_nagbar *nagbar); | 5 | void render_frame(struct swaynag *swaynag); |
5 | 6 | ||
6 | #endif | 7 | #endif |
diff --git a/include/swaynag/nagbar.h b/include/swaynag/swaynag.h index 4ef101e9..6a56f14f 100644 --- a/include/swaynag/nagbar.h +++ b/include/swaynag/swaynag.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _SWAY_NAGBAR_NAGBAR_H | 1 | #ifndef _SWAYNAG_SWAYNAG_H |
2 | #define _SWAY_NAGBAR_NAGBAR_H | 2 | #define _SWAYNAG_SWAYNAG_H |
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include <strings.h> | 4 | #include <strings.h> |
5 | #include "list.h" | 5 | #include "list.h" |
@@ -7,24 +7,24 @@ | |||
7 | #include "swaynag/types.h" | 7 | #include "swaynag/types.h" |
8 | #include "xdg-output-unstable-v1-client-protocol.h" | 8 | #include "xdg-output-unstable-v1-client-protocol.h" |
9 | 9 | ||
10 | #define NAGBAR_BAR_BORDER_THICKNESS 2 | 10 | #define SWAYNAG_BAR_BORDER_THICKNESS 2 |
11 | #define NAGBAR_MESSAGE_PADDING 8 | 11 | #define SWAYNAG_MESSAGE_PADDING 8 |
12 | #define NAGBAR_DETAILS_BORDER_THICKNESS 3 | 12 | #define SWAYNAG_DETAILS_BORDER_THICKNESS 3 |
13 | #define NAGBAR_BUTTON_BORDER_THICKNESS 3 | 13 | #define SWAYNAG_BUTTON_BORDER_THICKNESS 3 |
14 | #define NAGBAR_BUTTON_GAP 20 | 14 | #define SWAYNAG_BUTTON_GAP 20 |
15 | #define NAGBAR_BUTTON_GAP_CLOSE 15 | 15 | #define SWAYNAG_BUTTON_GAP_CLOSE 15 |
16 | #define NAGBAR_BUTTON_MARGIN_RIGHT 2 | 16 | #define SWAYNAG_BUTTON_MARGIN_RIGHT 2 |
17 | #define NAGBAR_BUTTON_PADDING 3 | 17 | #define SWAYNAG_BUTTON_PADDING 3 |
18 | 18 | ||
19 | #define NAGBAR_MAX_HEIGHT 500 | 19 | #define SWAYNAG_MAX_HEIGHT 500 |
20 | 20 | ||
21 | enum sway_nagbar_action_type { | 21 | enum swaynag_action_type { |
22 | NAGBAR_ACTION_DISMISS, | 22 | SWAYNAG_ACTION_DISMISS, |
23 | NAGBAR_ACTION_EXPAND, | 23 | SWAYNAG_ACTION_EXPAND, |
24 | NAGBAR_ACTION_COMMAND, | 24 | SWAYNAG_ACTION_COMMAND, |
25 | }; | 25 | }; |
26 | 26 | ||
27 | struct sway_nagbar_pointer { | 27 | struct swaynag_pointer { |
28 | struct wl_pointer *pointer; | 28 | struct wl_pointer *pointer; |
29 | struct wl_cursor_theme *cursor_theme; | 29 | struct wl_cursor_theme *cursor_theme; |
30 | struct wl_cursor_image *cursor_image; | 30 | struct wl_cursor_image *cursor_image; |
@@ -33,15 +33,15 @@ struct sway_nagbar_pointer { | |||
33 | int y; | 33 | int y; |
34 | }; | 34 | }; |
35 | 35 | ||
36 | struct sway_nagbar_output { | 36 | struct swaynag_output { |
37 | char *name; | 37 | char *name; |
38 | struct wl_output *wl_output; | 38 | struct wl_output *wl_output; |
39 | uint32_t wl_name; | 39 | uint32_t wl_name; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct sway_nagbar_button { | 42 | struct swaynag_button { |
43 | char *text; | 43 | char *text; |
44 | enum sway_nagbar_action_type type; | 44 | enum swaynag_action_type type; |
45 | char *action; | 45 | char *action; |
46 | int x; | 46 | int x; |
47 | int y; | 47 | int y; |
@@ -49,7 +49,7 @@ struct sway_nagbar_button { | |||
49 | int height; | 49 | int height; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | struct sway_nagbar_details { | 52 | struct swaynag_details { |
53 | bool visible; | 53 | bool visible; |
54 | char *message; | 54 | char *message; |
55 | 55 | ||
@@ -61,12 +61,12 @@ struct sway_nagbar_details { | |||
61 | int offset; | 61 | int offset; |
62 | int visible_lines; | 62 | int visible_lines; |
63 | int total_lines; | 63 | int total_lines; |
64 | struct sway_nagbar_button button_details; | 64 | struct swaynag_button button_details; |
65 | struct sway_nagbar_button button_up; | 65 | struct swaynag_button button_up; |
66 | struct sway_nagbar_button button_down; | 66 | struct swaynag_button button_down; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | struct sway_nagbar { | 69 | struct swaynag { |
70 | bool run_display; | 70 | bool run_display; |
71 | int querying_outputs; | 71 | int querying_outputs; |
72 | 72 | ||
@@ -74,9 +74,9 @@ struct sway_nagbar { | |||
74 | struct wl_compositor *compositor; | 74 | struct wl_compositor *compositor; |
75 | struct wl_seat *seat; | 75 | struct wl_seat *seat; |
76 | struct wl_shm *shm; | 76 | struct wl_shm *shm; |
77 | struct sway_nagbar_pointer pointer; | 77 | struct swaynag_pointer pointer; |
78 | struct zxdg_output_manager_v1 *xdg_output_manager; | 78 | struct zxdg_output_manager_v1 *xdg_output_manager; |
79 | struct sway_nagbar_output output; | 79 | struct swaynag_output output; |
80 | struct zwlr_layer_shell_v1 *layer_shell; | 80 | struct zwlr_layer_shell_v1 *layer_shell; |
81 | struct zwlr_layer_surface_v1 *layer_surface; | 81 | struct zwlr_layer_surface_v1 *layer_surface; |
82 | struct wl_surface *surface; | 82 | struct wl_surface *surface; |
@@ -87,18 +87,18 @@ struct sway_nagbar { | |||
87 | struct pool_buffer buffers[2]; | 87 | struct pool_buffer buffers[2]; |
88 | struct pool_buffer *current_buffer; | 88 | struct pool_buffer *current_buffer; |
89 | 89 | ||
90 | struct sway_nagbar_type *type; | 90 | struct swaynag_type *type; |
91 | uint32_t anchors; | 91 | uint32_t anchors; |
92 | char *message; | 92 | char *message; |
93 | char *font; | 93 | char *font; |
94 | list_t *buttons; | 94 | list_t *buttons; |
95 | struct sway_nagbar_details details; | 95 | struct swaynag_details details; |
96 | }; | 96 | }; |
97 | 97 | ||
98 | void nagbar_setup(struct sway_nagbar *nagbar); | 98 | void swaynag_setup(struct swaynag *swaynag); |
99 | 99 | ||
100 | void nagbar_run(struct sway_nagbar *nagbar); | 100 | void swaynag_run(struct swaynag *swaynag); |
101 | 101 | ||
102 | void nagbar_destroy(struct sway_nagbar *nagbar); | 102 | void swaynag_destroy(struct swaynag *swaynag); |
103 | 103 | ||
104 | #endif | 104 | #endif |
diff --git a/include/swaynag/types.h b/include/swaynag/types.h index 32056514..af83bd83 100644 --- a/include/swaynag/types.h +++ b/include/swaynag/types.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _SWAY_NAGBAR_TYPES_H | 1 | #ifndef _SWAYNAG_TYPES_H |
2 | #define _SWAY_NAGBAR_TYPES_H | 2 | #define _SWAYNAG_TYPES_H |
3 | 3 | ||
4 | struct sway_nagbar_type { | 4 | struct swaynag_type { |
5 | char *name; | 5 | char *name; |
6 | uint32_t button_background; | 6 | uint32_t button_background; |
7 | uint32_t background; | 7 | uint32_t background; |
@@ -10,16 +10,16 @@ struct sway_nagbar_type { | |||
10 | uint32_t border_bottom; | 10 | uint32_t border_bottom; |
11 | }; | 11 | }; |
12 | 12 | ||
13 | void nagbar_types_add_default(list_t *types); | 13 | void swaynag_types_add_default(list_t *types); |
14 | 14 | ||
15 | struct sway_nagbar_type *nagbar_type_get(list_t *types, char *name); | 15 | struct swaynag_type *swaynag_type_get(list_t *types, char *name); |
16 | 16 | ||
17 | struct sway_nagbar_type *nagbar_type_clone(struct sway_nagbar_type *type); | 17 | struct swaynag_type *swaynag_type_clone(struct swaynag_type *type); |
18 | 18 | ||
19 | void nagbar_type_free(struct sway_nagbar_type *type); | 19 | void swaynag_type_free(struct swaynag_type *type); |
20 | 20 | ||
21 | void nagbar_types_free(list_t *types); | 21 | void swaynag_types_free(list_t *types); |
22 | 22 | ||
23 | int nagbar_parse_type(int argc, char **argv, struct sway_nagbar_type *type); | 23 | int swaynag_parse_type(int argc, char **argv, struct swaynag_type *type); |
24 | 24 | ||
25 | #endif | 25 | #endif |