Alexandros Frantzis (@afrantzis) commented about dlls/winewayland.drv/window.c:
/* Get the managed state with win_data unlocked, as is_window_managed * may need to query win_data information about other HWNDs and thus * acquire the lock itself internally. */
- managed = is_window_managed(hwnd, swp_flags, &new_rects->window);
- if (!(managed = is_window_managed(hwnd, swp_flags, &new_rects->window)) && surface)
- {
toplevel = NtUserGetWindowRelative(hwnd, GW_OWNER);
if (toplevel) toplevel = NtUserGetAncestor(toplevel, GA_ROOT);
/* fallback to any window that is right below our top left corner */
if (!toplevel) toplevel = NtUserWindowFromPoint(new_rects->window.left - 1, new_rects->window.top - 1);
If I am reading the docs correctly `NtUserWindowFromPoint()` can return child windows in which case anchoring won't work. If we move this above the `NtUserGetAncestor(toplevel, GA_ROOT)` a couple of lines above we will we get a proper toplevel in all cases. Are there any downsides to this?