diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/config.h | 2 | ||||
-rw-r--r-- | include/sway/debug.h | 23 | ||||
-rw-r--r-- | include/sway/output.h | 8 | ||||
-rw-r--r-- | include/sway/server.h | 3 | ||||
-rw-r--r-- | include/sway/tree/arrange.h | 6 | ||||
-rw-r--r-- | include/sway/tree/container.h | 80 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 59 | ||||
-rw-r--r-- | include/sway/tree/root.h | 4 | ||||
-rw-r--r-- | include/sway/tree/view.h | 5 | ||||
-rw-r--r-- | include/sway/tree/workspace.h | 13 | ||||
-rw-r--r-- | include/swaynag/swaynag.h | 2 | ||||
-rw-r--r-- | include/util.h | 14 |
12 files changed, 105 insertions, 114 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index c2eaea1b..18d10faa 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -8,8 +8,8 @@ #include <xkbcommon/xkbcommon.h> #include "list.h" #include "swaynag.h" -#include "tree/layout.h" #include "tree/container.h" +#include "sway/tree/root.h" #include "wlr-layer-shell-unstable-v1-protocol.h" // TODO: Refactor this shit diff --git a/include/sway/debug.h b/include/sway/debug.h index 38d4eccd..bf3a5f6d 100644 --- a/include/sway/debug.h +++ b/include/sway/debug.h @@ -1,15 +1,22 @@ #ifndef SWAY_DEBUG_H #define SWAY_DEBUG_H +#include <stdbool.h> -// Tree -extern bool enable_debug_tree; -void update_debug_tree(); +struct sway_debug { + bool noatomic; // Ignore atomic layout updates + bool render_tree; // Render the tree overlay + bool txn_timings; // Log verbose messages about transactions + bool txn_wait; // Always wait for the timeout before applying + + enum { + DAMAGE_DEFAULT, // Default behaviour + DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged + DAMAGE_RERENDER, // Render the full output when any damage occurs + } damage; +}; -// Damage -extern const char *damage_debug; +extern struct sway_debug debug; -// Transactions -extern int txn_timeout_ms; -extern bool txn_debug; +void update_debug_tree(); #endif diff --git a/include/sway/output.h b/include/sway/output.h index d0d034b3..651fdfe7 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -39,6 +39,14 @@ struct sway_output { } events; }; +struct sway_container *output_create(struct sway_output *sway_output); + +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/server.h b/include/sway/server.h index b93584b6..1e20f2c8 100644 --- a/include/sway/server.h +++ b/include/sway/server.h @@ -54,8 +54,7 @@ struct sway_server { struct wl_listener server_decoration; struct wl_list decorations; // sway_server_decoration::link - bool debug_txn_timings; - + size_t txn_timeout_ms; list_t *transactions; list_t *dirty_containers; }; diff --git a/include/sway/tree/arrange.h b/include/sway/tree/arrange.h index d6abcc81..346103d3 100644 --- a/include/sway/tree/arrange.h +++ b/include/sway/tree/arrange.h @@ -4,12 +4,6 @@ struct sway_container; -// Remove gaps around container -void remove_gaps(struct sway_container *c); - -// Add gaps around container -void add_gaps(struct sway_container *c); - /** * Arrange layout for all the children of the given container. */ diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 5eccedc1..e4071cfe 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -53,6 +53,9 @@ struct sway_output; struct sway_workspace; struct sway_view; +enum movement_direction; +enum wlr_direction; + struct sway_container_state { // Container/swayc properties enum sway_container_layout layout; @@ -138,6 +141,9 @@ struct sway_container { struct sway_container *parent; + // Outputs currently being intersected + list_t *outputs; // struct sway_output + // Indicates that the container is a scratchpad container. // Both hidden and visible scratchpad containers have scratchpad=true. // Hidden scratchpad containers have a NULL parent. @@ -166,39 +172,13 @@ struct sway_container { struct { struct wl_signal destroy; - // Raised after the tree updates, but before arrange_windows - // Passed the previous parent - struct wl_signal reparent; } events; - - struct wl_listener reparent; }; struct sway_container *container_create(enum sway_container_type type); const char *container_type_to_str(enum sway_container_type type); -struct sway_container *output_create(struct sway_output *sway_output); - -/** - * Create a new container container. A container container can be a a child of - * a workspace container or another container container. - */ -struct sway_container *container_container_create(); - -/** - * Create a new output. Outputs are children of the root container and have no - * order in the tree structure. - */ -struct sway_container *output_create(struct sway_output *sway_output); - -/** - * Create a new workspace container. Workspaces are children of an output - * container and are ordered alphabetically by name. - */ -struct sway_container *workspace_create(struct sway_container *output, - const char *name); - /* * Create a new view container. A view can be a child of a workspace container * or a container container and are rendered in the order and structure of @@ -207,9 +187,9 @@ struct sway_container *workspace_create(struct sway_container *output, struct sway_container *container_view_create( struct sway_container *sibling, struct sway_view *sway_view); -void container_free(struct sway_container *cont); +void container_destroy(struct sway_container *con); -struct sway_container *container_destroy(struct sway_container *container); +void container_begin_destroy(struct sway_container *con); struct sway_container *container_close(struct sway_container *container); @@ -257,10 +237,7 @@ void container_update_textures_recursive(struct sway_container *con); void container_damage_whole(struct sway_container *container); -bool container_reap_empty(struct sway_container *con); - -struct sway_container *container_reap_empty_recursive( - struct sway_container *con); +struct sway_container *container_reap_empty(struct sway_container *con); struct sway_container *container_flatten(struct sway_container *container); @@ -353,4 +330,43 @@ bool container_is_floating_or_child(struct sway_container *container); */ bool container_is_fullscreen_or_child(struct sway_container *container); +/** + * Return the output which will be used for scale purposes. + * This is the most recently entered output. + */ +struct sway_output *container_get_effective_output(struct sway_container *con); + +void container_discover_outputs(struct sway_container *con); + +void container_remove_gaps(struct sway_container *container); + +void container_add_gaps(struct sway_container *container); + +int container_sibling_index(const struct sway_container *child); + +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); + +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); + +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_split(struct sway_container *child, + enum sway_container_layout layout); + #endif diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h deleted file mode 100644 index 5b803dfe..00000000 --- a/include/sway/tree/layout.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef _SWAY_LAYOUT_H -#define _SWAY_LAYOUT_H -#include <wlr/types/wlr_output_layout.h> -#include <wlr/render/wlr_texture.h> -#include "sway/tree/container.h" -#include "sway/tree/root.h" -#include "config.h" - -enum movement_direction { - MOVE_LEFT, - MOVE_RIGHT, - MOVE_UP, - MOVE_DOWN, - MOVE_PARENT, - MOVE_CHILD, -}; - -enum resize_edge { - RESIZE_EDGE_NONE = 0, - RESIZE_EDGE_LEFT = 1, - RESIZE_EDGE_RIGHT = 2, - RESIZE_EDGE_TOP = 4, - RESIZE_EDGE_BOTTOM = 8, -}; - -struct sway_container; - -void container_add_child(struct sway_container *parent, - struct sway_container *child); - -struct sway_container *container_add_sibling(struct sway_container *parent, - struct sway_container *child); - -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); - -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); - -void container_recursive_resize(struct sway_container *container, - double amount, enum resize_edge edge); - -void container_swap(struct sway_container *con1, struct sway_container *con2); - -#endif diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index d1f04a96..ec6516c9 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h @@ -21,9 +21,11 @@ struct sway_root { struct wlr_texture *debug_tree; - struct wl_list outputs; // sway_output::link + // Includes disabled outputs + struct wl_list all_outputs; // sway_output::link list_t *scratchpad; // struct sway_container + list_t *saved_workspaces; // For when there's no connected outputs struct { struct wl_signal new_container; diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 2747e7c4..f73ce571 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -120,7 +120,6 @@ struct sway_view { } events; struct wl_listener surface_new_subsurface; - struct wl_listener container_reparent; }; struct sway_xdg_shell_v6_view { @@ -285,10 +284,10 @@ void view_for_each_popup(struct sway_view *view, void view_init(struct sway_view *view, enum sway_view_type type, const struct sway_view_impl *impl); -void view_free(struct sway_view *view); - void view_destroy(struct sway_view *view); +void view_begin_destroy(struct sway_view *view); + void view_map(struct sway_view *view, struct wlr_surface *wlr_surface); void view_unmap(struct sway_view *view); diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index 35c91017..04325919 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h @@ -18,6 +18,15 @@ extern char *prev_workspace_name; struct sway_container *workspace_get_initial_output(const char *name); +struct sway_container *workspace_create(struct sway_container *output, + const char *name); + +void workspace_destroy(struct sway_container *workspace); + +void workspace_begin_destroy(struct sway_container *workspace); + +void workspace_consider_destroy(struct sway_container *ws); + char *workspace_next_name(const char *output_name); bool workspace_switch(struct sway_container *workspace, @@ -66,4 +75,8 @@ struct sway_container *workspace_wrap_children(struct sway_container *ws); void workspace_add_floating(struct sway_container *workspace, struct sway_container *con); +void workspace_remove_gaps(struct sway_container *ws); + +void workspace_add_gaps(struct sway_container *ws); + #endif diff --git a/include/swaynag/swaynag.h b/include/swaynag/swaynag.h index 1bf8b640..a32d1503 100644 --- a/include/swaynag/swaynag.h +++ b/include/swaynag/swaynag.h @@ -58,7 +58,7 @@ struct swaynag_details { int offset; int visible_lines; int total_lines; - struct swaynag_button button_details; + struct swaynag_button *button_details; struct swaynag_button button_up; struct swaynag_button button_down; }; diff --git a/include/util.h b/include/util.h index 9277fa6e..46ed1533 100644 --- a/include/util.h +++ b/include/util.h @@ -4,9 +4,19 @@ #include <stdint.h> #include <stdbool.h> #include <unistd.h> -#include <sys/types.h> +#include <sys/types.h> +#include <wlr/types/wlr_output_layout.h> #include <xkbcommon/xkbcommon.h> +enum movement_direction { + MOVE_LEFT, + MOVE_RIGHT, + MOVE_UP, + MOVE_DOWN, + MOVE_PARENT, + MOVE_CHILD, +}; + /** * Wrap i into the range [0, max[ */ @@ -71,4 +81,6 @@ char* resolve_path(const char* path); char *b64_encode(const char* binaryData, size_t len, size_t *flen); unsigned char *b64_decode(const char *ascii, size_t len, size_t *flen); +bool sway_dir_to_wlr(enum movement_direction dir, enum wlr_direction *out); + #endif |