Repository navigation
fix(dock): preserve X11 event subscriptions in smart hide - #1889
Merged
Merged
Conversation
1. Read the event mask already selected on Qt's X11 connection with xcb_get_window_attributes, then merge the property, structure and visibility events required by smart hide instead of replacing the whole mask. 2. Keep Qt's focus, keyboard, button and exposure subscriptions intact, so the launcher still receives input and popups close when they lose focus. 3. In onWindowClientListChanged, collect the newly tracked windows and queue their event-mask queries before reading any reply, then apply the merged masks in one pass before initializing their metadata. The attribute reads for this update no longer block on one X11 round trip per window. 4. Skip the update when an attribute query fails or the merged mask is unchanged, and consume every queued cookie, so existing subscriptions are not lost. Log: Preserve Qt's X11 event subscriptions and batch event-mask queries for newly tracked windows. Influence: Smart hide keeps working without losing launcher input or focus-out behavior, and window updates avoid one blocking X11 round trip per window. fix(dock): 智能隐藏监听窗口时保留 X11 事件订阅并批量查询 1. 使用 xcb_get_window_attributes 读取 Qt 的 X11 连接上已选择的事件 掩码,将智能隐藏所需的属性变化、结构变化和可见性事件合并进去,而不是 替换整个掩码。 2. 保留 Qt 自身的焦点、键盘、鼠标按键和重绘(Expose)订阅,使启动器 仍能接收输入,弹窗失焦时也能正常关闭。 3. 在 onWindowClientListChanged 中先收集本次新增的窗口,为它们排入 事件掩码查询后统一读取回复,再批量应用合并后的掩码并初始化窗口元数据; 本次更新不再按窗口逐一阻塞等待 X11 往返。 4. 当事件掩码查询失败或合并后的掩码未变化时跳过更新,并读取每个已排入 的 cookie,避免丢失已有订阅。 Log: 监听窗口时保留 Qt 的 X11 事件订阅,并批量查询本次新增窗口的事件掩码,保证智能隐藏正常工作。 Influence: 智能隐藏正常生效,启动器和弹窗保持正常的输入与失焦关闭行为;新增窗口的事件掩码批量处理,不再按窗口逐一阻塞等待 X11 往返。 PMS: BUG-383253
Reviewer's GuideImplementationMerge smart-hide event subscriptions with Qt's existing X11 mask, batch queries for newly added windows, and update the method declaration and caller to apply the masks before metadata initialization.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="panels/dock/x11dockhelper.cpp" line_range="342" />
<code_context>
+ // This runs on the connection owned by Qt. Merging keeps Qt's own subscriptions
+ // (focus, keyboard, buttons, exposure) instead of replacing them.
+ uint32_t value_list[] = { mergedMask };
+ xcb_change_window_attributes(m_connection, windows.at(i), XCB_CW_EVENT_MASK, value_list);
+ }
};
</code_context>
<issue_to_address>
**Qt event subscriptions disappear**
When the task-manager or app-runtime monitoring path writes an event mask after smart hide adds its subscriptions, `X11WindowMonitor::onWindowMapped` and `XcbGetInfo::addWindows` replace the merged mask with only property, structure, and visibility bits, so scans or tracking on the Qt connection remove input and focus-out subscriptions and launcher or popup behavior stops working.
Have both paths preserve the existing Qt connection's event-mask bits when adding their subscriptions.
</issue_to_address>
### Comment 2
<location path="panels/dock/x11dockhelper.cpp" line_range="335-342" />
<code_context>
+ const uint32_t currentMask = attributes->your_event_mask;
+ free(attributes);
+
+ const uint32_t mergedMask = currentMask | monitorMask;
+ if (mergedMask == currentMask)
+ continue;
+
+ // This runs on the connection owned by Qt. Merging keeps Qt's own subscriptions
+ // (focus, keyboard, buttons, exposure) instead of replacing them.
+ uint32_t value_list[] = { mergedMask };
+ xcb_change_window_attributes(m_connection, windows.at(i), XCB_CW_EVENT_MASK, value_list);
+ }
};
</code_context>
<issue_to_address>
**Concurrent mask update loses subscriptions**
When another X11 component changes the same window’s event mask between the attribute reply and this change request, `monitorWindowChange` writes the mask captured by its earlier query; if another X11 user of the connection changes that window’s event mask after the reply, this write replaces that newer mask and its subscriptions stop receiving events.
Serialize event-mask updates for a connection and window, or centralize mask ownership so updates cannot overwrite a newer selection.
</issue_to_address>
|
BLumia
approved these changes
Nov 26, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, Ivy233 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.
Log: Preserve Qt's X11 event subscriptions and batch event-mask queries for newly tracked windows.
Influence: Smart hide keeps working without losing launcher input or focus-out behavior, and window updates avoid one blocking X11 round trip per window.
fix(dock): 智能隐藏监听窗口时保留 X11 事件订阅并批量查询
替换整个掩码。
本次更新不再按窗口逐一阻塞等待 X11 往返。
Log: 监听窗口时保留 Qt 的 X11 事件订阅,并批量查询本次新增窗口的事件掩码,保证智能隐藏正常工作。
Influence: 智能隐藏正常生效,启动器和弹窗保持正常的输入与失焦关闭行为;新增窗口的事件掩码批量处理,不再按窗口逐一阻塞等待 X11 往返。
PMS: BUG-383253
Summary by Sourcery
Preserve Qt X11 event subscriptions and batch smart-hide monitoring updates for newly tracked windows.
Bug Fixes:
Enhancements: