diff options
Diffstat (limited to 'include/sway/tree/workspace.h')
-rw-r--r-- | include/sway/tree/workspace.h | 105 |
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 | ||
7 | struct sway_view; | 8 | struct sway_view; |
8 | 9 | ||
10 | struct 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 | |||
9 | struct sway_workspace { | 23 | struct 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 | ||
17 | extern char *prev_workspace_name; | 49 | extern char *prev_workspace_name; |
18 | 50 | ||
19 | struct sway_container *workspace_get_initial_output(const char *name); | 51 | struct sway_output *workspace_get_initial_output(const char *name); |
20 | 52 | ||
21 | struct sway_container *workspace_create(struct sway_container *output, | 53 | struct sway_workspace *workspace_create(struct sway_output *output, |
22 | const char *name); | 54 | const char *name); |
23 | 55 | ||
24 | void workspace_destroy(struct sway_container *workspace); | 56 | void workspace_destroy(struct sway_workspace *workspace); |
25 | 57 | ||
26 | void workspace_begin_destroy(struct sway_container *workspace); | 58 | void workspace_begin_destroy(struct sway_workspace *workspace); |
27 | 59 | ||
28 | void workspace_consider_destroy(struct sway_container *ws); | 60 | void workspace_consider_destroy(struct sway_workspace *ws); |
29 | 61 | ||
30 | char *workspace_next_name(const char *output_name); | 62 | char *workspace_next_name(const char *output_name); |
31 | 63 | ||
32 | bool workspace_switch(struct sway_container *workspace, | 64 | bool workspace_switch(struct sway_workspace *workspace, |
33 | bool no_auto_back_and_forth); | 65 | bool no_auto_back_and_forth); |
34 | 66 | ||
35 | struct sway_container *workspace_by_number(const char* name); | 67 | struct sway_workspace *workspace_by_number(const char* name); |
36 | 68 | ||
37 | struct sway_container *workspace_by_name(const char*); | 69 | struct sway_workspace *workspace_by_name(const char*); |
38 | 70 | ||
39 | struct sway_container *workspace_output_next(struct sway_container *current); | 71 | struct sway_workspace *workspace_output_next(struct sway_workspace *current); |
40 | 72 | ||
41 | struct sway_container *workspace_next(struct sway_container *current); | 73 | struct sway_workspace *workspace_next(struct sway_workspace *current); |
42 | 74 | ||
43 | struct sway_container *workspace_output_prev(struct sway_container *current); | 75 | struct sway_workspace *workspace_output_prev(struct sway_workspace *current); |
44 | 76 | ||
45 | struct sway_container *workspace_prev(struct sway_container *current); | 77 | struct sway_workspace *workspace_prev(struct sway_workspace *current); |
46 | 78 | ||
47 | bool workspace_is_visible(struct sway_container *ws); | 79 | bool workspace_is_visible(struct sway_workspace *ws); |
48 | 80 | ||
49 | bool workspace_is_empty(struct sway_container *ws); | 81 | bool workspace_is_empty(struct sway_workspace *ws); |
50 | 82 | ||
51 | void workspace_output_raise_priority(struct sway_container *workspace, | 83 | void 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 | ||
54 | void workspace_output_add_priority(struct sway_container *workspace, | 86 | void workspace_output_add_priority(struct sway_workspace *workspace, |
55 | struct sway_container *output); | 87 | struct sway_output *output); |
56 | 88 | ||
57 | struct sway_container *workspace_output_get_highest_available( | 89 | struct 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 | ||
60 | void workspace_detect_urgent(struct sway_container *workspace); | 92 | void workspace_detect_urgent(struct sway_workspace *workspace); |
61 | 93 | ||
62 | void workspace_for_each_container(struct sway_container *ws, | 94 | void 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 | ||
65 | struct sway_container *workspace_find_container(struct sway_container *ws, | 97 | struct 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 | */ |
73 | struct sway_container *workspace_wrap_children(struct sway_container *ws); | 105 | struct sway_container *workspace_wrap_children(struct sway_workspace *ws); |
74 | 106 | ||
75 | void workspace_add_floating(struct sway_container *workspace, | 107 | void workspace_detach(struct sway_workspace *workspace); |
108 | |||
109 | void workspace_add_tiling(struct sway_workspace *workspace, | ||
110 | struct sway_container *con); | ||
111 | |||
112 | void workspace_add_floating(struct sway_workspace *workspace, | ||
76 | struct sway_container *con); | 113 | struct sway_container *con); |
77 | 114 | ||
78 | void workspace_remove_gaps(struct sway_container *ws); | 115 | void workspace_insert_tiling(struct sway_workspace *workspace, |
116 | struct sway_container *con, int index); | ||
117 | |||
118 | void workspace_remove_gaps(struct sway_workspace *ws); | ||
119 | |||
120 | void workspace_add_gaps(struct sway_workspace *ws); | ||
121 | |||
122 | struct sway_container *workspace_split(struct sway_workspace *workspace, | ||
123 | enum sway_container_layout layout); | ||
124 | |||
125 | void workspace_update_representation(struct sway_workspace *ws); | ||
79 | 126 | ||
80 | void workspace_add_gaps(struct sway_container *ws); | 127 | void workspace_get_box(struct sway_workspace *workspace, struct wlr_box *box); |
81 | 128 | ||
82 | #endif | 129 | #endif |