diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-25 12:09:42 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-25 12:09:42 +1000 |
commit | f4bc25bcc6c822e264938447940b7d75fa84319b (patch) | |
tree | b04befcfad9b7c679b1dec388d168901fc5daf86 /include | |
parent | e86d99acd655815781cd2e23877ce58ab5b24826 (diff) |
Relocate container_move, container_move_to and container_get_in_direction
* container_move is only called from the move command
* container_move_to was called from both the move command and the sticky
command, but the sticky command can easily not call it
* container_get_in_direction is only called from the focus command
Moving these functions to their respective commands gives better
separation of code and removes bloat from layout.c. These functions will
need to be refactored to take advantage of type safety, so separating
them will make this easier to refactor.
The following static functions have also been moved:
* is_parellel
* invert_movement
* move_offs
* container_limit
* workspace_rejigger
* move_out_of_tabs_stacks
* get_swayc_in_output_direction
They were all used by the move functions, except for the last one which
is used by focus.
Other changes:
* index_child has been renamed to container_sibling_index, moved to
container.c and made public
* sway_output_from_wlr has been renamed to output_from_wlr_output, moved
to output.c and made public
* container_handle_fullscreen_reparent has been made public
* sway_dir_to_wlr has been made public
No changes have been made to any of the moved functions, other than
updating calls to functions that have been renamed.
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/output.h | 2 | ||||
-rw-r--r-- | include/sway/tree/container.h | 2 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 15 |
3 files changed, 11 insertions, 8 deletions
diff --git a/include/sway/output.h b/include/sway/output.h index 098540fb..651fdfe7 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -45,6 +45,8 @@ void output_destroy(struct sway_container *output); void output_begin_destroy(struct sway_container *output); +struct sway_container *output_from_wlr_output(struct wlr_output *output); + typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, struct wlr_surface *surface, struct wlr_box *box, float rotation, void *user_data); diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 2cb23d3c..2cedb613 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -335,4 +335,6 @@ struct sway_output *container_get_effective_output(struct sway_container *con); void container_discover_outputs(struct sway_container *con); +int container_sibling_index(const struct sway_container *child); + #endif diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h index 519189d9..5c834ad2 100644 --- a/include/sway/tree/layout.h +++ b/include/sway/tree/layout.h @@ -19,9 +19,15 @@ enum wlr_edges; struct sway_container; +void container_handle_fullscreen_reparent(struct sway_container *con, + struct sway_container *old_parent); + void container_add_child(struct sway_container *parent, struct sway_container *child); +void container_insert_child(struct sway_container *parent, + struct sway_container *child, int i); + struct sway_container *container_add_sibling(struct sway_container *parent, struct sway_container *child); @@ -30,18 +36,11 @@ struct sway_container *container_remove_child(struct sway_container *child); struct sway_container *container_replace_child(struct sway_container *child, struct sway_container *new_child); -void container_move_to(struct sway_container* container, - struct sway_container* destination); - -void container_move(struct sway_container *container, - enum movement_direction dir, int move_amt); +bool sway_dir_to_wlr(enum movement_direction dir, enum wlr_direction *out); enum sway_container_layout container_get_default_layout( struct sway_container *con); -struct sway_container *container_get_in_direction(struct sway_container - *container, struct sway_seat *seat, enum movement_direction dir); - struct sway_container *container_split(struct sway_container *child, enum sway_container_layout layout); |