On Wed Feb 4 03:38:46 2026 +0000, Alexandre Julliard wrote:
That will only work for two windows, otherwise it will mess up the Z-order. I don't think we should be bringing the insert_after window to the front. You are correct that when there are more than two windows, window Z-order issues can arise. For example, with three windows in the order: **hwndA, hwndB, hwndC**, if we call **SetWindowPos(hwndB, hwndA, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOACTIVATE)** to place **hwndA** above **hwndB**, based on my MR modification, **hwndA** would actually be placed at the top, resulting in the window Z-order: **hwndB, hwndC, hwndA**. However, the expected window Z-order should be: **hwndB, hwndA, hwndC**.
Actually, I think the correct modification for my MR should be: `XWindowChanges changes;` `changes.stack_mode = Below;` `changes.sibling = prev_window;` `XConfigureWindow(data->display, data->whole_window, CWStackMode | CWSibling, &changes);` However, the current X server does not support the **CWSibling** mode very well, so I abandoned this modification approach. In my own testing, calling the **XSetTransientForHint** function to establish a relationship between two windows can successfully place **hwndA** above **hwndB** without affecting the Z-order of other windows. For example, calling **XSetTransientForHint(data->display, prev_window, data->whole_window)**; achieves this. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9999#note_128743