From 17a95fdf992cbb8be0194c32a15b0a6d41093635 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Fri, 23 May 2025 14:14:18 +0900 Subject: [PATCH] Ignore relative ConfigureNotify events after absolute ones Once we get a single absolute ConfigureNotify event, we assume they will keep coming and ignore any relative ones. The relative computation only works if the parent window is a direct descendant of the host window, which may not be the case. To fully fix this in the general case (only relative ConfigureNotify events) we would have to walk the window hierarchy and add up all the offsets until the host window, but so far the only known case of an extra level (Ardour VST2) also sends absolute ConfigureNotify events, so we can just use those. --- src/wine-host/editor.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/wine-host/editor.cpp b/src/wine-host/editor.cpp index 80b2a6fb..c38ccc50 100644 --- a/src/wine-host/editor.cpp +++ b/src/wine-host/editor.cpp @@ -518,12 +518,24 @@ void Editor::handle_x11_events() noexcept { // intermediate wrapper window. However, this window // receives synthetic (absolute) ConfigureNotify events, so // in this case we keep track of its position directly. + // If this happens once, we ignore all real ConfigureNotify + // events, as the relative position will not be correct if + // there is another offset window between the parent window + // and the host window (as is the case in Ardour). However, + // we still accept the new dimensions of real + // ConfigureNotify events, as this is necessary for resizing + // to work properly. if (event->window == host_window_ && is_synthetic_event) { host_window_config_ = *event; } if (event->window == parent_window_) { - parent_window_config_ = *event; - parent_window_config_abs_ = is_synthetic_event; + if (is_synthetic_event || !parent_window_config_abs_) { + parent_window_config_ = *event; + parent_window_config_abs_ = is_synthetic_event; + } else { + parent_window_config_.width = event->width; + parent_window_config_.height = event->height; + } } // Window managers are expected to send ConfigureNotify to