summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/cairo.h2
-rw-r--r--include/pango.h14
-rw-r--r--include/sway/commands.h12
-rw-r--r--include/sway/config.h28
-rw-r--r--include/sway/debug.h2
-rw-r--r--include/sway/ipc-json.h2
-rw-r--r--include/sway/tree/container.h3
-rw-r--r--include/sway/tree/workspace.h9
-rw-r--r--include/swaybar/bar.h8
-rw-r--r--include/swaybar/config.h2
-rw-r--r--include/swaybar/i3bar.h34
-rw-r--r--include/swaybar/ipc.h2
-rw-r--r--include/swaybar/render.h4
-rw-r--r--include/swaybar/status_line.h26
-rw-r--r--include/swaybar/tray/dbus.h18
-rw-r--r--include/swaybar/tray/sni_watcher.h10
-rw-r--r--include/swaybar/tray/tray.h32
-rw-r--r--include/swaylock/swaylock.h4
18 files changed, 82 insertions, 130 deletions
diff --git a/include/cairo.h b/include/cairo.h
index 31672705..86530b60 100644
--- a/include/cairo.h
+++ b/include/cairo.h
@@ -2,8 +2,10 @@
2#define _SWAY_CAIRO_H 2#define _SWAY_CAIRO_H
3#include <stdint.h> 3#include <stdint.h>
4#include <cairo/cairo.h> 4#include <cairo/cairo.h>
5#include <wlr/types/wlr_output.h>
5 6
6void cairo_set_source_u32(cairo_t *cairo, uint32_t color); 7void cairo_set_source_u32(cairo_t *cairo, uint32_t color);
8cairo_subpixel_order_t to_cairo_subpixel_order(enum wl_output_subpixel subpixel);
7 9
8cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image, 10cairo_surface_t *cairo_image_surface_scale(cairo_surface_t *image,
9 int width, int height); 11 int width, int height);
diff --git a/include/pango.h b/include/pango.h
index 09a535a5..6ab83c16 100644
--- a/include/pango.h
+++ b/include/pango.h
@@ -6,17 +6,13 @@
6#include <cairo/cairo.h> 6#include <cairo/cairo.h>
7#include <pango/pangocairo.h> 7#include <pango/pangocairo.h>
8 8
9/* Utility function which escape characters a & < > ' ". 9/**
10 * Utility function which escape characters a & < > ' ".
10 * 11 *
11 * If the dest parameter is NULL, then the function returns the length of 12 * The function returns the length of the escaped string, optionally writing the
12 * of the escaped src string. The dest_length doesn't matter. 13 * escaped string to dest if provided.
13 *
14 * If the dest parameter is not NULL then the fuction escapes the src string
15 * an puts the escaped string in dest and returns the lenght of the escaped string.
16 * The dest_length parameter is the size of dest array. If the size of dest is not
17 * enough, then the function returns -1.
18 */ 14 */
19int escape_markup_text(const char *src, char *dest, int dest_length); 15size_t escape_markup_text(const char *src, char *dest);
20PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, 16PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
21 const char *text, double scale, bool markup); 17 const char *text, double scale, bool markup);
22void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, 18void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
diff --git a/include/sway/commands.h b/include/sway/commands.h
index 226cf932..afa65340 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -4,6 +4,8 @@
4#include <wlr/util/edges.h> 4#include <wlr/util/edges.h>
5#include "config.h" 5#include "config.h"
6 6
7struct sway_container;
8
7typedef struct cmd_results *sway_cmd(int argc, char **argv); 9typedef struct cmd_results *sway_cmd(int argc, char **argv);
8 10
9struct cmd_handler { 11struct cmd_handler {
@@ -50,8 +52,13 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers,
50 int handlers_size); 52 int handlers_size);
51/** 53/**
52 * Parse and executes a command. 54 * Parse and executes a command.
55 *
56 * If the command string contains criteria then the command will be executed on
57 * all matching containers. Otherwise, it'll run on the `con` container. If
58 * `con` is NULL then it'll run on the currently focused container.
53 */ 59 */
54struct cmd_results *execute_command(char *command, struct sway_seat *seat); 60struct cmd_results *execute_command(char *command, struct sway_seat *seat,
61 struct sway_container *con);
55/** 62/**
56 * Parse and handles a command during config file loading. 63 * Parse and handles a command during config file loading.
57 * 64 *
@@ -88,7 +95,7 @@ struct cmd_results *add_color(const char *name,
88/** 95/**
89 * TODO: Move this function and its dependent functions to container.c. 96 * TODO: Move this function and its dependent functions to container.c.
90 */ 97 */
91void container_resize_tiled(struct sway_container *parent, enum wlr_edges edge, 98bool container_resize_tiled(struct sway_container *parent, enum wlr_edges edge,
92 int amount); 99 int amount);
93 100
94sway_cmd cmd_assign; 101sway_cmd cmd_assign;
@@ -210,6 +217,7 @@ sway_cmd bar_colors_cmd_urgent_workspace;
210sway_cmd input_cmd_seat; 217sway_cmd input_cmd_seat;
211sway_cmd input_cmd_accel_profile; 218sway_cmd input_cmd_accel_profile;
212sway_cmd input_cmd_click_method; 219sway_cmd input_cmd_click_method;
220sway_cmd input_cmd_drag;
213sway_cmd input_cmd_drag_lock; 221sway_cmd input_cmd_drag_lock;
214sway_cmd input_cmd_dwt; 222sway_cmd input_cmd_dwt;
215sway_cmd input_cmd_events; 223sway_cmd input_cmd_events;
diff --git a/include/sway/config.h b/include/sway/config.h
index b53c1f1f..eab48aed 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -93,6 +93,7 @@ struct input_config {
93 93
94 int accel_profile; 94 int accel_profile;
95 int click_method; 95 int click_method;
96 int drag;
96 int drag_lock; 97 int drag_lock;
97 int dwt; 98 int dwt;
98 int left_handed; 99 int left_handed;
@@ -167,13 +168,14 @@ struct output_config {
167}; 168};
168 169
169/** 170/**
170 * Maps a workspace name to an output name. 171 * Stores configuration for a workspace, regardless of whether the workspace
171 * 172 * exists.
172 * Set via `workspace <x> output <y>`
173 */ 173 */
174struct workspace_output { 174struct workspace_config {
175 char *output;
176 char *workspace; 175 char *workspace;
176 char *output;
177 int gaps_inner;
178 int gaps_outer;
177}; 179};
178 180
179struct bar_config { 181struct bar_config {
@@ -327,7 +329,7 @@ struct sway_config {
327 list_t *modes; 329 list_t *modes;
328 list_t *bars; 330 list_t *bars;
329 list_t *cmd_queue; 331 list_t *cmd_queue;
330 list_t *workspace_outputs; 332 list_t *workspace_configs;
331 list_t *output_configs; 333 list_t *output_configs;
332 list_t *input_configs; 334 list_t *input_configs;
333 list_t *seat_configs; 335 list_t *seat_configs;
@@ -450,20 +452,16 @@ void free_sway_variable(struct sway_variable *var);
450 */ 452 */
451char *do_var_replacement(char *str); 453char *do_var_replacement(char *str);
452 454
453struct cmd_results *check_security_config();
454
455int input_identifier_cmp(const void *item, const void *data); 455int input_identifier_cmp(const void *item, const void *data);
456 456
457struct input_config *new_input_config(const char* identifier); 457struct input_config *new_input_config(const char* identifier);
458 458
459void merge_input_config(struct input_config *dst, struct input_config *src); 459void merge_input_config(struct input_config *dst, struct input_config *src);
460 460
461struct input_config *copy_input_config(struct input_config *ic); 461struct input_config *store_input_config(struct input_config *ic);
462 462
463void free_input_config(struct input_config *ic); 463void free_input_config(struct input_config *ic);
464 464
465void apply_input_config(struct input_config *input);
466
467int seat_name_cmp(const void *item, const void *data); 465int seat_name_cmp(const void *item, const void *data);
468 466
469struct seat_config *new_seat_config(const char* name); 467struct seat_config *new_seat_config(const char* name);
@@ -474,7 +472,7 @@ struct seat_config *copy_seat_config(struct seat_config *seat);
474 472
475void free_seat_config(struct seat_config *ic); 473void free_seat_config(struct seat_config *ic);
476 474
477struct seat_attachment_config *seat_attachment_config_new(); 475struct seat_attachment_config *seat_attachment_config_new(void);
478 476
479struct seat_attachment_config *seat_config_get_attachment( 477struct seat_attachment_config *seat_config_get_attachment(
480 struct seat_config *seat_config, char *identifier); 478 struct seat_config *seat_config, char *identifier);
@@ -512,9 +510,7 @@ void free_sway_binding(struct sway_binding *sb);
512 510
513void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding); 511void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding);
514 512
515void load_swaybars(); 513void load_swaybars(void);
516
517void invoke_swaybar(struct bar_config *bar);
518 514
519void terminate_swaybg(pid_t pid); 515void terminate_swaybg(pid_t pid);
520 516
@@ -522,6 +518,8 @@ struct bar_config *default_bar_config(void);
522 518
523void free_bar_config(struct bar_config *bar); 519void free_bar_config(struct bar_config *bar);
524 520
521void free_workspace_config(struct workspace_config *wsc);
522
525/** 523/**
526 * Updates the value of config->font_height based on the max title height 524 * Updates the value of config->font_height based on the max title height
527 * reported by each container. If recalculate is true, the containers will 525 * reported by each container. If recalculate is true, the containers will
diff --git a/include/sway/debug.h b/include/sway/debug.h
index bf3a5f6d..0e9bb056 100644
--- a/include/sway/debug.h
+++ b/include/sway/debug.h
@@ -17,6 +17,6 @@ struct sway_debug {
17 17
18extern struct sway_debug debug; 18extern struct sway_debug debug;
19 19
20void update_debug_tree(); 20void update_debug_tree(void);
21 21
22#endif 22#endif
diff --git a/include/sway/ipc-json.h b/include/sway/ipc-json.h
index fef243e3..1cbfd15d 100644
--- a/include/sway/ipc-json.h
+++ b/include/sway/ipc-json.h
@@ -4,7 +4,7 @@
4#include "sway/tree/container.h" 4#include "sway/tree/container.h"
5#include "sway/input/input-manager.h" 5#include "sway/input/input-manager.h"
6 6
7json_object *ipc_json_get_version(); 7json_object *ipc_json_get_version(void);
8 8
9json_object *ipc_json_describe_disabled_output(struct sway_output *o); 9json_object *ipc_json_describe_disabled_output(struct sway_output *o);
10json_object *ipc_json_describe_node(struct sway_node *node); 10json_object *ipc_json_describe_node(struct sway_node *node);
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index 5e281a2f..b865a0f2 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -94,9 +94,6 @@ struct sway_container {
94 94
95 // The gaps currently applied to the container. 95 // The gaps currently applied to the container.
96 double current_gaps; 96 double current_gaps;
97 bool has_gaps;
98 double gaps_inner;
99 double gaps_outer;
100 97
101 struct sway_workspace *workspace; // NULL when hidden in the scratchpad 98 struct sway_workspace *workspace; // NULL when hidden in the scratchpad
102 struct sway_container *parent; // NULL if container in root of workspace 99 struct sway_container *parent; // NULL if container in root of workspace
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h
index e4b616d1..efdae5a1 100644
--- a/include/sway/tree/workspace.h
+++ b/include/sway/tree/workspace.h
@@ -32,10 +32,9 @@ struct sway_workspace {
32 enum sway_container_layout layout; 32 enum sway_container_layout layout;
33 enum sway_container_layout prev_split_layout; 33 enum sway_container_layout prev_split_layout;
34 34
35 double current_gaps; 35 int current_gaps;
36 bool has_gaps; 36 int gaps_inner;
37 double gaps_inner; 37 int gaps_outer;
38 double gaps_outer;
39 38
40 struct sway_output *output; // NULL if no outputs are connected 39 struct sway_output *output; // NULL if no outputs are connected
41 list_t *floating; // struct sway_container 40 list_t *floating; // struct sway_container
@@ -48,6 +47,8 @@ struct sway_workspace {
48 47
49extern char *prev_workspace_name; 48extern char *prev_workspace_name;
50 49
50struct workspace_config *workspace_find_config(const char *ws_name);
51
51struct sway_output *workspace_get_initial_output(const char *name); 52struct sway_output *workspace_get_initial_output(const char *name);
52 53
53struct sway_workspace *workspace_create(struct sway_output *output, 54struct sway_workspace *workspace_create(struct sway_output *output,
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h
index 4065fb8b..de234111 100644
--- a/include/swaybar/bar.h
+++ b/include/swaybar/bar.h
@@ -54,7 +54,6 @@ struct swaybar {
54 struct wl_seat *seat; 54 struct wl_seat *seat;
55 55
56 struct swaybar_config *config; 56 struct swaybar_config *config;
57 struct swaybar_output *focused_output;
58 struct swaybar_pointer pointer; 57 struct swaybar_pointer pointer;
59 struct status_line *status; 58 struct status_line *status;
60 59
@@ -81,8 +80,11 @@ struct swaybar_output {
81 80
82 uint32_t width, height; 81 uint32_t width, height;
83 int32_t scale; 82 int32_t scale;
83 enum wl_output_subpixel subpixel;
84 struct pool_buffer buffers[2]; 84 struct pool_buffer buffers[2];
85 struct pool_buffer *current_buffer; 85 struct pool_buffer *current_buffer;
86 bool dirty;
87 bool frame_scheduled;
86}; 88};
87 89
88struct swaybar_workspace { 90struct swaybar_workspace {
@@ -94,9 +96,7 @@ struct swaybar_workspace {
94 bool urgent; 96 bool urgent;
95}; 97};
96 98
97void bar_setup(struct swaybar *bar, 99bool bar_setup(struct swaybar *bar, const char *socket_path, const char *bar_id);
98 const char *socket_path,
99 const char *bar_id);
100void bar_run(struct swaybar *bar); 100void bar_run(struct swaybar *bar);
101void bar_teardown(struct swaybar *bar); 101void bar_teardown(struct swaybar *bar);
102 102
diff --git a/include/swaybar/config.h b/include/swaybar/config.h
index 6739c28a..5f5688cf 100644
--- a/include/swaybar/config.h
+++ b/include/swaybar/config.h
@@ -50,7 +50,7 @@ struct swaybar_config {
50 } colors; 50 } colors;
51}; 51};
52 52
53struct swaybar_config *init_config(); 53struct swaybar_config *init_config(void);
54void free_config(struct swaybar_config *config); 54void free_config(struct swaybar_config *config);
55uint32_t parse_position(const char *position); 55uint32_t parse_position(const char *position);
56 56
diff --git a/include/swaybar/i3bar.h b/include/swaybar/i3bar.h
new file mode 100644
index 00000000..12d9b317
--- /dev/null
+++ b/include/swaybar/i3bar.h
@@ -0,0 +1,34 @@
1#ifndef _SWAYBAR_I3BAR_H
2#define _SWAYBAR_I3BAR_H
3
4#include "bar.h"
5#include "status_line.h"
6
7struct i3bar_block {
8 struct wl_list link;
9 int ref_count;
10 char *full_text, *short_text, *align;
11 bool urgent;
12 uint32_t *color;
13 int min_width;
14 char *name, *instance;
15 bool separator;
16 int separator_block_width;
17 bool markup;
18 // Airblader features
19 uint32_t background;
20 uint32_t border;
21 int border_top;
22 int border_bottom;
23 int border_left;
24 int border_right;
25};
26
27void i3bar_block_unref(struct i3bar_block *block);
28bool i3bar_handle_readable(struct status_line *status);
29enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
30 struct i3bar_block *block, int x, int y, enum x11_button button);
31enum x11_button wl_button_to_x11_button(uint32_t button);
32enum x11_button wl_axis_to_x11_button(uint32_t axis, wl_fixed_t value);
33
34#endif
diff --git a/include/swaybar/ipc.h b/include/swaybar/ipc.h
index a1696bcf..81e48a6b 100644
--- a/include/swaybar/ipc.h
+++ b/include/swaybar/ipc.h
@@ -3,7 +3,7 @@
3#include <stdbool.h> 3#include <stdbool.h>
4#include "swaybar/bar.h" 4#include "swaybar/bar.h"
5 5
6void ipc_initialize(struct swaybar *bar, const char *bar_id); 6bool ipc_initialize(struct swaybar *bar, const char *bar_id);
7bool handle_ipc_readable(struct swaybar *bar); 7bool handle_ipc_readable(struct swaybar *bar);
8void ipc_get_workspaces(struct swaybar *bar); 8void ipc_get_workspaces(struct swaybar *bar);
9void ipc_send_workspace_command(struct swaybar *bar, const char *ws); 9void ipc_send_workspace_command(struct swaybar *bar, const char *ws);
diff --git a/include/swaybar/render.h b/include/swaybar/render.h
index 071e2298..ebdc69e4 100644
--- a/include/swaybar/render.h
+++ b/include/swaybar/render.h
@@ -1,10 +1,8 @@
1#ifndef _SWAYBAR_RENDER_H 1#ifndef _SWAYBAR_RENDER_H
2#define _SWAYBAR_RENDER_H 2#define _SWAYBAR_RENDER_H
3 3
4struct swaybar;
5struct swaybar_output; 4struct swaybar_output;
6struct swaybar_config;
7 5
8void render_frame(struct swaybar *bar, struct swaybar_output *output); 6void render_frame(struct swaybar_output *output);
9 7
10#endif 8#endif
diff --git a/include/swaybar/status_line.h b/include/swaybar/status_line.h
index d3eabdf6..e6c7dac2 100644
--- a/include/swaybar/status_line.h
+++ b/include/swaybar/status_line.h
@@ -13,26 +13,6 @@ enum status_protocol {
13 PROTOCOL_I3BAR, 13 PROTOCOL_I3BAR,
14}; 14};
15 15
16struct i3bar_block {
17 struct wl_list link;
18 int ref_count;
19 char *full_text, *short_text, *align;
20 bool urgent;
21 uint32_t *color;
22 int min_width;
23 char *name, *instance;
24 bool separator;
25 int separator_block_width;
26 bool markup;
27 // Airblader features
28 uint32_t background;
29 uint32_t border;
30 int border_top;
31 int border_bottom;
32 int border_left;
33 int border_right;
34};
35
36struct status_line { 16struct status_line {
37 pid_t pid; 17 pid_t pid;
38 int read_fd, write_fd; 18 int read_fd, write_fd;
@@ -55,11 +35,5 @@ struct status_line *status_line_init(char *cmd);
55void status_error(struct status_line *status, const char *text); 35void status_error(struct status_line *status, const char *text);
56bool status_handle_readable(struct status_line *status); 36bool status_handle_readable(struct status_line *status);
57void status_line_free(struct status_line *status); 37void status_line_free(struct status_line *status);
58bool i3bar_handle_readable(struct status_line *status);
59enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
60 struct i3bar_block *block, int x, int y, enum x11_button button);
61void i3bar_block_unref(struct i3bar_block *block);
62enum x11_button wl_button_to_x11_button(uint32_t button);
63enum x11_button wl_axis_to_x11_button(uint32_t axis, wl_fixed_t value);
64 38
65#endif 39#endif
diff --git a/include/swaybar/tray/dbus.h b/include/swaybar/tray/dbus.h
deleted file mode 100644
index eb9cfea7..00000000
--- a/include/swaybar/tray/dbus.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _SWAYBAR_DBUS_H
2#define _SWAYBAR_DBUS_H
3
4#include <stdbool.h>
5#include <dbus/dbus.h>
6extern DBusConnection *conn;
7
8/**
9 * Should be called in main loop to dispatch events
10 */
11void dispatch_dbus();
12
13/**
14 * Initializes async dbus communication
15 */
16int dbus_init();
17
18#endif /* _SWAYBAR_DBUS_H */
diff --git a/include/swaybar/tray/sni_watcher.h b/include/swaybar/tray/sni_watcher.h
deleted file mode 100644
index 25ddfcd2..00000000
--- a/include/swaybar/tray/sni_watcher.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _SWAYBAR_SNI_WATCHER_H
2#define _SWAYBAR_SNI_WATCHER_H
3
4/**
5 * Starts the sni_watcher, the watcher is practically a black box and should
6 * only be accessed though functions described in its spec
7 */
8int init_sni_watcher();
9
10#endif /* _SWAYBAR_SNI_WATCHER_H */
diff --git a/include/swaybar/tray/tray.h b/include/swaybar/tray/tray.h
deleted file mode 100644
index 2d0662be..00000000
--- a/include/swaybar/tray/tray.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef _SWAYBAR_TRAY_H
2#define _SWAYBAR_TRAY_H
3
4#include <stdint.h>
5#include <stdbool.h>
6#include "swaybar/tray/dbus.h"
7#include "swaybar/tray/sni.h"
8#include "swaybar/bar.h"
9#include "list.h"
10
11extern struct tray *tray;
12
13struct tray {
14 list_t *items;
15};
16
17/**
18 * Processes a mouse event on the bar
19 */
20void tray_mouse_event(struct output *output, int x, int y,
21 uint32_t button, uint32_t state);
22
23uint32_t tray_render(struct output *output, struct config *config);
24
25void tray_upkeep(struct bar *bar);
26
27/**
28 * Initializes the tray with D-Bus
29 */
30void init_tray(struct bar *bar);
31
32#endif /* _SWAYBAR_TRAY_H */
diff --git a/include/swaylock/swaylock.h b/include/swaylock/swaylock.h
index 950cfaaf..970e3cc9 100644
--- a/include/swaylock/swaylock.h
+++ b/include/swaylock/swaylock.h
@@ -82,6 +82,7 @@ struct swaylock_surface {
82 bool frame_pending, dirty; 82 bool frame_pending, dirty;
83 uint32_t width, height; 83 uint32_t width, height;
84 int32_t scale; 84 int32_t scale;
85 enum wl_output_subpixel subpixel;
85 char *output_name; 86 char *output_name;
86 struct wl_list link; 87 struct wl_list link;
87}; 88};
@@ -100,5 +101,8 @@ void render_frame(struct swaylock_surface *surface);
100void render_frames(struct swaylock_state *state); 101void render_frames(struct swaylock_state *state);
101void damage_surface(struct swaylock_surface *surface); 102void damage_surface(struct swaylock_surface *surface);
102void damage_state(struct swaylock_state *state); 103void damage_state(struct swaylock_state *state);
104void initialize_pw_backend(void);
105bool attempt_password(struct swaylock_password *pw);
106void clear_password_buffer(struct swaylock_password *pw);
103 107
104#endif 108#endif