1 /**************************************************************************** 2 Copyright 2020 Faveraux Adrien <ad1rie3@hotmail.fr> 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) version 3, or any 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), which shall 10 act as a proxy defined in Section 6 of version 3 of the license. 11 12 This library is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Lesser General Public License for more details. 16 17 You should have received a copy of the GNU Lesser General Public 18 License along with this library. If not, see <http://www.gnu.org/licenses/>. 19 ****************************************************************************/ 20 #pragma once 21 22 #include <QObject> 23 #include <memory> 24 25 #include "appmenu.h" 26 27 #include "wayland/global.h" 28 #include "wayland/resource.h" 29 30 #include <wayland-appmenu-server-protocol.h> 31 32 namespace Wrapland::Server 33 { 34 35 class Display; 36 class Surface; 37 class Appmenu; 38 39 constexpr uint32_t AppmenuManagerVersion = 1; 40 using AppmenuManagerGlobal = Wayland::Global<AppmenuManager, AppmenuManagerVersion>; 41 using AppmenuManagerBind = Wayland::Bind<AppmenuManagerGlobal>; 42 43 class AppmenuManager::Private : public AppmenuManagerGlobal 44 { 45 public: 46 Private(Display* display, AppmenuManager* qpt); 47 ~Private() override; 48 49 std::vector<Appmenu*> appmenus; 50 51 private: 52 static void createCallback(AppmenuManagerBind* bind, uint32_t id, wl_resource* surface); 53 54 static const struct org_kde_kwin_appmenu_manager_interface s_interface; 55 }; 56 57 class Appmenu::Private : public Wayland::Resource<Appmenu> 58 { 59 public: 60 Private(Client* client, uint32_t version, uint32_t id, Surface* surface, Appmenu* qptr); 61 ~Private() override; 62 63 Surface* surface; 64 InterfaceAddress address; 65 66 private: 67 static void setAddressCallback(wl_client* wlClient, 68 wl_resource* wlResource, 69 const char* service_name, 70 const char* object_path); 71 72 static const struct org_kde_kwin_appmenu_interface s_interface; 73 }; 74 } 75