From f2ffb68b553446e3205062b7413e2a003e3bb144 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Tue, 15 Jun 2021 13:16:50 +0200 Subject: [PATCH] Attempt to fix rare multiple displays issue (cherry picked from 1950206159fbc830718803fa152b636b2a914a95) Under certain DEs/WMs, the window might not render at all when using multiple displays and the primary display is set to the rightmost display. This seems like a reasonably candidate for fixing this. https://github.com/robbert-vdh/yabridge/issues/89 https://github.com/robbert-vdh/yabridge/issues/104 --- CHANGELOG.md | 7 +++++++ src/wine-host/editor.cpp | 23 ++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b7f11f5..929124cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,13 @@ Versioning](https://semver.org/spec/v2.0.0.html). yabridge will now try to steal it back and reparent it to the host's window again. This very rarely happened with some window managers, like XFWM, and only in certain DAWs like **Ardour**. +- Possibly fixed an obscure error where the editor would not render when using + multiple displays, and the rightmost display was set as primary. This issue is + very rare, and I haven't gotten any response back when I asked the people + affected by this to test a potential fix, so I'm just including it in yabridge + proper in case it helps (it should at least not make anything worse). If + anyone was affected by this, please let me know if this patch makes any + difference! - Worked around a **REAPER** bug that would cause REAPER to not process any keyboard input when the FX window is active but the mouse is outside of the window. We now use the same validation used in `xprop` and `xwininfo` to find diff --git a/src/wine-host/editor.cpp b/src/wine-host/editor.cpp index 3947a6a9..5206e459 100644 --- a/src/wine-host/editor.cpp +++ b/src/wine-host/editor.cpp @@ -257,8 +257,21 @@ Editor::Editor(MainContext& main_context, reinterpret_cast(get_window_class()), "yabridge plugin", WS_POPUP, - CW_USEDEFAULT, - CW_USEDEFAULT, + // NOTE: With certain DEs/WMs (notably, + // Cinnamon), Wine does not render the + // window at all when using a primary + // display that's positioned to the + // right of another display. Presumably + // it tries to manually clip the client + // rendered client area to the physical + // display. During the reparenting and + // `fix_local_coordinates()` the window + // will be moved to `(0, 0)` anyways, + // but setting its initial position + // according to the primary display + // fixes these rendering issues. + GetSystemMetrics(SM_XVIRTUALSCREEN), + GetSystemMetrics(SM_YVIRTUALSCREEN), client_area.width, client_area.height, nullptr, @@ -372,9 +385,9 @@ Editor::Editor(MainContext& main_context, main_context, x11_connection, CreateWindowEx(WS_EX_TOOLWINDOW, reinterpret_cast(get_window_class()), - "yabridge plugin child", WS_CHILD, CW_USEDEFAULT, - CW_USEDEFAULT, client_area.width, - client_area.height, win32_window.handle, nullptr, + "yabridge plugin child", WS_CHILD, 0, 0, + client_area.width, client_area.height, + win32_window.handle, nullptr, GetModuleHandle(nullptr), this)); ShowWindow(win32_child_window->handle, SW_SHOWNORMAL);