feat: add secure-input support via _DEEPIN_SECURE_INPUT property - #379
feat: add secure-input support via _DEEPIN_SECURE_INPUT property#379justforlxz wants to merge 1 commit into
Conversation
Add secure-input support for polkit authentication windows. When a window has the _DEEPIN_SECURE_INPUT property set, KWin tracks it in the DDERestrictInterface secureInputWindowIdLists and auto-clears the entry on X11Window destruction. Add _DEEPIN_SECURE_INPUT atom alongside existing _DEEPIN_PROHIBIT_SCREENSHOT. Add PropertyNotify handler to observe the property. Mirror the existing screenshot-protection pattern (isSecureInputWindow/updateSecureInput/ secureInputWindowIdLists). Store the XID in updateSecureInput setter for destructor cleanup (window() is reset to XCB_WINDOW_NONE before dtor). 新增 _DEEPIN_SECURE_INPUT 属性支持,用于标记安全输入窗口。 KWin 通过 DDERestrictInterface 追踪安全输入窗口列表,并在窗口 销毁时自动清理。PropertyNotify 观察属性变化,与截图保护同构。 Log: 新增安全输入窗口属性支持 Influence: 拥有 _DEEPIN_SECURE_INPUT 属性的窗口被标记为安全输入窗口; X11Window 析构时自动清理列表条目;不影响现有截图保护功能
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: justforlxz 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 |
There was a problem hiding this comment.
Sorry @justforlxz, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Reviewer's GuideAdds support for the _DEEPIN_SECURE_INPUT X11 property and wires it through X11 window tracking and the Wayland dde_restrict interface, mirroring the existing screenshot protection flow so secure-input windows can be tracked and cleaned up correctly. Sequence diagram for secure-input window tracking and cleanupsequenceDiagram
actor Client
participant X11Window
participant Window
participant WaylandServer
participant DDERestrictInterface
Client->>X11Window: propertyNotifyEvent(_DEEPIN_SECURE_INPUT)
X11Window->>X11Window: updateSecureInput(isSecure)
opt [Wayland session]
X11Window->>Window: isSecureInputWindow()
Window->>WaylandServer: waylandServer()
WaylandServer->>DDERestrictInterface: ddeRestrict()
DDERestrictInterface->>DDERestrictInterface: secureInputWindowIdLists()
DDERestrictInterface-->>Window: contains(window())
Window-->>X11Window: return true/false
end
X11Window->>X11Window: ~X11Window()
alt [m_isSecureInputWindow && m_secureInputWindowId != XCB_WINDOW_NONE]
X11Window->>WaylandServer: waylandServer()
WaylandServer->>DDERestrictInterface: ddeRestrict()
DDERestrictInterface->>DDERestrictInterface: removeSecureInputWindow(m_secureInputWindowId)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review★ 总体评分:90分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 diff --git a/src/wayland/dderestrict_interface.cpp b/src/wayland/dderestrict_interface.cpp
index 37267e1e58..97ed1497c7 100644
--- a/src/wayland/dderestrict_interface.cpp
+++ b/src/wayland/dderestrict_interface.cpp
@@ -159,6 +162,15 @@ void DDERestrictInterfacePrivate::removeProtectedWindow(int32_t window)
}
}
void DDERestrictInterfacePrivate::setSecureInputWindow(int32_t window)
{
if (m_secureInputWindowIdLists.contains(window)) {
return;
}
m_secureInputWindowIdLists.append(window);
}
void DDERestrictInterfacePrivate::removeSecureInputWindow(int32_t window)
{
- for (int i = 0; i < m_secureInputWindowIdLists.length(); i++) {
- if (m_secureInputWindowIdLists[i] == window) {
- m_secureInputWindowIdLists.removeAt(i);
- break;
- }
- }
+ m_secureInputWindowIdLists.removeOne(window);
} |
Summary
Add support for the _DEEPIN_SECURE_INPUT X11 window property to mark windows as secure-input windows. When a window has this property set and the restrict daemon activates secure-input mode via the UACE extension, synthetic/injected input (XTEST, SendEvent of input-class events, XWarpPointer) is rejected by the X server.
Changes
_DEEPIN_SECURE_INPUTatom alongside_DEEPIN_PROHIBIT_SCREENSHOT_DEEPIN_SECURE_INPUTproperty (mirrorupdateProhibitScreenshot)isSecureInputWindow()/updateSecureInput(bool)/m_isSecureInputWindow/m_secureInputWindowId; destructor auto-clearssecureInputWindowIdListsisSecureInputWindow()virtual methodsecureInputWindowIdLists/setSecureInputWindow/removeSecureInputWindowDesign
_DEEPIN_PROHIBIT_SCREENSHOT/isProhibitScreenshotWindow/protectedWindowIdLists)window()is reset toXCB_WINDOW_NONEbefore destructor runs)Related
Summary by Sourcery
Add secure-input window support so the compositor and restrict service can identify and manage windows that require protection from synthetic input.
New Features:
_DEEPIN_SECURE_INPUTproperty.Bug Fixes: