mirror of
https://github.com/swaywm/sway.git
synced 2026-04-29 06:46:22 -04:00
Merge 02638c1f44 into aca9f6b2a2
This commit is contained in:
commit
675bfcbf96
7 changed files with 22 additions and 10 deletions
|
|
@ -141,6 +141,11 @@ enum visibility_mask {
|
|||
VISIBLE = true
|
||||
} visible;
|
||||
|
||||
/**
|
||||
* Whether this con is tabbed or stacked
|
||||
*/
|
||||
bool swayc_is_tabbed_or_stacked(swayc_t *container);
|
||||
|
||||
/**
|
||||
* Allocates a new output container.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ void render_view_borders(wlc_handle view) {
|
|||
// if we are not the only child in the container, always draw borders,
|
||||
// regardless of the border setting on the individual view
|
||||
if (!c || (c->border_type == B_NONE
|
||||
&& !((c->parent->layout == L_TABBED || c->parent->layout == L_STACKED)
|
||||
&& !(swayc_is_tabbed_or_stacked(c->parent)
|
||||
&& c->parent->children->length > 1))) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -438,7 +438,7 @@ bool should_hide_top_border(swayc_t *con, double y) {
|
|||
// sharing top border with tabbed titlebar
|
||||
swayc_t *par = con->parent;
|
||||
while (par->type != C_WORKSPACE) {
|
||||
if (par->layout == L_TABBED || par->layout == L_STACKED) {
|
||||
if (swayc_is_tabbed_or_stacked(par)) {
|
||||
return con->y == y;
|
||||
}
|
||||
con = par;
|
||||
|
|
|
|||
|
|
@ -1968,7 +1968,7 @@ static struct cmd_results *cmd_layout(int argc, char **argv) {
|
|||
parent->layout = default_layout(output);
|
||||
}
|
||||
} else {
|
||||
if (parent->layout != L_TABBED && parent->layout != L_STACKED) {
|
||||
if (!swayc_is_tabbed_or_stacked(parent)) {
|
||||
parent->prev_layout = parent->layout;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,14 @@ static void update_root_geometry() {
|
|||
root_container.height = height;
|
||||
}
|
||||
|
||||
bool swayc_is_tabbed_or_stacked(swayc_t *container) {
|
||||
if (!ASSERT_NONNULL(container)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return container->layout == L_STACKED || container->layout == L_TABBED;
|
||||
}
|
||||
|
||||
// New containers
|
||||
|
||||
swayc_t *new_output(wlc_handle handle) {
|
||||
|
|
@ -682,7 +690,7 @@ swayc_t *container_under_pointer(void) {
|
|||
int len;
|
||||
// if tabbed/stacked go directly to focused container, otherwise search
|
||||
// children
|
||||
if (lookup->layout == L_TABBED || lookup->layout == L_STACKED) {
|
||||
if (swayc_is_tabbed_or_stacked(lookup)) {
|
||||
lookup = lookup->focused;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -888,7 +896,7 @@ swayc_t *swayc_tabbed_stacked_ancestor(swayc_t *view) {
|
|||
}
|
||||
while (view->type != C_WORKSPACE && view->parent && view->parent->type != C_WORKSPACE) {
|
||||
view = view->parent;
|
||||
if (view->layout == L_TABBED || view->layout == L_STACKED) {
|
||||
if (swayc_is_tabbed_or_stacked(view)) {
|
||||
parent = view;
|
||||
}
|
||||
}
|
||||
|
|
@ -900,7 +908,7 @@ swayc_t *swayc_tabbed_stacked_parent(swayc_t *con) {
|
|||
if (!ASSERT_NONNULL(con)) {
|
||||
return NULL;
|
||||
}
|
||||
if (con->parent && (con->parent->layout == L_TABBED || con->parent->layout == L_STACKED)) {
|
||||
if (con->parent && swayc_is_tabbed_or_stacked(con->parent)) {
|
||||
return con->parent;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ bool set_focused_container(swayc_t *c) {
|
|||
}
|
||||
// set focus
|
||||
wlc_view_focus(c->handle);
|
||||
if (c->parent->layout != L_TABBED && c->parent->layout != L_STACKED) {
|
||||
if (!swayc_is_tabbed_or_stacked(c->parent)) {
|
||||
update_container_border(c);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ static bool handle_view_created(wlc_handle handle) {
|
|||
// layout is tabbed/stacked, add a container around newview
|
||||
swayc_t *parent_container = newview->parent;
|
||||
if (parent_container->type == C_WORKSPACE && parent_container->children->length == 1 &&
|
||||
(parent_container->layout == L_TABBED || parent_container->layout == L_STACKED)) {
|
||||
swayc_is_tabbed_or_stacked(parent_container)) {
|
||||
swayc_t *container = new_container(newview, parent_container->layout);
|
||||
set_focused_container(newview);
|
||||
arrange_windows(container, -1, -1);
|
||||
|
|
|
|||
|
|
@ -793,8 +793,7 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
|
|||
y = container->y;
|
||||
|
||||
// add gaps to top level tapped/stacked container
|
||||
if (container->parent->type == C_WORKSPACE &&
|
||||
(container->layout == L_TABBED || container->layout == L_STACKED)) {
|
||||
if (container->parent->type == C_WORKSPACE && swayc_is_tabbed_or_stacked(container)) {
|
||||
update_geometry(container);
|
||||
width = container->border_geometry.size.w;
|
||||
height = container->border_geometry.size.h;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue