aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authormwenzkowski <29407878+mwenzkowski@users.noreply.github.com>2019-04-16 21:11:35 +0200
committerBrian Ashworth <bosrsf04@gmail.com>2019-04-16 17:05:49 -0400
commite9e1fbc5011b8eaaaab73be21266ee1d388d38a7 (patch)
treeb20709cd963d967ac725e3d3688ad58f9465f198 /sway
parent2f9eed659d290c1a3a008bf104e2a94b6e031915 (diff)
view.c: refactor view_autoconfigure()
Diffstat (limited to 'sway')
-rw-r--r--sway/tree/view.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index c241b2b3..40432661 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -197,11 +197,13 @@ static bool gaps_to_edge(struct sway_view *view) {
void view_autoconfigure(struct sway_view *view) {
struct sway_container *con = view->container;
+ struct sway_workspace *ws = con->workspace;
+
if (container_is_scratchpad_hidden(con) &&
con->fullscreen_mode != FULLSCREEN_GLOBAL) {
return;
}
- struct sway_output *output = con->workspace ? con->workspace->output : NULL;
+ struct sway_output *output = ws ? ws->output : NULL;
if (con->fullscreen_mode == FULLSCREEN_WORKSPACE) {
con->content_x = output->lx;
@@ -217,27 +219,23 @@ void view_autoconfigure(struct sway_view *view) {
return;
}
- struct sway_workspace *ws = view->container->workspace;
-
- bool smart = config->hide_edge_borders == E_SMART ||
- config->hide_edge_borders == E_SMART_NO_GAPS;
- bool other_views = smart && !view_is_only_visible(view);
- bool no_gaps = config->hide_edge_borders != E_SMART_NO_GAPS
- || !gaps_to_edge(view);
-
con->border_top = con->border_bottom = true;
con->border_left = con->border_right = true;
+
if (ws) {
+ bool smart = config->hide_edge_borders == E_SMART ||
+ (config->hide_edge_borders == E_SMART_NO_GAPS &&
+ !gaps_to_edge(view));
+ bool hide_smart = smart && view_is_only_visible(view);
+
if (config->hide_edge_borders == E_BOTH
- || config->hide_edge_borders == E_VERTICAL
- || (smart && !other_views && no_gaps)) {
+ || config->hide_edge_borders == E_VERTICAL || hide_smart) {
con->border_left = con->x - con->current_gaps.left != ws->x;
int right_x = con->x + con->width + con->current_gaps.right;
con->border_right = right_x != ws->x + ws->width;
}
if (config->hide_edge_borders == E_BOTH
- || config->hide_edge_borders == E_HORIZONTAL
- || (smart && !other_views && no_gaps)) {
+ || config->hide_edge_borders == E_HORIZONTAL || hide_smart) {
con->border_top = con->y - con->current_gaps.top != ws->y;
int bottom_y = con->y + con->height + con->current_gaps.bottom;
con->border_bottom = bottom_y != ws->y + ws->height;