Rémi Bernon (@rbernon) commented about dlls/winewayland.drv/window.c:
- if (surface && role && surface->role && role != surface->role) goto out;
- visible = (NtUserGetWindowLongW(data->hwnd, GWL_STYLE) & WS_VISIBLE) == WS_VISIBLE;
- xdg_visible = surface->xdg_toplevel != NULL;
/* Ensure that we have a wayland surface. */
if (!surface && !(surface = wayland_surface_create(data->hwnd))) goto out;
pthread_mutex_lock(&surface->mutex);
- if (visible != xdg_visible)
- if ((role == WAYLAND_SURFACE_ROLE_TOPLEVEL) != !!(surface->xdg_toplevel) ||
(role == WAYLAND_SURFACE_ROLE_SUBSURFACE) != !!(surface->wl_subsurface) ||
{ /* If we have a pre-existing surface ensure it has no role. */ if (data->wayland_surface) wayland_surface_clear_role(surface);(role == WAYLAND_SURFACE_ROLE_SUBSURFACE && surface->parent_hwnd != parent_data->hwnd))
The comment above `wayland_surface_clear_role` says that we are only allowed to give it the same role, would that still hold with this change which introduces different roles? It's not very obvious that it is from the code, when windows are getting reparented for instance.
I think it would be cleaner to better separate the two wayland surface use cases - one which uses top-level wayland surfaces for windowing purposes, and the other one which uses wayland sub-surfaces in OpenGL/Vulkan only. Maybe it would even be better to not share that much code between the two, they are pretty much separate and GL/VK doesn't need any of the windowing logic.
Generally speaking I don't think we want to create dedicated host surfaces for child windows, the Win32 compositing rules are already implemented more or less correctly and in a driver-independent way. This also means that some of the later changes in this MR aren't going to be necessary.
We still want dedicated surface for accelerated content (incl. child windows) because there's no other way, but ultimately only for cases where it can be presented directly on screen. For all the other cases we will need to do the composition ourselves, in a host-independent way, with the help of the host if possible but only for things like partial presentation, or maybe with our own accelerated composition engine.