Skip to content

Commit

Permalink
Merge upstream (#1)
Browse files Browse the repository at this point in the history
* swaymsg: fix floating_nodes being ignored

Fix floating_nodes being ignored in pretty_print_tree.

* ipc: make get_deco_rect check config->hide_lone_tab

Without this, the `IPC_GET_TREE` ipc call would return false information
about the container's `deco_rect` and `rect` properties if
`hide_edge_borders --i3` was in effect.

Co-authored-by: llyyr <[email protected]>
Co-authored-by: Baltazár Radics <[email protected]>
  • Loading branch information
3 people authored Jul 27, 2022
1 parent e39e6d8 commit d0e71a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sway/ipc-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,9 @@ static void ipc_json_describe_workspace(struct sway_workspace *workspace,

static void get_deco_rect(struct sway_container *c, struct wlr_box *deco_rect) {
enum sway_container_layout parent_layout = container_parent_layout(c);
bool tab_or_stack = parent_layout == L_TABBED || parent_layout == L_STACKED;
list_t *siblings = container_get_siblings(c);
bool tab_or_stack = (parent_layout == L_TABBED || parent_layout == L_STACKED)
&& ((siblings && siblings->length > 1) || !config->hide_lone_tab);
if (((!tab_or_stack || container_is_floating(c)) &&
c->current.border != B_NORMAL) ||
c->pending.fullscreen_mode != FULLSCREEN_NONE ||
Expand Down
9 changes: 9 additions & 0 deletions swaymsg/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,15 @@ static void pretty_print_tree(json_object *obj, int indent) {
for (size_t i = 0; i < len; i++) {
pretty_print_tree(json_object_array_get_idx(nodes_obj, i), indent + 1);
}

json_object *floating_nodes_obj;
json_bool floating_nodes = json_object_object_get_ex(obj, "floating_nodes", &floating_nodes_obj);
if (floating_nodes) {
size_t len = json_object_array_length(floating_nodes_obj);
for (size_t i = 0; i < len; i++) {
pretty_print_tree(json_object_array_get_idx(floating_nodes_obj, i), indent + 1);
}
}
}

static void pretty_print(int type, json_object *resp) {
Expand Down

0 comments on commit d0e71a2

Please sign in to comment.