- Qt 6.7
- Qt Wayland Compositor
- QML Types
- WaylandCompositor
- Qt Wayland Compositor | Commercial or GPLv3

# WaylandCompositor QML Type

Manages the Wayland display server. More...

Import Statement: | import QtWayland.Compositor
Instantiates: | QWaylandCompositor

- List of all members, including inherited members

## Properties

- additionalShmFormats : list<enum> `(since 6.0)`
- created : bool
- defaultOutput : WaylandOutput
- defaultSeat : WaylandSeat
- extensions : list
- retainedSelection : bool
- socketName : string
- useHardwareIntegrationExtension : bool

## Signals

- void surfaceCreated(WaylandSurface surface)
- void surfaceRequested(WaylandClient client, int id, int version)

## Methods

- addSocketDescriptor(fd)
- destroyClient(client)
- destroyClientForSurface(surface)

## Detailed Description

The WaylandCompositor manages the connections to the clients, as well as the different outputs and seats.

Normally, a compositor application will have a single WaylandCompositor instance, which can have several outputs as children. When a client requests the compositor to create a surface, the request is handled by the onSurfaceRequested handler.

Extensions that are supported by the compositor should be instantiated and added to the extensions property.

## Property Documentation

additionalShmFormats : list<enum> `[since 6.0]`

This property holds the list of additional wl_shm formats advertised as supported by the compositor.

By default, only the required ShmFormat_ARGB8888 and ShmFormat_XRGB8888 are listed and this list will empty. Additional formats may require conversion internally and can thus affect performance.

This property must be set before the compositor component is completed. Subsequent changes will have no effect.

This property was introduced in Qt 6.0.

created : bool `[read-only]`

This property is true if WaylandCompositor has been initialized, otherwise it's false.

defaultOutput : WaylandOutput

This property contains the first in the list of outputs added to the WaylandCompositor, or null if no outputs have been added.

Setting a new default output prepends it to the output list, making it the new default, but the previous default is not removed from the list.

defaultSeat : WaylandSeat `[read-only]`

This property contains the default seat for this WaylandCompositor.

extensions : list

A list of extensions that the compositor advertises to its clients. For any Wayland extension the compositor should support, instantiate its component, and add it to the list of extensions.

For instance, the following code would allow the clients to request `wl_shell` surfaces in the compositor using the `wl_shell` interface.

     import QtWayland.Compositor

     WaylandCompositor {
         WlShell {
             // ...
         }
     }

retainedSelection : bool

This property holds whether retained selection is enabled.

socketName : string

This property holds the socket name used by WaylandCompositor to communicate with clients. It must be set before the component is completed.

If the socketName is empty (the default), the contents of the start argument `--wayland-socket-name` are used instead. If the argument is not set, the compositor tries to find a socket name, which is `wayland-0` by default.

useHardwareIntegrationExtension : bool

This property holds whether the hardware integration extension should be enabled for this WaylandCompositor.

This property must be set before the compositor component is completed.

## Signal Documentation

void surfaceCreated(WaylandSurface surface)

This signal is emitted when a new WaylandSurface instance surface has been created.

Note: The corresponding handler is `onSurfaceCreated`.

void surfaceRequested(WaylandClient client, int id, int version)

This signal is emitted when a client has created a surface with id id. The interface version is also available.

The slot connecting to this signal may create and initialize a WaylandSurface instance in the scope of the slot. Otherwise a default surface is created.

Note: The corresponding handler is `onSurfaceRequested`.

## Method Documentation

addSocketDescriptor(fd)

Listen for client connections on a file descriptor, fd, referring to a server socket already bound and listening.

Does not take ownership of the file descriptor; it must be closed explicitly if needed.

Note: This method is only available with libwayland 1.10.0 or newer. If built against an earlier libwayland runtime, this method is a noop.

destroyClient(client)

Destroys the given WaylandClient client.

destroyClientForSurface(surface)

Destroys the client for the WaylandSurface surface.