XdgShell QML Type

Provides an extension for desktop-style user interfaces. More...

Import Statement: import QtWayland.Compositor 1.0

Methods

  • void ping(object client)

Detailed Description

The XdgShell extension provides desktop functionality such as minimize, maximize, and resize using the xdg-shell protocol. It creates an XdgSurface for each Wayland surface.

The following snippet demonstrates how to use the extension:


  import QtQuick 2.6
  import QtQuick.Window 2.2
  import QtWayland.Compositor 1.0

  WaylandCompositor {
      id: wlcompositor
      // The output defines the screen.
      WaylandOutput {
          compositor: wlcompositor
          window: Window {
              width: 1024
              height: 768
              visible: true
              Rectangle {
                  id: surfaceArea
                  color: "#1337af"
                  anchors.fill: parent
              }
          }
      }
      // The chrome defines the window look and behavior.
      // Here we use the built-in ShellSurfaceItem.
      Component {
          id: chromeComponent
          ShellSurfaceItem {
              onSurfaceDestroyed: destroy()
          }
      }
      // Extensions are additions to the core Wayland
      // protocol. We choose to support two different
      // shells (window management protocols). When the
      // client creates a new window, we instantiate a
      // chromeComponent on the output.
      extensions: [
          WlShell {
              onShellSurfaceCreated:
                  chromeComponent.createObject(surfaceArea, { "shellSurface": shellSurface } );
          },
          XdgShell {
              onXdgSurfaceCreated:
                  chromeComponent.createObject(surfaceArea, { "shellSurface": xdgSurface } );
          }
      ]
  }

Method Documentation

void ping(object client)

Sends a ping event to the client. If the client replies to the event the pong signal will be emitted.