.. _program_listing_file_include_miral_miral_wayland_extensions.h: Program Listing for File wayland_extensions.h ============================================= |exhale_lsh| :ref:`Return to documentation for file ` (``include/miral/miral/wayland_extensions.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright © Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 or 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef MIRAL_WAYLAND_EXTENSIONS_H #define MIRAL_WAYLAND_EXTENSIONS_H #include "application.h" #include #include #include #include #include struct wl_display; struct wl_client; struct wl_resource; namespace mir { class Server; } namespace miral { class Window; class WaylandExtensions { public: WaylandExtensions(); void operator()(mir::Server& server) const; ~WaylandExtensions(); WaylandExtensions(WaylandExtensions const&); auto operator=(WaylandExtensions const&) -> WaylandExtensions&; auto all_supported() const -> std::set; class Context { public: virtual auto display() const -> wl_display* = 0; virtual void run_on_wayland_mainloop(std::function&& work) const = 0; protected: Context() = default; virtual ~Context() = default; Context(Context const&) = delete; Context& operator=(Context const&) = delete; }; struct Builder { std::string name; std::function(Context const* context)> build; }; class EnableInfo { public: auto app() const -> Application const&; auto name() const -> const char*; auto user_preference() const -> std::optional; private: friend WaylandExtensions; EnableInfo(Application const& app, const char* name, std::optional user_preference); struct Self; std::unique_ptr const self; }; using Filter = std::function; using EnableCallback = std::function; static char const* const zwlr_layer_shell_v1; static char const* const zxdg_output_manager_v1; static char const* const zwlr_foreign_toplevel_manager_v1; static char const* const zwp_virtual_keyboard_manager_v1; static const char* const zwp_input_method_v1; static const char* const zwp_input_panel_v1; static char const* const zwp_input_method_manager_v2; static char const* const zwlr_screencopy_manager_v1; static char const* const zwlr_virtual_pointer_manager_v1; static char const* const ext_session_lock_manager_v1; void add_extension(Builder const& builder); void add_extension_disabled_by_default(Builder const& builder); static auto recommended() -> std::set; static auto supported() -> std::set; auto enable(std::string name) -> WaylandExtensions&; auto disable(std::string name) -> WaylandExtensions&; auto conditionally_enable(std::string name, EnableCallback const& callback) -> WaylandExtensions&; private: struct Self; std::shared_ptr self; }; auto application_for(wl_client* client) -> Application; auto application_for(wl_resource* resource) -> Application; auto window_for(wl_resource* surface) -> Window; } #endif //MIRAL_WAYLAND_EXTENSIONS_H