From 4f66565606c8958684c00f28d0b4996904c041bc Mon Sep 17 00:00:00 2001
From: Sebastian Krzyszkowiak <dos@dosowisko.net>
Date: Fri, 22 Feb 2019 04:03:29 +0100
Subject: rootston: surface_at: check for fullscreen surfaces in between TOP
 and OVERLAY layers

Input order didn't match rendering order, causing pointer events to go into surfaces
that were completely obscured by others (like a LAYER_TOP panel behind a fullscreen
window).
---
 rootston/desktop.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/rootston/desktop.c b/rootston/desktop.c
index 4cb85885..63ff1382 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -759,20 +759,6 @@ static bool view_at(struct roots_view *view, double lx, double ly,
 static struct roots_view *desktop_view_at(struct roots_desktop *desktop,
 		double lx, double ly, struct wlr_surface **surface,
 		double *sx, double *sy) {
-	struct wlr_output *wlr_output =
-		wlr_output_layout_output_at(desktop->layout, lx, ly);
-	if (wlr_output != NULL) {
-		struct roots_output *output =
-			desktop_output_from_wlr_output(desktop, wlr_output);
-		if (output != NULL && output->fullscreen_view != NULL) {
-			if (view_at(output->fullscreen_view, lx, ly, surface, sx, sy)) {
-				return output->fullscreen_view;
-			} else {
-				return NULL;
-			}
-		}
-	}
-
 	struct roots_view *view;
 	wl_list_for_each(view, &desktop->views, link) {
 		if (view_at(view, lx, ly, surface, sx, sy)) {
@@ -821,6 +807,17 @@ struct wlr_surface *desktop_surface_at(struct roots_desktop *desktop,
 					ox, oy, sx, sy))) {
 			return surface;
 		}
+
+		struct roots_output *output =
+			desktop_output_from_wlr_output(desktop, wlr_output);
+		if (output != NULL && output->fullscreen_view != NULL) {
+			if (view_at(output->fullscreen_view, lx, ly, &surface, sx, sy)) {
+				return surface;
+			} else {
+				return NULL;
+			}
+		}
+
 		if ((surface = layer_surface_at(roots_output,
 					&roots_output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
 					ox, oy, sx, sy))) {
-- 
cgit v1.2.3