fix(bridge): real-input dance dat window tai cursor thay vi goc work-area - het GUI floating ngoai cua so DAW khi click vao embed (iZotope/JUCE reject PostMessage)
This commit is contained in:
@@ -254,14 +254,22 @@ uint64_t frameHash(HWND hwnd) {
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void danceStart(HWND hwnd) {
|
void danceStart(HWND hwnd, HWND target, int x, int y) {
|
||||||
if (g_dance) return;
|
if (g_dance) return;
|
||||||
RECT wa = {0}, wr = {0};
|
// Dat window ngay tai vi tri cursor (dang nam tren panel embed trong DAW)
|
||||||
SystemParametersInfoA(SPI_GETWORKAREA, 0, &wa, 0);
|
// chu khong nhay ra goc man hinh: shift window sao cho client point (x,y)
|
||||||
|
// cua editor trung voi screen point dang click -> GUI xuat hien dung cho
|
||||||
|
// panel, khong con floating ngoai cua so DAW.
|
||||||
|
POINT pt = { x, y };
|
||||||
|
ClientToScreen(target, &pt); // screen cua diem click (window con offscreen)
|
||||||
|
POINT cur;
|
||||||
|
GetCursorPos(&cur);
|
||||||
|
RECT wr = {0};
|
||||||
GetWindowRect(hwnd, &wr);
|
GetWindowRect(hwnd, &wr);
|
||||||
const int w = wr.right - wr.left, h = wr.bottom - wr.top;
|
const int nx = wr.left + (cur.x - pt.x);
|
||||||
|
const int ny = wr.top + (cur.y - pt.y);
|
||||||
GetCursorPos(&g_savedCursor);
|
GetCursorPos(&g_savedCursor);
|
||||||
SetWindowPos(hwnd, HWND_TOPMOST, wa.right - w, wa.bottom - h, 0, 0,
|
SetWindowPos(hwnd, HWND_TOPMOST, nx, ny, 0, 0,
|
||||||
SWP_NOSIZE | SWP_SHOWWINDOW);
|
SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||||
Sleep(60); // let the compositor repaint so the editor sees itself active
|
Sleep(60); // let the compositor repaint so the editor sees itself active
|
||||||
g_dance = true;
|
g_dance = true;
|
||||||
@@ -334,7 +342,7 @@ void relayInput(HWND hwnd, const json_object_s* o) {
|
|||||||
|
|
||||||
if (g_realInput && (isDown || isUp || type == "mousemove" || type == "wheel")) {
|
if (g_realInput && (isDown || isUp || type == "mousemove" || type == "wheel")) {
|
||||||
if (isDown) {
|
if (isDown) {
|
||||||
danceStart(hwnd);
|
danceStart(hwnd, target, x, y);
|
||||||
POINT pt = { x, y };
|
POINT pt = { x, y };
|
||||||
if (!outside) ClientToScreen(target, &pt);
|
if (!outside) ClientToScreen(target, &pt);
|
||||||
realClick(pt.x, pt.y, true, button);
|
realClick(pt.x, pt.y, true, button);
|
||||||
@@ -355,7 +363,7 @@ void relayInput(HWND hwnd, const json_object_s* o) {
|
|||||||
danceEnd(hwnd);
|
danceEnd(hwnd);
|
||||||
}
|
}
|
||||||
} else if (type == "wheel") {
|
} else if (type == "wheel") {
|
||||||
danceStart(hwnd);
|
danceStart(hwnd, target, x, y);
|
||||||
POINT pt = { x, y };
|
POINT pt = { x, y };
|
||||||
if (!outside) ClientToScreen(target, &pt);
|
if (!outside) ClientToScreen(target, &pt);
|
||||||
SetCursorPos(pt.x, pt.y);
|
SetCursorPos(pt.x, pt.y);
|
||||||
|
|||||||
Reference in New Issue
Block a user