diff options
29 files changed, 89 insertions, 110 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index 48a8b0ab..48ebba3b 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -10,8 +10,8 @@ | |||
10 | #include <xkbcommon/xkbcommon.h> | 10 | #include <xkbcommon/xkbcommon.h> |
11 | #include <time.h> | 11 | #include <time.h> |
12 | #include "list.h" | 12 | #include "list.h" |
13 | #include "layout.h" | 13 | #include "tree/layout.h" |
14 | #include "container.h" | 14 | #include "tree/container.h" |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Describes a variable created via the `set` command. | 17 | * Describes a variable created via the `set` command. |
diff --git a/include/sway/criteria.h b/include/sway/criteria.h index 9b4b4bef..431cfa3a 100644 --- a/include/sway/criteria.h +++ b/include/sway/criteria.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _SWAY_CRITERIA_H | 1 | #ifndef _SWAY_CRITERIA_H |
2 | #define _SWAY_CRITERIA_H | 2 | #define _SWAY_CRITERIA_H |
3 | 3 | ||
4 | #include "container.h" | 4 | #include "tree/container.h" |
5 | #include "list.h" | 5 | #include "list.h" |
6 | 6 | ||
7 | /** | 7 | /** |
diff --git a/include/sway/ipc-json.h b/include/sway/ipc-json.h index eef5a018..76b7d45b 100644 --- a/include/sway/ipc-json.h +++ b/include/sway/ipc-json.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _SWAY_IPC_JSON_H | 1 | #ifndef _SWAY_IPC_JSON_H |
2 | #define _SWAY_IPC_JSON_H | 2 | #define _SWAY_IPC_JSON_H |
3 | #include <json-c/json.h> | 3 | #include <json-c/json.h> |
4 | #include "sway/container.h" | 4 | #include "sway/tree/container.h" |
5 | #include "sway/input/input-manager.h" | 5 | #include "sway/input/input-manager.h" |
6 | 6 | ||
7 | json_object *ipc_json_get_version(); | 7 | json_object *ipc_json_get_version(); |
diff --git a/include/sway/ipc-server.h b/include/sway/ipc-server.h index bcf1c433..db690b6e 100644 --- a/include/sway/ipc-server.h +++ b/include/sway/ipc-server.h | |||
@@ -1,13 +1,15 @@ | |||
1 | #ifndef _SWAY_IPC_SERVER_H | 1 | #ifndef _SWAY_IPC_SERVER_H |
2 | #define _SWAY_IPC_SERVER_H | 2 | #define _SWAY_IPC_SERVER_H |
3 | #include <sys/socket.h> | 3 | #include <sys/socket.h> |
4 | #include "sway/container.h" | 4 | #include "sway/tree/container.h" |
5 | #include "ipc.h" | 5 | #include "ipc.h" |
6 | 6 | ||
7 | struct sway_server; | 7 | struct sway_server; |
8 | 8 | ||
9 | void ipc_init(struct sway_server *server); | 9 | void ipc_init(struct sway_server *server); |
10 | |||
10 | void ipc_terminate(void); | 11 | void ipc_terminate(void); |
12 | |||
11 | struct sockaddr_un *ipc_user_sockaddr(void); | 13 | struct sockaddr_un *ipc_user_sockaddr(void); |
12 | 14 | ||
13 | void ipc_event_window(swayc_t *window, const char *change); | 15 | void ipc_event_window(swayc_t *window, const char *change); |
diff --git a/include/sway/container.h b/include/sway/tree/container.h index f200a1a2..5a2ae349 100644 --- a/include/sway/container.h +++ b/include/sway/tree/container.h | |||
@@ -20,60 +20,43 @@ struct sway_seat; | |||
20 | * it on this list. | 20 | * it on this list. |
21 | */ | 21 | */ |
22 | enum swayc_types { | 22 | enum swayc_types { |
23 | C_ROOT, /**< The root container. Only one of these ever exists. */ | 23 | C_ROOT, |
24 | C_OUTPUT, /**< An output (aka monitor, head, etc). */ | 24 | C_OUTPUT, |
25 | C_WORKSPACE, /**< A workspace. */ | 25 | C_WORKSPACE, |
26 | C_CONTAINER, /**< A manually created container. */ | 26 | C_CONTAINER, |
27 | C_VIEW, /**< A view (aka window). */ | 27 | C_VIEW, |
28 | 28 | ||
29 | C_TYPES, | 29 | C_TYPES, |
30 | }; | 30 | }; |
31 | 31 | ||
32 | /** | ||
33 | * Different ways to arrange a container. | ||
34 | */ | ||
35 | enum swayc_layouts { | 32 | enum swayc_layouts { |
36 | L_NONE, /**< Used for containers that have no layout (views, root) */ | 33 | L_NONE, |
37 | L_HORIZ, | 34 | L_HORIZ, |
38 | L_VERT, | 35 | L_VERT, |
39 | L_STACKED, | 36 | L_STACKED, |
40 | L_TABBED, | 37 | L_TABBED, |
41 | L_FLOATING, /**< A psuedo-container, removed from the tree, to hold floating windows */ | 38 | L_FLOATING, |
42 | |||
43 | /* Awesome/Monad style auto layouts */ | ||
44 | L_AUTO_LEFT, | ||
45 | L_AUTO_RIGHT, | ||
46 | L_AUTO_TOP, | ||
47 | L_AUTO_BOTTOM, | ||
48 | |||
49 | L_AUTO_FIRST = L_AUTO_LEFT, | ||
50 | L_AUTO_LAST = L_AUTO_BOTTOM, | ||
51 | 39 | ||
52 | // Keep last | 40 | // Keep last |
53 | L_LAYOUTS, | 41 | L_LAYOUTS, |
54 | }; | 42 | }; |
55 | 43 | ||
56 | enum swayc_border_types { | 44 | enum swayc_border_types { |
57 | B_NONE, /**< No border */ | 45 | B_NONE, |
58 | B_PIXEL, /**< 1px border */ | 46 | B_PIXEL, |
59 | B_NORMAL, /**< Normal border with title bar */ | 47 | B_NORMAL, |
60 | }; | 48 | }; |
61 | 49 | ||
62 | struct sway_root; | 50 | struct sway_root; |
63 | struct sway_output; | 51 | struct sway_output; |
64 | struct sway_view; | 52 | struct sway_view; |
65 | 53 | ||
66 | /** | ||
67 | * Stores information about a container. | ||
68 | * | ||
69 | * The tree is made of these. Views are containers that cannot have children. | ||
70 | */ | ||
71 | struct sway_container { | 54 | struct sway_container { |
72 | union { | 55 | union { |
73 | // TODO: Encapsulate state for other node types as well like C_CONTAINER | 56 | // TODO: Encapsulate state for other node types as well like C_CONTAINER |
74 | struct sway_root *sway_root; // C_ROOT | 57 | struct sway_root *sway_root; |
75 | struct sway_output *sway_output; // C_OUTPUT | 58 | struct sway_output *sway_output; |
76 | struct sway_view *sway_view; // C_VIEW | 59 | struct sway_view *sway_view; |
77 | }; | 60 | }; |
78 | 61 | ||
79 | /** | 62 | /** |
@@ -89,38 +72,17 @@ struct sway_container { | |||
89 | enum swayc_layouts prev_layout; | 72 | enum swayc_layouts prev_layout; |
90 | enum swayc_layouts workspace_layout; | 73 | enum swayc_layouts workspace_layout; |
91 | 74 | ||
92 | /** | 75 | // TODO convert to layout coordinates |
93 | * The coordinates that this view appear at, relative to the output they | ||
94 | * are located on (output containers have absolute coordinates). | ||
95 | */ | ||
96 | double x, y; | 76 | double x, y; |
97 | 77 | ||
98 | /** | 78 | // does not include borders or gaps. |
99 | * Width and height of this container, without borders or gaps. | ||
100 | */ | ||
101 | double width, height; | 79 | double width, height; |
102 | 80 | ||
103 | list_t *children; | 81 | list_t *children; |
104 | 82 | ||
105 | /** | ||
106 | * The parent of this container. NULL for the root container. | ||
107 | */ | ||
108 | struct sway_container *parent; | 83 | struct sway_container *parent; |
109 | 84 | ||
110 | /** | 85 | list_t *marks; // list of char* |
111 | * Number of master views in auto layouts. | ||
112 | */ | ||
113 | size_t nb_master; | ||
114 | |||
115 | /** | ||
116 | * Number of slave groups (e.g. columns) in auto layouts. | ||
117 | */ | ||
118 | size_t nb_slave_groups; | ||
119 | |||
120 | /** | ||
121 | * Marks applied to the container, list_t of char*. | ||
122 | */ | ||
123 | list_t *marks; | ||
124 | 86 | ||
125 | struct { | 87 | struct { |
126 | struct wl_signal destroy; | 88 | struct wl_signal destroy; |
@@ -130,8 +92,11 @@ struct sway_container { | |||
130 | void swayc_descendants_of_type(swayc_t *root, enum swayc_types type, | 92 | void swayc_descendants_of_type(swayc_t *root, enum swayc_types type, |
131 | void (*func)(swayc_t *item, void *data), void *data); | 93 | void (*func)(swayc_t *item, void *data), void *data); |
132 | 94 | ||
95 | // TODO only one container create function and pass the type? | ||
133 | swayc_t *new_output(struct sway_output *sway_output); | 96 | swayc_t *new_output(struct sway_output *sway_output); |
97 | |||
134 | swayc_t *new_workspace(swayc_t *output, const char *name); | 98 | swayc_t *new_workspace(swayc_t *output, const char *name); |
99 | |||
135 | swayc_t *new_view(swayc_t *sibling, struct sway_view *sway_view); | 100 | swayc_t *new_view(swayc_t *sibling, struct sway_view *sway_view); |
136 | 101 | ||
137 | swayc_t *destroy_output(swayc_t *output); | 102 | swayc_t *destroy_output(swayc_t *output); |
@@ -145,10 +110,12 @@ swayc_t *next_view_sibling(struct sway_seat *seat); | |||
145 | */ | 110 | */ |
146 | swayc_t *swayc_by_test(swayc_t *container, | 111 | swayc_t *swayc_by_test(swayc_t *container, |
147 | bool (*test)(swayc_t *view, void *data), void *data); | 112 | bool (*test)(swayc_t *view, void *data), void *data); |
113 | |||
148 | /** | 114 | /** |
149 | * Finds a parent container with the given swayc_type. | 115 | * Finds a parent container with the given swayc_type. |
150 | */ | 116 | */ |
151 | swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type); | 117 | swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type); |
118 | |||
152 | /** | 119 | /** |
153 | * Maps a container's children over a function. | 120 | * Maps a container's children over a function. |
154 | */ | 121 | */ |
diff --git a/include/sway/layout.h b/include/sway/tree/layout.h index e82c4442..39b7fb24 100644 --- a/include/sway/layout.h +++ b/include/sway/tree/layout.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define _SWAY_LAYOUT_H | 2 | #define _SWAY_LAYOUT_H |
3 | 3 | ||
4 | #include <wlr/types/wlr_output_layout.h> | 4 | #include <wlr/types/wlr_output_layout.h> |
5 | #include "sway/container.h" | 5 | #include "sway/tree/container.h" |
6 | 6 | ||
7 | enum movement_direction { | 7 | enum movement_direction { |
8 | MOVE_LEFT, | 8 | MOVE_LEFT, |
@@ -31,12 +31,20 @@ struct sway_root { | |||
31 | }; | 31 | }; |
32 | 32 | ||
33 | void init_layout(void); | 33 | void init_layout(void); |
34 | |||
34 | void add_child(struct sway_container *parent, struct sway_container *child); | 35 | void add_child(struct sway_container *parent, struct sway_container *child); |
36 | |||
35 | swayc_t *add_sibling(swayc_t *parent, swayc_t *child); | 37 | swayc_t *add_sibling(swayc_t *parent, swayc_t *child); |
38 | |||
36 | struct sway_container *remove_child(struct sway_container *child); | 39 | struct sway_container *remove_child(struct sway_container *child); |
40 | |||
37 | enum swayc_layouts default_layout(struct sway_container *output); | 41 | enum swayc_layouts default_layout(struct sway_container *output); |
42 | |||
38 | void sort_workspaces(struct sway_container *output); | 43 | void sort_workspaces(struct sway_container *output); |
39 | void arrange_windows(struct sway_container *container, double width, double height); | 44 | |
45 | void arrange_windows(struct sway_container *container, | ||
46 | double width, double height); | ||
47 | |||
40 | swayc_t *get_swayc_in_direction(swayc_t *container, | 48 | swayc_t *get_swayc_in_direction(swayc_t *container, |
41 | struct sway_seat *seat, enum movement_direction dir); | 49 | struct sway_seat *seat, enum movement_direction dir); |
42 | 50 | ||
diff --git a/include/sway/view.h b/include/sway/tree/view.h index b2886211..e5f53f4e 100644 --- a/include/sway/view.h +++ b/include/sway/tree/view.h | |||
@@ -62,10 +62,6 @@ enum sway_view_prop { | |||
62 | VIEW_PROP_INSTANCE, | 62 | VIEW_PROP_INSTANCE, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | /** | ||
66 | * sway_view is a state container for surfaces that are arranged in the sway | ||
67 | * tree (shell surfaces). | ||
68 | */ | ||
69 | struct sway_view { | 65 | struct sway_view { |
70 | enum sway_view_type type; | 66 | enum sway_view_type type; |
71 | struct sway_container *swayc; | 67 | struct sway_container *swayc; |
diff --git a/include/sway/workspace.h b/include/sway/tree/workspace.h index fee54255..c8ce40d1 100644 --- a/include/sway/workspace.h +++ b/include/sway/tree/workspace.h | |||
@@ -1,20 +1,26 @@ | |||
1 | #ifndef _SWAY_WORKSPACE_H | 1 | #ifndef _SWAY_WORKSPACE_H |
2 | #define _SWAY_WORKSPACE_H | 2 | #define _SWAY_WORKSPACE_H |
3 | 3 | ||
4 | #include "sway/container.h" | 4 | #include "sway/tree/container.h" |
5 | 5 | ||
6 | extern char *prev_workspace_name; | 6 | extern char *prev_workspace_name; |
7 | 7 | ||
8 | char *workspace_next_name(const char *output_name); | 8 | char *workspace_next_name(const char *output_name); |
9 | |||
9 | swayc_t *workspace_create(const char *name); | 10 | swayc_t *workspace_create(const char *name); |
11 | |||
10 | bool workspace_switch(swayc_t *workspace); | 12 | bool workspace_switch(swayc_t *workspace); |
11 | 13 | ||
12 | struct sway_container *workspace_by_number(const char* name); | 14 | struct sway_container *workspace_by_number(const char* name); |
15 | |||
13 | swayc_t *workspace_by_name(const char*); | 16 | swayc_t *workspace_by_name(const char*); |
14 | 17 | ||
15 | struct sway_container *workspace_output_next(swayc_t *current); | 18 | struct sway_container *workspace_output_next(swayc_t *current); |
19 | |||
16 | struct sway_container *workspace_next(swayc_t *current); | 20 | struct sway_container *workspace_next(swayc_t *current); |
21 | |||
17 | struct sway_container *workspace_output_prev(swayc_t *current); | 22 | struct sway_container *workspace_output_prev(swayc_t *current); |
23 | |||
18 | struct sway_container *workspace_prev(swayc_t *current); | 24 | struct sway_container *workspace_prev(swayc_t *current); |
19 | 25 | ||
20 | #endif | 26 | #endif |
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c index 61870c51..954950e7 100644 --- a/sway/commands/exec_always.c +++ b/sway/commands/exec_always.c | |||
@@ -6,8 +6,8 @@ | |||
6 | #include <unistd.h> | 6 | #include <unistd.h> |
7 | #include "sway/commands.h" | 7 | #include "sway/commands.h" |
8 | #include "sway/config.h" | 8 | #include "sway/config.h" |
9 | #include "sway/container.h" | 9 | #include "sway/tree/container.h" |
10 | #include "sway/workspace.h" | 10 | #include "sway/tree/workspace.h" |
11 | #include "log.h" | 11 | #include "log.h" |
12 | #include "stringop.h" | 12 | #include "stringop.h" |
13 | 13 | ||
diff --git a/sway/commands/focus.c b/sway/commands/focus.c index f1a8078f..18e9e0bf 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c | |||
@@ -3,10 +3,11 @@ | |||
3 | #include "log.h" | 3 | #include "log.h" |
4 | #include "sway/input/input-manager.h" | 4 | #include "sway/input/input-manager.h" |
5 | #include "sway/input/seat.h" | 5 | #include "sway/input/seat.h" |
6 | #include "sway/view.h" | 6 | #include "sway/tree/view.h" |
7 | #include "sway/commands.h" | 7 | #include "sway/commands.h" |
8 | 8 | ||
9 | static bool parse_movement_direction(const char *name, enum movement_direction *out) { | 9 | static bool parse_movement_direction(const char *name, |
10 | enum movement_direction *out) { | ||
10 | if (strcasecmp(name, "left") == 0) { | 11 | if (strcasecmp(name, "left") == 0) { |
11 | *out = MOVE_LEFT; | 12 | *out = MOVE_LEFT; |
12 | } else if (strcasecmp(name, "right") == 0) { | 13 | } else if (strcasecmp(name, "right") == 0) { |
diff --git a/sway/commands/kill.c b/sway/commands/kill.c index f408ce2a..c0faed7a 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c | |||
@@ -2,7 +2,7 @@ | |||
2 | #include "log.h" | 2 | #include "log.h" |
3 | #include "sway/input/input-manager.h" | 3 | #include "sway/input/input-manager.h" |
4 | #include "sway/input/seat.h" | 4 | #include "sway/input/seat.h" |
5 | #include "sway/view.h" | 5 | #include "sway/tree/view.h" |
6 | #include "sway/commands.h" | 6 | #include "sway/commands.h" |
7 | 7 | ||
8 | struct cmd_results *cmd_kill(int argc, char **argv) { | 8 | struct cmd_results *cmd_kill(int argc, char **argv) { |
diff --git a/sway/commands/layout.c b/sway/commands/layout.c index b0fc5d66..2b193136 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c | |||
@@ -1,8 +1,8 @@ | |||
1 | #include <string.h> | 1 | #include <string.h> |
2 | #include <strings.h> | 2 | #include <strings.h> |
3 | #include "sway/commands.h" | 3 | #include "sway/commands.h" |
4 | #include "sway/container.h" | 4 | #include "sway/tree/container.h" |
5 | #include "sway/layout.h" | 5 | #include "sway/tree/layout.h" |
6 | #include "log.h" | 6 | #include "log.h" |
7 | 7 | ||
8 | struct cmd_results *cmd_layout(int argc, char **argv) { | 8 | struct cmd_results *cmd_layout(int argc, char **argv) { |
diff --git a/sway/commands/reload.c b/sway/commands/reload.c index d54d40db..8cef789b 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #include "sway/commands.h" | 1 | #include "sway/commands.h" |
2 | #include "sway/config.h" | 2 | #include "sway/config.h" |
3 | #include "sway/layout.h" | 3 | #include "sway/tree/layout.h" |
4 | 4 | ||
5 | struct cmd_results *cmd_reload(int argc, char **argv) { | 5 | struct cmd_results *cmd_reload(int argc, char **argv) { |
6 | struct cmd_results *error = NULL; | 6 | struct cmd_results *error = NULL; |
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index fa891398..8751dffe 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include "sway/commands.h" | 4 | #include "sway/commands.h" |
5 | #include "sway/config.h" | 5 | #include "sway/config.h" |
6 | #include "sway/input/seat.h" | 6 | #include "sway/input/seat.h" |
7 | #include "sway/workspace.h" | 7 | #include "sway/tree/workspace.h" |
8 | #include "list.h" | 8 | #include "list.h" |
9 | #include "log.h" | 9 | #include "log.h" |
10 | #include "stringop.h" | 10 | #include "stringop.h" |
diff --git a/sway/config.c b/sway/config.c index 213e7680..0b29735a 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "sway/input/seat.h" | 24 | #include "sway/input/seat.h" |
25 | #include "sway/commands.h" | 25 | #include "sway/commands.h" |
26 | #include "sway/config.h" | 26 | #include "sway/config.h" |
27 | #include "sway/layout.h" | 27 | #include "sway/tree/layout.h" |
28 | #include "readline.h" | 28 | #include "readline.h" |
29 | #include "stringop.h" | 29 | #include "stringop.h" |
30 | #include "list.h" | 30 | #include "list.h" |
diff --git a/sway/criteria.c b/sway/criteria.c index 2eee331c..b8b581ed 100644 --- a/sway/criteria.c +++ b/sway/criteria.c | |||
@@ -4,9 +4,9 @@ | |||
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <pcre.h> | 5 | #include <pcre.h> |
6 | #include "sway/criteria.h" | 6 | #include "sway/criteria.h" |
7 | #include "sway/container.h" | 7 | #include "sway/tree/container.h" |
8 | #include "sway/config.h" | 8 | #include "sway/config.h" |
9 | #include "sway/view.h" | 9 | #include "sway/tree/view.h" |
10 | #include "stringop.h" | 10 | #include "stringop.h" |
11 | #include "list.h" | 11 | #include "list.h" |
12 | #include "log.h" | 12 | #include "log.h" |
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index bd62f84a..137b3260 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <wlr/types/wlr_output.h> | 7 | #include <wlr/types/wlr_output.h> |
8 | #include <wlr/util/log.h> | 8 | #include <wlr/util/log.h> |
9 | #include "sway/layers.h" | 9 | #include "sway/layers.h" |
10 | #include "sway/layout.h" | 10 | #include "sway/tree/layout.h" |
11 | #include "sway/output.h" | 11 | #include "sway/output.h" |
12 | #include "sway/server.h" | 12 | #include "sway/server.h" |
13 | 13 | ||
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 9e7fbcc6..debda396 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -11,14 +11,14 @@ | |||
11 | #include <wlr/types/wlr_surface.h> | 11 | #include <wlr/types/wlr_surface.h> |
12 | #include <wlr/types/wlr_wl_shell.h> | 12 | #include <wlr/types/wlr_wl_shell.h> |
13 | #include "log.h" | 13 | #include "log.h" |
14 | #include "sway/container.h" | 14 | #include "sway/tree/container.h" |
15 | #include "sway/input/input-manager.h" | 15 | #include "sway/input/input-manager.h" |
16 | #include "sway/input/seat.h" | 16 | #include "sway/input/seat.h" |
17 | #include "sway/layers.h" | 17 | #include "sway/layers.h" |
18 | #include "sway/layout.h" | 18 | #include "sway/tree/layout.h" |
19 | #include "sway/output.h" | 19 | #include "sway/output.h" |
20 | #include "sway/server.h" | 20 | #include "sway/server.h" |
21 | #include "sway/view.h" | 21 | #include "sway/tree/view.h" |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Rotate a child's position relative to a parent. The parent size is (pw, ph), | 24 | * Rotate a child's position relative to a parent. The parent size is (pw, ph), |
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c index 0356aa81..bb97fad4 100644 --- a/sway/desktop/wl_shell.c +++ b/sway/desktop/wl_shell.c | |||
@@ -3,10 +3,10 @@ | |||
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <wayland-server.h> | 4 | #include <wayland-server.h> |
5 | #include <wlr/types/wlr_wl_shell.h> | 5 | #include <wlr/types/wlr_wl_shell.h> |
6 | #include "sway/container.h" | 6 | #include "sway/tree/container.h" |
7 | #include "sway/layout.h" | 7 | #include "sway/tree/layout.h" |
8 | #include "sway/server.h" | 8 | #include "sway/server.h" |
9 | #include "sway/view.h" | 9 | #include "sway/tree/view.h" |
10 | #include "sway/input/seat.h" | 10 | #include "sway/input/seat.h" |
11 | #include "sway/input/input-manager.h" | 11 | #include "sway/input/input-manager.h" |
12 | #include "log.h" | 12 | #include "log.h" |
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 7bc17149..25ffacbb 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -3,10 +3,10 @@ | |||
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <wayland-server.h> | 4 | #include <wayland-server.h> |
5 | #include <wlr/types/wlr_xdg_shell_v6.h> | 5 | #include <wlr/types/wlr_xdg_shell_v6.h> |
6 | #include "sway/container.h" | 6 | #include "sway/tree/container.h" |
7 | #include "sway/layout.h" | 7 | #include "sway/tree/layout.h" |
8 | #include "sway/server.h" | 8 | #include "sway/server.h" |
9 | #include "sway/view.h" | 9 | #include "sway/tree/view.h" |
10 | #include "sway/input/seat.h" | 10 | #include "sway/input/seat.h" |
11 | #include "sway/input/input-manager.h" | 11 | #include "sway/input/input-manager.h" |
12 | #include "log.h" | 12 | #include "log.h" |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index f9b5242b..7f66f746 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -5,10 +5,10 @@ | |||
5 | #include <wlr/xwayland.h> | 5 | #include <wlr/xwayland.h> |
6 | #include <wlr/types/wlr_output_layout.h> | 6 | #include <wlr/types/wlr_output_layout.h> |
7 | #include <wlr/types/wlr_output.h> | 7 | #include <wlr/types/wlr_output.h> |
8 | #include "sway/container.h" | 8 | #include "sway/tree/container.h" |
9 | #include "sway/layout.h" | 9 | #include "sway/tree/layout.h" |
10 | #include "sway/server.h" | 10 | #include "sway/server.h" |
11 | #include "sway/view.h" | 11 | #include "sway/tree/view.h" |
12 | #include "sway/output.h" | 12 | #include "sway/output.h" |
13 | #include "sway/input/seat.h" | 13 | #include "sway/input/seat.h" |
14 | #include "sway/input/input-manager.h" | 14 | #include "sway/input/input-manager.h" |
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 8a0d1df5..c0e14265 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <wlr/types/wlr_cursor.h> | 7 | #include <wlr/types/wlr_cursor.h> |
8 | #include <wlr/types/wlr_xcursor_manager.h> | 8 | #include <wlr/types/wlr_xcursor_manager.h> |
9 | #include "sway/input/cursor.h" | 9 | #include "sway/input/cursor.h" |
10 | #include "sway/view.h" | 10 | #include "sway/tree/view.h" |
11 | #include "list.h" | 11 | #include "list.h" |
12 | #include "log.h" | 12 | #include "log.h" |
13 | 13 | ||
diff --git a/sway/input/seat.c b/sway/input/seat.c index 648e7914..56b39766 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -1,13 +1,13 @@ | |||
1 | #define _XOPEN_SOURCE 700 | 1 | #define _XOPEN_SOURCE 700 |
2 | #include <wlr/types/wlr_cursor.h> | 2 | #include <wlr/types/wlr_cursor.h> |
3 | #include <wlr/types/wlr_xcursor_manager.h> | 3 | #include <wlr/types/wlr_xcursor_manager.h> |
4 | #include "sway/container.h" | 4 | #include "sway/tree/container.h" |
5 | #include "sway/input/seat.h" | 5 | #include "sway/input/seat.h" |
6 | #include "sway/input/cursor.h" | 6 | #include "sway/input/cursor.h" |
7 | #include "sway/input/input-manager.h" | 7 | #include "sway/input/input-manager.h" |
8 | #include "sway/input/keyboard.h" | 8 | #include "sway/input/keyboard.h" |
9 | #include "sway/output.h" | 9 | #include "sway/output.h" |
10 | #include "sway/view.h" | 10 | #include "sway/tree/view.h" |
11 | #include "log.h" | 11 | #include "log.h" |
12 | 12 | ||
13 | static void seat_device_destroy(struct sway_seat_device *seat_device) { | 13 | static void seat_device_destroy(struct sway_seat_device *seat_device) { |
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 977f1ecb..ebd5e43a 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -3,7 +3,7 @@ | |||
3 | #include <ctype.h> | 3 | #include <ctype.h> |
4 | #include "log.h" | 4 | #include "log.h" |
5 | #include "sway/ipc-json.h" | 5 | #include "sway/ipc-json.h" |
6 | #include "sway/container.h" | 6 | #include "sway/tree/container.h" |
7 | #include "sway/output.h" | 7 | #include "sway/output.h" |
8 | #include "sway/input/input-manager.h" | 8 | #include "sway/input/input-manager.h" |
9 | #include "sway/input/seat.h" | 9 | #include "sway/input/seat.h" |
diff --git a/sway/main.c b/sway/main.c index f2f24be3..31bf617b 100644 --- a/sway/main.c +++ b/sway/main.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <wlr/util/log.h> | 18 | #include <wlr/util/log.h> |
19 | #include "sway/config.h" | 19 | #include "sway/config.h" |
20 | #include "sway/server.h" | 20 | #include "sway/server.h" |
21 | #include "sway/layout.h" | 21 | #include "sway/tree/layout.h" |
22 | #include "sway/ipc-server.h" | 22 | #include "sway/ipc-server.h" |
23 | #include "ipc-client.h" | 23 | #include "ipc-client.h" |
24 | #include "readline.h" | 24 | #include "readline.h" |
diff --git a/sway/tree/container.c b/sway/tree/container.c index bbafe9ec..805d5644 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -7,14 +7,14 @@ | |||
7 | #include <wlr/types/wlr_output_layout.h> | 7 | #include <wlr/types/wlr_output_layout.h> |
8 | #include <wlr/types/wlr_wl_shell.h> | 8 | #include <wlr/types/wlr_wl_shell.h> |
9 | #include "sway/config.h" | 9 | #include "sway/config.h" |
10 | #include "sway/container.h" | 10 | #include "sway/tree/container.h" |
11 | #include "sway/input/input-manager.h" | 11 | #include "sway/input/input-manager.h" |
12 | #include "sway/input/seat.h" | 12 | #include "sway/input/seat.h" |
13 | #include "sway/layout.h" | 13 | #include "sway/tree/layout.h" |
14 | #include "sway/output.h" | 14 | #include "sway/output.h" |
15 | #include "sway/server.h" | 15 | #include "sway/server.h" |
16 | #include "sway/view.h" | 16 | #include "sway/tree/view.h" |
17 | #include "sway/workspace.h" | 17 | #include "sway/tree/workspace.h" |
18 | #include "sway/ipc-server.h" | 18 | #include "sway/ipc-server.h" |
19 | #include "log.h" | 19 | #include "log.h" |
20 | 20 | ||
@@ -82,8 +82,6 @@ static swayc_t *new_swayc(enum swayc_types type) { | |||
82 | c->layout = L_NONE; | 82 | c->layout = L_NONE; |
83 | c->workspace_layout = L_NONE; | 83 | c->workspace_layout = L_NONE; |
84 | c->type = type; | 84 | c->type = type; |
85 | c->nb_master = 1; | ||
86 | c->nb_slave_groups = 1; | ||
87 | if (type != C_VIEW) { | 85 | if (type != C_VIEW) { |
88 | c->children = create_list(); | 86 | c->children = create_list(); |
89 | } | 87 | } |
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index de9e7b58..5a15f3a2 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -6,10 +6,10 @@ | |||
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <wlr/types/wlr_output.h> | 7 | #include <wlr/types/wlr_output.h> |
8 | #include <wlr/types/wlr_output_layout.h> | 8 | #include <wlr/types/wlr_output_layout.h> |
9 | #include "sway/container.h" | 9 | #include "sway/tree/container.h" |
10 | #include "sway/layout.h" | 10 | #include "sway/tree/layout.h" |
11 | #include "sway/output.h" | 11 | #include "sway/output.h" |
12 | #include "sway/view.h" | 12 | #include "sway/tree/view.h" |
13 | #include "sway/input/seat.h" | 13 | #include "sway/input/seat.h" |
14 | #include "list.h" | 14 | #include "list.h" |
15 | #include "log.h" | 15 | #include "log.h" |
diff --git a/sway/tree/view.c b/sway/tree/view.c index 9499adca..20e657a2 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -1,8 +1,8 @@ | |||
1 | #include <wayland-server.h> | 1 | #include <wayland-server.h> |
2 | #include <wlr/types/wlr_output_layout.h> | 2 | #include <wlr/types/wlr_output_layout.h> |
3 | #include "sway/container.h" | 3 | #include "sway/tree/container.h" |
4 | #include "sway/layout.h" | 4 | #include "sway/tree/layout.h" |
5 | #include "sway/view.h" | 5 | #include "sway/tree/view.h" |
6 | 6 | ||
7 | const char *view_get_title(struct sway_view *view) { | 7 | const char *view_get_title(struct sway_view *view) { |
8 | if (view->iface.get_prop) { | 8 | if (view->iface.get_prop) { |
@@ -45,6 +45,7 @@ void view_set_size(struct sway_view *view, int width, int height) { | |||
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | // TODO make view coordinates | ||
48 | void view_set_position(struct sway_view *view, double ox, double oy) { | 49 | void view_set_position(struct sway_view *view, double ox, double oy) { |
49 | if (view->iface.set_position) { | 50 | if (view->iface.set_position) { |
50 | struct wlr_box box = { | 51 | struct wlr_box box = { |
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 861fda4d..3da3fde6 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -3,10 +3,10 @@ | |||
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <stdio.h> | 4 | #include <stdio.h> |
5 | #include <strings.h> | 5 | #include <strings.h> |
6 | #include "sway/container.h" | 6 | #include "sway/tree/container.h" |
7 | #include "sway/input/input-manager.h" | 7 | #include "sway/input/input-manager.h" |
8 | #include "sway/input/seat.h" | 8 | #include "sway/input/seat.h" |
9 | #include "sway/workspace.h" | 9 | #include "sway/tree/workspace.h" |
10 | #include "log.h" | 10 | #include "log.h" |
11 | #include "util.h" | 11 | #include "util.h" |
12 | 12 | ||