summaryrefslogtreecommitdiff
path: root/kiosk-shell
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2021-12-22 16:52:12 +0200
committerDaniel Stone <daniels@collabora.com>2022-02-03 15:37:03 +0000
commitf3221832c504fe2d3bb0aa7c2ecc1d55a0154e0a (patch)
tree24ca721fd53fb4ba0d48e776385f435eee6f2d2e /kiosk-shell
parentf3ad5939255daf0d39c9d53605e678f4e0ece968 (diff)
downloadweston-f3221832c504fe2d3bb0aa7c2ecc1d55a0154e0a.tar.gz
kiosk-shell: Favor out views on same output
In multiple output cases, finding the succesor from the inactive layer might result in picking the wrong view when there are multiple views being stacked in the inactive layer. This adds two additional checks to favor views on the same output as the one being destroyed/removed. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Diffstat (limited to 'kiosk-shell')
-rw-r--r--kiosk-shell/kiosk-shell.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/kiosk-shell/kiosk-shell.c b/kiosk-shell/kiosk-shell.c
index b63116c8..14857ecc 100644
--- a/kiosk-shell/kiosk-shell.c
+++ b/kiosk-shell/kiosk-shell.c
@@ -650,12 +650,18 @@ find_focus_successor(struct weston_layer *layer,
struct weston_view *top_view = NULL;
struct weston_view *view;
+
/* we need to take into account that the surface being destroyed it not
* always the same as the focus_surface, which could result in picking
* and *activating* the wrong window, so avoid returning a view for
* that case. A particular case is when a top-level child window, would
- * pick a parent window below the focused_surface. */
- if (focused_surface != shsurf->view->surface)
+ * pick a parent window below the focused_surface.
+ *
+ * Apply that only on the same output to avoid incorrectly returning an
+ * invalid/empty view, which could happen if the view being destroyed
+ * is on a output different than the focused_surface output */
+ if (focused_surface && focused_surface != shsurf->view->surface &&
+ shsurf->output == focused_surface->output)
return top_view;
wl_list_for_each(view, &layer->view_list.link, layer_link.link) {
@@ -665,6 +671,10 @@ find_focus_successor(struct weston_layer *layer,
if (!view->is_mapped || view == shsurf->view)
continue;
+ /* pick views only on the same output */
+ if (view->output != shsurf->output)
+ continue;
+
view_shsurf = get_kiosk_shell_surface(view->surface);
if (!view_shsurf)
continue;