KWayland

outputmanagement.cpp
1 /*
2  SPDX-FileCopyrightText: 2015 Sebastian Kügler <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #include "outputmanagement.h"
7 #include "outputconfiguration.h"
8 #include "event_queue.h"
9 #include "wayland_pointer_p.h"
10 #include "wayland-output-management-client-protocol.h"
11 
12 
13 namespace KWayland
14 {
15 namespace Client
16 {
17 
18 class Q_DECL_HIDDEN OutputManagement::Private
19 {
20 public:
21  Private() = default;
22 
23  WaylandPointer<org_kde_kwin_outputmanagement, org_kde_kwin_outputmanagement_destroy> outputmanagement;
24  EventQueue *queue = nullptr;
25 };
26 
28 : QObject(parent)
29 , d(new Private)
30 {
31 }
32 
33 OutputManagement::~OutputManagement()
34 {
35  d->outputmanagement.release();
36 }
37 
38 void OutputManagement::setup(org_kde_kwin_outputmanagement *outputmanagement)
39 {
40  Q_ASSERT(outputmanagement);
41  Q_ASSERT(!d->outputmanagement);
42  d->outputmanagement.setup(outputmanagement);
43 }
44 
46 {
47  d->outputmanagement.release();
48 }
49 
51 {
52  d->outputmanagement.destroy();
53 }
54 
56 {
57  d->queue = queue;
58 }
59 
61 {
62  return d->queue;
63 }
64 
65 OutputManagement::operator org_kde_kwin_outputmanagement*() {
66  return d->outputmanagement;
67 }
68 
69 OutputManagement::operator org_kde_kwin_outputmanagement*() const {
70  return d->outputmanagement;
71 }
72 
74 {
75  return d->outputmanagement.isValid();
76 }
77 
78 OutputConfiguration *OutputManagement::createConfiguration(QObject *parent)
79 {
80  Q_UNUSED(parent);
81  OutputConfiguration *config = new OutputConfiguration(this);
82  auto w = org_kde_kwin_outputmanagement_create_configuration(d->outputmanagement);
83 
84  if (d->queue) {
85  d->queue->addProxy(w);
86  }
87 
88  config->setup(w);
89  return config;
90 }
91 
92 
93 }
94 }
void release()
Releases the org_kde_kwin_outputmanagement interface.
void setup(org_kde_kwin_outputmanagement *outputmanagement)
Setup this OutputManagement to manage the outputmanagement.
Wrapper class for wl_event_queue interface.
Definition: event_queue.h:55
void destroy()
Destroys the data hold by this OutputManagement.
OutputManagement(QObject *parent=nullptr)
Creates a new OutputManagement.
void setup(org_kde_kwin_outputconfiguration *outputconfiguration)
Setup this OutputConfiguration to manage the outputconfiguration.
OutputConfiguration provides access to changing OutputDevices.
void setEventQueue(EventQueue *queue)
Sets the queue to use for creating objects with this OutputManagement.
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 13 2020 22:50:20 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.