From 7623292734d6ba48bbfef1c32da28d02118dac38 Mon Sep 17 00:00:00 2001
From: Simon Ser <contact@emersion.fr>
Date: Thu, 3 Nov 2022 18:39:14 +0100
Subject: Update for wlroots!3814

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3814
---
 sway/input/keyboard.c | 10 +++-------
 sway/server.c         |  2 +-
 2 files changed, 4 insertions(+), 8 deletions(-)

(limited to 'sway')

diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c
index 5e5692f1..0b90b6af 100644
--- a/sway/input/keyboard.c
+++ b/sway/input/keyboard.c
@@ -264,13 +264,9 @@ static bool keyboard_execute_compositor_binding(struct sway_keyboard *keyboard,
 		xkb_keysym_t keysym = pressed_keysyms[i];
 		if (keysym >= XKB_KEY_XF86Switch_VT_1 &&
 				keysym <= XKB_KEY_XF86Switch_VT_12) {
-			if (wlr_backend_is_multi(server.backend)) {
-				struct wlr_session *session =
-					wlr_backend_get_session(server.backend);
-				if (session) {
-					unsigned vt = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
-					wlr_session_change_vt(session, vt);
-				}
+			if (server.session) {
+				unsigned vt = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
+				wlr_session_change_vt(server.session, vt);
 			}
 			return true;
 		}
diff --git a/sway/server.c b/sway/server.c
index ef7d4c4b..042f20be 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -69,8 +69,8 @@ bool server_init(struct sway_server *server) {
 	sway_log(SWAY_DEBUG, "Initializing Wayland server");
 	server->wl_display = wl_display_create();
 	server->wl_event_loop = wl_display_get_event_loop(server->wl_display);
-	server->backend = wlr_backend_autocreate(server->wl_display);
 
+	server->backend = wlr_backend_autocreate(server->wl_display, &server->session);
 	if (!server->backend) {
 		sway_log(SWAY_ERROR, "Unable to create backend");
 		return false;
-- 
cgit v1.2.3