File indexing completed on 2024-05-05 17:39:43

0001 /*
0002  *  SPDX-FileCopyrightText: 2014-2015 Sebastian Kügler <sebas@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 
0007 #ifndef KSCREEN_WAYLAND_TESTSERVER_H
0008 #define KSCREEN_WAYLAND_TESTSERVER_H
0009 
0010 #include <QObject>
0011 
0012 // KWayland
0013 #include <KWayland/Server/compositor_interface.h>
0014 #include <KWayland/Server/display.h>
0015 #include <KWayland/Server/dpms_interface.h>
0016 #include <KWayland/Server/outputconfiguration_interface.h>
0017 #include <KWayland/Server/outputdevice_interface.h>
0018 #include <KWayland/Server/outputmanagement_interface.h>
0019 #include <KWayland/Server/seat_interface.h>
0020 #include <KWayland/Server/shell_interface.h>
0021 
0022 namespace KScreen
0023 {
0024 static const QString s_socketName = QStringLiteral("libkscreen-test-wayland-backend-0");
0025 
0026 using namespace KWayland::Server;
0027 
0028 class WaylandTestServer : public QObject
0029 {
0030     Q_OBJECT
0031 
0032 public:
0033     explicit WaylandTestServer(QObject *parent = nullptr);
0034     ~WaylandTestServer() override;
0035 
0036     void setConfig(const QString &configfile);
0037     void start();
0038     void stop();
0039 
0040     void showOutputs();
0041     KWayland::Server::Display *display();
0042     QList<KWayland::Server::OutputDeviceInterface *> outputs() const;
0043 
0044     int outputCount() const;
0045 
0046     void suspendChanges(bool suspend);
0047 
0048 Q_SIGNALS:
0049     void outputsChanged();
0050 
0051     void started();
0052 
0053     void configReceived();
0054     void configChanged();
0055 
0056 private Q_SLOTS:
0057     void configurationChangeRequested(KWayland::Server::OutputConfigurationInterface *configurationInterface);
0058 
0059 private:
0060     static QString modeString(KWayland::Server::OutputDeviceInterface *outputdevice, int mid);
0061     QString m_configFile;
0062     KWayland::Server::Display *m_display;
0063     QList<KWayland::Server::OutputDeviceInterface *> m_outputs;
0064     KWayland::Server::OutputManagementInterface *m_outputManagement;
0065     KWayland::Server::DpmsManagerInterface *m_dpmsManager;
0066     bool m_suspendChanges;
0067     KWayland::Server::OutputConfigurationInterface *m_waiting;
0068 };
0069 
0070 } // namespace
0071 
0072 #endif // KSCREEN_WAYLAND_SCREEN_H