linuxwayland

What does surface represents in Wayland


I've extensively read the wayland documentation and resources on the topic but still cannot wrap my head around this question. Is Wayland's wl_surface represent a window or the display surface itself? It would make sense if wl_surface represents a display as we don't provide any window-specific information to the create_surface request, but then it would be called get_surface, wouldn't it? I really cannot figure that out on my own.

I've tried to find some existing questions on the topic that are answered already. But it seems there is no questions like that on the SO, so here it is. For me, as well as for any other person who would encounter the same problem


Solution

  • A quick search brought a chapter from the Wayland Book to me: https://wayland-book.com/surfaces/roles.html

    A surface can have many roles, application window is one of them. But it's not the display surface, also because a few chapters earlier (https://wayland-book.com/surfaces/compositor.html) the book describes

    To quote the spec, a Wayland surface has a rectangular area which may be displayed on zero or more outputs, present buffers, receive user input, and define a local coordinate system.

    Maybe you were confused by the wl_shell_surface (see specs at https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_shell_surface) because this is

    An interface that may be implemented by a wl_surface, for implementations that provide a desktop-style user interface.

    But it is more like a "skin" maybe covered with icons, menus, windows; just think of a multi-desktop-environment where you can switch between two or more virtual desktops, each with its own window-configuration etc.