Mir
Loading...
Searching...
No Matches
miral::WaylandExtensions Class Reference

Enable configuration of the Wayland extensions enabled at runtime. More...

#include <wayland_extensions.h>

Classes

class  Context
 Context information useful for implementing Wayland extensions. More...
struct  Builder
 A Builder creates and registers an extension protocol. More...

Public Types

using Filter = std::function<bool(Application const& app, char const* protocol)>

Public Member Functions

 WaylandExtensions ()
 Default to enabling the extensions recommended by Mir.
 WaylandExtensions (std::string const &default_value)
 Initialize "enabled by default" to a custom set of extensions (colon separated list).
void operator() (mir::Server &server) const
auto supported_extensions () const -> std::string
 All Wayland extensions currently supported (colon separated list). This includes both the recommended_extensions() and any extensions that have been added using add_extension().
 ~WaylandExtensions ()
 WaylandExtensions (WaylandExtensions const &)
auto operator= (WaylandExtensions const &) -> WaylandExtensions &
void set_filter (Filter const &extension_filter)
 Set an extension filter callback to control the extensions available to specific clients.
void add_extension (Builder const &builder)
 Add a bespoke Wayland extension both to "supported" and "enabled by default".
void add_extension_disabled_by_default (Builder const &builder)
 Add a bespoke Wayland extension both to "supported" but not "enabled by default".
auto enable (std::string name) -> WaylandExtensions &
 Enable a Wayland extension Throws a std::runtime_error if the extension is not supported.
auto disable (std::string name) -> WaylandExtensions &
 Disable a Wayand extension Throws a std::runtime_error if the extension is not supported.

Static Public Member Functions

static auto recommended_extensions () -> std::string
 Default for extensions to enabled recommended by Mir (colon separated list).
static auto recommended () -> std::set< std::string >
 The set of Wayland extensions that Mir recommends. Also the set that is enabled by default upon construction of a WaylandExtensions object.
static auto supported () -> std::set< std::string >
 The set of Wayland extensions that core Mir supports. Does not include bespoke extensions A superset of recommended().

Static Public Attributes

static char const *const zwlr_layer_shell_v1
 Supported wayland extensions that are not enabled by default.
static char const *const zxdg_output_manager_v1
 Allows clients to retrieve additional information about outputs.

Detailed Description

Enable configuration of the Wayland extensions enabled at runtime.

This adds the command line option '–wayland-extensions' the corresponding MIR_SERVER_WAYLAND_EXTENSIONS environment variable, and the wayland-extensions config line.

  • The server can add support for additional extensions
  • The server can specify the configuration defaults
  • Mir's option handling allows the defaults to be overridden
    Remarks
    Since MirAL 2.4

Member Typedef Documentation

◆ Filter

using miral::WaylandExtensions::Filter = std::function<bool(Application const& app, char const* protocol)>
Remarks
Since MirAL 2.5

Constructor & Destructor Documentation

◆ WaylandExtensions() [1/3]

miral::WaylandExtensions::WaylandExtensions ( )

Default to enabling the extensions recommended by Mir.

◆ WaylandExtensions() [2/3]

miral::WaylandExtensions::WaylandExtensions ( std::string const & default_value)
explicit

Initialize "enabled by default" to a custom set of extensions (colon separated list).

Note
This can only be a subset of supported_extensions()
Deprecated
A better option is to use the default constructor, enable() and disable(). You can call disable() on all recommended() extensions if you want complete control over which are enabled

◆ ~WaylandExtensions()

miral::WaylandExtensions::~WaylandExtensions ( )

◆ WaylandExtensions() [3/3]

miral::WaylandExtensions::WaylandExtensions ( WaylandExtensions const & )

Member Function Documentation

◆ add_extension()

void miral::WaylandExtensions::add_extension ( Builder const & builder)

Add a bespoke Wayland extension both to "supported" and "enabled by default".

Remarks
Since MirAL 2.5

◆ add_extension_disabled_by_default()

void miral::WaylandExtensions::add_extension_disabled_by_default ( Builder const & builder)

Add a bespoke Wayland extension both to "supported" but not "enabled by default".

Remarks
Since MirAL 2.5

◆ disable()

auto miral::WaylandExtensions::disable ( std::string name) ->WaylandExtensions &

Disable a Wayand extension Throws a std::runtime_error if the extension is not supported.

Remarks
Since MirAL 2.6

◆ enable()

auto miral::WaylandExtensions::enable ( std::string name) ->WaylandExtensions &

Enable a Wayland extension Throws a std::runtime_error if the extension is not supported.

Remarks
Since MirAL 2.6

◆ operator()()

void miral::WaylandExtensions::operator() ( mir::Server & server) const

◆ operator=()

auto miral::WaylandExtensions::operator= ( WaylandExtensions const & ) ->WaylandExtensions &

◆ recommended()

auto miral::WaylandExtensions::recommended ( ) ->std::set< std::string >
static

The set of Wayland extensions that Mir recommends. Also the set that is enabled by default upon construction of a WaylandExtensions object.

Remarks
Since MirAL 2.6

◆ recommended_extensions()

auto miral::WaylandExtensions::recommended_extensions ( ) ->std::string
static

Default for extensions to enabled recommended by Mir (colon separated list).

Remarks
Since MirAL 2.5
Deprecated
Instead of overridding the whole extension list in the constructor and using this to get the recommended ones, you can now just enable() the extensions you want.

◆ set_filter()

void miral::WaylandExtensions::set_filter ( Filter const & extension_filter)

Set an extension filter callback to control the extensions available to specific clients.

Remarks
Since MirAL 2.5

◆ supported()

auto miral::WaylandExtensions::supported ( ) ->std::set< std::string >
static

The set of Wayland extensions that core Mir supports. Does not include bespoke extensions A superset of recommended().

Remarks
Since MirAL 2.6

◆ supported_extensions()

auto miral::WaylandExtensions::supported_extensions ( ) const->std::string

All Wayland extensions currently supported (colon separated list). This includes both the recommended_extensions() and any extensions that have been added using add_extension().

Deprecated
This is of no real use to the server, just for documenting the configuration option.

Member Data Documentation

◆ zwlr_layer_shell_v1

char const* const miral::WaylandExtensions::zwlr_layer_shell_v1
static

Supported wayland extensions that are not enabled by default.

These can be passed into WaylandExtensions::enable() to turn them on. Enables shell components such as panels, notifications and lock screens. It is recommended to use this in conjunction with set_filter() as malicious clients could potentially use this protocol to steal input focus or otherwise bother the user.

Remarks
Since MirAL 2.6

◆ zxdg_output_manager_v1

char const* const miral::WaylandExtensions::zxdg_output_manager_v1
static

Allows clients to retrieve additional information about outputs.

Remarks
Since MirAL 2.6

The documentation for this class was generated from the following file:

Copyright © 2012-2026 Canonical Ltd.
Generated on Sun Mar 15 20:28:55 UTC 2026
This documentation is licensed under the GPL version 2 or 3.