feat: add shortcut capture protocol support#897
Conversation
|
Skipping CI for Draft Pull Request. |
There was a problem hiding this comment.
Pull request overview
EN: This PR adds one-shot shortcut capture support to Treeland’s shortcut manager flow, allowing Wayland clients to request the next valid key combination and receive either a captured shortcut string or a failure reason. The implementation hooks capture handling into the seat event-dispose path and introduces validation logic to determine which key combinations are considered capturable.
**中文:**该 PR 为 Treeland 增加“一次性快捷键捕获”能力,使 Wayland 客户端可以请求捕获下一次有效的按键组合,并收到捕获结果(字符串)或失败原因。实现上将捕获逻辑接入 seat 的事件分发/释放前阶段,并新增按键组合的有效性判定规则。
Changes:
- Add a shortcut capture session object and lifecycle/state management in
ShortcutManagerV2. - Implement shortcut validity checks (pure-modifier detection + “good shortcut” rules) for capture.
- Integrate capture-event interception into
Helper::beforeDisposeEvent()so capture can consume/cancel relevant input events.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
src/seat/helper.cpp |
Routes pending-capture input events to the shortcut manager before normal shortcut dispatch. |
src/modules/shortcut/shortcutmanager.h |
Exposes capture state + event handling entry points on ShortcutManagerV2. |
src/modules/shortcut/shortcutmanager.cpp |
Implements capture protocol handling, capture session state machine, and shortcut validation rules. |
c83f2bf to
0868ba2
Compare
7b38cff to
06cc59c
Compare
278da82 to
be781f3
Compare
1f6f6a9 to
d915bdd
Compare
1. Add test_shortcut_capture example directory and CMakeLists.txt configuration 2. Implement ShortcutCapture wrapper class for treeland_shortcut_capture_v1 Wayland protocol 3. Implement ShortcutManagerV2 class to handle protocol initialization and capture requests 4. Create simple UI with button to trigger one-shot shortcut capture and status label 5. Handle capture success event and various failure reasons including busy, aborted, not_active, and interrupted Influence: 1. Verify the example application builds successfully with Qt6 and required Wayland components 2. Test application launch under a Wayland compositor supporting treeland-shortcut-manager-v2
1. Implement treeland_shortcut_capture_v1 protocol for one-shot shortcut capture 2. Add isPureModifierKey() to identify pure modifier keys (excluding Super/Meta) 3. Add isValidShortcutCombo() mirroring dde-daemon's IsGood() validation logic 4. Add ShortcutCaptureV1 class to manage capture session lifecycle 5. Integrate capture event handling in Helper::beforeDisposeEvent() 6. Validate surface ownership and focus state before allowing capture Log: Added shortcut capture feature allowing clients to request key combination input Influence: 1. Test capturing valid shortcuts like Ctrl+A, Alt+F4, F1-F12 2. Verify Win/Super key alone is captured as "Meta" 3. Test that pure modifier releases (Ctrl alone) fail the capture 4. Verify pointer clicks or wheel events cancel pending capture 5. Test capture rejection when surface is not focused/active 6. Test capture rejection when surface belongs to different client 7. Verify only one capture session can be active at a time 8. Test Shift+special keys like Shift+Tab, Shift+Escape 9. Test media keys capture without modifiers 10. Verify auto-repeat key events are consumed silently
1. Replace preprocessor macros with static constexpr int for Wayland protocol version constants 2. Move InterfaceVersion definitions to public class headers for better encapsulation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wineee, zccrs 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 |
capture
Super/Meta)
logic
functionality
Log: Added shortcut capture feature allowing clients to request key
combination input
Influence: