Fix fx-gui z-order: anchored window HWND_TOPMOST so real clicks reach plugin over webview; /hide demotes

This commit is contained in:
2026-08-19 11:39:11 +07:00
parent 2bbe80efa3
commit dbbcb85ffe
2 changed files with 6 additions and 2 deletions
+6 -2
View File
@@ -283,7 +283,7 @@ void danceStart(HWND hwnd, HWND target, int x, int y) {
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
SWP_NOACTIVATE | SWP_FRAMECHANGED);
}
SetWindowPos(hwnd, HWND_TOP, g_embedRect.left, g_embedRect.top,
SetWindowPos(hwnd, HWND_TOPMOST, g_embedRect.left, g_embedRect.top,
cw, ch, SWP_NOACTIVATE | SWP_SHOWWINDOW);
fxGuiRequestResize(hwnd, cw, ch);
Sleep(60); // let the compositor repaint so the editor sees itself active
@@ -520,6 +520,10 @@ void runHttpServer(HWND hwnd, std::atomic<bool>& stop) {
sendResponse(c, 400, "application/json", "{\"error\":\"bad json\"}", 20);
}
} else if (req.path == "/hide") {
// Demote first: without it the next SW_SHOW would keep the
// window topmost and it would float over other apps.
SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
ShowWindow(hwnd, SW_HIDE);
sendResponse(c, 200, "application/json", "{\"ok\":true}", 11);
} else if (req.path == "/show") {
@@ -558,7 +562,7 @@ void runHttpServer(HWND hwnd, std::atomic<bool>& stop) {
// 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,
SetWindowPos(hwnd, HWND_TOPMOST, 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);