aboutsummaryrefslogtreecommitdiff
path: root/include/swaynag
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2018-07-28 23:15:12 -0400
committerBrian Ashworth <bosrsf04@gmail.com>2018-08-01 22:47:54 -0400
commita6145914c60351d8e541192c7fe35556f8e02507 (patch)
tree8bb5cacc6e91ed4483c8a4fd0b903aacb76abf15 /include/swaynag
parent6124d0f9a202ba2f39125602a35bb47d3742022b (diff)
swaynag: refactor {sway_,}nagbar to swaynag
Diffstat (limited to 'include/swaynag')
-rw-r--r--include/swaynag/config.h12
-rw-r--r--include/swaynag/render.h7
-rw-r--r--include/swaynag/swaynag.h (renamed from include/swaynag/nagbar.h)66
-rw-r--r--include/swaynag/types.h18
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 @@
-#ifndef _SWAY_NAGBAR_CONFIG_H
-#define _SWAY_NAGBAR_CONFIG_H
-#include "swaynag/nagbar.h"
+#ifndef _SWAYNAG_CONFIG_H
+#define _SWAYNAG_CONFIG_H
+#include "swaynag/swaynag.h"
#include "list.h"
-int nagbar_parse_options(int argc, char **argv, struct sway_nagbar *nagbar,
+int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
list_t *types, char **config, bool *debug);
-char *nagbar_get_config_path(void);
+char *swaynag_get_config_path(void);
-int nagbar_load_config(char *path, struct sway_nagbar *nagbar, list_t *types);
+int swaynag_load_config(char *path, struct swaynag *swaynag, list_t *types);
#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 @@
-#ifndef _SWAY_NAGBAR_RENDER_H
-#define _SWAY_NAGBAR_RENDER_H
+#ifndef _SWAYNAG_RENDER_H
+#define _SWAYNAG_RENDER_H
+#include "swaynag/swaynag.h"
-void render_frame(struct sway_nagbar *nagbar);
+void render_frame(struct swaynag *swaynag);
#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 @@
-#ifndef _SWAY_NAGBAR_NAGBAR_H
-#define _SWAY_NAGBAR_NAGBAR_H
+#ifndef _SWAYNAG_SWAYNAG_H
+#define _SWAYNAG_SWAYNAG_H
#include <stdint.h>
#include <strings.h>
#include "list.h"
@@ -7,24 +7,24 @@
#include "swaynag/types.h"
#include "xdg-output-unstable-v1-client-protocol.h"
-#define NAGBAR_BAR_BORDER_THICKNESS 2
-#define NAGBAR_MESSAGE_PADDING 8
-#define NAGBAR_DETAILS_BORDER_THICKNESS 3
-#define NAGBAR_BUTTON_BORDER_THICKNESS 3
-#define NAGBAR_BUTTON_GAP 20
-#define NAGBAR_BUTTON_GAP_CLOSE 15
-#define NAGBAR_BUTTON_MARGIN_RIGHT 2
-#define NAGBAR_BUTTON_PADDING 3
-
-#define NAGBAR_MAX_HEIGHT 500
-
-enum sway_nagbar_action_type {
- NAGBAR_ACTION_DISMISS,
- NAGBAR_ACTION_EXPAND,
- NAGBAR_ACTION_COMMAND,
+#define SWAYNAG_BAR_BORDER_THICKNESS 2
+#define SWAYNAG_MESSAGE_PADDING 8
+#define SWAYNAG_DETAILS_BORDER_THICKNESS 3
+#define SWAYNAG_BUTTON_BORDER_THICKNESS 3
+#define SWAYNAG_BUTTON_GAP 20
+#define SWAYNAG_BUTTON_GAP_CLOSE 15
+#define SWAYNAG_BUTTON_MARGIN_RIGHT 2
+#define SWAYNAG_BUTTON_PADDING 3
+
+#define SWAYNAG_MAX_HEIGHT 500
+
+enum swaynag_action_type {
+ SWAYNAG_ACTION_DISMISS,
+ SWAYNAG_ACTION_EXPAND,
+ SWAYNAG_ACTION_COMMAND,
};
-struct sway_nagbar_pointer {
+struct swaynag_pointer {
struct wl_pointer *pointer;
struct wl_cursor_theme *cursor_theme;
struct wl_cursor_image *cursor_image;
@@ -33,15 +33,15 @@ struct sway_nagbar_pointer {
int y;
};
-struct sway_nagbar_output {
+struct swaynag_output {
char *name;
struct wl_output *wl_output;
uint32_t wl_name;
};
-struct sway_nagbar_button {
+struct swaynag_button {
char *text;
- enum sway_nagbar_action_type type;
+ enum swaynag_action_type type;
char *action;
int x;
int y;
@@ -49,7 +49,7 @@ struct sway_nagbar_button {
int height;
};
-struct sway_nagbar_details {
+struct swaynag_details {
bool visible;
char *message;
@@ -61,12 +61,12 @@ struct sway_nagbar_details {
int offset;
int visible_lines;
int total_lines;
- struct sway_nagbar_button button_details;
- struct sway_nagbar_button button_up;
- struct sway_nagbar_button button_down;
+ struct swaynag_button button_details;
+ struct swaynag_button button_up;
+ struct swaynag_button button_down;
};
-struct sway_nagbar {
+struct swaynag {
bool run_display;
int querying_outputs;
@@ -74,9 +74,9 @@ struct sway_nagbar {
struct wl_compositor *compositor;
struct wl_seat *seat;
struct wl_shm *shm;
- struct sway_nagbar_pointer pointer;
+ struct swaynag_pointer pointer;
struct zxdg_output_manager_v1 *xdg_output_manager;
- struct sway_nagbar_output output;
+ struct swaynag_output output;
struct zwlr_layer_shell_v1 *layer_shell;
struct zwlr_layer_surface_v1 *layer_surface;
struct wl_surface *surface;
@@ -87,18 +87,18 @@ struct sway_nagbar {
struct pool_buffer buffers[2];
struct pool_buffer *current_buffer;
- struct sway_nagbar_type *type;
+ struct swaynag_type *type;
uint32_t anchors;
char *message;
char *font;
list_t *buttons;
- struct sway_nagbar_details details;
+ struct swaynag_details details;
};
-void nagbar_setup(struct sway_nagbar *nagbar);
+void swaynag_setup(struct swaynag *swaynag);
-void nagbar_run(struct sway_nagbar *nagbar);
+void swaynag_run(struct swaynag *swaynag);
-void nagbar_destroy(struct sway_nagbar *nagbar);
+void swaynag_destroy(struct swaynag *swaynag);
#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 @@
-#ifndef _SWAY_NAGBAR_TYPES_H
-#define _SWAY_NAGBAR_TYPES_H
+#ifndef _SWAYNAG_TYPES_H
+#define _SWAYNAG_TYPES_H
-struct sway_nagbar_type {
+struct swaynag_type {
char *name;
uint32_t button_background;
uint32_t background;
@@ -10,16 +10,16 @@ struct sway_nagbar_type {
uint32_t border_bottom;
};
-void nagbar_types_add_default(list_t *types);
+void swaynag_types_add_default(list_t *types);
-struct sway_nagbar_type *nagbar_type_get(list_t *types, char *name);
+struct swaynag_type *swaynag_type_get(list_t *types, char *name);
-struct sway_nagbar_type *nagbar_type_clone(struct sway_nagbar_type *type);
+struct swaynag_type *swaynag_type_clone(struct swaynag_type *type);
-void nagbar_type_free(struct sway_nagbar_type *type);
+void swaynag_type_free(struct swaynag_type *type);
-void nagbar_types_free(list_t *types);
+void swaynag_types_free(list_t *types);
-int nagbar_parse_type(int argc, char **argv, struct sway_nagbar_type *type);
+int swaynag_parse_type(int argc, char **argv, struct swaynag_type *type);
#endif