Paul Gofman (@gofman) commented about dlls/winex11.drv/window.c:
+ * detach_client_window + */ +static void detach_client_window( struct x11drv_win_data *data, Window window ) +{ + if (!data->client_window || data->client_window != window) return; + + XSelectInput( data->display, data->client_window, 0 ); + XFlush( data->display ); /* make sure XSelectInput is disabled for client_window after this point */ + XDeleteContext( data->display, data->client_window, winContext ); + + XReparentWindow( gdi_display, data->client_window, get_dummy_parent(), 0, 0 ); + TRACE( "%p/%lx detached client window %lx\n", data->hwnd, data->whole_window, data->client_window ); + + data->client_window = 0; +} + I think after 'XReparentWindow( gdi_display, ...)' we always need XSync(gdi_display, False). I know that as far as this patch is concerned all the uses of the helper do that XSync after anyway. But it looks like the following patches which use detach_client_window (directly or through attach_client_window added later) miss that. Maybe worth considering putting XSync() here and rearranging the calling code so it doesn't call it the second time (doing the other ops on gdi_context before this call)?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4533#note_54141