From bce3afa5e48a2e5faa916a5ee40cead7c5881cba Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 26 Dec 2020 18:13:40 +0100 Subject: [PATCH] Revert "Mostly fix editor GUIs drifting in negative coords" I've also tried a lot of other things, but none of the solutions I've tried work 100% of the time. It sounds like a better idea to have something that doesn't work consistently than to have something that inconsistently sort of works. Setting the size in `WM_WINDOWPOSCHANGING` to (0, 0) fixes the drifting, but the mouse coordinates are still wrong and `SetWindowPos()` breaks the reparenting. This reverts commit db2cc5800aad78d7b92a025a0ccb70974105cac3. --- CHANGELOG.md | 5 ----- src/wine-host/editor.cpp | 36 ++++-------------------------------- src/wine-host/editor.h | 11 ----------- 3 files changed, 4 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1c1dd3..613f38d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,11 +45,6 @@ TODO: Add an updates screenshot with some fancy VST3-only plugins to the readme and 5.8 required a change, but that change now breaks builds using Wine 6.0 and up, so this change has been reverted. -### Fixed - -- Mostly fixed editor GUIs drifting off to the top or the left when dragging the - window off screen in those directions. - ### yabridgectl - Updated for the changes in yabridge 3.0. Yabridgectl now allows you to set up diff --git a/src/wine-host/editor.cpp b/src/wine-host/editor.cpp index 5ba57a78..5de2f913 100644 --- a/src/wine-host/editor.cpp +++ b/src/wine-host/editor.cpp @@ -376,44 +376,16 @@ void Editor::fix_local_coordinates() const { translated_event.response_type = XCB_CONFIGURE_NOTIFY; translated_event.event = wine_window; translated_event.window = wine_window; - // This should be set to the same sizes the window was created on. Wine can - // get a bit confused when we suddenly report a different client area size. - // Without this certain plugins (such as those by Valhalla DSP) would break. + // This should be set to the same sizes the window was created on. Since + // we're not using `SetWindowPos` to resize the Window, Wine can get a bit + // confused when we suddenly report a different client area size. Without + // this certain plugins (such as those by Valhalla DSP) would break. translated_event.width = client_area.width; translated_event.height = client_area.height; translated_event.x = translated_coordinates->dst_x; translated_event.y = translated_coordinates->dst_y; free(translated_coordinates); - // When the window gets dragged off to the left or top corner of the screen - // a lot of plugin's GUIs start to drift off in the wrong direction when we - // send these negative coordinates in a ConfigureNotify event. To somewhat - // work around this, we'll move the Wine window to offset these changes. - // Since this could in theory cause other weird behaviour, we'll only undo - // these changes (by moving the window back to `(0, 0)`) once. - int correction_x = 0; - int correction_y = 0; - if (translated_event.x < 0) { - correction_x = -translated_event.x; - } - if (translated_event.y < 0) { - correction_y = -translated_event.y; - } - - if (correction_x != 0 || correction_y != 0) { - SetWindowPos( - get_win32_handle(), nullptr, correction_x, correction_y, 0, 0, - SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER); - has_negative_coordinate_correction = true; - } else if (has_negative_coordinate_correction.compare_exchange_strong( - const_cast(static_cast(true)), false)) { - // Undo this only once, since who knows what side effects this might - // cause - SetWindowPos( - get_win32_handle(), nullptr, 0, 0, 0, 0, - SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER); - } - xcb_send_event( x11_connection.get(), false, wine_window, XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY, diff --git a/src/wine-host/editor.h b/src/wine-host/editor.h index 56e6e47f..0d428f8c 100644 --- a/src/wine-host/editor.h +++ b/src/wine-host/editor.h @@ -250,17 +250,6 @@ class Editor { */ const xcb_window_t topmost_window; - /** - * In `fix_local_coordinates()` we send a ConfigureNotify event to the Wine - * window with its screen coordinates. Because you're not supposed to do - * that directly, we're getting some strange behaviour on some plugins when - * the window gets dragged off screen to the left or the top. We perform a - * small workaround to mostly correct this issue. This flag indicates - * whether we have done this in the last call to `fix_local_coordinates()`, - * since we only only need to undo the changes made there once. - */ - mutable std::atomic_bool has_negative_coordinate_correction = false; - /** * The atom corresponding to `_NET_ACTIVE_WINDOW`. */