Repository navigation
feat: adapt keyboard layout for Treeland - #1253
Conversation
|
Skipping CI for Draft Pull Request. |
Reviewer's GuideThe PR adapts keyboard layout updates for Treeland by initializing a user-seat DConfig client and writing xkbLayout/xkbVariant values, while preserving the existing X11 behavior and avoiding unsupported setxkbmap option calls in Treeland. Sequence diagram for Treeland keyboard layout applicationsequenceDiagram
participant Keyboard
participant TreelandSeatConfig as TreelandUserSeatDConfig
Keyboard->>Keyboard: applyLayout()
alt hasTreeLand
Keyboard->>Keyboard: applyLayoutTreeLand(value)
Keyboard->>TreelandSeatConfig: SetValue(xkbLayout, layout)
Keyboard->>TreelandSeatConfig: SetValue(xkbVariant, variant)
else X11
Keyboard->>Keyboard: applyLayout(value)
end
Flow diagram for Treeland keyboard initialization and options handlingflowchart TD
Start[newKeyboard]
Environment{hasTreeLand}
X11[Initialize X connection]
Treeland[NewDConfig treeland user seat]
Layout[applyLayout]
Options[applyOptions]
Skip[Skip setxkbmap options]
Start --> Environment
Environment -->|false| X11
Environment -->|true| Treeland
X11 --> Layout
Treeland --> Layout
Layout --> Options
Options -->|hasTreeLand| Skip
Options -->|X11| SetOptions[Apply setxkbmap options]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
4b5113b to
8f1b4aa
Compare
适配 Treeland 键盘布局 1. 新增 treeland user seat DConfig 常量(treelandAppID/treelandSeatName/treelandKeyXkbLayout/treelandKeyXkbVariant) 2. Keyboard 结构体新增 treelandSeatConfig 字段,newKeyboard 中 hasTreeLand 分支初始化 3. applyLayout() 方法新增 hasTreeLand 分流,调用 applyLayoutTreeLand 4. 新增 applyLayoutTreeLand 方法:通过 dconfig 写入 xkbLayout/xkbVariant,复用 layout/variant 拆分与 ,us 兜底逻辑 5. applyOptions() 添加 hasTreeLand guard,避免 treeland 下执行 setxkbmap 产生噪音日志 6. applyLayoutTreeLand 中两次 SetValue 添加已知行为注释 PMS: BUG-377251 Log: 适配 Treeland 键盘布局,通过 dconfig 写入 treeland user seat 的 xkbLayout/xkbVariant 配置 Influence: inputdevices1 键盘布局设置在 Treeland 环境下走 dconfig 路径,X11 路径不受影响
8f1b4aa to
6c62c64
Compare
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="inputdevices1/keyboard.go" line_range="305-308" />
<code_context>
currentLayout := kbd.CurrentLayout.Get()
kbd.PropsMu.RUnlock()
+ if hasTreeLand {
+ kbd.applyLayoutTreeLand(currentLayout)
+ return
+ }
+
err := applyLayout(currentLayout)
</code_context>
<issue_to_address>
**issue (broader_impact):** Every Wayland session is treated as Treeland because `hasTreeLand` is set solely from `XDG_SESSION_TYPE=wayland`; on a non-Treeland Wayland compositor, `applyLayoutTreeLand` tries to write the Treeland DConfig instead of applying the layout, so layout changes are ignored when that manager is unavailable.
**Triggers:** When dde-daemon runs under a non-Treeland Wayland compositor.
**Suggested fix:** Detect the Treeland compositor specifically before selecting the Treeland DConfig path, or retain the existing layout path for other Wayland environments.
</issue_to_address>|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fly602, mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Treeland 键盘布局适配
适配 Treeland 环境下的键盘布局设置,通过 dconfig 写入 treeland user seat 的
xkbLayout/xkbVariant配置,X11 路径保留不变。改动内容
treelandAppID/treelandSeatName/treelandKeyXkbLayout/treelandKeyXkbVariant)Keyboard结构体新增treelandSeatConfig字段,newKeyboard中hasTreeLand分支初始化applyLayout()方法新增hasTreeLand分流,调用applyLayoutTreeLandapplyLayoutTreeLand方法:通过 dconfig 写入xkbLayout/xkbVariant,复用 layout/variant 拆分与,us兜底逻辑applyOptions()添加hasTreeLandguard,避免 treeland 下执行 setxkbmap 产生噪音日志验证
参考上游 treeland PR: linuxdeepin/treeland#1406
Multica Issue: DDE-321
Summary by Sourcery
Adapt keyboard layout handling to configure Treeland user seats without affecting X11 behavior.
New Features:
Enhancements: