Skip to content

fix: disable gesture module on Treeland#1133

Merged
yixinshark merged 1 commit into
linuxdeepin:masterfrom
yixinshark:fix/disable-gesture-on-treeland
Jun 1, 2026
Merged

fix: disable gesture module on Treeland#1133
yixinshark merged 1 commit into
linuxdeepin:masterfrom
yixinshark:fix/disable-gesture-on-treeland

Conversation

@yixinshark

@yixinshark yixinshark commented May 29, 2026

Copy link
Copy Markdown
Contributor

Add gesture to the Treeland module denylist so dde-session-daemon does not load the legacy gesture module under Treeland.

将 gesture 加入 Treeland 模块禁用列表,避免 dde-session-daemon 在 Treeland 环境加载旧的 gesture 模块。

Log: disable gesture module on Treeland
Pms: TASK-390447
Change-Id: I68f5a29ef9b3543523d1b15baa678b6ec432032f

Summary by Sourcery

Bug Fixes:

  • Add the gesture module to the Treeland module denylist so it is not loaded under Treeland.

@sourcery-ai

sourcery-ai Bot commented May 29, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds the legacy gesture module to the Treeland module denylist so dde-session-daemon skips loading it under Treeland, and updates the SPDX copyright year range.

Flow diagram for Treeland module denylist including gesture

flowchart LR
    TreelandEnv["Treeland environment detected"] --> Loader["dde-session-daemon module loader"]
    Loader --> CheckDenylist["Check treeLandNotAllowModules"]
    CheckDenylist -->|gesture in denylist| SkipGesture["Skip loading gesture module"]
    CheckDenylist -->|module not in denylist| LoadModule["Load module"]
Loading

File-Level Changes

Change Details Files
Extend Treeland module denylist to include the gesture module so it is not loaded under Treeland.
  • Add "gesture" to the treeLandNotAllowModules slice that controls which modules are disabled under Treeland
bin/dde-session-daemon/main.go
Update SPDX copyright header to reflect coverage through 2026.
  • Change the SPDX-FileCopyrightText year range from 2018-2022 to 2018-2026
bin/dde-session-daemon/main.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Add gesture to the Treeland module denylist so dde-session-daemon does not load the legacy gesture module under Treeland.

将 gesture 加入 Treeland 模块禁用列表,避免 dde-session-daemon 在 Treeland 环境加载旧的 gesture 模块。

Log: disable gesture module on Treeland
Pms: TASK-390447
Change-Id: I68f5a29ef9b3543523d1b15baa678b6ec432032f
@yixinshark
yixinshark force-pushed the fix/disable-gesture-on-treeland branch from d945acc to e718e80 Compare June 1, 2026 01:40
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

你好!我是你的智能编程助手 CodeGeeX。我已经仔细审查了你提供的 Git Diff 输入。下面是我对本次代码变更的详细审查意见:

变更概述

本次修改在 dde-session-daemon 的主程序中,向 treeLandNotAllowModules(TreeLand 环境下不允许加载的模块黑名单)切片中新增了 "gesture"(手势)模块。


审查意见

1. 语法逻辑

  • 评估:语法正确,逻辑清晰。在 Go 语言中,向已有的字符串切片追加元素符合语法规范。
  • 潜在逻辑风险:新增 "gesture" 到黑名单意味着当系统运行在 TreeLand 环境下时,手势模块将被禁止加载。需要确认这是否符合产品需求:
    • TreeLand 环境下是否有替代的手势管理服务?
    • 如果没有替代服务,禁用手势是否会导致用户交互体验大幅下降?
    • 建议:确保业务逻辑上确实需要在 TreeLand 下禁用手势模块,并在提交信息中说明原因。

2. 代码质量

  • 评估:当前代码通过硬编码的方式维护黑名单,虽然简单直接,但在模块增多时不易维护。
  • 改进建议
    • 提取常量或配置化:如果这个黑名单经常变动,建议将其提取到配置文件(如 JSON/YAML)中,或者使用 Go 的 init() 函数或常量定义来管理,避免频繁修改主程序代码。
    • 排序与查找效率:当前切片是无序的。如果后续在代码中通过遍历切片(O(n))来检查模块是否在黑名单中,当黑名单变长时效率不高。建议改为基于 map 的集合查找,以获得 O(1) 的查询性能。

3. 代码性能

  • 评估:由于这是一个在程序启动时只初始化一次的切片,且当前元素数量极少(7个),新增一个元素对内存和初始化性能的影响微乎其微,当前无需过度优化
  • 改进建议(针对后续扩展):如上文所述,如果后续黑名单继续增加,且在热路径中频繁调用检查函数,建议重构检查逻辑。例如:
// 重构建议:使用 map 替代 slice 以提高查找性能
var treeLandNotAllowModulesMap = map[string]bool{
    "x-event-monitor": true,
    "keybinding":      true,
    "gesture":         true, // 新增
    "screensaver":     true,
    "display":         true,
    "xsettings":       true,
    "power":           true,
}

// 检查函数可以简化为
func isModuleNotAllowedInTreeLand(moduleName string) bool {
    return treeLandNotAllowModulesMap[moduleName]
}

4. 代码安全

  • 评估:本次修改仅涉及模块名称字符串的添加,不涉及用户输入、权限提升、内存操作或网络通信,无直接安全隐患
  • 间接安全考量:禁用 gesture 模块本身是一种功能降级。在某些极端场景下,如果手势模块存在与 TreeLand 不兼容的严重 Bug(如导致崩溃或死锁),将其加入黑名单反而是一种安全兜底措施,能保证系统基础稳定性。

总结

本次代码变更非常小且明确,语法无误,无安全风险。主要的关注点在于业务逻辑的正确性(是否真的需要在 TreeLand 下禁用手势),以及未来代码的可维护性和查询性能(建议考虑使用 map 替代 slice)。如果确认业务逻辑无误,本次修改可以合入。

@mhduiy

mhduiy commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy, yixinshark

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yixinshark
yixinshark merged commit 8b92989 into linuxdeepin:master Jun 1, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants