1 Star 0 Fork 10

yuan_xing/kiran-menu

forked from src-openEuler/kiran-menu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-fix-menu-Fix-the-switch-user-error-by-xdmcp-logging.patch 2.70 KB
一键复制 编辑 原始数据 按行查看 历史
From 40e7e134d87727cb651e9d290a852bd9ef95b826 Mon Sep 17 00:00:00 2001
From: tangjie02 <tangjie02@kylinsec.com.cn>
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 <tangjie02@kylinsec.com.cn>
---
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<Glib::Variant<bool>>(variant_value).get();
+ }
+ catch (const Glib::Error &e)
+ {
+ KLOG_WARNING("%s", e.what().c_str());
+ }
return true;
}
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yuan__xing/kiran-menu.git
git@gitee.com:yuan__xing/kiran-menu.git
yuan__xing
kiran-menu
kiran-menu
master

搜索帮助