1 /****************************************************************************
2 Copyright © 2020 Roman Gilg <subdiff@gmail.com>
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 "xdg_shell_surface.h"
23 
24 // For Qt metatype declaration.
25 #include "seat.h"
26 #include "xdg_shell.h"
27 
28 #include <QObject>
29 #include <QSize>
30 
31 #include <Wrapland/Server/wraplandserver_export.h>
32 
33 namespace Wrapland::Server
34 {
35 class Output;
36 class Seat;
37 class XdgShellSurface;
38 
39 class WRAPLANDSERVER_EXPORT XdgShellToplevel : public QObject
40 {
41     Q_OBJECT
42 public:
43     std::string title() const;
44     std::string appId() const;
45 
46     XdgShellSurface* surface() const;
47     Client* client() const;
48 
49     XdgShellToplevel* transientFor() const;
50 
51     uint32_t configure(XdgShellSurface::States states, const QSize& size = QSize(0, 0));
52     bool configurePending() const;
53 
54     QSize minimumSize() const;
55     QSize maximumSize() const;
56 
57     void close();
58 
59 Q_SIGNALS:
60     void titleChanged(std::string title);
61     void appIdChanged(std::string appId);
62     void minSizeChanged(const QSize& size);
63     void maxSizeChanged(const QSize& size);
64     void moveRequested(Seat* seat, uint32_t serial);
65     void maximizedChanged(bool maximized);
66     void fullscreenChanged(bool fullscreen, Wrapland::Server::Output* output);
67     void windowMenuRequested(Seat* seat, uint32_t serial, const QPoint& position);
68     void resizeRequested(Seat* seat, uint32_t serial, Qt::Edges edges);
69     void minimizeRequested();
70     void configureAcknowledged(uint32_t serial);
71     void transientForChanged();
72     void resourceDestroyed();
73 
74 private:
75     friend class XdgShell;
76     friend class XdgShellSurface;
77     explicit XdgShellToplevel(uint32_t version, uint32_t id, XdgShellSurface* surface);
78 
79     class Private;
80     Private* d_ptr;
81 };
82 
83 }
84 
85 Q_DECLARE_METATYPE(Wrapland::Server::XdgShellToplevel*)
86