fix(seat): clear keyboard focus before desktop surface transfer in onShowDesktop - #1364
Closed
deepin-wm wants to merge 1 commit into
Closed
fix(seat): clear keyboard focus before desktop surface transfer in onShowDesktop#1364deepin-wm wants to merge 1 commit into
deepin-wm wants to merge 1 commit into
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-wm 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 guide (collapsed on small PRs)Reviewer's GuideUpdates onShowDesktop to fully close popup surfaces and clear stale keyboard focus before requesting focus for the desktop surface, preventing popup focus or visibility from requiring a second Super+D. Sequence diagram for clearing popups and transferring desktop focussequenceDiagram
participant Helper
participant PopupContainer
participant PopupSurface
participant SeatContainer
participant DesktopSurface
Helper->>PopupContainer: surfaces()
loop each XdgPopup
Helper->>PopupSurface: type()
Helper->>PopupSurface: close()
end
Helper->>SeatContainer: dismissPopups()
Helper->>SeatContainer: setKeyboardFocusSurface(null, Qt.OtherFocusReason)
Helper->>DesktopSurface: requestKeyboardFocus(desktopSurface, Qt.OtherFocusReason, seat)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
dismissPopups() only ends the keyboard grab and sends popup_done, but does not destroy the popup surfaces themselves. When the desktop has only popup windows (no normal windows), the popups remain visible after the first Super+D, requiring a second press to dismiss them. Fix: explicitly close all XdgPopup surfaces in the popup container before transferring keyboard focus to the desktop surface in onShowDesktop().
deepin-wm
force-pushed
the
agent/developer/6294f7ed6b90
branch
from
September 1, 2026 13:35
733e054 to
8e8fd6f
Compare
deepin-wm
marked this pull request as ready for review
September 1, 2026 13:35
zccrs
marked this pull request as draft
September 2, 2026 05:06
Contributor
|
#1376 这个提交解决该问题 |
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.
修复:Super+D 显示桌面时 popup 窗口焦点未清除
问题
当桌面只有 popup 窗口(无普通窗口)时,按 Super+D 进入显示桌面状态,概率性需要按 2 次 Super+D 才能退出 popup;而当桌面有普通窗口时,按一次 Super+D popup 窗口就会失焦退出。
根因
onShowDesktop()调用dismissPopups()结束了 popup 的 keyboard grab,但没有清除SeatSurfaceManager中的m_keyboardFocusSurface(仍指向 popup surface)。随后requestKeyboardFocus(desktopSurface)调用setKeyboardFocusSurface(desktopSurface, ...)时,由于 popup 的keyboardFocusPriority()为 0,而桌面背景 layer surface(KeyboardInteractivity::None)的优先级为 -1,触发优先级检查0 > -1,焦点转移被拒绝。popup 仍持有键盘焦点,导致需要第二次按 Super+D 才能退出。修复方案
在
src/seat/helper.cpp的onShowDesktop()中,dismissPopups()之后、requestKeyboardFocus(desktopSurface)之前,显式调用setKeyboardFocusSurface(nullptr, Qt::OtherFocusReason)清除键盘焦点。由于setKeyboardFocusSurface中的优先级检查仅在oldSurface && surface都非空时执行,传nullptr可绕过该检查,使后续对桌面 surface 的焦点请求成功。改动
Multica Issue
WM-366
Summary by Sourcery
Bug Fixes: