From 88d9d43b367b9b0cb61c4c9fb1619becdb71e9d6 Mon Sep 17 00:00:00 2001
From: emersion <contact@emersion.fr>
Date: Sun, 13 May 2018 16:38:56 +0100
Subject: Add xdg-shell stable support

---
 sway/tree/container.c | 12 ++++++++++++
 sway/tree/view.c      |  2 ++
 2 files changed, 14 insertions(+)

(limited to 'sway/tree')

diff --git a/sway/tree/container.c b/sway/tree/container.c
index fc35a81c..9f7294db 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -7,6 +7,8 @@
 #include <wayland-server.h>
 #include <wlr/types/wlr_output_layout.h>
 #include <wlr/types/wlr_wl_shell.h>
+#include <wlr/types/wlr_xdg_shell_v6.h>
+#include <wlr/types/wlr_xdg_shell.h>
 #include "cairo.h"
 #include "pango.h"
 #include "sway/config.h"
@@ -459,6 +461,16 @@ struct sway_container *container_at(struct sway_container *parent,
 					sview->wlr_xdg_surface_v6,
 					view_sx, view_sy, &_sx, &_sy);
 				break;
+			case SWAY_VIEW_XDG_SHELL:
+				// the top left corner of the sway container is the
+				// coordinate of the top left corner of the window geometry
+				view_sx += sview->wlr_xdg_surface->geometry.x;
+				view_sy += sview->wlr_xdg_surface->geometry.y;
+
+				_surface = wlr_xdg_surface_surface_at(
+					sview->wlr_xdg_surface,
+					view_sx, view_sy, &_sx, &_sy);
+				break;
 			}
 			if (_surface) {
 				*sx = _sx;
diff --git a/sway/tree/view.c b/sway/tree/view.c
index e2cb8a7a..55271d79 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -74,6 +74,8 @@ const char *view_get_type(struct sway_view *view) {
 		return "wl_shell";
 	case SWAY_VIEW_XDG_SHELL_V6:
 		return "xdg_shell_v6";
+	case SWAY_VIEW_XDG_SHELL:
+		return "xdg_shell";
 	case SWAY_VIEW_XWAYLAND:
 		return "xwayland";
 	}
-- 
cgit v1.2.3