diff options
Diffstat (limited to 'include/sway')
-rw-r--r-- | include/sway/commands.h | 1 | ||||
-rw-r--r-- | include/sway/criteria.h | 9 | ||||
-rw-r--r-- | include/sway/debug.h | 23 | ||||
-rw-r--r-- | include/sway/desktop.h | 5 | ||||
-rw-r--r-- | include/sway/input/seat.h | 23 | ||||
-rw-r--r-- | include/sway/output.h | 14 | ||||
-rw-r--r-- | include/sway/server.h | 3 | ||||
-rw-r--r-- | include/sway/tree/container.h | 33 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 12 | ||||
-rw-r--r-- | include/sway/tree/root.h | 15 | ||||
-rw-r--r-- | include/sway/tree/view.h | 11 | ||||
-rw-r--r-- | include/sway/tree/workspace.h | 18 |
12 files changed, 111 insertions, 56 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index 545b21e6..8e91c158 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -136,6 +136,7 @@ sway_cmd cmd_mark; sway_cmd cmd_mode; sway_cmd cmd_mouse_warping; sway_cmd cmd_move; +sway_cmd cmd_nop; sway_cmd cmd_opacity; sway_cmd cmd_new_float; sway_cmd cmd_new_window; diff --git a/include/sway/criteria.h b/include/sway/criteria.h index b4ff7d49..7a1e547b 100644 --- a/include/sway/criteria.h +++ b/include/sway/criteria.h @@ -7,10 +7,11 @@ #include "tree/view.h" enum criteria_type { - CT_COMMAND = 1 << 0, - CT_ASSIGN_OUTPUT = 1 << 1, - CT_ASSIGN_WORKSPACE = 1 << 2, - CT_NO_FOCUS = 1 << 3, + CT_COMMAND = 1 << 0, + CT_ASSIGN_OUTPUT = 1 << 1, + CT_ASSIGN_WORKSPACE = 1 << 2, + CT_ASSIGN_WORKSPACE_NUMBER = 1 << 3, + CT_NO_FOCUS = 1 << 4, }; struct criteria { 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/desktop.h b/include/sway/desktop.h index 348fb187..c969a76b 100644 --- a/include/sway/desktop.h +++ b/include/sway/desktop.h @@ -1,8 +1,13 @@ #include <wlr/types/wlr_surface.h> struct sway_container; +struct sway_view; void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly, bool whole); void desktop_damage_whole_container(struct sway_container *con); + +void desktop_damage_box(struct wlr_box *box); + +void desktop_damage_view(struct sway_view *view); diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index eb4202f3..5c404ecd 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h @@ -35,6 +35,14 @@ struct sway_drag_icon { struct wl_listener destroy; }; +enum sway_seat_operation { + OP_NONE, + OP_DOWN, + OP_MOVE, + OP_RESIZE_FLOATING, + OP_RESIZE_TILING, +}; + struct sway_seat { struct wlr_seat *wlr_seat; struct sway_cursor *cursor; @@ -54,13 +62,7 @@ struct sway_seat { double touch_x, touch_y; // Operations (drag and resize) - enum { - OP_NONE, - OP_MOVE, - OP_RESIZE_FLOATING, - OP_RESIZE_TILING, - } operation; - + enum sway_seat_operation operation; struct sway_container *op_container; enum wlr_edges op_resize_edge; uint32_t op_button; @@ -68,6 +70,7 @@ struct sway_seat { double op_ref_lx, op_ref_ly; // cursor's x/y at start of op double op_ref_width, op_ref_height; // container's size at start of op double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op + bool op_moved; // if the mouse moved during a down op uint32_t last_button; uint32_t last_button_serial; @@ -157,6 +160,9 @@ bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); void drag_icon_update_position(struct sway_drag_icon *icon); +void seat_begin_down(struct sway_seat *seat, struct sway_container *con, + uint32_t button, double sx, double sy); + void seat_begin_move(struct sway_seat *seat, struct sway_container *con, uint32_t button); @@ -166,6 +172,9 @@ void seat_begin_resize_floating(struct sway_seat *seat, void seat_begin_resize_tiling(struct sway_seat *seat, struct sway_container *con, uint32_t button, enum wlr_edges edge); +struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, + struct sway_container *container); + void seat_end_mouse_operation(struct sway_seat *seat); void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, diff --git a/include/sway/output.h b/include/sway/output.h index 80dcd37b..d0d034b3 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -58,6 +58,8 @@ void output_damage_whole_container(struct sway_output *output, struct sway_container *output_by_name(const char *name); +void output_sort_workspaces(struct sway_container *output); + void output_enable(struct sway_output *output); bool output_has_opaque_overlay_layer_surface(struct sway_output *output); @@ -93,4 +95,16 @@ void output_drag_icons_for_each_surface(struct sway_output *output, struct wl_list *drag_icons, sway_surface_iterator_func_t iterator, void *user_data); +void output_for_each_workspace(struct sway_container *output, + void (*f)(struct sway_container *con, void *data), void *data); + +void output_for_each_container(struct sway_container *output, + void (*f)(struct sway_container *con, void *data), void *data); + +struct sway_container *output_find_workspace(struct sway_container *output, + bool (*test)(struct sway_container *con, void *data), void *data); + +struct sway_container *output_find_container(struct sway_container *output, + bool (*test)(struct sway_container *con, void *data), void *data); + #endif 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/container.h b/include/sway/tree/container.h index b64a2e63..cd886cd0 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -40,7 +40,6 @@ enum sway_container_layout { L_VERT, L_STACKED, L_TABBED, - L_FLOATING, }; enum sway_container_border { @@ -83,10 +82,11 @@ struct sway_container_state { bool border_bottom; bool border_left; bool border_right; + bool using_csd; // Workspace properties struct sway_container *ws_fullscreen; - struct sway_container *ws_floating; + list_t *ws_floating; }; struct sway_container { @@ -138,6 +138,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,12 +169,7 @@ 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); @@ -213,15 +211,11 @@ struct sway_container *container_destroy(struct sway_container *container); struct sway_container *container_close(struct sway_container *container); -void container_descendants(struct sway_container *root, - enum sway_container_type type, - void (*func)(struct sway_container *item, void *data), void *data); - /** * Search a container's descendants a container based on test criteria. Returns * the first container that passes the test. */ -struct sway_container *container_find(struct sway_container *container, +struct sway_container *container_find_child(struct sway_container *container, bool (*test)(struct sway_container *view, void *data), void *data); /** @@ -243,10 +237,7 @@ struct sway_container *tiling_container_at( struct sway_container *con, double lx, double ly, struct wlr_surface **surface, double *sx, double *sy); -/** - * Apply the function for each child of the container depth first. - */ -void container_for_each_descendant(struct sway_container *container, +void container_for_each_child(struct sway_container *container, void (*f)(struct sway_container *container, void *data), void *data); /** @@ -361,11 +352,11 @@ bool container_is_floating_or_child(struct sway_container *container); bool container_is_fullscreen_or_child(struct sway_container *container); /** - * Wrap the children of parent in a new container. The new container will be the - * only child of parent. - * - * The new container is returned. + * Return the output which will be used for scale purposes. + * This is the most recently entered output. */ -struct sway_container *container_wrap_children(struct sway_container *parent); +struct sway_output *container_get_effective_output(struct sway_container *con); + +void container_discover_outputs(struct sway_container *con); #endif diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h index 77cd954b..519189d9 100644 --- a/include/sway/tree/layout.h +++ b/include/sway/tree/layout.h @@ -15,13 +15,7 @@ enum movement_direction { 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, -}; +enum wlr_edges; struct sway_container; @@ -45,8 +39,6 @@ void container_move(struct sway_container *container, enum sway_container_layout container_get_default_layout( struct sway_container *con); -void container_sort_workspaces(struct sway_container *output); - struct sway_container *container_get_in_direction(struct sway_container *container, struct sway_seat *seat, enum movement_direction dir); @@ -54,7 +46,7 @@ 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); + double amount, enum wlr_edges edge); void container_swap(struct sway_container *con1, struct sway_container *con2); diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index edb7c817..d1f04a96 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h @@ -58,4 +58,19 @@ struct sway_container *root_workspace_for_pid(pid_t pid); void root_record_workspace_pid(pid_t pid); +void root_for_each_workspace(void (*f)(struct sway_container *con, void *data), + void *data); + +void root_for_each_container(void (*f)(struct sway_container *con, void *data), + void *data); + +struct sway_container *root_find_output( + bool (*test)(struct sway_container *con, void *data), void *data); + +struct sway_container *root_find_workspace( + bool (*test)(struct sway_container *con, void *data), void *data); + +struct sway_container *root_find_container( + bool (*test)(struct sway_container *con, void *data), void *data); + #endif diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index c2225bcb..5fdecc2b 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -88,6 +88,14 @@ struct sway_view { struct wlr_buffer *saved_buffer; int saved_buffer_width, saved_buffer_height; + // The geometry for whatever the client is committing, regardless of + // transaction state. Updated on every commit. + struct wlr_box geometry; + + // The "old" geometry during a transaction. Used to damage the old location + // when a transaction is applied. + struct wlr_box saved_geometry; + bool destroying; list_t *executed_criteria; // struct criteria * @@ -112,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,8 +292,6 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface); void view_unmap(struct sway_view *view); -void view_update_position(struct sway_view *view, double lx, double ly); - void view_update_size(struct sway_view *view, int width, int height); void view_child_init(struct sway_view_child *child, diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index 056f2329..35c91017 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h @@ -9,7 +9,7 @@ struct sway_view; struct sway_workspace { struct sway_container *swayc; struct sway_container *fullscreen; - struct sway_container *floating; + list_t *floating; // struct sway_container list_t *output_priority; bool urgent; }; @@ -50,4 +50,20 @@ struct sway_container *workspace_output_get_highest_available( void workspace_detect_urgent(struct sway_container *workspace); +void workspace_for_each_container(struct sway_container *ws, + void (*f)(struct sway_container *con, void *data), void *data); + +struct sway_container *workspace_find_container(struct sway_container *ws, + bool (*test)(struct sway_container *con, void *data), void *data); + +/** + * Wrap the workspace's tiling children in a new container. + * The new container will be the only direct tiling child of the workspace. + * The new container is returned. + */ +struct sway_container *workspace_wrap_children(struct sway_container *ws); + +void workspace_add_floating(struct sway_container *workspace, + struct sway_container *con); + #endif |