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 "event_queue.h"
8 #include "outputconfiguration.h"
9 #include "wayland-output-management-client-protocol.h"
10 #include "wayland_pointer_p.h"
11 
12 namespace KWayland
13 {
14 namespace Client
15 {
16 class Q_DECL_HIDDEN OutputManagement::Private
17 {
18 public:
19  Private() = default;
20 
21  WaylandPointer<org_kde_kwin_outputmanagement, org_kde_kwin_outputmanagement_destroy> outputmanagement;
22  EventQueue *queue = nullptr;
23 };
24 
26  : QObject(parent)
27  , d(new Private)
28 {
29 }
30 
31 OutputManagement::~OutputManagement()
32 {
33  d->outputmanagement.release();
34 }
35 
36 void OutputManagement::setup(org_kde_kwin_outputmanagement *outputmanagement)
37 {
38  Q_ASSERT(outputmanagement);
39  Q_ASSERT(!d->outputmanagement);
40  d->outputmanagement.setup(outputmanagement);
41 }
42 
44 {
45  d->outputmanagement.release();
46 }
47 
49 {
50  d->outputmanagement.destroy();
51 }
52 
54 {
55  d->queue = queue;
56 }
57 
59 {
60  return d->queue;
61 }
62 
63 OutputManagement::operator org_kde_kwin_outputmanagement *()
64 {
65  return d->outputmanagement;
66 }
67 
68 OutputManagement::operator org_kde_kwin_outputmanagement *() const
69 {
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 }
void setup(org_kde_kwin_outputmanagement *outputmanagement)
Setup this OutputManagement to manage the outputmanagement.
void destroy()
Destroys the data hold by this OutputManagement.
Wrapper class for wl_event_queue interface.
Definition: event_queue.h:54
void setEventQueue(EventQueue *queue)
Sets the queue to use for creating objects with this OutputManagement.
OutputManagement(QObject *parent=nullptr)
Creates a new OutputManagement.
void release()
Releases the org_kde_kwin_outputmanagement interface.
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Jan 30 2023 03:56:24 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.