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.
This commit is contained in:
Asahi Lina
2025-05-23 14:14:18 +09:00
committed by Robbert van der Helm
parent 2e1dcb2316
commit 17a95fdf99
+14 -2
View File
@@ -518,12 +518,24 @@ void Editor::handle_x11_events() noexcept {
// intermediate wrapper window. However, this window // intermediate wrapper window. However, this window
// receives synthetic (absolute) ConfigureNotify events, so // receives synthetic (absolute) ConfigureNotify events, so
// in this case we keep track of its position directly. // 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) { if (event->window == host_window_ && is_synthetic_event) {
host_window_config_ = *event; host_window_config_ = *event;
} }
if (event->window == parent_window_) { if (event->window == parent_window_) {
parent_window_config_ = *event; if (is_synthetic_event || !parent_window_config_abs_) {
parent_window_config_abs_ = is_synthetic_event; 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 // Window managers are expected to send ConfigureNotify to