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

@ -98,6 +98,22 @@ static struct sway_node *node_at_coords(
return NULL;
}
if (ws->fullscreen) {
// Try transient containers
if (config->popup_during_fullscreen == POPUP_SMART &&
ws->fullscreen->view) {
for (int i = 0; i < ws->floating->length; ++i) {
struct sway_container *floater = ws->floating->items[i];
if (floater->view && view_is_transient_for(
floater->view, ws->fullscreen->view)) {
struct sway_container *con = tiling_container_at(
&floater->node, lx, ly, surface, sx, sy);
if (con) {
return &con->node;
}
}
}
}
// Try fullscreen container
struct sway_container *con =
tiling_container_at(&ws->fullscreen->node, lx, ly, surface, sx, sy);
if (con) {

View file

@ -655,7 +655,14 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
// Deny setting focus to a view which is hidden by a fullscreen container
if (new_workspace && new_workspace->fullscreen && container &&
!container_is_fullscreen_or_child(container)) {
return;
// Unless it's a transient container
bool is_transient = new_workspace->fullscreen->view &&
config->popup_during_fullscreen == POPUP_SMART &&
container->view && view_is_transient_for(
container->view, new_workspace->fullscreen->view);
if (!is_transient) {
return;
}
}
struct sway_output *last_output = last_workspace ?