fix(waylib/inputmethod): restore IME keyboard grab after popup grab ends - #1226
fix(waylib/inputmethod): restore IME keyboard grab after popup grab ends#1226LFRon wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LFRon 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 |
|
Hi @LFRon. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR ensures that when a temporary keyboard grab ends, the IME’s own keyboard grab is correctly restored, preventing situations where fcitx5 fails to appear or becomes unusable after other grabs interfere. Sequence diagram for restoring IME keyboard grab after other grab endssequenceDiagram
participant Seat
participant WInputMethodHelper
participant IMEKeyboardGrab
participant OtherKeyboardGrab
Seat->>WInputMethodHelper: notify_keyboard_grab_begin
WInputMethodHelper->>Seat: keyboard_start_grab(OtherKeyboardGrab)
Seat->>WInputMethodHelper: notify_keyboard_grab_end
WInputMethodHelper->>WInputMethodHelper: handleKeyboardGrabEnd()
alt [activeKeyboardGrab and current grab != keyboardGrab]
WInputMethodHelper->>Seat: keyboard_start_grab(keyboardGrab)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
6d84a13 to
f4d41e9
Compare
|
TAG Bot New tag: 0.8.17 |
c7ac3b3 to
60bf411
Compare
51bcb32 to
c676a1f
Compare
|
大佬们有没有好思路修复这个( |
49e9b4a to
502ecd5
Compare
|
TAG Bot New tag: 0.8.18 |
de1839c to
c363b5c
Compare
|
TAG Bot New tag: 0.9.0 |
With Wayland input-method support enabled, closing an xdg popup or switching focus can occasionally leave fcitx5 unusable. This is most visible when renaming a folder in dde-file-manager: the editor no longer activates the input method, XWayland clients can stop receiving keyboard input, and the terminal-based workaround can leave focus associated with the wrong window. The previous helper implemented zwp_input_method_keyboard_grab_v2 by installing a synthetic wlr_seat_keyboard_grab. Xdg-popup and drag grabs share the same single seat grab slot, and wlroots replaces that slot without emitting a matching end event for the displaced grab. The protocol keyboard-grab object could therefore remain alive after the helper lost structural grab ownership, leaving text-input focus, input-method activation and keyboard delivery out of sync. Focus reconciliation also handled leave and enter independently, while popup-grab end restored m_activatedSurface. A stale same-client leave could clear the new Qt text-input-v2 focus, and popup teardown could restore keyboard focus to an unrelated previously activated surface. Route input-method keys independently from structural seat grabs: - Add a WSeat keyboard filter and forward physical key and modifier events directly to the active input-method keyboard endpoint only when seat, Wayland client, focused surface and enabled text-input all match. Input-method-owned virtual keyboards bypass the filter to avoid feedback loops and preserve normal client delivery. - Keep popup and drag grab ownership in wlroots. Validate popup focus against the exact wlr_xdg_popup_grab membership and pointer, track replacement and end events separately, restore the real popup parent or pre-popup focus only while a tracked popup still owns focus, and dismiss the concrete popup instead of ending an arbitrary seat grab. - Derive the active text-input from current seat focus, send all obsolete leaves before any enter, and activate or deactivate the input method from that reconciled state. Focus loss disables IME routing immediately even if fcitx5's protocol keyboard endpoint is still alive. - Harden text-input-v2 focus and enabled-surface destruction connections so callbacks from an old surface cannot clear newer focus state. - Route keyboard filtering from the raw WSeat key path before Qt shortcut and QQuick delivery, so an eligible input-method grab cannot be bypassed by the compositor's focus window or by an early Qt shortcut handler. - Preserve exclusive input-method key delivery, guard Qt repeat handling against invalid keyboards and disabled repeat rates, and clear stale repeat state whenever keyboard focus or the compositor focus window changes. - Add categorized transition logs for input-method, text-input and popup-focus state. They contain object and state identifiers only, never key codes, surrounding text, preedit text or committed user input. This removes the seat-grab race instead of trying to reinstall an IME grab after popup close, keeps XWayland keyboard delivery independent from stale IME state, prevents the raw Qt keyboard path from bypassing IME ownership, and matches the raw-wlroots and WWaylandResource lifecycle used by current master.
该问题修复的是由于设置了QT_IM_MODULES, XMODIFIERS等环境变量后, 在treeland运行一段时间后一定会出现的几个问题:
该PR同时修复了上述问题
Summary by Sourcery
Restore the input method (IME) keyboard grab after temporary keyboard grabs end to ensure consistent input method availability across applications.
Bug Fixes:
Summary by Sourcery
Restore reliable IME input across applications by coordinating keyboard filtering, popup grabs, focus transitions, and text-input state.
Bug Fixes:
Enhancements: