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 | Add assertion in container_at_view (diff) | |
download | sway-efc07fb3d45e07529e3817b4a1598f2c3256d600.tar.gz sway-efc07fb3d45e07529e3817b4a1598f2c3256d600.tar.zst sway-efc07fb3d45e07529e3817b4a1598f2c3256d600.zip |
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, | |||
754 | } | 754 | } |
755 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 755 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
756 | struct sway_container *focus = seat_get_focus(seat); | 756 | struct sway_container *focus = seat_get_focus(seat); |
757 | struct sway_container *current = seat_get_focus_inactive(seat, con); | 757 | struct sway_container *current = seat_get_active_child(seat, con); |
758 | while (current->parent != con) { | ||
759 | current = current->parent; | ||
760 | } | ||
761 | struct border_colors *current_colors = NULL; | 758 | struct border_colors *current_colors = NULL; |
762 | 759 | ||
763 | // Render tabs | 760 | // Render tabs |
@@ -1082,9 +1079,7 @@ static void output_damage_view(struct sway_output *output, | |||
1082 | return; | 1079 | return; |
1083 | } | 1080 | } |
1084 | 1081 | ||
1085 | struct sway_container *workspace = container_parent(view->swayc, | 1082 | if (!view_is_visible(view)) { |
1086 | C_WORKSPACE); | ||
1087 | if (workspace->sway_workspace->fullscreen && !view->is_fullscreen) { | ||
1088 | return; | 1083 | return; |
1089 | } | 1084 | } |
1090 | 1085 | ||
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, | |||
718 | return seat_get_focus_by_type(seat, container, C_TYPES); | 718 | return seat_get_focus_by_type(seat, container, C_TYPES); |
719 | } | 719 | } |
720 | 720 | ||
721 | struct sway_container *seat_get_active_child(struct sway_seat *seat, | ||
722 | struct sway_container *container) { | ||
723 | struct sway_container *focus = seat_get_focus_inactive(seat, container); | ||
724 | if (!focus) { | ||
725 | return NULL; | ||
726 | } | ||
727 | while (focus->parent != container) { | ||
728 | focus = focus->parent; | ||
729 | } | ||
730 | return focus; | ||
731 | } | ||
732 | |||
721 | struct sway_container *sway_seat_get_focus(struct sway_seat *seat) { | 733 | struct sway_container *sway_seat_get_focus(struct sway_seat *seat) { |
722 | if (!seat->has_focus) { | 734 | if (!seat->has_focus) { |
723 | return NULL; | 735 | 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, | |||
522 | } | 522 | } |
523 | 523 | ||
524 | // Surfaces | 524 | // Surfaces |
525 | struct sway_container *current = seat_get_focus_inactive(seat, parent); | 525 | struct sway_container *current = seat_get_active_child(seat, parent); |
526 | while (current->parent != parent) { | ||
527 | current = current->parent; | ||
528 | } | ||
529 | 526 | ||
530 | return container_at(current, ox, oy, surface, sx, sy); | 527 | return container_at(current, ox, oy, surface, sx, sy); |
531 | } | 528 | } |
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) { | |||
865 | &config->border_colors.urgent); | 865 | &config->border_colors.urgent); |
866 | container_damage_whole(view->swayc); | 866 | container_damage_whole(view->swayc); |
867 | } | 867 | } |
868 | |||
869 | bool view_is_visible(struct sway_view *view) { | ||
870 | if (!view->swayc) { | ||
871 | return false; | ||
872 | } | ||
873 | // Check view isn't in a tabbed or stacked container on an inactive tab | ||
874 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
875 | struct sway_container *container = view->swayc; | ||
876 | while (container->type != C_WORKSPACE) { | ||
877 | if (container->parent->layout == L_TABBED || | ||
878 | container->parent->layout == L_STACKED) { | ||
879 | if (seat_get_active_child(seat, container->parent) != container) { | ||
880 | return false; | ||
881 | } | ||
882 | } | ||
883 | container = container->parent; | ||
884 | } | ||
885 | // Check view isn't hidden by another fullscreen view | ||
886 | struct sway_container *workspace = container; | ||
887 | if (workspace->sway_workspace->fullscreen && !view->is_fullscreen) { | ||
888 | return false; | ||
889 | } | ||
890 | // Check the workspace is visible | ||
891 | return workspace_is_visible(workspace); | ||
892 | } | ||