Only reset coordinates when resizing

This was the original idea. I though that to be extra safe, maybe we can
do this all the time. And while that does work fine, most of the time,
it does cause a lot of other fun issues especially when plugins fully
redraw themselves that way.
This commit is contained in:
Robbert van der Helm
2021-08-16 21:31:57 +02:00
parent aee6e9a4a7
commit b84aa18ecf
2 changed files with 16 additions and 21 deletions
+4 -4
View File
@@ -23,10 +23,10 @@ Versioning](https://semver.org/spec/v2.0.0.html).
### Changed
- Yabridge's Wine window embedding now takes more measures to make sure that the
plugin draws itself properly in the top left corner of the window. This is
needed for some buggy plugins that draw window based on absolute screen
coordinates, instead of their positioning within the parent window, like the
_Soundtoys_ plugins and older _PSPaudioware_ plugins.
plugin draws itself properly in the top left corner of the window when windows
are being resized. This is needed for some buggy plugins that draw window
based on absolute screen coordinates, instead of their positioning within the
parent window, like the _Soundtoys_ plugins and older _PSPaudioware_ plugins.
### Fixed
+12 -17
View File
@@ -440,6 +440,18 @@ void Editor::resize(uint16_t width, uint16_t height) {
value_mask, values.data());
xcb_flush(x11_connection.get());
// Before lying to Wine about the window's coordinates, we do need to make
// sure that the window is actually placed at (0, 0) coordinates. Otherwise
// some plugins that rely on screen coordinates, like the Soundtoys plugins
// and older PSPaudioware plugins, will draw their GUI at the wrong
// location.
logger.log_editor_trace([]() {
return "DEBUG: Resetting Wine window position back to (0, 0)";
});
SetWindowPos(win32_window.handle, nullptr, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOCOPYBITS |
SWP_NOOWNERZORDER | SWP_DEFERERASE);
// Make sure that after the resize the screen coordinates always match up
// properly. Without this Soundtoys Crystallizer might appear choppy or skip
// a frame during their resize animation (which somehow calls
@@ -715,23 +727,6 @@ void Editor::fix_local_coordinates() const {
return;
}
// Before lying to Wine about the window's coordinates, we do need to make
// sure that the window is actually placed at (0, 0) coordinates. Otherwise
// some plugins that rely on screen coordinates, like the Soundtoys plugins
// and older PSPaudioware plugins, will draw their GUI at the wrong
// location. In case we have multiple `ConfiguratioNotify` events in a row,
// we'll only need to do this once.
RECT current_pos{};
if (GetWindowRect(win32_window.handle, &current_pos) ||
current_pos.left != 0 || current_pos.top != 0) {
logger.log_editor_trace([]() {
return "DEBUG: Resetting Wine window position back to (0, 0)";
});
SetWindowPos(win32_window.handle, nullptr, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOREDRAW | SWP_NOACTIVATE |
SWP_NOCOPYBITS | SWP_NOOWNERZORDER | SWP_DEFERERASE);
}
// We're purposely not using XEmbed here. This has the consequence that wine
// still thinks that any X and Y coordinates are relative to the x11 window
// root instead of the parent window provided by the DAW, causing all sorts