diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt index 8f6adb1c9..9770c64a9 100644 --- a/shell/CMakeLists.txt +++ b/shell/CMakeLists.txt @@ -6,6 +6,7 @@ find_package(Dtk${DTK_VERSION_MAJOR} COMPONENTS Widget REQUIRED) find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Widgets Gui WaylandClient) find_package(TreelandProtocols REQUIRED) pkg_check_modules(WaylandClient REQUIRED IMPORTED_TARGET wayland-client) +pkg_check_modules(X11 REQUIRED IMPORTED_TARGET x11) if (NOT DEFINED SYSTEMD_USER_UNIT_DIR) find_package(PkgConfig REQUIRED) @@ -48,6 +49,7 @@ target_link_libraries(dde-shell PRIVATE Dtk${DTK_VERSION_MAJOR}::Widget Qt${QT_VERSION_MAJOR}::DBus PkgConfig::WaylandClient + PkgConfig::X11 ) configure_file(${CMAKE_SOURCE_DIR}/misc/dde-shell-plugin@.service.in diff --git a/shell/main.cpp b/shell/main.cpp index aa7335652..77c13edf5 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -16,6 +16,8 @@ #include #include +#include +#include #include "applet.h" #include "containment.h" @@ -134,6 +136,11 @@ class AppletManager QList m_loaders; }; +static int x11IOErrorHandler(Display *) +{ + _exit(0); +} + int main(int argc, char *argv[]) { setenv("DSG_APP_ID", "org.deepin.dde.shell", 0); @@ -255,6 +262,8 @@ int main(int argc, char *argv[]) manager.exec(); }, Qt::QueuedConnection); + XSetIOErrorHandler(x11IOErrorHandler); + QObject::connect(qApp, &QCoreApplication::aboutToQuit, qApp, [&manager]() { qCInfo(dsLog) << "Exit dde-shell."; DPluginLoader::instance()->destroy();