fix(vst-gui): borderless fx-gui window + anchored re-show (mouse stable)

- RenderFxJob: offscreen fx-gui window now WS_POPUP (borderless) so
  GetWindowRect == client rect; anchored placement over the embed panel is
  exact. WS_OVERLAPPEDWINDOW put the client ~31px lower/right -> cursor
  jumped on hover and clicks hit the webview (relay rejected).
- AdjustWindowRect sizes to the window's own style (no caption for POPUP).
- FxGuiServer: mousemove only SetCursorPos while dragging (buttons!=0);
  hover no longer teleports the cursor.
- FxGuiServer /show: skip SetWindowPos/resize when rect unchanged (frontend
  now re-POSTs /show every ~500ms to re-anchor on scroll/resize).
- app.jsx VstGuiEmbed: drop shownRef one-shot; re-POST /show each refresh.
- Rebuilt bridge (6 locations) + Tauri release (embedded sidecar) + v=202608190002.
This commit is contained in:
2026-08-19 10:22:35 +07:00
parent da0f8fa40e
commit e5ce9ca90a
7 changed files with 35 additions and 18 deletions
+18 -7
View File
@@ -405,7 +405,10 @@ void relayInput(HWND hwnd, const json_object_s* o) {
if (!outside) ClientToScreen(target, &pt);
realClick(pt.x, pt.y, true, button);
} else if (type == "mousemove") {
if (g_dance) {
// Drag only: moving the cursor on plain hover fights the webview
// (the plugin window sits under the pointer while anchored, so
// hover reaches it naturally — no SetCursorPos needed).
if (g_dance && buttons != 0) {
POINT pt = { x, y };
ClientToScreen(target, &pt);
SetCursorPos(pt.x, pt.y);
@@ -545,12 +548,20 @@ void runHttpServer(HWND hwnd, std::atomic<bool>& stop) {
}
if (sroot) std::free(sroot);
if (rectOk) {
SetWindowPos(hwnd, HWND_TOP, g_embedRect.left, g_embedRect.top,
g_embedRect.right - g_embedRect.left,
g_embedRect.bottom - g_embedRect.top,
SWP_NOACTIVATE | SWP_SHOWWINDOW);
fxGuiRequestResize(hwnd, g_embedRect.right - g_embedRect.left,
g_embedRect.bottom - g_embedRect.top);
const int cw = g_embedRect.right - g_embedRect.left;
const int ch = g_embedRect.bottom - g_embedRect.top;
RECT cur = {};
GetWindowRect(hwnd, &cur);
const bool same = cur.left == g_embedRect.left && cur.top == g_embedRect.top &&
cur.right - cur.left == cw && cur.bottom - cur.top == ch;
// Frontend re-POSTs /show every ~500ms to re-anchor on scroll;
// skip both when nothing moved so the plugin view is not
// re-laid-out in a loop. Re-show after /hide regardless.
if (!same || !IsWindowVisible(hwnd))
SetWindowPos(hwnd, HWND_TOP, g_embedRect.left, g_embedRect.top,
cw, ch, SWP_NOACTIVATE | SWP_SHOWWINDOW);
if (cur.right - cur.left != cw || cur.bottom - cur.top != ch)
fxGuiRequestResize(hwnd, cw, ch);
g_dance = true;
g_anchored = true;
g_parkUntil = 0;
+8 -2
View File
@@ -667,7 +667,9 @@ public:
int w = rect.right - rect.left;
int h = rect.bottom - rect.top;
RECT r = { 0, 0, w, h };
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, FALSE);
// Size to the window's own style: borderless (WS_POPUP) needs no
// caption/border adjustment.
AdjustWindowRect(&r, GetWindowLongPtrA(hwnd, GWL_STYLE), FALSE);
SetWindowPos(hwnd, nullptr, 0, 0, r.right - r.left, r.bottom - r.top,
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
view->onSize(&rect); // some Skia/OpenGL editors skip first paint
@@ -1192,7 +1194,11 @@ static int fxGuiCreateWindow(const std::string& name, bool offscreen,
const int x = offscreen ? -20000 : CW_USEDEFAULT;
const int y = offscreen ? -20000 : CW_USEDEFAULT;
const DWORD exStyle = offscreen ? WS_EX_TOOLWINDOW : 0;
const DWORD style = (offscreen ? (WS_OVERLAPPEDWINDOW & ~WS_MINIMIZEBOX) : WS_OVERLAPPEDWINDOW)
// Borderless (WS_POPUP): GetWindowRect == client rect, so anchored
// placement over the embed panel is exact. A captioned/bordered window
// (WS_OVERLAPPEDWINDOW) put the client area ~31px lower/right of the
// requested rect -> cursor jumped on hover and clicks landed on the webview.
const DWORD style = (offscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW)
| WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
HWND hwnd = CreateWindowExA(exStyle, kFxGuiWndClass,
(name.empty() ? "VST FX" : name).c_str(),