1 /********************************************************************
2 Copyright 2014  Martin Gräßlin <mgraesslin@kde.org>
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 #ifndef WAYLAND_FULLSCREEN_SHELL_H
21 #define WAYLAND_FULLSCREEN_SHELL_H
22 
23 #include <QObject>
24 // STD
25 #include <memory>
26 
27 #include <Wrapland/Client/wraplandclient_export.h>
28 
29 struct _wl_fullscreen_shell;
30 struct wl_output;
31 struct wl_surface;
32 
33 namespace Wrapland
34 {
35 namespace Client
36 {
37 
38 class EventQueue;
39 class Surface;
40 class Output;
41 
42 /**
43  * @short Wrapper for the _wl_fullscreen_shell interface.
44  *
45  * This class provides a convenient wrapper for the _wl_fullscreen_shell interface.
46  *
47  * To use this class one needs to interact with the Registry. There are two
48  * possible ways to create the FullscreenShell interface:
49  * @code
50  * FullscreenShell *f = registry->createFullscreenShell(name, version);
51  * @endcode
52  *
53  * This creates the FullscreenShell and sets it up directly. As an alternative this
54  * can also be done in a more low level way:
55  * @code
56  * FullscreenShell *f = new FullscreenShell;
57  * f->setup(registry->bindFullscreenShell(name, version));
58  * @endcode
59  *
60  * The FullscreenShell can be used as a drop-in replacement for any _wl_fullscreen_shell
61  * pointer as it provides matching cast operators.
62  *
63  * @see Registry
64  **/
65 class WRAPLANDCLIENT_EXPORT FullscreenShell : public QObject
66 {
67     Q_OBJECT
68 
69 public:
70     explicit FullscreenShell(QObject* parent = nullptr);
71     virtual ~FullscreenShell();
72 
73     bool isValid() const;
74     void release();
75 
76     bool hasCapabilityArbitraryModes() const;
77     bool hasCapabilityCursorPlane() const;
78     void setup(_wl_fullscreen_shell* shell);
79     void present(wl_surface* surface, wl_output* output);
80     void present(Surface* surface, Output* output);
81 
82     /**
83      * Sets the @p queue to use for bound proxies.
84      **/
85     void setEventQueue(EventQueue* queue);
86     /**
87      * @returns The event queue to use for bound proxies.
88      **/
89     EventQueue* eventQueue() const;
90 
91 Q_SIGNALS:
92     void capabilityArbitraryModesChanged(bool);
93     void capabilityCursorPlaneChanged(bool);
94 
95     /**
96      * The corresponding global for this interface on the Registry got removed.
97      *
98      * This signal gets only emitted if the Compositor got created by
99      * Registry::createFullscreenShell
100      *
101      * @since 5.5
102      **/
103     void removed();
104 
105 private:
106     class Private;
107     std::unique_ptr<Private> d;
108 };
109 
110 }
111 }
112 
113 #endif
114