diff options
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 25 |
1 files changed, 25 insertions, 0 deletions
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 | } | ||