Feature: Capture the virtual desktop for multi-monitor remote control

The MCP Observe/Act loop requires screenshots and mouse injection to share
one coordinate space. Previously the client sent only the primary monitor
while injection used virtual-desktop coordinates, so multi-monitor hosts
were rejected outright.

- Client: COMMAND_SCREEN_SPY param buffer[11] (wire index 12) now forces
  whole-virtual-desktop GDI capture; preview JPEGs also cover the virtual
  desktop including negative origins.
- Server: advertise CLIENT_CAP_VIRTUAL_DESKTOP, gate multi-monitor remote
  control on that capability, and pass the flag when starting the session.
  Linux stays exempt (X root capture/injection are already consistent).
This commit was merged in pull request #7.
This commit is contained in:
yuanyuanxiang committed 2026-11-10 08:21:55 +01:00
1 parent 5bb24d714a
commit 5eb44307ee
11 files changed
+93 -48

No files matched your search

+5 -3
View File
@@ -13,8 +13,8 @@
//////////////////////////////////////////////////////////////////////
CScreenSpy::CScreenSpy(ULONG ulbiBitCount, BYTE algo, BOOL vDesk, int gop, BOOL all, int level,
RECT rc, BOOL switchScreen, HWND hwnd, bool dynamicFg) :
ScreenCapture(ulbiBitCount, algo, all, level, rc, switchScreen)
RECT rc, BOOL switchScreen, HWND hwnd, bool dynamicFg, BOOL forceVirtual) :
ScreenCapture(ulbiBitCount, algo, all, level, rc, switchScreen, forceVirtual)
{
m_hTargetWnd = hwnd;
m_bDynamicForeground = dynamicFg;
@@ -24,7 +24,9 @@ CScreenSpy::CScreenSpy(ULONG ulbiBitCount, BYTE algo, BOOL vDesk, int gop, BOOL
// 也走这里:两条路径必须落到同一块屏上,否则下一次重建会换屏。
// 窗口捕获(含动态前景)不参与屏索引:下面的窗口矩形会覆盖基类的显示器几何,
// 此时若提交,一次窗口重建就会把索引往前推一格,取消窗口捕获后画面就换屏了。
if (!hwnd && !m_bDynamicForeground && m_bEnableMultiScreen && m_nScreenCount > 0)
// 强制虚拟桌面同理:那是服务端本次会话的显式选择,不应影响人类的屏轮转顺序。
if (!hwnd && !m_bDynamicForeground && !m_bForceVirtualDesktop &&
m_bEnableMultiScreen && m_nScreenCount > 0)
CommitMonitorIndex(m_nMonitorIndex);
// 窗口捕获模式:用 DWM 真实边界覆盖基类的全屏尺寸,并缓存阴影偏移量