Skip to content

Commit 17a95fd

Browse files
hoshinolinarobbert-vdh
authored andcommitted
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.
1 parent 2e1dcb2 commit 17a95fd

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/wine-host/editor.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,12 +518,24 @@ void Editor::handle_x11_events() noexcept {
518518
// intermediate wrapper window. However, this window
519519
// receives synthetic (absolute) ConfigureNotify events, so
520520
// in this case we keep track of its position directly.
521+
// If this happens once, we ignore all real ConfigureNotify
522+
// events, as the relative position will not be correct if
523+
// there is another offset window between the parent window
524+
// and the host window (as is the case in Ardour). However,
525+
// we still accept the new dimensions of real
526+
// ConfigureNotify events, as this is necessary for resizing
527+
// to work properly.
521528
if (event->window == host_window_ && is_synthetic_event) {
522529
host_window_config_ = *event;
523530
}
524531
if (event->window == parent_window_) {
525-
parent_window_config_ = *event;
526-
parent_window_config_abs_ = is_synthetic_event;
532+
if (is_synthetic_event || !parent_window_config_abs_) {
533+
parent_window_config_ = *event;
534+
parent_window_config_abs_ = is_synthetic_event;
535+
} else {
536+
parent_window_config_.width = event->width;
537+
parent_window_config_.height = event->height;
538+
}
527539
}
528540

529541
// Window managers are expected to send ConfigureNotify to

0 commit comments

Comments
 (0)