aboutsummaryrefslogtreecommitdiff
path: root/sway/tree/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c90
1 files changed, 43 insertions, 47 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 40fe2740..dbf803c6 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -187,23 +187,23 @@ void view_autoconfigure(struct sway_view *view) {
}
}
- struct sway_container_state *state = &view->swayc->pending;
+ struct sway_container *con = view->swayc;
- state->border_top = state->border_bottom = true;
- state->border_left = state->border_right = true;
+ view->border_top = view->border_bottom = true;
+ view->border_left = view->border_right = true;
if (config->hide_edge_borders == E_BOTH
|| config->hide_edge_borders == E_VERTICAL
|| (config->hide_edge_borders == E_SMART && !other_views)) {
- state->border_left = state->swayc_x != ws->x;
- int right_x = state->swayc_x + state->swayc_width;
- state->border_right = right_x != ws->x + ws->width;
+ view->border_left = con->x != ws->x;
+ int right_x = con->x + con->width;
+ view->border_right = right_x != ws->x + ws->width;
}
if (config->hide_edge_borders == E_BOTH
|| config->hide_edge_borders == E_HORIZONTAL
|| (config->hide_edge_borders == E_SMART && !other_views)) {
- state->border_top = state->swayc_y != ws->y;
- int bottom_y = state->swayc_y + state->swayc_height;
- state->border_bottom = bottom_y != ws->y + ws->height;
+ view->border_top = con->y != ws->y;
+ int bottom_y = con->y + con->height;
+ view->border_bottom = bottom_y != ws->y + ws->height;
}
double x, y, width, height;
@@ -213,54 +213,53 @@ void view_autoconfigure(struct sway_view *view) {
// In a tabbed or stacked container, the swayc's y is the top of the title
// area. We have to offset the surface y by the height of the title bar, and
// disable any top border because we'll always have the title bar.
- if (view->swayc->parent->pending.layout == L_TABBED) {
+ if (con->parent->layout == L_TABBED) {
y_offset = container_titlebar_height();
- state->border_top = false;
- } else if (view->swayc->parent->pending.layout == L_STACKED) {
- y_offset = container_titlebar_height()
- * view->swayc->parent->children->length;
+ view->border_top = false;
+ } else if (con->parent->layout == L_STACKED) {
+ y_offset = container_titlebar_height() * con->parent->children->length;
view->border_top = false;
}
- switch (state->border) {
+ switch (view->border) {
case B_NONE:
- x = state->swayc_x;
- y = state->swayc_y + y_offset;
- width = state->swayc_width;
- height = state->swayc_height - y_offset;
+ x = con->x;
+ y = con->y + y_offset;
+ width = con->width;
+ height = con->height - y_offset;
break;
case B_PIXEL:
- x = state->swayc_x + state->border_thickness * state->border_left;
- y = state->swayc_y + state->border_thickness * state->border_top + y_offset;
- width = state->swayc_width
- - state->border_thickness * state->border_left
- - state->border_thickness * state->border_right;
- height = state->swayc_height - y_offset
- - state->border_thickness * state->border_top
- - state->border_thickness * state->border_bottom;
+ x = con->x + view->border_thickness * view->border_left;
+ y = con->y + view->border_thickness * view->border_top + y_offset;
+ width = con->width
+ - view->border_thickness * view->border_left
+ - view->border_thickness * view->border_right;
+ height = con->height - y_offset
+ - view->border_thickness * view->border_top
+ - view->border_thickness * view->border_bottom;
break;
case B_NORMAL:
// Height is: 1px border + 3px pad + title height + 3px pad + 1px border
- x = state->swayc_x + state->border_thickness * state->border_left;
- width = state->swayc_width
- - state->border_thickness * state->border_left
- - state->border_thickness * state->border_right;
+ x = con->x + view->border_thickness * view->border_left;
+ width = con->width
+ - view->border_thickness * view->border_left
+ - view->border_thickness * view->border_right;
if (y_offset) {
- y = state->swayc_y + y_offset;
- height = state->swayc_height - y_offset
- - state->border_thickness * state->border_bottom;
+ y = con->y + y_offset;
+ height = con->height - y_offset
+ - view->border_thickness * view->border_bottom;
} else {
- y = state->swayc_y + container_titlebar_height();
- height = state->swayc_height - container_titlebar_height()
- - state->border_thickness * state->border_bottom;
+ y = con->y + container_titlebar_height();
+ height = con->height - container_titlebar_height()
+ - view->border_thickness * view->border_bottom;
}
break;
}
- state->view_x = x;
- state->view_y = y;
- state->view_width = width;
- state->view_height = height;
+ view->x = x;
+ view->y = y;
+ view->width = width;
+ view->height = height;
}
void view_set_activated(struct sway_view *view, bool activated) {
@@ -319,9 +318,8 @@ void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen) {
view_configure(view, view->saved_x, view->saved_y,
view->saved_width, view->saved_height);
} else {
- view->swayc->width = view->swayc->saved_width;
- view->swayc->height = view->swayc->saved_height;
- view_autoconfigure(view);
+ view->swayc->width = view->swayc->saved_width;
+ view->swayc->height = view->swayc->saved_height;
}
}
}
@@ -508,8 +506,6 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
view->swayc = cont;
view->border = config->border;
view->border_thickness = config->border_thickness;
- view->swayc->pending.border = config->border;
- view->swayc->pending.border_thickness = config->border_thickness;
view_init_subsurfaces(view, wlr_surface);
wl_signal_add(&wlr_surface->events.new_subsurface,
@@ -977,7 +973,7 @@ bool view_is_visible(struct sway_view *view) {
}
// Check the workspace is visible
if (!is_sticky) {
- return workspace_is_visible(workspace);
+ return workspace_is_visible(workspace);
}
return true;
}