File indexing completed on 2024-05-12 05:32:23

0001 /*
0002     SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0003     SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
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 "core/output.h"
0010 #include "kwin_export.h"
0011 
0012 #include <QObject>
0013 #include <QPoint>
0014 #include <QSize>
0015 
0016 struct wl_resource;
0017 struct wl_client;
0018 
0019 namespace KWin
0020 {
0021 class Output;
0022 }
0023 
0024 namespace KWin
0025 {
0026 class ClientConnection;
0027 class Display;
0028 class OutputInterfacePrivate;
0029 
0030 /**
0031  * The OutputInterface class represents a screen. This class corresponds to the Wayland
0032  * interface @c wl_output.
0033  */
0034 class KWIN_EXPORT OutputInterface : public QObject
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039     explicit OutputInterface(Display *display, Output *handle, QObject *parent = nullptr);
0040     ~OutputInterface() override;
0041 
0042     bool isRemoved() const;
0043     void remove();
0044 
0045     Output *handle() const;
0046 
0047     /**
0048      * @returns all wl_resources bound for the @p client
0049      */
0050     QList<wl_resource *> clientResources(wl_client *client) const;
0051 
0052     /**
0053      * Submit changes to all clients.
0054      */
0055     void scheduleDone();
0056 
0057     /**
0058      * Submit changes to @p client.
0059      */
0060     void done(wl_client *client);
0061 
0062     static OutputInterface *get(wl_resource *native);
0063 
0064     Display *display() const;
0065 
0066 Q_SIGNALS:
0067     void removed();
0068 
0069     /**
0070      * Emitted when a client binds to a given output
0071      * @internal
0072      */
0073     void bound(ClientConnection *client, wl_resource *boundResource);
0074 
0075 private:
0076     std::unique_ptr<OutputInterfacePrivate> d;
0077 };
0078 
0079 } // namespace KWin