How are GDK_WINDOW_CHILD windows created as subsurfaces in wayland?

I noticed that in wayland , popovers are created as subsurfaces rather than new windows. (I discovered this while investigating I’m not really sure why it is a subsurface instead of using xdg_popup, but anyway, I was looking through the code of gtk and gdk to figure out how this was happening, and am quite confused about it. It appears that GtkPopover sets the window type to GDK_WINDOW_CHILD. But in should_map_as_subsurface we have the following code (

    return TRUE;

    return FALSE;

but since the window type is GDK_WINDOW_CHILD, it seems like this should return false, but apparantly it doesn’t. What is going on?

The GtkPopover widget is a GtkBin container. When it is associated with a GtkWindow, the window creates a GDK_WINDOW_SUBSURFACE (Wayland only) and puts the popover’s GDK_WINDOW_CHILD inside of it:

1 Like

Ah, that makes sense. Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.