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 <Wrapland/Server/wraplandserver_export.h> 24 #include <memory> 25 26 struct wl_resource; 27 28 namespace Wrapland::Server 29 { 30 31 class Display; 32 class Client; 33 class Surface; 34 class PlasmaShellSurface; 35 36 class WRAPLANDSERVER_EXPORT PlasmaShell : public QObject 37 { 38 Q_OBJECT 39 public: 40 ~PlasmaShell() override; 41 42 Q_SIGNALS: 43 void surfaceCreated(Wrapland::Server::PlasmaShellSurface*); 44 45 private: 46 friend class Display; 47 48 explicit PlasmaShell(Display* display, QObject* parent); 49 class Private; 50 std::unique_ptr<Private> d_ptr; 51 }; 52 53 class WRAPLANDSERVER_EXPORT PlasmaShellSurface : public QObject 54 { 55 Q_OBJECT 56 public: 57 Surface* surface() const; 58 PlasmaShell* shell() const; 59 wl_resource* resource() const; 60 Client* client() const; 61 QPoint position() const; 62 bool isPositionSet() const; 63 64 enum class Role { 65 Normal, 66 Desktop, 67 Panel, 68 OnScreenDisplay, 69 Notification, 70 ToolTip, 71 CriticalNotification, 72 }; 73 74 Role role() const; 75 76 enum class PanelBehavior { 77 AlwaysVisible, 78 AutoHide, 79 WindowsCanCover, 80 WindowsGoBelow, 81 }; 82 83 PanelBehavior panelBehavior() const; 84 bool skipTaskbar() const; 85 bool skipSwitcher() const; 86 void hideAutoHidingPanel(); 87 void showAutoHidingPanel(); 88 89 // TODO(unknown author): KF6 rename to something generic 90 bool panelTakesFocus() const; 91 92 static PlasmaShellSurface* get(wl_resource* native); 93 94 Q_SIGNALS: 95 void positionChanged(); 96 void roleChanged(); 97 void panelBehaviorChanged(); 98 void skipTaskbarChanged(); 99 void skipSwitcherChanged(); 100 void panelAutoHideHideRequested(); 101 void panelAutoHideShowRequested(); 102 void panelTakesFocusChanged(); 103 void resourceDestroyed(); 104 105 private: 106 friend class PlasmaShell; 107 PlasmaShellSurface(Client* client, 108 uint32_t version, 109 uint32_t id, 110 Surface* surface, 111 PlasmaShell* shell); 112 113 class Private; 114 Private* d_ptr; 115 }; 116 117 } 118 119 Q_DECLARE_METATYPE(Wrapland::Server::PlasmaShellSurface::Role) 120 Q_DECLARE_METATYPE(Wrapland::Server::PlasmaShellSurface::PanelBehavior) 121