Feature: Add native region, window and monitor capture to get_screenshot

New Windows clients advertise CLIENT_CAP_SCREEN_REGION and accept a 24-byte
ScreenPreviewReqEx appended to the existing 8-byte preview request, so
get_screenshot can capture a region, a window or a single monitor at 1:1
resolution instead of only the scaled virtual desktop. Successful v2
responses append an optional ScreenCaptureMeta block reporting the source
rect and scale, letting callers map coordinates back for remote input.
Old clients and old servers keep the v1 byte stream unchanged.

The 8192 px per-side bound only applies to native (1:1) capture, where it
guards bitmap memory; scaled captures are unaffected so ultra-wide virtual
desktops (for example triple 4K) still produce thumbnails and previews.
max_width is clamped to [64,1920] as before instead of rejected, matching
the documented schema.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-10 16:34:10 +01:00
1 parent b2c0d81396
commit 235a8a622c
11 files changed
+668 -97

No files matched your search

+8
View File
@@ -123,6 +123,14 @@ public:
return (strtoul(caps.GetString(), nullptr, 16) & CLIENT_CAP_WINDOW_INFO) != 0;
}
// 检查客户端是否支持区域/窗口/显示器原生分辨率截图(COMMAND_SCREEN_PREVIEW_REQ 的
// v2 扩展,CLIENT_CAP_SCREEN_REGION)。未声明时 get_screenshot 只能整屏抓取。
bool SupportsScreenCapture() const {
CString caps = GetClientData(ONLINELIST_CAPABILITIES);
if (caps.IsEmpty()) return false;
return (strtoul(caps.GetString(), nullptr, 16) & CLIENT_CAP_SCREEN_REGION) != 0;
}
// 检查客户端是否支持远程协议切换(COMMAND_SET_PROTO)。老客户端没有这个命令,
// 收到也会走 default 丢弃,服务端据此把「协议切换」菜单置灰。
bool SupportsProtoSwitch() const {