diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-08 23:00:36 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-08 23:00:36 +1000 |
commit | f23588de3c7085830614f6764a5c0cd262538afd (patch) | |
tree | 6460aecbaf206dffcc4ffb546c4a8143025b82db | |
parent | Implement popup_during_fullscreen (diff) | |
download | sway-f23588de3c7085830614f6764a5c0cd262538afd.tar.gz sway-f23588de3c7085830614f6764a5c0cd262538afd.tar.zst sway-f23588de3c7085830614f6764a5c0cd262538afd.zip |
Introduce container_is_transient_for
-rw-r--r-- | include/sway/tree/container.h | 3 | ||||
-rw-r--r-- | sway/desktop/output.c | 15 | ||||
-rw-r--r-- | sway/desktop/render.c | 12 | ||||
-rw-r--r-- | sway/input/cursor.c | 18 | ||||
-rw-r--r-- | sway/input/seat.c | 6 | ||||
-rw-r--r-- | sway/tree/container.c | 7 | ||||
-rw-r--r-- | sway/tree/view.c | 6 |
7 files changed, 30 insertions, 37 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index da6592b4..920ef038 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -292,4 +292,7 @@ bool sway_dir_to_wlr(enum movement_direction dir, enum wlr_direction *out); | |||
292 | struct sway_container *container_split(struct sway_container *child, | 292 | struct sway_container *container_split(struct sway_container *child, |
293 | enum sway_container_layout layout); | 293 | enum sway_container_layout layout); |
294 | 294 | ||
295 | bool container_is_transient_for(struct sway_container *child, | ||
296 | struct sway_container *ancestor); | ||
297 | |||
295 | #endif | 298 | #endif |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 0bcdcac1..adc1ee10 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -329,15 +329,12 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) { | |||
329 | workspace->current.fullscreen, &data); | 329 | workspace->current.fullscreen, &data); |
330 | container_for_each_child(workspace->current.fullscreen, | 330 | container_for_each_child(workspace->current.fullscreen, |
331 | send_frame_done_container_iterator, &data); | 331 | send_frame_done_container_iterator, &data); |
332 | if (config->popup_during_fullscreen == POPUP_SMART && | 332 | for (int i = 0; i < workspace->current.floating->length; ++i) { |
333 | workspace->current.fullscreen->view) { | 333 | struct sway_container *floater = |
334 | for (int i = 0; i < workspace->current.floating->length; ++i) { | 334 | workspace->current.floating->items[i]; |
335 | struct sway_container *floater = | 335 | if (container_is_transient_for(floater, |
336 | workspace->current.floating->items[i]; | 336 | workspace->current.fullscreen)) { |
337 | if (floater->view && view_is_transient_for(floater->view, | 337 | send_frame_done_container_iterator(floater, &data); |
338 | workspace->current.fullscreen->view)) { | ||
339 | send_frame_done_container_iterator(floater, &data); | ||
340 | } | ||
341 | } | 338 | } |
342 | } | 339 | } |
343 | #ifdef HAVE_XWAYLAND | 340 | #ifdef HAVE_XWAYLAND |
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index c2a0d29f..765317db 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -962,14 +962,10 @@ void output_render(struct sway_output *output, struct timespec *when, | |||
962 | fullscreen_con->current.focused); | 962 | fullscreen_con->current.focused); |
963 | } | 963 | } |
964 | 964 | ||
965 | if (config->popup_during_fullscreen == POPUP_SMART && | 965 | for (int i = 0; i < workspace->floating->length; ++i) { |
966 | fullscreen_con->view) { | 966 | struct sway_container *floater = workspace->floating->items[i]; |
967 | for (int i = 0; i < workspace->floating->length; ++i) { | 967 | if (container_is_transient_for(floater, fullscreen_con)) { |
968 | struct sway_container *floater = workspace->floating->items[i]; | 968 | render_floating_container(output, damage, floater); |
969 | if (floater->view && view_is_transient_for( | ||
970 | floater->view, fullscreen_con->view)) { | ||
971 | render_floating_container(output, damage, floater); | ||
972 | } | ||
973 | } | 969 | } |
974 | } | 970 | } |
975 | #ifdef HAVE_XWAYLAND | 971 | #ifdef HAVE_XWAYLAND |
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 08eeb812..6d57c45f 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -99,17 +99,13 @@ static struct sway_node *node_at_coords( | |||
99 | } | 99 | } |
100 | if (ws->fullscreen) { | 100 | if (ws->fullscreen) { |
101 | // Try transient containers | 101 | // Try transient containers |
102 | if (config->popup_during_fullscreen == POPUP_SMART && | 102 | for (int i = 0; i < ws->floating->length; ++i) { |
103 | ws->fullscreen->view) { | 103 | struct sway_container *floater = ws->floating->items[i]; |
104 | for (int i = 0; i < ws->floating->length; ++i) { | 104 | if (container_is_transient_for(floater, ws->fullscreen)) { |
105 | struct sway_container *floater = ws->floating->items[i]; | 105 | struct sway_container *con = tiling_container_at( |
106 | if (floater->view && view_is_transient_for( | 106 | &floater->node, lx, ly, surface, sx, sy); |
107 | floater->view, ws->fullscreen->view)) { | 107 | if (con) { |
108 | struct sway_container *con = tiling_container_at( | 108 | return &con->node; |
109 | &floater->node, lx, ly, surface, sx, sy); | ||
110 | if (con) { | ||
111 | return &con->node; | ||
112 | } | ||
113 | } | 109 | } |
114 | } | 110 | } |
115 | } | 111 | } |
diff --git a/sway/input/seat.c b/sway/input/seat.c index 690b59e6..f418785d 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -656,11 +656,7 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node, | |||
656 | if (new_workspace && new_workspace->fullscreen && container && | 656 | if (new_workspace && new_workspace->fullscreen && container && |
657 | !container_is_fullscreen_or_child(container)) { | 657 | !container_is_fullscreen_or_child(container)) { |
658 | // Unless it's a transient container | 658 | // Unless it's a transient container |
659 | bool is_transient = new_workspace->fullscreen->view && | 659 | if (!container_is_transient_for(container, new_workspace->fullscreen)) { |
660 | config->popup_during_fullscreen == POPUP_SMART && | ||
661 | container->view && view_is_transient_for( | ||
662 | container->view, new_workspace->fullscreen->view); | ||
663 | if (!is_transient) { | ||
664 | return; | 660 | return; |
665 | } | 661 | } |
666 | } | 662 | } |
diff --git a/sway/tree/container.c b/sway/tree/container.c index 9db7aed1..1664514a 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -1212,3 +1212,10 @@ struct sway_container *container_split(struct sway_container *child, | |||
1212 | 1212 | ||
1213 | return cont; | 1213 | return cont; |
1214 | } | 1214 | } |
1215 | |||
1216 | bool container_is_transient_for(struct sway_container *child, | ||
1217 | struct sway_container *ancestor) { | ||
1218 | return config->popup_during_fullscreen == POPUP_SMART && | ||
1219 | child->view && ancestor->view && | ||
1220 | view_is_transient_for(child->view, ancestor->view); | ||
1221 | } | ||
diff --git a/sway/tree/view.c b/sway/tree/view.c index edf771c1..b107d871 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -1044,10 +1044,8 @@ bool view_is_visible(struct sway_view *view) { | |||
1044 | !container_is_fullscreen_or_child(view->container)) { | 1044 | !container_is_fullscreen_or_child(view->container)) { |
1045 | // However, if we're transient for the fullscreen view and we allow | 1045 | // However, if we're transient for the fullscreen view and we allow |
1046 | // "popups" during fullscreen then it might be visible | 1046 | // "popups" during fullscreen then it might be visible |
1047 | bool is_transient = config->popup_during_fullscreen == POPUP_SMART && | 1047 | if (!container_is_transient_for(view->container, |
1048 | workspace->fullscreen->view && | 1048 | workspace->fullscreen)) { |
1049 | view_is_transient_for(view, workspace->fullscreen->view); | ||
1050 | if (!is_transient) { | ||
1051 | return false; | 1049 | return false; |
1052 | } | 1050 | } |
1053 | } | 1051 | } |