From c7abb77f2217cc4d5642ef1650f7fc75e1c1a9a4 Mon Sep 17 00:00:00 2001
From: emersion <contact@emersion.fr>
Date: Tue, 12 Dec 2017 20:02:01 +0100
Subject: Listen to output layout change

---
 sway/desktop/output.c   | 12 ++++--------
 sway/desktop/xwayland.c |  6 +++---
 2 files changed, 7 insertions(+), 11 deletions(-)

(limited to 'sway/desktop')

diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index f44cda1a..bcdaa7d2 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -72,8 +72,7 @@ static void output_frame_view(swayc_t *view, void *data) {
 }
 
 static void output_frame_notify(struct wl_listener *listener, void *data) {
-	struct sway_output *soutput = wl_container_of(
-			listener, soutput, frame);
+	struct sway_output *soutput = wl_container_of(listener, soutput, frame);
 	struct wlr_output *wlr_output = data;
 	struct sway_server *server = soutput->server;
 
@@ -93,20 +92,17 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
 }
 
 static void output_resolution_notify(struct wl_listener *listener, void *data) {
-	struct sway_output *soutput = wl_container_of(
-			listener, soutput, resolution);
+	struct sway_output *soutput = wl_container_of(listener, soutput, resolution);
 	arrange_windows(soutput->swayc, -1, -1);
 }
 
 static void output_scale_notify(struct wl_listener *listener, void *data) {
-	struct sway_output *soutput = wl_container_of(
-			listener, soutput, scale);
+	struct sway_output *soutput = wl_container_of(listener, soutput, scale);
 	arrange_windows(soutput->swayc, -1, -1);
 }
 
 static void output_transform_notify(struct wl_listener *listener, void *data) {
-	struct sway_output *soutput = wl_container_of(
-			listener, soutput, transform);
+	struct sway_output *soutput = wl_container_of(listener, soutput, transform);
 	arrange_windows(soutput->swayc, -1, -1);
 }
 
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 65c7e1ec..e3799d2d 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -55,7 +55,7 @@ static void set_position(struct sway_view *view, double ox, double oy) {
 	if (!sway_assert(root, "output must be within tree to set position")) {
 		return;
 	}
-	struct wlr_output_layout *layout = root->output_layout;
+	struct wlr_output_layout *layout = root->sway_root->output_layout;
 	struct wlr_output_layout_output *loutput =
 		wlr_output_layout_get(layout, output->sway_output->wlr_output);
 	if (!sway_assert(loutput, "output must be within layout to set position")) {
@@ -147,14 +147,14 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
 	// TODO remove from the tree when the surface goes away (unmapped)
 	sway_view->surface = xsurface->surface;
 	sway_surface->view = sway_view;
-	
+
 	// TODO:
 	// - Wire up listeners
 	// - Handle popups
 	// - Look up pid and open on appropriate workspace
 	// - Set new view to maximized so it behaves nicely
 	// - Criteria
-	
+
 	sway_surface->commit.notify = handle_commit;
 	wl_signal_add(&xsurface->surface->events.commit, &sway_surface->commit);
 	sway_surface->destroy.notify = handle_destroy;
-- 
cgit v1.2.3