From 52df180fc5d96e5b5923667d57be0e971ddc2e9f Mon Sep 17 00:00:00 2001
From: tangjie02 <tangjie02@kylinsec.com.cn>
Date: Tue, 7 Feb 2023 20:07:29 +0800
Subject: [PATCH] feature(backends): Compatible wayland framework which exists
 xwayland.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- 在wayland环境下gtk获取的display默认为wayland display，会导致程序崩溃，因此需要强制指定gtk使用x11作为backend。

Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
---
 src/main.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/main.cpp b/src/main.cpp
index 0ed4cc9..d065d25 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -83,6 +83,7 @@ int main(int argc, char* argv[])
 #if defined KCC_SYSTEM_TYPE
     auto loop = Glib::MainLoop::create();
 #elif defined KCC_SESSION_TYPE
+    gdk_set_allowed_backends("x11");
     gtk_init(NULL, NULL);
     Gdk::wrap_init();
     Gtk::wrap_init();
-- 
2.36.1

