Feature: Add window-relative remote_mouse coords and PTY pipes in terminal_exec
New Windows clients append an optional 20-byte WINDOWINFO_MCP_DESKTOP block (virtual desktop rect, magic 'VDCP') after the window list, so the server can map window-relative coordinates into the capture frame. remote_mouse accepts an optional window_hwnd; x/y and drag x2/y2 are then normalized against the intersection of the window and the virtual desktop, which is exactly the source rect of get_screenshot mode=window. The target window must be foreground by default, and window_hwnd/expect_hwnd must agree when both are given. structuredContent gains coordinateWindow and resolved (frame coords plus the basis rect), so callers can verify the mapping. terminal_exec now allows pipes, && and || in PTY sessions (ConPTY on Windows, POSIX PTY on Linux) because the sentinel runs on its own line; legacy non-PTY sessions still reject & and |. A read-only PeekTermSession lets the server reject unsupported syntax before BeginTermCommand. POSIX still rejects bare background & (&&, &>, 2>&1 stay allowed). Docs: Mcp_Design.md sections 12.1/20.2/22 and Mcp_Terminal_Design.md 4.4/4.6 are synchronized with the protocol, the new validation order, and the basis rect semantics. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
235a8a622c
commit
5501889d33
10 files changed
+383
-60
No files matched your search
@@ -202,10 +202,12 @@ Json::Value WindowEntryToJson(const WindowEntry& e) {
|
||||
}
|
||||
|
||||
int FetchWindowInfo(context* ctx, uint64_t devId, const char* tool, int timeoutMs,
|
||||
std::vector<WindowEntry>& out, std::string& errMsg, bool* truncated) {
|
||||
std::vector<WindowEntry>& out, std::string& errMsg, bool* truncated,
|
||||
WindowDesktopRect* desktop) {
|
||||
out.clear();
|
||||
errMsg.clear();
|
||||
if (truncated) *truncated = false;
|
||||
if (desktop) *desktop = WindowDesktopRect();
|
||||
if (!ctx) {
|
||||
errMsg = "host context unavailable";
|
||||
return 2;
|
||||
@@ -265,6 +267,19 @@ int FetchWindowInfo(context* ctx, uint64_t devId, const char* tool, int timeoutM
|
||||
e.title = title;
|
||||
out.push_back(std::move(e));
|
||||
}
|
||||
|
||||
// 可选尾块:虚拟桌面矩形(新客户端才回;老客户端包长正好到 count 条记录为止)。
|
||||
if (desktop && data.size() >= 4 + count * sizeof(WINDOWINFO_MCP) + sizeof(WINDOWINFO_MCP_DESKTOP)) {
|
||||
WINDOWINFO_MCP_DESKTOP d;
|
||||
memcpy(&d, data.data() + 4 + count * sizeof(WINDOWINFO_MCP), sizeof(d));
|
||||
if (d.magic == WINDOWINFO_DESKTOP_MAGIC && d.width > 0 && d.height > 0) {
|
||||
desktop->left = d.left;
|
||||
desktop->top = d.top;
|
||||
desktop->width = d.width;
|
||||
desktop->height = d.height;
|
||||
desktop->valid = true;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user