.. _program_listing_file_include_miral_miral_internal_client.h: Program Listing for File internal_client.h ========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/miral/miral/internal_client.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_INTERNAL_CLIENT_H #define MIRAL_INTERNAL_CLIENT_H #include #include #include namespace mir { class Server; namespace scene { class Session; }} struct wl_display; namespace miral { class StartupInternalClient { public: explicit StartupInternalClient( std::function client_code, std::function const session)> connect_notification); template explicit StartupInternalClient(ClientObject const& client_object) : StartupInternalClient(client_object, client_object) {} ~StartupInternalClient(); void operator()(mir::Server& server); private: class Self; std::shared_ptr internal_client; }; class InternalClientLauncher { public: InternalClientLauncher(); ~InternalClientLauncher(); void operator()(mir::Server& server); void launch( std::function const& wayland_fd, std::function const session)> const& connect_notification) const; template void launch(ClientObject& client_object) const { launch( [&](struct ::wl_display* display) { client_object(display); }, [&](std::weak_ptr const session) { client_object(session); }); } private: struct Self; std::shared_ptr self; }; } #endif //MIRAL_INTERNAL_CLIENT_H