mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-16 16:50:41 +01:00
* feat(host): KDE Wayland 被控端防窥模式(隐私 / 关屏) viewer RPC 7 打开防窥时,采集和输入切到 KWin 虚拟输出(portal ScreenCast VIRTUAL), 再用 kscreen-doctor 禁用物理屏;隐私模式随后重新启用物理屏并全屏覆盖桌面壁纸。 防窥期间通过 KWin InputDevice 禁用本地键鼠,指针/按键/文字改走 uinput (KDE 不处理虚拟输出共享上的 portal 输入)。 - privacy_type 实测:1 关闭、2 隐私(壁纸)、3 关屏;SettingMetric 4/7 上报真实状态 - 恢复记录 + privacy-guard 子进程:主机以任何方式结束(含 SIGKILL)都恢复屏幕和输入 - src/privacy_screen/ 分层:控制器/协议/记录/守护/遮挡窗口共享,桌面实现走 Backend trait(kde/) - portal:Session::set_virtual,闭包恢复按当前源重开;编码器随 portal 尺寸变化重建 Refs #140 * fix(privacy): 按 Mac 客户端协议应答防窥请求,修复授权竞态 - FeatureFlag ff_private_screen=2(ENHANCED_PRIVACY),声明支持关屏 - 先回 RPC 7 应答再切换,避免客户端超时报 9998;切换失败发 ReportError -7 - 应答 RPC 25 update_screen_saver_req(RpcResponse 21),隐私模式不再被中止 - SettingMetric 4/7 上报开关与最近一次模式(host_settings.json privacy_type),状态变化推送 SystemStateChange 5 - portal 会话串行打开,打开失败回填一次性授权:快速重连时防窥切换与闭包恢复并发曾清空保存的授权 字段号与枚举取自官方 Mac 客户端的 SwiftProtobuf name map。 已知限制:Mac 客户端防窥菜单切换后仍显示"不启用",实际模式正确。 Refs #140 * fix(privacy): 处理 #146 评审意见 - 预检 uinput:injector 未打开 uinput(/dev/uinput 不可用或 UU_INPUT_BACKEND=native)时, 在改动输出和设备之前拒绝防窥(虚拟输出共享上 KDE 忽略 portal 输入) - leave() 中输入设备恢复失败在恢复输出后向上返回,保留 privacy-power.json 与 guard - record::ownership() 只缓存成功持锁,guard 轮询和 recover() 可重试 - 遮挡窗口就绪握手:privacy-wallpaper 建好窗口后输出 ready,5 秒内未就绪则报错并回滚 - rebase 到 main(#145):DMA-BUF 打开路径跳过虚拟输出、失败同样回填授权; #145 的 uinput 指针路径也按隐私模式的虚拟输出区域换算坐标 - README 表格压缩为一句,细节在 docs/privacy-screen.md Refs #140 * docs(privacy): 注明 ff_system_metrics=3 对应的枚举 Refs #140 * fix(privacy): resolve lifecycle and restoration review findings
47 lines
3.4 KiB
C
47 lines
3.4 KiB
C
#ifndef UU_PORTAL_ENGINE_H
|
|
#define UU_PORTAL_ENGINE_H
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include "dmabuf_frame.h"
|
|
struct uu_portal;
|
|
typedef int (*uu_portal_cancelled_fn)(void *data);
|
|
/* One object owns one consent/session and one PipeWire stream. */
|
|
struct uu_portal *uu_portal_open(int *error, uint32_t *width, uint32_t *height);
|
|
/* Saves the rotated token immediately after Start, before video initialization. */
|
|
struct uu_portal *uu_portal_open_virtual(const char *restore, void (*save_token)(const char *, void *), void *data, int *error, uint32_t *width, uint32_t *height);
|
|
struct uu_portal *uu_portal_open_persist(const char *restore, void (*save_token)(const char *, void *), void *data, int *error, uint32_t *width, uint32_t *height);
|
|
/* The cancellation callback and data are used only until this call returns. */
|
|
struct uu_portal *uu_portal_open_persist_cancellable(const char *restore, void (*save_token)(const char *, void *), void *save_data, uu_portal_cancelled_fn cancelled, void *cancel_data, int *error, uint32_t *width, uint32_t *height);
|
|
/* Select the capture transport before connecting, including on same-process recovery. */
|
|
struct uu_portal *uu_portal_open_persist_capture(const char *restore, void (*save_token)(const char *, void *), void *save_data, uu_portal_cancelled_fn cancelled, void *cancel_data, int prefer_dmabuf, int *error, uint32_t *width, uint32_t *height);
|
|
struct uu_portal *uu_portal_open_restore(const char *restore, int *error, uint32_t *width, uint32_t *height);
|
|
const char *uu_portal_restore_token(struct uu_portal *portal);
|
|
void uu_portal_close(struct uu_portal *portal);
|
|
int uu_portal_clipboard_ready(struct uu_portal *portal);
|
|
int uu_portal_clipboard_set(struct uu_portal *portal, const uint8_t *text, size_t length);
|
|
int uu_portal_clipboard_poll(struct uu_portal *portal, uint8_t *text, size_t capacity);
|
|
int uu_portal_alive(struct uu_portal *portal);
|
|
int uu_portal_capture_alive(struct uu_portal *portal);
|
|
void uu_portal_input_dispatch(struct uu_portal *portal);
|
|
void uu_portal_logical_size(struct uu_portal *portal, uint32_t *width, uint32_t *height);
|
|
void uu_portal_reset_frame(struct uu_portal *portal);
|
|
int uu_portal_capture(struct uu_portal *portal, uint8_t *bgra, size_t length);
|
|
int uu_portal_capture_since(struct uu_portal *portal, uint8_t *bgra, size_t length, uint64_t *revision);
|
|
/* acquire holds the PipeWire loop until release, including GPU completion.
|
|
* 0/12 = leased new/unchanged frame, 10 = pending, 15 = neutral black.
|
|
* CPU fallback: 14 layout/disabled, 16 shared memory, 17 timeout, 18 explicit sync, 19 modifier. */
|
|
int uu_portal_dmabuf_acquire(struct uu_portal *portal, UuDmaFrame *frame, uint64_t *revision);
|
|
void uu_portal_dmabuf_release(struct uu_portal *portal);
|
|
void uu_portal_dmabuf_disable(struct uu_portal *portal);
|
|
int uu_portal_move(struct uu_portal *portal, double x, double y, int relative);
|
|
int uu_portal_button(struct uu_portal *portal, int button, int pressed);
|
|
int uu_portal_scroll(struct uu_portal *portal, double dx, double dy, int finish);
|
|
int uu_portal_touch_supported(struct uu_portal *portal);
|
|
int uu_portal_touch_available(struct uu_portal *portal);
|
|
int uu_portal_touch(struct uu_portal *portal, int phase, double x, double y);
|
|
int uu_portal_key(struct uu_portal *portal, uint32_t keysym, int keycode, int pressed);
|
|
int uu_portal_stream_position(struct uu_portal *portal, int32_t *x, int32_t *y);
|
|
int uu_portal_monitors(char *out, size_t length);
|
|
void uu_portal_end(struct uu_portal *portal);
|
|
#endif
|