summaryrefslogtreecommitdiffstats
path: root/include/sway/tree/workspace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sway/tree/workspace.h')
-rw-r--r--include/sway/tree/workspace.h105
1 files changed, 76 insertions, 29 deletions
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h
index 04325919..af9a071a 100644
--- a/include/sway/tree/workspace.h
+++ b/include/sway/tree/workspace.h
@@ -3,66 +3,98 @@
3 3
4#include <stdbool.h> 4#include <stdbool.h>
5#include "sway/tree/container.h" 5#include "sway/tree/container.h"
6#include "sway/tree/node.h"
6 7
7struct sway_view; 8struct sway_view;
8 9
10struct sway_workspace_state {
11 struct sway_container *fullscreen;
12 double x, y;
13 int width, height;
14 enum sway_container_layout layout;
15 struct sway_output *output;
16 list_t *floating;
17 list_t *tiling;
18
19 struct sway_container *focused_inactive_child;
20 bool focused;
21};
22
9struct sway_workspace { 23struct sway_workspace {
10 struct sway_container *swayc; 24 struct sway_node node;
11 struct sway_container *fullscreen; 25 struct sway_container *fullscreen;
12 list_t *floating; // struct sway_container 26
27 char *name;
28 char *representation;
29
30 double x, y;
31 int width, height;
32 enum sway_container_layout layout;
33 enum sway_container_layout prev_split_layout;
34
35 double current_gaps;
36 bool has_gaps;
37 double gaps_inner;
38 double gaps_outer;
39
40 struct sway_output *output; // NULL if no outputs are connected
41 list_t *floating; // struct sway_container
42 list_t *tiling; // struct sway_container
13 list_t *output_priority; 43 list_t *output_priority;
14 bool urgent; 44 bool urgent;
45
46 struct sway_workspace_state current;
15}; 47};
16 48
17extern char *prev_workspace_name; 49extern char *prev_workspace_name;
18 50
19struct sway_container *workspace_get_initial_output(const char *name); 51struct sway_output *workspace_get_initial_output(const char *name);
20 52
21struct sway_container *workspace_create(struct sway_container *output, 53struct sway_workspace *workspace_create(struct sway_output *output,
22 const char *name); 54 const char *name);
23 55
24void workspace_destroy(struct sway_container *workspace); 56void workspace_destroy(struct sway_workspace *workspace);
25 57
26void workspace_begin_destroy(struct sway_container *workspace); 58void workspace_begin_destroy(struct sway_workspace *workspace);
27 59
28void workspace_consider_destroy(struct sway_container *ws); 60void workspace_consider_destroy(struct sway_workspace *ws);
29 61
30char *workspace_next_name(const char *output_name); 62char *workspace_next_name(const char *output_name);
31 63
32bool workspace_switch(struct sway_container *workspace, 64bool workspace_switch(struct sway_workspace *workspace,
33 bool no_auto_back_and_forth); 65 bool no_auto_back_and_forth);
34 66
35struct sway_container *workspace_by_number(const char* name); 67struct sway_workspace *workspace_by_number(const char* name);
36 68
37struct sway_container *workspace_by_name(const char*); 69struct sway_workspace *workspace_by_name(const char*);
38 70
39struct sway_container *workspace_output_next(struct sway_container *current); 71struct sway_workspace *workspace_output_next(struct sway_workspace *current);
40 72
41struct sway_container *workspace_next(struct sway_container *current); 73struct sway_workspace *workspace_next(struct sway_workspace *current);
42 74
43struct sway_container *workspace_output_prev(struct sway_container *current); 75struct sway_workspace *workspace_output_prev(struct sway_workspace *current);
44 76
45struct sway_container *workspace_prev(struct sway_container *current); 77struct sway_workspace *workspace_prev(struct sway_workspace *current);
46 78
47bool workspace_is_visible(struct sway_container *ws); 79bool workspace_is_visible(struct sway_workspace *ws);
48 80
49bool workspace_is_empty(struct sway_container *ws); 81bool workspace_is_empty(struct sway_workspace *ws);
50 82
51void workspace_output_raise_priority(struct sway_container *workspace, 83void workspace_output_raise_priority(struct sway_workspace *workspace,
52 struct sway_container *old_output, struct sway_container *new_output); 84 struct sway_output *old_output, struct sway_output *new_output);
53 85
54void workspace_output_add_priority(struct sway_container *workspace, 86void workspace_output_add_priority(struct sway_workspace *workspace,
55 struct sway_container *output); 87 struct sway_output *output);
56 88
57struct sway_container *workspace_output_get_highest_available( 89struct sway_output *workspace_output_get_highest_available(
58 struct sway_container *ws, struct sway_container *exclude); 90 struct sway_workspace *ws, struct sway_output *exclude);
59 91
60void workspace_detect_urgent(struct sway_container *workspace); 92void workspace_detect_urgent(struct sway_workspace *workspace);
61 93
62void workspace_for_each_container(struct sway_container *ws, 94void workspace_for_each_container(struct sway_workspace *ws,
63 void (*f)(struct sway_container *con, void *data), void *data); 95 void (*f)(struct sway_container *con, void *data), void *data);
64 96
65struct sway_container *workspace_find_container(struct sway_container *ws, 97struct sway_container *workspace_find_container(struct sway_workspace *ws,
66 bool (*test)(struct sway_container *con, void *data), void *data); 98 bool (*test)(struct sway_container *con, void *data), void *data);
67 99
68/** 100/**
@@ -70,13 +102,28 @@ struct sway_container *workspace_find_container(struct sway_container *ws,
70 * The new container will be the only direct tiling child of the workspace. 102 * The new container will be the only direct tiling child of the workspace.
71 * The new container is returned. 103 * The new container is returned.
72 */ 104 */
73struct sway_container *workspace_wrap_children(struct sway_container *ws); 105struct sway_container *workspace_wrap_children(struct sway_workspace *ws);
74 106
75void workspace_add_floating(struct sway_container *workspace, 107void workspace_detach(struct sway_workspace *workspace);
108
109void workspace_add_tiling(struct sway_workspace *workspace,
110 struct sway_container *con);
111
112void workspace_add_floating(struct sway_workspace *workspace,
76 struct sway_container *con); 113 struct sway_container *con);
77 114
78void workspace_remove_gaps(struct sway_container *ws); 115void workspace_insert_tiling(struct sway_workspace *workspace,
116 struct sway_container *con, int index);
117
118void workspace_remove_gaps(struct sway_workspace *ws);
119
120void workspace_add_gaps(struct sway_workspace *ws);
121
122struct sway_container *workspace_split(struct sway_workspace *workspace,
123 enum sway_container_layout layout);
124
125void workspace_update_representation(struct sway_workspace *ws);
79 126
80void workspace_add_gaps(struct sway_container *ws); 127void workspace_get_box(struct sway_workspace *workspace, struct wlr_box *box);
81 128
82#endif 129#endif