mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
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 db2cc5800a.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<bool&>(static_cast<const bool&>(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,
|
||||
|
||||
@@ -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`.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user