mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Don't respond to hit tests from the Win32 window
This will let us detect other, non-wrapper windows to the right and to the bottom of a plugin GUI. Useful for drag-and-drop so we don't end up overriding Wine's internal drag-and-drop mechanism.
This commit is contained in:
@@ -1082,6 +1082,20 @@ LRESULT CALLBACK window_proc(HWND handle,
|
|||||||
SetCursor(arrow_cursor);
|
SetCursor(arrow_cursor);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
// NOTE: Needed for our `is_cursor_in_wine_window()` implementation. Our
|
||||||
|
// `win32_window` extends way past the visible plugin GUI. And
|
||||||
|
// even though it will appear nicely clipped on screen,
|
||||||
|
// `WindowFromPoint()` would still return our window when hovering
|
||||||
|
// to the right or bottom of a plugin GUI, even if there's another
|
||||||
|
// window right behind it. To make sure we can detect other Wine
|
||||||
|
// windows in that region, we need to make sure that
|
||||||
|
// `WindowFromPoint()` doesn't consider the parent window (it's
|
||||||
|
// not going to be relevant anyways). In practice this will still
|
||||||
|
// mean that the function returns our parent window if it's the
|
||||||
|
// only window on that coordinate.
|
||||||
|
case WM_NCHITTEST: {
|
||||||
|
return HTNOWHERE;
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(handle, message, wParam, lParam);
|
return DefWindowProc(handle, message, wParam, lParam);
|
||||||
@@ -1259,7 +1273,8 @@ bool is_cursor_in_wine_window() noexcept {
|
|||||||
// `WindowFromPoint()` will still return that same huge window
|
// `WindowFromPoint()` will still return that same huge window
|
||||||
// when we hover over an area to the right or to the bottom of a
|
// when we hover over an area to the right or to the bottom of a
|
||||||
// plugin GUI. We can easily detect by just checking the window
|
// plugin GUI. We can easily detect by just checking the window
|
||||||
// class name.
|
// class name. Also check out the `WM_NCHITTEST` implementation in
|
||||||
|
// the message loop above.
|
||||||
std::array<char, 64> window_class_name{0};
|
std::array<char, 64> window_class_name{0};
|
||||||
GetClassName(windows_window, window_class_name.data(),
|
GetClassName(windows_window, window_class_name.data(),
|
||||||
window_class_name.size());
|
window_class_name.size());
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ xcb_atom_t get_atom_by_name(xcb_connection_t& x11_connection,
|
|||||||
/**
|
/**
|
||||||
* Check if the cursor is within a Wine window. We can of course only detect
|
* Check if the cursor is within a Wine window. We can of course only detect
|
||||||
* Wine applications within the current prefix. This ignores the extended client
|
* Wine applications within the current prefix. This ignores the extended client
|
||||||
* area of yabridge windows (which might mean that this function will spuriously
|
* area of yabridge windows. (so it will consider other Wine windows to the
|
||||||
* return false if another window on the bottom right of an editor window is
|
* right or to the bottom of a yabridge plugin editor, but not the extended
|
||||||
* 'obstructed' by this clipped, invisible window).
|
* client area itself)
|
||||||
*/
|
*/
|
||||||
bool is_cursor_in_wine_window() noexcept;
|
bool is_cursor_in_wine_window() noexcept;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user