From 8bb40c24c7b045df0d43e9f22c096d1473f6f9f6 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 11 Sep 2018 21:34:21 +1000 Subject: Implement tiling drag Hold floating_modifier and drag a tiling view to a new location. --- sway/tree/workspace.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sway/tree/workspace.c') diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index b8e90892..d4b57a0f 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -694,3 +694,16 @@ void workspace_get_box(struct sway_workspace *workspace, struct wlr_box *box) { box->width = workspace->width; box->height = workspace->height; } + +static void count_tiling_views(struct sway_container *con, void *data) { + if (con->view && !container_is_floating_or_child(con)) { + size_t *count = data; + *count += 1; + } +} + +size_t workspace_num_tiling_views(struct sway_workspace *ws) { + size_t count = 0; + workspace_for_each_container(ws, count_tiling_views, &count); + return count; +} -- cgit v1.2.3 From df95c61044c37b511922db03eb5bd868b374e9d4 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 11 Sep 2018 23:38:17 +1000 Subject: Fix crash in workspace_wrap_children When workspace_wrap_children is called on a workspace which has a fullscreen child and the fullscreen child is a direct child of the workspace, sway would crash. The workspace's fullscreen pointer is unset when the fullscreen container is detached and applied again when added to a parent, but in this case the parent hadn't yet been added to the workspace which meant con->workspace was NULL. The fix makes container_handle_fullscreen_reparent return if there's no workspace, and the fullscreen pointer is reapplied in workspace_wrap_children. --- sway/tree/container.c | 3 ++- sway/tree/workspace.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'sway/tree/workspace.c') diff --git a/sway/tree/container.c b/sway/tree/container.c index ff10c1ab..21a0cd76 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -1063,7 +1063,8 @@ list_t *container_get_current_siblings(struct sway_container *container) { } void container_handle_fullscreen_reparent(struct sway_container *con) { - if (!con->is_fullscreen || con->workspace->fullscreen == con) { + if (!con->is_fullscreen || !con->workspace || + con->workspace->fullscreen == con) { return; } if (con->workspace->fullscreen) { diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index d4b57a0f..18746430 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -557,6 +557,7 @@ struct sway_container *workspace_find_container(struct sway_workspace *ws, } struct sway_container *workspace_wrap_children(struct sway_workspace *ws) { + struct sway_container *fs = ws->fullscreen; struct sway_container *middle = container_create(NULL); middle->layout = ws->layout; while (ws->tiling->length) { @@ -565,6 +566,7 @@ struct sway_container *workspace_wrap_children(struct sway_workspace *ws) { container_add_child(middle, child); } workspace_add_tiling(ws, middle); + ws->fullscreen = fs; return middle; } -- cgit v1.2.3