Implement popup_during_fullscreen

This introduces a new view_impl function: is_transient_for. Similar to
container_has_ancestor but works using the surface parents rather than
the tree.

This patch modifies view_is_visible, container_at and so on to allow
transient views to function normally when they're in front of a
fullscreen view.
This commit is contained in:
Ryan Dwyer 2018-10-07 20:40:05 +10:00
parent 6cb0e58c6d
commit 832ebc8966
16 changed files with 192 additions and 2 deletions

View file

@ -1042,7 +1042,14 @@ bool view_is_visible(struct sway_view *view) {
// Check view isn't hidden by another fullscreen view
if (workspace->fullscreen &&
!container_is_fullscreen_or_child(view->container)) {
return false;
// However, if we're transient for the fullscreen view and we allow
// "popups" during fullscreen then it might be visible
bool is_transient = config->popup_during_fullscreen == POPUP_SMART &&
workspace->fullscreen->view &&
view_is_transient_for(view, workspace->fullscreen->view);
if (!is_transient) {
return false;
}
}
return true;
}
@ -1095,3 +1102,9 @@ void view_save_buffer(struct sway_view *view) {
view->saved_buffer_height = view->surface->current.height;
}
}
bool view_is_transient_for(struct sway_view *child,
struct sway_view *ancestor) {
return child->impl->is_transient_for &&
child->impl->is_transient_for(child, ancestor);
}