Skip to content

Commit bccde6b

Browse files
committed
fix: skip scale factor retrieval on Wayland temporarily
1. Modified scale factor retrieval logic to only query XSettings DBus interface when running under X11 session 2. Added session type check using XDG_SESSION_TYPE environment variable 3. Added TODO comment explaining that XSettings is not available on Wayland during early startup 4. This change prevents failed DBus calls and potential startup delays on Wayland sessions 5. The scale factor is temporarily defaulted to 1.0 on Wayland, affecting only double-click distance calculation Log: Fixed Wayland session startup issue by skipping XSettings scale factor query Influence: 1. Test application startup on both X11 and Wayland sessions 2. Verify double-click behavior works correctly with default scale factor on Wayland 3. Ensure no DBus errors appear during Wayland session initialization 4. Confirm X11 sessions still properly retrieve scale factor from XSettings 5. Test that QT_QPA_PLATFORM environment variable is correctly set based on session type fix: Wayland 下暂时跳过缩放因子获取 1. 修改缩放因子获取逻辑,仅在 X11 会话下查询 XSettings DBus 接口 2. 添加使用 XDG_SESSION_TYPE 环境变量的会话类型检查 3. 添加 TODO 注释说明 Wayland 在早期启动阶段无法使用 XSettings 4. 此更改防止 Wayland 会话上的 DBus 调用失败和潜在的启动延迟 5. Wayland 上的缩放因子暂时默认为 1.0,仅影响双击距离计算 Log: 修复 Wayland 会话启动问题,跳过 XSettings 缩放因子查询 Influence: 1. 测试在 X11 和 Wayland 会话上的应用程序启动 2. 验证 Wayland 上使用默认缩放因子的双击行为正常工作 3. 确保 Wayland 会话初始化期间不出现 DBus 错误 4. 确认 X11 会话仍能正确从 XSettings 获取缩放因子 5. 测试 QT_QPA_PLATFORM 环境变量根据会话类型正确设置
1 parent 79b98dc commit bccde6b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/dde-session/environmentsmanager.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,21 @@ void EnvironmentsManager::init()
7373

7474
void EnvironmentsManager::createGeneralEnvironments()
7575
{
76+
QByteArray sessionType = qgetenv("XDG_SESSION_TYPE");
7677
double scaleFactor = 1.0;
77-
QDBusInterface dbusInterface("org.deepin.dde.XSettings1", "/org/deepin/dde/XSettings1",
78+
79+
if (sessionType == "x11") {
80+
QDBusInterface dbusInterface("org.deepin.dde.XSettings1", "/org/deepin/dde/XSettings1",
7881
"org.deepin.dde.XSettings1", QDBusConnection::sessionBus());
79-
if (dbusInterface.isValid()) {
80-
QDBusReply<double> scaleFactorReply = dbusInterface.call("GetScaleFactor");
81-
if (scaleFactorReply.isValid()) {
82-
scaleFactor = scaleFactorReply.value();
82+
if (dbusInterface.isValid()) {
83+
QDBusReply<double> scaleFactorReply = dbusInterface.call("GetScaleFactor");
84+
if (scaleFactorReply.isValid()) {
85+
scaleFactor = scaleFactorReply.value();
86+
}
8387
}
88+
} else {
89+
// TODO: wayland环境下在这里通过xsettings获取是不合理的,此时xsettings服务还没有启动,并且也无法启动(没有DISPLAY,xwayland此时没有启动)
90+
// 且 wayland 此时也无法连接,无法通过协议获取,后续考虑其他方式获取,这里仅影响双击时两次点击坐标的冗余量的设置
8491
}
8592

8693
auto envs = QProcessEnvironment::systemEnvironment();
@@ -94,7 +101,6 @@ void EnvironmentsManager::createGeneralEnvironments()
94101
m_envMap.insert("XDG_CURRENT_DESKTOP", "DDE");
95102
m_envMap.insert("QT_DBL_CLICK_DIST", QString::number(15 * scaleFactor));
96103

97-
QByteArray sessionType = qgetenv("XDG_SESSION_TYPE");
98104
if (sessionType == "x11") {
99105
m_envMap.insert("QT_QPA_PLATFORM", "dxcb;xcb");
100106
} else if (sessionType == "wayland") {

0 commit comments

Comments
 (0)