Filter Win32 windows for XDND by class name

Instead of ignoring all windows that have an associated X11 window. That
would otherwise treat standalone applications like yabridge GUI
wrappers.
This commit is contained in:
Robbert van der Helm
2021-07-26 14:28:15 +02:00
parent 34cbf43459
commit 186a6c01a2
2 changed files with 21 additions and 14 deletions
+8
View File
@@ -13,6 +13,14 @@ Versioning](https://semver.org/spec/v2.0.0.html).
- Added more tracing for input focus handling when using the `+editor` - Added more tracing for input focus handling when using the `+editor`
`YABRIDGE_DEBUG_LEVEL` flag. `YABRIDGE_DEBUG_LEVEL` flag.
### Fixed
- Changed the filter in the Wine->X11 drag-and-drop implementation for
distinguishing between Wine windows and other windows (so that we don't
interfere with Wine->Wine drag-and-drop) to be more specific. Before this
change we might use our own XDND implementation when dragging from a plugin to
a standalone Wine application running within the same Wine prefix.
## [3.5.0] - 2021-06-23 ## [3.5.0] - 2021-06-23
### Added ### Added
+13 -14
View File
@@ -44,7 +44,7 @@ using namespace std::literals::string_literals;
* The name of the Win32 window class we'll use for the Win32 window that the * The name of the Win32 window class we'll use for the Win32 window that the
* plugin can embed itself in. * plugin can embed itself in.
*/ */
constexpr char window_class_name[] = "yabridge plugin"; constexpr char yabridge_window_class_name[] = "yabridge plugin";
/** /**
* The Win32 timer ID we'll use to periodically call the VST2 `effeditidle` * The Win32 timer ID we'll use to periodically call the VST2 `effeditidle`
@@ -1237,7 +1237,7 @@ ATOM get_window_class() noexcept {
window_class.lpfnWndProc = window_proc; window_class.lpfnWndProc = window_proc;
window_class.hInstance = GetModuleHandle(nullptr); window_class.hInstance = GetModuleHandle(nullptr);
window_class.hCursor = arrow_cursor; window_class.hCursor = arrow_cursor;
window_class.lpszClassName = window_class_name; window_class.lpszClassName = yabridge_window_class_name;
window_class_handle = RegisterClassEx(&window_class); window_class_handle = RegisterClassEx(&window_class);
} }
@@ -1252,19 +1252,18 @@ bool is_cursor_in_wine_window() noexcept {
GetCursorPos(&windows_pointer_pos); GetCursorPos(&windows_pointer_pos);
if (HWND windows_window = WindowFromPoint(windows_pointer_pos); if (HWND windows_window = WindowFromPoint(windows_pointer_pos);
windows_window && windows_window != windows_desktop_window) { windows_window && windows_window != windows_desktop_window) {
// NOTE: Because resizing reparented Wine windows without XEmbed is // NOTE: Because resizing reparented Wine windows without XEmbed is a
// a bit janky, yabridge creates windows with client areas // bit janky, yabridge creates windows with client areas large
// large enough to fit the entire screen, and the plugin then // enough to fit the entire screen, and the plugin then embeds its
// embeds its own GUI in a portion of that. The result is that // own GUI in a portion of that. The result is that
// `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 // when we hover over an area to the right or to the bottom of a
// a plugin GUI. We can easily detect and skip that though, // plugin GUI. We can easily detect by just checking the window
// since the embedded plugin windows won't have an X11 window // class name.
// ID property. std::array<char, 64> window_class_name{0};
const xcb_window_t x11_window = GetClassName(windows_window, window_class_name.data(),
static_cast<xcb_window_t>(reinterpret_cast<size_t>( window_class_name.size());
GetProp(windows_window, "__wine_x11_whole_window"))); if (strcmp(window_class_name.data(), yabridge_window_class_name) != 0) {
if (x11_window == XCB_NONE) {
return true; return true;
} }
} }