mirror of
https://github.com/swaywm/sway.git
synced 2026-04-20 06:47:03 -04:00
update view_autoconfigure to account for arrange.c changes
This commit is contained in:
parent
6101ca3ca3
commit
df3e926d7f
2 changed files with 17 additions and 28 deletions
|
|
@ -188,7 +188,8 @@ static void apply_tabbed_layout(list_t *children, struct wlr_box *parent) {
|
||||||
}
|
}
|
||||||
for (int i = 0; i < children->length; ++i) {
|
for (int i = 0; i < children->length; ++i) {
|
||||||
struct sway_container *child = children->items[i];
|
struct sway_container *child = children->items[i];
|
||||||
int parent_offset = child->view ? container_titlebar_height() : 0;
|
bool show_titlebar = (child->view && children->length > 1) || !config->hide_lone_tab;
|
||||||
|
int parent_offset = show_titlebar ? container_titlebar_height() : 0;
|
||||||
child->pending.x = parent->x;
|
child->pending.x = parent->x;
|
||||||
child->pending.y = parent->y + parent_offset;
|
child->pending.y = parent->y + parent_offset;
|
||||||
child->pending.width = parent->width;
|
child->pending.width = parent->width;
|
||||||
|
|
@ -202,8 +203,8 @@ static void apply_stacked_layout(list_t *children, struct wlr_box *parent) {
|
||||||
}
|
}
|
||||||
for (int i = 0; i < children->length; ++i) {
|
for (int i = 0; i < children->length; ++i) {
|
||||||
struct sway_container *child = children->items[i];
|
struct sway_container *child = children->items[i];
|
||||||
int parent_offset = child->view ?
|
bool show_titlebar = (child->view && children->length > 1) || !config->hide_lone_tab;
|
||||||
container_titlebar_height() * children->length : 0;
|
int parent_offset = show_titlebar ? container_titlebar_height() * children->length : 0;
|
||||||
child->pending.x = parent->x;
|
child->pending.x = parent->x;
|
||||||
child->pending.y = parent->y + parent_offset;
|
child->pending.y = parent->y + parent_offset;
|
||||||
child->pending.width = parent->width;
|
child->pending.width = parent->width;
|
||||||
|
|
|
||||||
|
|
@ -301,12 +301,13 @@ static bool gaps_to_edge(struct sway_view *view) {
|
||||||
|
|
||||||
void view_autoconfigure(struct sway_view *view) {
|
void view_autoconfigure(struct sway_view *view) {
|
||||||
struct sway_container *con = view->container;
|
struct sway_container *con = view->container;
|
||||||
struct sway_workspace *ws = con->pending.workspace;
|
|
||||||
|
|
||||||
if (container_is_scratchpad_hidden(con) &&
|
if (container_is_scratchpad_hidden(con) &&
|
||||||
con->pending.fullscreen_mode != FULLSCREEN_GLOBAL) {
|
con->pending.fullscreen_mode != FULLSCREEN_GLOBAL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct sway_workspace *ws = con->pending.workspace;
|
||||||
struct sway_output *output = ws ? ws->output : NULL;
|
struct sway_output *output = ws ? ws->output : NULL;
|
||||||
|
|
||||||
if (output && con->pending.fullscreen_mode == FULLSCREEN_WORKSPACE) {
|
if (output && con->pending.fullscreen_mode == FULLSCREEN_WORKSPACE) {
|
||||||
|
|
@ -325,9 +326,9 @@ void view_autoconfigure(struct sway_view *view) {
|
||||||
|
|
||||||
con->pending.border_top = con->pending.border_bottom = true;
|
con->pending.border_top = con->pending.border_bottom = true;
|
||||||
con->pending.border_left = con->pending.border_right = true;
|
con->pending.border_left = con->pending.border_right = true;
|
||||||
double y_offset = 0;
|
|
||||||
|
|
||||||
if (!container_is_floating_or_child(con) && ws) {
|
sway_assert(ws, "containers outside of the scratchpad need a workspace");
|
||||||
|
if (!container_is_floating_or_child(con)) {
|
||||||
if (config->hide_edge_borders == E_BOTH
|
if (config->hide_edge_borders == E_BOTH
|
||||||
|| config->hide_edge_borders == E_VERTICAL) {
|
|| config->hide_edge_borders == E_VERTICAL) {
|
||||||
con->pending.border_left = con->pending.x != ws->x;
|
con->pending.border_left = con->pending.x != ws->x;
|
||||||
|
|
@ -355,21 +356,14 @@ void view_autoconfigure(struct sway_view *view) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!container_is_floating(con)) {
|
if (!container_is_floating(con)) {
|
||||||
// In a tabbed or stacked container, the container's y is the top of the
|
// In a tabbed or stacked container, disable any top border
|
||||||
// title area. We have to offset the surface y by the height of the title,
|
// due to the presence of the title bar.
|
||||||
// bar, and disable any top border because we'll always have the title bar.
|
|
||||||
list_t *siblings = container_get_siblings(con);
|
list_t *siblings = container_get_siblings(con);
|
||||||
bool show_titlebar = (siblings && siblings->length > 1)
|
bool show_titlebar = (siblings && siblings->length > 1)
|
||||||
|| !config->hide_lone_tab;
|
|| !config->hide_lone_tab;
|
||||||
if (show_titlebar) {
|
if (show_titlebar) {
|
||||||
enum sway_container_layout layout = container_parent_layout(con);
|
enum sway_container_layout layout = container_parent_layout(con);
|
||||||
if (layout == L_TABBED) {
|
con->pending.border_top = layout != L_TABBED && layout != L_STACKED;
|
||||||
y_offset = container_titlebar_height();
|
|
||||||
con->pending.border_top = false;
|
|
||||||
} else if (layout == L_STACKED) {
|
|
||||||
y_offset = container_titlebar_height() * siblings->length;
|
|
||||||
con->pending.border_top = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -379,35 +373,29 @@ void view_autoconfigure(struct sway_view *view) {
|
||||||
case B_CSD:
|
case B_CSD:
|
||||||
case B_NONE:
|
case B_NONE:
|
||||||
x = con->pending.x;
|
x = con->pending.x;
|
||||||
y = con->pending.y + y_offset;
|
y = con->pending.y;
|
||||||
width = con->pending.width;
|
width = con->pending.width;
|
||||||
height = con->pending.height - y_offset;
|
height = con->pending.height - y_offset;
|
||||||
break;
|
break;
|
||||||
case B_PIXEL:
|
case B_PIXEL:
|
||||||
x = con->pending.x + con->pending.border_thickness * con->pending.border_left;
|
x = con->pending.x + con->pending.border_thickness * con->pending.border_left;
|
||||||
y = con->pending.y + con->pending.border_thickness * con->pending.border_top + y_offset;
|
y = con->pending.y + con->pending.border_thickness * con->pending.border_top;
|
||||||
width = con->pending.width
|
width = con->pending.width
|
||||||
- con->pending.border_thickness * con->pending.border_left
|
- con->pending.border_thickness * con->pending.border_left
|
||||||
- con->pending.border_thickness * con->pending.border_right;
|
- con->pending.border_thickness * con->pending.border_right;
|
||||||
height = con->pending.height - y_offset
|
height = con->pending.height
|
||||||
- con->pending.border_thickness * con->pending.border_top
|
- con->pending.border_thickness * con->pending.border_top
|
||||||
- con->pending.border_thickness * con->pending.border_bottom;
|
- con->pending.border_thickness * con->pending.border_bottom;
|
||||||
break;
|
break;
|
||||||
case B_NORMAL:
|
case B_NORMAL:
|
||||||
// Height is: 1px border + 3px pad + title height + 3px pad + 1px border
|
// Height is: 1px border + 3px pad + title height + 3px pad + 1px border
|
||||||
x = con->pending.x + con->pending.border_thickness * con->pending.border_left;
|
x = con->pending.x + con->pending.border_thickness * con->pending.border_left;
|
||||||
|
y = con->pending.y + container_titlebar_height();
|
||||||
width = con->pending.width
|
width = con->pending.width
|
||||||
- con->pending.border_thickness * con->pending.border_left
|
- con->pending.border_thickness * con->pending.border_left
|
||||||
- con->pending.border_thickness * con->pending.border_right;
|
- con->pending.border_thickness * con->pending.border_right;
|
||||||
if (y_offset) {
|
|
||||||
y = con->pending.y + y_offset;
|
|
||||||
height = con->pending.height - y_offset
|
|
||||||
- con->pending.border_thickness * con->pending.border_bottom;
|
|
||||||
} else {
|
|
||||||
y = con->pending.y + container_titlebar_height();
|
|
||||||
height = con->pending.height - container_titlebar_height()
|
height = con->pending.height - container_titlebar_height()
|
||||||
- con->pending.border_thickness * con->pending.border_bottom;
|
- con->pending.border_thickness * con->pending.border_bottom;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue