diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/container.h | 10 | ||||
-rw-r--r-- | include/sway/input/seat.h | 21 | ||||
-rw-r--r-- | include/sway/layout.h | 20 | ||||
-rw-r--r-- | include/sway/workspace.h | 10 |
4 files changed, 51 insertions, 10 deletions
diff --git a/include/sway/container.h b/include/sway/container.h index 0c66932d..48363be6 100644 --- a/include/sway/container.h +++ b/include/sway/container.h | |||
@@ -106,10 +106,6 @@ struct sway_container { | |||
106 | * The parent of this container. NULL for the root container. | 106 | * The parent of this container. NULL for the root container. |
107 | */ | 107 | */ |
108 | struct sway_container *parent; | 108 | struct sway_container *parent; |
109 | /** | ||
110 | * Which of this container's children has focus. | ||
111 | */ | ||
112 | struct sway_container *focused; | ||
113 | 109 | ||
114 | /** | 110 | /** |
115 | * Number of master views in auto layouts. | 111 | * Number of master views in auto layouts. |
@@ -162,4 +158,10 @@ void container_map(swayc_t *container, | |||
162 | swayc_t *swayc_at(swayc_t *parent, double lx, double ly, | 158 | swayc_t *swayc_at(swayc_t *parent, double lx, double ly, |
163 | struct wlr_surface **surface, double *sx, double *sy); | 159 | struct wlr_surface **surface, double *sx, double *sy); |
164 | 160 | ||
161 | /** | ||
162 | * Apply the function for each child of the container breadth first. | ||
163 | */ | ||
164 | void container_for_each_bfs(swayc_t *con, void (*f)(swayc_t *con, void *data), | ||
165 | void *data); | ||
166 | |||
165 | #endif | 167 | #endif |
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index b21cbccb..f9244f43 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -12,14 +12,26 @@ struct sway_seat_device { | |||
12 | struct wl_list link; // sway_seat::devices | 12 | struct wl_list link; // sway_seat::devices |
13 | }; | 13 | }; |
14 | 14 | ||
15 | struct sway_seat_container { | ||
16 | struct sway_seat *seat; | ||
17 | swayc_t *container; | ||
18 | |||
19 | struct wl_list link; // sway_seat::focus_stack | ||
20 | |||
21 | struct wl_listener destroy; | ||
22 | }; | ||
23 | |||
15 | struct sway_seat { | 24 | struct sway_seat { |
16 | struct wlr_seat *wlr_seat; | 25 | struct wlr_seat *wlr_seat; |
17 | struct seat_config *config; | 26 | struct seat_config *config; |
18 | struct sway_cursor *cursor; | 27 | struct sway_cursor *cursor; |
19 | struct sway_input_manager *input; | 28 | struct sway_input_manager *input; |
20 | swayc_t *focus; | 29 | |
30 | bool has_focus; | ||
31 | struct wl_list focus_stack; // list of containers in focus order | ||
21 | 32 | ||
22 | struct wl_listener focus_destroy; | 33 | struct wl_listener focus_destroy; |
34 | struct wl_listener new_container; | ||
23 | 35 | ||
24 | struct wl_list devices; // sway_seat_device::link | 36 | struct wl_list devices; // sway_seat_device::link |
25 | 37 | ||
@@ -44,6 +56,13 @@ void sway_seat_configure_xcursor(struct sway_seat *seat); | |||
44 | 56 | ||
45 | void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container); | 57 | void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container); |
46 | 58 | ||
59 | swayc_t *sway_seat_get_focus(struct sway_seat *seat); | ||
60 | |||
61 | swayc_t *sway_seat_get_focus_inactive(struct sway_seat *seat, swayc_t *container); | ||
62 | |||
63 | swayc_t *sway_seat_get_focus_by_type(struct sway_seat *seat, | ||
64 | enum swayc_types type); | ||
65 | |||
47 | void sway_seat_set_config(struct sway_seat *seat, struct seat_config *seat_config); | 66 | void sway_seat_set_config(struct sway_seat *seat, struct seat_config *seat_config); |
48 | 67 | ||
49 | #endif | 68 | #endif |
diff --git a/include/sway/layout.h b/include/sway/layout.h index af561453..e82c4442 100644 --- a/include/sway/layout.h +++ b/include/sway/layout.h | |||
@@ -2,6 +2,19 @@ | |||
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" | ||
6 | |||
7 | enum movement_direction { | ||
8 | MOVE_LEFT, | ||
9 | MOVE_RIGHT, | ||
10 | MOVE_UP, | ||
11 | MOVE_DOWN, | ||
12 | MOVE_PARENT, | ||
13 | MOVE_CHILD, | ||
14 | MOVE_NEXT, | ||
15 | MOVE_PREV, | ||
16 | MOVE_FIRST | ||
17 | }; | ||
5 | 18 | ||
6 | struct sway_container; | 19 | struct sway_container; |
7 | 20 | ||
@@ -11,13 +24,20 @@ struct sway_root { | |||
11 | struct wl_listener output_layout_change; | 24 | struct wl_listener output_layout_change; |
12 | 25 | ||
13 | struct wl_list unmanaged_views; // sway_view::unmanaged_view_link | 26 | struct wl_list unmanaged_views; // sway_view::unmanaged_view_link |
27 | |||
28 | struct { | ||
29 | struct wl_signal new_container; | ||
30 | } events; | ||
14 | }; | 31 | }; |
15 | 32 | ||
16 | void init_layout(void); | 33 | void init_layout(void); |
17 | void add_child(struct sway_container *parent, struct sway_container *child); | 34 | void add_child(struct sway_container *parent, struct sway_container *child); |
35 | swayc_t *add_sibling(swayc_t *parent, swayc_t *child); | ||
18 | struct sway_container *remove_child(struct sway_container *child); | 36 | struct sway_container *remove_child(struct sway_container *child); |
19 | enum swayc_layouts default_layout(struct sway_container *output); | 37 | enum swayc_layouts default_layout(struct sway_container *output); |
20 | void sort_workspaces(struct sway_container *output); | 38 | void sort_workspaces(struct sway_container *output); |
21 | void arrange_windows(struct sway_container *container, double width, double height); | 39 | void arrange_windows(struct sway_container *container, double width, double height); |
40 | swayc_t *get_swayc_in_direction(swayc_t *container, | ||
41 | struct sway_seat *seat, enum movement_direction dir); | ||
22 | 42 | ||
23 | #endif | 43 | #endif |
diff --git a/include/sway/workspace.h b/include/sway/workspace.h index 30bbdaa8..ca6f9bdb 100644 --- a/include/sway/workspace.h +++ b/include/sway/workspace.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _SWAY_WORKSPACE_H | 1 | #ifndef _SWAY_WORKSPACE_H |
2 | #define _SWAY_WORKSPACE_H | 2 | #define _SWAY_WORKSPACE_H |
3 | 3 | ||
4 | struct sway_container; | 4 | #include <sway/container.h> |
5 | 5 | ||
6 | extern char *prev_workspace_name; | 6 | extern char *prev_workspace_name; |
7 | 7 | ||
@@ -12,9 +12,9 @@ bool workspace_switch(swayc_t *workspace); | |||
12 | struct sway_container *workspace_by_number(const char* name); | 12 | struct sway_container *workspace_by_number(const char* name); |
13 | swayc_t *workspace_by_name(const char*); | 13 | swayc_t *workspace_by_name(const char*); |
14 | 14 | ||
15 | struct sway_container *workspace_output_next(struct sway_container *current); | 15 | struct sway_container *workspace_output_next(swayc_t *current); |
16 | struct sway_container *workspace_next(struct sway_container *current); | 16 | struct sway_container *workspace_next(swayc_t *current); |
17 | struct sway_container *workspace_output_prev(struct sway_container *current); | 17 | struct sway_container *workspace_output_prev(swayc_t *current); |
18 | struct sway_container *workspace_prev(struct sway_container *current); | 18 | struct sway_container *workspace_prev(swayc_t *current); |
19 | 19 | ||
20 | #endif | 20 | #endif |