Repository navigation
fix: restore LIBDJK_SUPPORT guard for clipboard - #833
pppanghu77 wants to merge 1 commit into
Conversation
1. Root cause: commit 0617b0f removed the #ifdef LIBDJK_SUPPORT guard in openWindow(), making WaylandUtils::isWayland() ? InputOutput : InputOnly execute unconditionally; in Wayland sessions the InputOutput window gets unmapped by enter(), and XSetSelectionOwner on the unmapped window is not bridged by XWayland to the native Wayland clipboard 2. Fix: restore the #ifdef LIBDJK_SUPPORT guard so that when LIBDJK_SUPPORT is undefined inputType falls back to InputOnly, preventing the window from being unmapped and allowing XSetSelectionOwner to work correctly 3. Impact: only affects Wayland session window creation type; X11 sessions are unaffected (WaylandUtils::isWayland() returns false) Log: fix clipboard sharing not working in Wayland sessions Influence: 1. Test cross-device clipboard sharing in Wayland session 2. Verify X11 session cross-device cooperation has no regression fix: 恢复 LIBDJK_SUPPORT 守卫修复剪贴板共享 1. 根因:commit 0617b0f 移除了 openWindow() 中的 #ifdef LIBDJK_SUPPORT 守卫,导致 WaylandUtils::isWayland() ? InputOutput : InputOnly 无条件执行;Wayland 会话下 InputOutput 窗口被 enter() 取消映射,XSetSelectionOwner 在 unmapped 窗口上设置的选区不被 XWayland 桥接到原生 Wayland 剪贴板 2. 方案:恢复 #ifdef LIBDJK_SUPPORT 守卫,未定义时 inputType 回退为 InputOnly,窗口不被 enter() unmap, XSetSelectionOwner 正常工作 3. 影响:仅影响 Wayland 会话下窗口创建类型;X11 会话不受影响 Log: 修复 Wayland 会话下剪贴板共享不生效的问题 Influence: 1. 测试 Wayland 会话下跨端剪贴板共享功能 2. 验证 X11 会话下跨端协同功能无回归 PMS: BUG-278649
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR restores the LIBDJK_SUPPORT compile-time guard in XWindowsScreen::openWindow(), limiting the Wayland-specific InputOutput window behavior to builds that support it and restoring InputOnly behavior for current builds. This prevents the window from being unmapped before XSetSelectionOwner can bridge clipboard contents under Wayland, while preserving existing X11 behavior. Sequence diagram for Wayland clipboard ownership after window creationsequenceDiagram
participant Screen as XWindowsScreen
participant Wayland as WaylandUtils
participant X11 as XServer
participant Clipboard as XWindowsClipboard
Screen->>Screen: openWindow()
alt LIBDJK_SUPPORT defined
Screen->>Wayland: isWayland()
Wayland-->>Screen: true or false
Screen->>X11: XCreateWindow(inputType)
else LIBDJK_SUPPORT undefined
Screen->>X11: XCreateWindow(InputOnly)
end
Clipboard->>X11: XSetSelectionOwner()
X11-->>Clipboard: clipboard ownership available
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pppanghu77 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 |
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例本报告由 AI 代码审查工具自动生成 |
Root Cause Analysis
Commit
0617b0f7("feat: Remove displayjack kvm depend") removed the#ifdef LIBDJK_SUPPORTguard inXWindowsScreen::openWindow(), causingWaylandUtils::isWayland() ? InputOutput : InputOnlyto execute unconditionally. In Wayland sessions, the InputOutput window gets unmapped byenter()(XWindowsScreen.cpp:237), andXSetSelectionOwneron the unmapped window (XWindowsClipboard.cpp:285) is not bridged by XWayland to the native Wayland clipboard, resulting in clipboard sharing failure between connected devices.Fix
Restore the
#ifdef LIBDJK_SUPPORTguard inXWindowsScreen.cpp:1040. WhenLIBDJK_SUPPORTis undefined (the current state after0617b0f7removedFindLibDJK.cmake),inputTypefalls back toInputOnly, preventing the window from being unmapped byenter()and allowingXSetSelectionOwnerto work correctly. This matches the fix already applied indevelop/v25(commit5b45e349, PMS BUG-341993).Change Safety Assessment
Code Safety
0617b0f7), not a fix. No function signatures changed, no public members modified, 0 affected callers (local variable only).develop/v25branch (commit5b45e349).Business Impact Scope
Affects cross-device clipboard sharing in Wayland sessions only. X11 sessions are unaffected (
WaylandUtils::isWayland()returns false, behavior unchanged). The change is limited to theinputTypelocal variable inopenWindow().Verification Suggestion
Test cross-device clipboard sharing in a Wayland session: connect two devices, copy text/screenshot on one, verify clipboard content appears on the other. Verify X11 session has no regression.
根因分析
commit
0617b0f7("feat: Remove displayjack kvm depend")移除了XWindowsScreen::openWindow()中的#ifdef LIBDJK_SUPPORT守卫,导致WaylandUtils::isWayland() ? InputOutput : InputOnly无条件执行。Wayland 会话下 InputOutput 窗口被enter()取消映射(XWindowsScreen.cpp:237),XSetSelectionOwner在 unmapped 窗口上设置的选区(XWindowsClipboard.cpp:285)不被 XWayland 桥接到原生 Wayland 剪贴板,导致跨端剪贴板共享不生效。修复方案
恢复
XWindowsScreen.cpp:1040的#ifdef LIBDJK_SUPPORT守卫。未定义LIBDJK_SUPPORT时inputType回退为InputOnly,窗口不被enter()unmap,XSetSelectionOwner正常工作。与develop/v25分支已有修复(commit5b45e349,PMS BUG-341993)一致。改动安全评估
代码安全评估
0617b0f7是功能变更,非 bug 修复;本次恢复其移除的守卫,修复该功能变更引入的回归。无函数签名变化,无公开成员修改,0 处受影响调用者(仅局部变量)。develop/v25分支已有修复一致(commit5b45e349)。业务影响范围
仅影响 Wayland 会话下跨端剪贴板共享功能。X11 会话不受影响(
WaylandUtils::isWayland()返回 false,行为不变)。改动范围限于openWindow()中的inputType局部变量。验证建议
在 Wayland 会话下测试跨端剪贴板共享:连接两台设备,在一台复制文字/截图,验证另一台剪贴板能获取内容。验证 X11 会话无回归。
PMS: BUG-278649
Summary by Sourcery
Bug Fixes: