Search code examples
surfacewaylandqtwayland

How can we create QWaylandSurface programatically?


How can we create QWaylandSurface programatically? The current QWindow compositor samples do not provide sufficient details. Is it to be created using native wayland APIs directly or Qt provides a mechanism to wrap a window object as QWayland surface?


Solution

  • When a client connects and creates a surface, the signal QWaylandCompositor::surfaceRequested is emitted. You can attach a signal handler and instantiate a QWaylandSurface yourself there if you need to do something special.

    If you don't create a QWaylandSurface or a derivative in that handler, then a QWaylandSurface is created automatically and will be provided in the QWaylandCompositor::surfaceCreated signal.