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 "output_configuration_v1.h"
23 
24 #include "wayland/global.h"
25 #include "wayland/resource.h"
26 
27 #include "wayland-output-device-v1-server-protocol.h"
28 #include "wayland-output-management-v1-server-protocol.h"
29 
30 namespace Wrapland::Server
31 {
32 
33 class OutputConfigurationV1::Private : public Wayland::Resource<OutputConfigurationV1>
34 {
35 public:
36     Private(Client* client,
37             uint32_t version,
38             uint32_t id,
39             OutputManagementV1* manager,
40             OutputConfigurationV1* q);
41 
42     void sendApplied();
43     void sendFailed();
44     void clearPendingChanges();
45 
46     bool hasPendingChanges(OutputDeviceV1* outputdevice) const;
47     OutputChangesetV1* pendingChanges(OutputDeviceV1* outputdevice);
48 
49     OutputManagementV1* manager;
50     QHash<OutputDeviceV1*, OutputChangesetV1*> changes;
51 
52 private:
53     static void enableCallback(wl_client* wlClient,
54                                wl_resource* wlResource,
55                                wl_resource* wlOutputDevice,
56                                int32_t wlEnable);
57     static void modeCallback(wl_client* wlClient,
58                              wl_resource* wlResource,
59                              wl_resource* wlOutputDevice,
60                              int32_t mode_id);
61     static void transformCallback(wl_client* wlClient,
62                                   wl_resource* wlResource,
63                                   wl_resource* wlOutputDevice,
64                                   int32_t wlTransform);
65     static void geometryCallback(wl_client* wlClient,
66                                  wl_resource* wlResource,
67                                  wl_resource* wlOutputDevice,
68                                  wl_fixed_t x,
69                                  wl_fixed_t y,
70                                  wl_fixed_t width,
71                                  wl_fixed_t height);
72     static void applyCallback(wl_client* wlClient, wl_resource* wlResource);
73 
74     static const struct zkwinft_output_configuration_v1_interface s_interface;
75 };
76 
77 }
78