fix(fx-gui): bring plugin window to top before real click (anchored mode)
Real-input clicks were landing in whatever window sat above the anchored
plugin window (foreground Chrome in tests) — WindowFromPoint at the click
point returned the browser, so the editor never saw the input. Attach to
the foreground thread, SetForegroundWindow + BringWindowToTop before the
click (still non-TOPMOST — no floating regression from 80c663e).
This commit is contained in:
@@ -269,6 +269,18 @@ uint64_t frameHash(HWND hwnd) {
|
||||
return h;
|
||||
}
|
||||
|
||||
// Lift the window above the foreground app without making it TOPMOST (the
|
||||
// foreground-lock would otherwise swallow real clicks). Attaching to the
|
||||
// foreground thread is required to steal foreground from another process.
|
||||
static void bringToTop(HWND hwnd) {
|
||||
DWORD fgTid = GetWindowThreadProcessId(GetForegroundWindow(), nullptr);
|
||||
DWORD myTid = GetCurrentThreadId();
|
||||
if (fgTid && fgTid != myTid) AttachThreadInput(fgTid, myTid, TRUE);
|
||||
SetForegroundWindow(hwnd);
|
||||
BringWindowToTop(hwnd);
|
||||
if (fgTid && fgTid != myTid) AttachThreadInput(fgTid, myTid, FALSE);
|
||||
}
|
||||
|
||||
void danceStart(HWND hwnd, HWND target, int x, int y) {
|
||||
// Real-input fallback (only entered when synthetic PostMessage was probed
|
||||
// as rejected — iZotope/JUCE editors): hardware input needs the plugin
|
||||
@@ -291,6 +303,7 @@ void danceStart(HWND hwnd, HWND target, int x, int y) {
|
||||
}
|
||||
SetWindowPos(hwnd, HWND_TOP, g_embedRect.left, g_embedRect.top,
|
||||
cw, ch, SWP_NOACTIVATE | SWP_SHOWWINDOW);
|
||||
bringToTop(hwnd); // plugin must sit above the foreground app (e.g. browser) or real clicks land there
|
||||
fxGuiRequestResize(hwnd, cw, ch);
|
||||
Sleep(60); // let the compositor repaint so the editor sees itself active
|
||||
g_dance = true;
|
||||
|
||||
Reference in New Issue
Block a user