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

+16
View File
@@ -10403,6 +10403,22 @@ void CMy2015RemoteDlg::SendScreenPreviewRequest(context* ctx, WORD reqId, WORD m
ctx->Send2Client((PBYTE)&req, sizeof(req));
}
void CMy2015RemoteDlg::SendScreenPreviewRequestEx(context* ctx, WORD reqId, WORD maxWidth,
BYTE jpegQuality, const ScreenPreviewReqEx& ex)
{
if (!ctx) return;
BYTE buf[sizeof(ScreenPreviewReq) + sizeof(ScreenPreviewReqEx)] = {};
ScreenPreviewReq req;
memset(&req, 0, sizeof(req));
req.cmd = COMMAND_SCREEN_PREVIEW_REQ;
req.reqId = reqId;
req.maxWidth = maxWidth;
req.jpegQuality = jpegQuality;
memcpy(buf, &req, sizeof(req));
memcpy(buf + sizeof(req), &ex, sizeof(ex));
ctx->Send2Client(buf, (int)sizeof(buf));
}
// 收到 TOKEN_SCREEN_PREVIEW_RSP(在主线程)
// wParam: 未使用
// LPARAM: 指向堆分配的 PreviewRspMsg*(含 clientId + 完整响应包:[Header|JPEG]),