Alexandros Frantzis (@afrantzis) commented about dlls/winewayland.drv/window.c:
{ struct wayland_client_surface *client; struct wayland_win_data *data;
HWND toplevel; BOOL managed;
TRACE("hwnd %p new_rects %s after %p flags %08x\n", hwnd, debugstr_window_rects(new_rects), insert_after, swp_flags);
if ((toplevel = NtUserGetAncestor(hwnd, GA_ROOT)) == hwnd) toplevel = 0;
Similarly to my other comment, this seems a bit suspicious, but perhaps it's actually what we want in this particular case, since the toplevel is only used in the `!surface` case below.
I guess if `hwnd` is a toplevel itself and it doesn't have a window_surface (how can that happen?), it wouldn't make sense to attach the client surface either?