File indexing completed on 2024-05-19 16:35:22

0001 /*
0002     SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0003     SPDX-FileCopyrightText: 2021 Méven Car <meven.car@enioka.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 #pragma once
0008 
0009 #include "kwin_export.h"
0010 
0011 #include <QObject>
0012 #include <QPoint>
0013 #include <QSize>
0014 #include <QUuid>
0015 #include <QVector>
0016 #include <memory>
0017 
0018 struct wl_resource;
0019 
0020 namespace KWin
0021 {
0022 class Output;
0023 class OutputMode;
0024 }
0025 
0026 namespace KWaylandServer
0027 {
0028 
0029 class Display;
0030 class OutputDeviceV2InterfacePrivate;
0031 class OutputDeviceModeV2Interface;
0032 class OutputDeviceModeV2InterfacePrivate;
0033 
0034 /** @class OutputDeviceV2Interface
0035  *
0036  * Represents an output device, the difference to Output is that this output can be disabled,
0037  * so not currently used to display content.
0038  *
0039  * @see OutputManagementV2Interface
0040  */
0041 class KWIN_EXPORT OutputDeviceV2Interface : public QObject
0042 {
0043     Q_OBJECT
0044 
0045 public:
0046     explicit OutputDeviceV2Interface(Display *display, KWin::Output *handle, QObject *parent = nullptr);
0047     ~OutputDeviceV2Interface() override;
0048 
0049     void remove();
0050 
0051     KWin::Output *handle() const;
0052 
0053     static OutputDeviceV2Interface *get(wl_resource *native);
0054 
0055 private:
0056     void updatePhysicalSize();
0057     void updateGlobalPosition();
0058     void updateManufacturer();
0059     void updateModel();
0060     void updateSerialNumber();
0061     void updateEisaId();
0062     void updateName();
0063     void updateScale();
0064     void updateSubPixel();
0065     void updateTransform();
0066     void updateModes();
0067     void updateCurrentMode();
0068     void updateEdid();
0069     void updateEnabled();
0070     void updateUuid();
0071     void updateCapabilities();
0072     void updateOverscan();
0073     void updateVrrPolicy();
0074     void updateRgbRange();
0075     void updateGeometry();
0076 
0077     std::unique_ptr<OutputDeviceV2InterfacePrivate> d;
0078 };
0079 
0080 /**
0081  * @class OutputDeviceModeV2Interface
0082  *
0083  * Represents an output device mode.
0084  *
0085  * @see OutputDeviceV2Interface
0086  */
0087 class KWIN_EXPORT OutputDeviceModeV2Interface : public QObject
0088 {
0089     Q_OBJECT
0090 
0091 public:
0092     OutputDeviceModeV2Interface(std::shared_ptr<KWin::OutputMode> handle, QObject *parent = nullptr);
0093     ~OutputDeviceModeV2Interface() override;
0094 
0095     std::weak_ptr<KWin::OutputMode> handle() const;
0096 
0097     static OutputDeviceModeV2Interface *get(wl_resource *native);
0098 
0099 private:
0100     friend class OutputDeviceModeV2InterfacePrivate;
0101     std::unique_ptr<OutputDeviceModeV2InterfacePrivate> d;
0102 };
0103 
0104 }