From 2b984b43544a0d4058a4b3de2f2a22fc1fccfd98 Mon Sep 17 00:00:00 2001 From: tangjie02 Date: Tue, 19 Jul 2022 19:04:26 +0800 Subject: [PATCH] fix(xdmcp): Fix the switch user error by xdmcp logging. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复通过xdmcp远程登录后切换用户错误问题 Signed-off-by: tangjie02 --- ...e-switch-user-error-by-xdmcp-logging.patch | 66 +++++++++++++++++++ kiran-menu.spec | 7 +- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 0001-fix-menu-Fix-the-switch-user-error-by-xdmcp-logging.patch diff --git a/0001-fix-menu-Fix-the-switch-user-error-by-xdmcp-logging.patch b/0001-fix-menu-Fix-the-switch-user-error-by-xdmcp-logging.patch new file mode 100644 index 0000000..29290c7 --- /dev/null +++ b/0001-fix-menu-Fix-the-switch-user-error-by-xdmcp-logging.patch @@ -0,0 +1,66 @@ +From 40e7e134d87727cb651e9d290a852bd9ef95b826 Mon Sep 17 00:00:00 2001 +From: tangjie02 +Date: Mon, 18 Jul 2022 16:20:26 +0800 +Subject: [PATCH] fix(menu): Fix the switch user error by xdmcp logging. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 修复通过xdmcp远程登录后切换用户错误问题 + +Closes #57865 + +Signed-off-by: tangjie02 +--- + src/common/kiran-power.cpp | 28 +++++++++++++++++++++++----- + 1 file changed, 23 insertions(+), 5 deletions(-) + +diff --git a/src/common/kiran-power.cpp b/src/common/kiran-power.cpp +index c7f1011..9ef8a2c 100644 +--- a/src/common/kiran-power.cpp ++++ b/src/common/kiran-power.cpp +@@ -68,11 +68,18 @@ KiranPower::KiranPower() + SESSION_MANAGER_PATH, + SESSION_MANAGER_INTERFACE); + +- // TODO: 这里直接选用seat0是有问题的,需要获取会话所在seat +- this->seat_manager_proxy_ = Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BUS_TYPE_SYSTEM, +- DISPLAY_MANAGER_DBUS, +- DISPLAY_MANAGER_SEAT_PATH, +- DISPLAY_MANAGER_INTERFACE); ++ auto xdg_seat_object_path = Glib::getenv("XDG_SEAT_PATH"); ++ if (!xdg_seat_object_path.empty()) ++ { ++ this->seat_manager_proxy_ = Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BUS_TYPE_SYSTEM, ++ DISPLAY_MANAGER_DBUS, ++ xdg_seat_object_path, ++ DISPLAY_MANAGER_INTERFACE); ++ } ++ else ++ { ++ KLOG_WARNING("Failed to get environment variable XDG_SEAT_PATH."); ++ } + } + catch (const Gio::DBus::Error &e) + { +@@ -359,6 +366,17 @@ bool KiranPower::can_logout() + bool KiranPower::can_switch_user() + { + RETURN_VAL_IF_TRUE(this->settings_->get_boolean(STARTMENU_LOCKDOWN_KEY_DISABLE_USER_SWITCHING), false); ++ ++ try ++ { ++ Glib::VariantBase variant_value; ++ this->seat_manager_proxy_->get_cached_property(variant_value, "CanSwitch"); ++ return Glib::VariantBase::cast_dynamic>(variant_value).get(); ++ } ++ catch (const Glib::Error &e) ++ { ++ KLOG_WARNING("%s", e.what().c_str()); ++ } + return true; + } + +-- +2.33.0 + diff --git a/kiran-menu.spec b/kiran-menu.spec index 5aa2309..24b866b 100644 --- a/kiran-menu.spec +++ b/kiran-menu.spec @@ -1,11 +1,13 @@ Name: kiran-menu Version: 2.3.0 -Release: 2 +Release: 3 Summary: Applets for mate panel from Kiran Desktop License: Mulan PSL v2 Source0: %{name}-%{version}.tar.gz +Patch1000: 0001-fix-menu-Fix-the-switch-user-error-by-xdmcp-logging.patch + BuildRequires: cmake > 3.0 BuildRequires: gcc-c++ @@ -84,6 +86,9 @@ gtk-update-icon-cache -f /usr/share/icons/hicolor/ %changelog +* Tue Jul 19 2022 tangjie02 - 2.3.0-3 +- KYOS-B: Fix the switch user error by xdmcp logging.(#57865) + * Tue Jul 19 2022 yuanxing - 2.3.0-2 - KYOS-F: Do not output the alarm information to the screen