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:
1 parent
5bb24d714a
commit
5eb44307ee
11 files changed
+93
-48
No files matched your search
@@ -176,6 +176,7 @@ public:
|
||||
static int& MonitorNext() { static int v = 0; return v; } // 下一次"切换显示器"要去的屏
|
||||
static void CommitMonitorIndex(int idx) { MonitorCur() = idx; MonitorNext() = idx + 1; }
|
||||
int m_nMonitorIndex = 0; // 本次构造选中的屏;后端初始化成功后由它提交
|
||||
bool m_bForceVirtualDesktop = false; // 外部强制整虚拟桌面(远程控制),不参与屏轮转
|
||||
|
||||
// 滚动检测相关
|
||||
CScrollDetector* m_pScrollDetector; // 滚动检测器
|
||||
@@ -221,8 +222,10 @@ protected:
|
||||
int m_nVScreenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||
|
||||
public:
|
||||
// forceVirtual:强制抓取整个虚拟桌面(屏索引 0),不参与「切换显示器」轮转。
|
||||
// 远程控制会话需要截图与注入共用同一坐标系,多显示器下必须整桌面抓屏。
|
||||
ScreenCapture(int n = 32, BYTE algo = ALGORITHM_DIFF, BOOL all = FALSE, int level = LEVEL_H264_SOFT,
|
||||
RECT rc = {0}, BOOL switchScreen = TRUE) :
|
||||
RECT rc = {0}, BOOL switchScreen = TRUE, BOOL forceVirtual = FALSE) :
|
||||
m_ThreadPool(nullptr), m_FirstBuffer(nullptr), m_RectBuffer(nullptr),
|
||||
m_BitmapInfor_Full(nullptr), m_bAlgorithm(algo), m_SendQuality(100),
|
||||
m_ulFullWidth(0), m_ulFullHeight(0), m_bZoomed(false), m_wZoom(1), m_hZoom(1),
|
||||
@@ -232,6 +235,7 @@ public:
|
||||
m_bLastFrameWasScroll(false), m_nScrollDetectInterval(1), m_EncodeLevel(level)
|
||||
{
|
||||
SetAlgorithm(algo);
|
||||
m_bForceVirtualDesktop = (forceVirtual != FALSE);
|
||||
m_ROI = rc;
|
||||
m_BitmapInfor_Send = nullptr;
|
||||
m_BmpZoomBuffer = nullptr;
|
||||
@@ -247,7 +251,10 @@ public:
|
||||
m_nScreenCount = monitors.size();
|
||||
m_bEnableMultiScreen = all;
|
||||
if (all && !monitors.empty()) {
|
||||
int idx = (switchScreen ? MonitorNext() : MonitorCur()) % (int)(monitors.size()+1);
|
||||
// forceVirtual 时恒取 0(虚拟桌面),也不推进 MonitorNext:这个选择由
|
||||
// COMMAND_SCREEN_SPY 每次会话显式给出,不该影响人类的屏轮转顺序。
|
||||
int idx = forceVirtual ? 0
|
||||
: (switchScreen ? MonitorNext() : MonitorCur()) % (int)(monitors.size()+1);
|
||||
m_nMonitorIndex = idx;
|
||||
if (idx == 0) {
|
||||
m_iScreenX = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||
|
||||
Reference in new issue
Block a user