fix: report explicit shortcut capture outcomes - #144
Conversation
There was a problem hiding this comment.
Sorry @yixinshark, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yixinshark 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 |
Reviewer's GuideRefactors shortcut querying/validation and X11 event tracking into dedicated helper classes while extending the capture API to return structured per-request results (success/invalid/canceled/timeout) with tests and minor API cleanups for gesture and CLI controllers. Sequence diagram for shortcut capture with per-request resultssequenceDiagram
actor Client
participant KeybindingManager
participant AbstractKeyHandler
participant X11KeyHandler
Client->>KeybindingManager: BeginCapture(captureId, timeoutMs)
KeybindingManager->>AbstractKeyHandler: beginCapture(captureId, timeoutMs, owner)
AbstractKeyHandler->>X11KeyHandler: beginCapture(captureId, timeoutMs, owner)
X11KeyHandler-->>KeybindingManager: captureStarted
alt key_pressed_and_released
X11KeyHandler-->>KeybindingManager: captureKeyEvent(pressed, keystroke)
X11KeyHandler-->>KeybindingManager: captureKeyEvent(released, keystroke)
alt Escape_or_pointer_cancel
X11KeyHandler-->>KeybindingManager: captureResult(captureId, CaptureCanceled, keystroke)
else valid_keystroke
X11KeyHandler-->>KeybindingManager: captureResult(captureId, CaptureSuccess, keystroke)
else invalid_keystroke
X11KeyHandler-->>KeybindingManager: captureResult(captureId, CaptureInvalid, keystroke)
end
else timeout
X11KeyHandler-->>KeybindingManager: captureResult(captureId, CaptureTimedOut, "")
end
KeybindingManager-->>Client: CaptureFinished(captureId, result, keystroke)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
5822bcf to
b5b3763
Compare
Report correlated X11 shortcut capture results to distinguish invalid input, cancellation, timeout, and successful capture. - Return the client capture ID with every terminal capture result. - Treat Escape and pointer clicks as cancellation and invalid keys separately. - Keep the legacy BeginCapture overload for existing clients. - Cover success, invalid, canceled, timeout, and explicit end cases. 明确返回可关联的 X11 快捷键录入结果,以区分无效输入、取消、超时和成功。 - 每个终态结果都返回客户端录入 ID。 - 分别处理 Escape、鼠标取消和无效按键。 - 保留旧版 BeginCapture 重载以兼容现有客户端。 - 覆盖成功、无效、取消、超时和主动结束场景。 Log: fix: report explicit shortcut capture outcomes Pms: BUG-373653 Change-Id: Ibb165871afcbf4611be4fcab530810f5f348be6a
b5b3763 to
cd41e71
Compare
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 建议示例:消除潜在的C++重载歧义,提升本地调用的健壮性
// 文件:src/plugin-qt/shortcut/src/core/keybindingmanager.h
// 修改前:
// Q_SCRIPTABLE bool BeginCapture(uint timeoutMs = 30000);
// Q_SCRIPTABLE bool BeginCapture(quint64 captureId, uint timeoutMs);
// 修改后:移除默认参数,强制调用方明确意图,避免隐式转换导致的歧义
Q_SCRIPTABLE bool BeginCapture(uint timeoutMs);
Q_SCRIPTABLE bool BeginCapture(quint64 captureId, uint timeoutMs);
// 文件:src/plugin-qt/shortcut/src/core/keybindingmanager.cpp
// 修改前:
// bool KeybindingManager::BeginCapture(uint timeoutMs)
// {
// return BeginCapture(0, timeoutMs);
// }
// 修改后:
bool KeybindingManager::BeginCapture(uint timeoutMs)
{
// 显式传递 0ULL 消除编译器警告或歧义
return BeginCapture(0ULL, timeoutMs);
} |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Summary
BeginCapture(uint)overload for existing clientsVerification
tst-x11grabresilientshortcutsshortcut-x11grabresilientshortcutsPms: BUG-373653