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
This commit is contained in:
Robbert van der Helm
2021-06-15 13:16:50 +02:00
parent 8fbc13fc25
commit f2ffb68b55
2 changed files with 25 additions and 5 deletions
+18 -5
View File
@@ -257,8 +257,21 @@ Editor::Editor(MainContext& main_context,
reinterpret_cast<LPCSTR>(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<LPCSTR>(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);