diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-20 09:11:55 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-21 20:16:56 +1000 |
commit | efc07fb3d45e07529e3817b4a1598f2c3256d600 (patch) | |
tree | 28a76416b5d3a50fa4db1c459e19a3f42c849d35 /sway | |
parent | bd79584f659428df5d34f64f3b1cdb4c4388c3c6 (diff) |
Don't track damage for views on inactive tabs
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/output.c | 9 | ||||
-rw-r--r-- | sway/input/seat.c | 12 | ||||
-rw-r--r-- | sway/tree/container.c | 5 | ||||
-rw-r--r-- | sway/tree/view.c | 25 |
4 files changed, 40 insertions, 11 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index e39ef8db..6d5777f3 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -754,10 +754,7 @@ static void render_container_tabbed(struct sway_output *output, } struct sway_seat *seat = input_manager_current_seat(input_manager); struct sway_container *focus = seat_get_focus(seat); - struct sway_container *current = seat_get_focus_inactive(seat, con); - while (current->parent != con) { - current = current->parent; - } + struct sway_container *current = seat_get_active_child(seat, con); struct border_colors *current_colors = NULL; // Render tabs @@ -1082,9 +1079,7 @@ static void output_damage_view(struct sway_output *output, return; } - struct sway_container *workspace = container_parent(view->swayc, - C_WORKSPACE); - if (workspace->sway_workspace->fullscreen && !view->is_fullscreen) { + if (!view_is_visible(view)) { return; } diff --git a/sway/input/seat.c b/sway/input/seat.c index 7d541f6e..7a3e928a 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -718,6 +718,18 @@ struct sway_container *seat_get_focus_inactive(struct sway_seat *seat, return seat_get_focus_by_type(seat, container, C_TYPES); } +struct sway_container *seat_get_active_child(struct sway_seat *seat, + struct sway_container *container) { + struct sway_container *focus = seat_get_focus_inactive(seat, container); + if (!focus) { + return NULL; + } + while (focus->parent != container) { + focus = focus->parent; + } + return focus; +} + struct sway_container *sway_seat_get_focus(struct sway_seat *seat) { if (!seat->has_focus) { return NULL; diff --git a/sway/tree/container.c b/sway/tree/container.c index 62dca487..5c1f42c2 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -522,10 +522,7 @@ static struct sway_container *container_at_tabbed(struct sway_container *parent, } // Surfaces - struct sway_container *current = seat_get_focus_inactive(seat, parent); - while (current->parent != parent) { - current = current->parent; - } + struct sway_container *current = seat_get_active_child(seat, parent); return container_at(current, ox, oy, surface, sx, sy); } diff --git a/sway/tree/view.c b/sway/tree/view.c index 636abb25..51316507 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -865,3 +865,28 @@ void view_update_marks_textures(struct sway_view *view) { &config->border_colors.urgent); container_damage_whole(view->swayc); } + +bool view_is_visible(struct sway_view *view) { + if (!view->swayc) { + return false; + } + // Check view isn't in a tabbed or stacked container on an inactive tab + struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_container *container = view->swayc; + while (container->type != C_WORKSPACE) { + if (container->parent->layout == L_TABBED || + container->parent->layout == L_STACKED) { + if (seat_get_active_child(seat, container->parent) != container) { + return false; + } + } + container = container->parent; + } + // Check view isn't hidden by another fullscreen view + struct sway_container *workspace = container; + if (workspace->sway_workspace->fullscreen && !view->is_fullscreen) { + return false; + } + // Check the workspace is visible + return workspace_is_visible(workspace); +} |