Repository navigation
fix: use focused shutdown-menu actions for right-click menu items - #1844
Merged
Merged
Conversation
Reviewer's GuideAPIDeclare the focused Treeland actions that the applet can call.
Uses of the APIRoute each Wayland shutdown-menu selection to its matching focused action while keeping the generic menu for other cases.
ImplementationImplement the focused Treeland actions using their corresponding protocol triggers.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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="applets/dde-shutdown/shutdownapplet.cpp" line_range="56-57" />
<code_context>
- type == QStringLiteral("Restart") || type == QStringLiteral("Logout")) {
- // TODO: implement these types
- m_lockscreen->shutdown();
+ } else if (type == QStringLiteral("Restart") || type == QStringLiteral("UpdateAndReboot")) {
+ m_lockscreen->reboot();
+ } else if (type == QStringLiteral("Suspend")) {
+ m_lockscreen->suspend();
</code_context>
<issue_to_address>
**Update choices focus ordinary actions**
When a Treeland caller requests UpdateAndReboot or UpdateAndShutdown, `requestShutdown()` routes `UpdateAndReboot` to `m_lockscreen->reboot()` and `UpdateAndShutdown` to `powerOff()`, losing the update intent, so users see the ordinary reboot or power-off action focused.
Preserve the update intent in the Treeland request instead of mapping these types to the ordinary reboot and power-off actions.
Also at `applets/dde-shutdown/shutdownapplet.cpp:65-66`.
</issue_to_address>
|
1. Root cause: ShutdownApplet::requestShutdown Wayland branch mapped Shutdown/Restart/Suspend/Hibernate/Logout types all to shutdown() (action_shutdown_menu=24), always showing the generic menu instead of focusing the matching button via the focused variants (26-30) 2. Fix: add powerOff/reboot/suspend/hibernate/logout methods to TreeLandLockScreen calling trigger with enum 26-30, map each type to its corresponding method in requestShutdown 3. Impact: right-click menu items now directly focus the matching action button; left-click and X11 branch unaffected Influence: 1. Test right-click shutdown icon and select each menu item 2. Verify focused button matches the selected action 3. Test left-click still shows generic shutdown menu 4. Verify X11 session shutdown behavior unchanged fix: 右键关机菜单项直接触发对应操作而非总弹通用界面 1. 根因:ShutdownApplet::requestShutdown 的 Wayland 分支将 Shutdown/Restart/Suspend/Hibernate/Logout 全部映射到 shutdown() (action_shutdown_menu=24),总是弹出通用菜单而非通过 focused 变体(26-30)聚焦到对应按钮 2. 方案:在 TreeLandLockScreen 中新增 powerOff/reboot/suspend/ hibernate/logout 五个方法分别调用 trigger 枚举 26-30,在 requestShutdown 中将每种 type 映射到对应方法 3. 影响:右键菜单项现在直接聚焦到对应操作按钮;左键单击和 X11 分支不受影响 Influence: 1. 测试右键关机图标后选择各菜单项 2. 验证聚焦按钮与选择的操作一致 3. 测试左键单击仍弹出通用关机菜单 4. 验证 X11 会话关机行为无变化 Log: Right-click shutdown menu items now directly trigger focused actions PMS: BUG-381309
18202781743
force-pushed
the
agent/bugfix/381309
branch
from
November 24, 2026 03:09
4316fa3 to
671c81c
Compare
BLumia
approved these changes
Nov 24, 2026
wjyrich
approved these changes
Nov 24, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia, wjyrich 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root Cause Analysis
In the Treeland Wayland session, right-clicking the shutdown icon on the taskbar and selecting "Restart", "Shutdown", "Suspend", "Hibernate", or "Logout" always opens the generic shutdown menu (no focus preference) instead of directly focusing the matching action button. The root cause is in
ShutdownApplet::requestShutdown()(applets/dde-shutdown/shutdownapplet.cpp:43-61): the Wayland branch mapsShutdown/Restart/Suspend/Hibernate/Logout/UpdateAndShutdown/UpdateAndRebootall tom_lockscreen->shutdown()which triggersaction_shutdown_menu(enum 24, generic menu), instead of the focused variants (enum 26-30). TheTreeLandLockScreenclass only implementedlock(),shutdown(), andswitchUser()— the five focused action methods were never added when treeland-protocols was upgraded to 0.7.0 in commit801e9981.Fix Approach
Added five new methods (
powerOff(),reboot(),suspend(),hibernate(),logout()) toTreeLandLockScreen, each callingtrigger()with the corresponding protocol enum (26-30). UpdatedrequestShutdown()Wayland branch to map each type string to its corresponding new method instead of falling through toshutdown(). This matches the analysis report section 10 fix recommendation with no deviation.Change Safety Assessment
Code Safety
lock(),shutdown(),switchUser()methods are unchangedisActive()guard +trigger(enum)call); X11 branch is not affectedBusiness Impact Scope
Verification Suggestion
Test right-clicking the shutdown icon in a Treeland Wayland session and selecting each menu item (Restart/Shutdown/Suspend/Hibernate/Logout) — verify the corresponding button is focused. Verify left-click still shows the generic menu and X11 session behavior is unchanged.
根因分析
在 Treeland Wayland 会话下,右键任务栏关机图标后选择"重启""关机""待机""休眠""注销"时,系统总是弹出通用关机界面(无焦点偏好),而非直接聚焦到对应操作按钮。根因在
ShutdownApplet::requestShutdown()(applets/dde-shutdown/shutdownapplet.cpp:43-61):Wayland 分支将Shutdown/Restart/Suspend/Hibernate/Logout/UpdateAndShutdown/UpdateAndReboot全部映射到m_lockscreen->shutdown(),触发action_shutdown_menu(枚举 24,通用菜单),而非对应的 focused 变体(枚举 26-30)。TreeLandLockScreen类只实现了lock()、shutdown()、switchUser()三个方法,在 commit801e9981升级 treeland-protocols 到 0.7.0 时未同步新增五个 focused action 方法。修复方案
在
TreeLandLockScreen中新增powerOff()、reboot()、suspend()、hibernate()、logout()五个方法,分别调用trigger()传入对应协议枚举值(26-30)。在requestShutdown()Wayland 分支中将每种 type 字符串映射到对应新方法,而非全部 fall through 到shutdown()。与分析报告第十节方案一致,无偏离。改动安全评估
代码安全评估
lock()、shutdown()、switchUser()方法isActive()守卫 +trigger(enum)调用),X11 分支不受影响业务影响范围
验证建议
在 Treeland Wayland 会话下右键关机图标,依次选择各菜单项(重启/关机/待机/休眠/注销),验证对应按钮被聚焦。验证左键单击仍弹出通用菜单,X11 会话关机行为无变化。
PMS: BUG-381309
Summary by Sourcery
Route Treeland Wayland shutdown-menu actions to the matching focused lock-screen controls.
Bug Fixes:
Enhancements: