2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2018 David Edmundson <kde@davidedmundson.co.uk>
|
2020-08-20 11:26:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2020 David Edmundson <kde@davidedmundson.co.uk>
|
2018-05-15 09:45:17 +00:00
|
|
|
|
2020-03-15 15:19:28 +00:00
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2018-09-12 17:49:38 +00:00
|
|
|
#ifndef KWAYLAND_SERVER_XDGOUTPUT_INTERFACE_H
|
|
|
|
#define KWAYLAND_SERVER_XDGOUTPUT_INTERFACE_H
|
2018-05-15 09:45:17 +00:00
|
|
|
|
2020-08-20 11:26:19 +00:00
|
|
|
#include <QObject>
|
2018-05-15 09:45:17 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
#include <KWaylandServer/kwaylandserver_export.h>
|
2018-05-15 09:45:17 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* In terms of protocol XdgOutputInterface are a resource
|
|
|
|
* but for the sake of sanity, we should treat XdgOutputs as globals like Output is
|
|
|
|
* Hence this doesn't match most of kwayland API paradigms.
|
|
|
|
*/
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2018-05-15 09:45:17 +00:00
|
|
|
{
|
|
|
|
class Display;
|
|
|
|
class OutputInterface;
|
2020-08-20 11:26:19 +00:00
|
|
|
class XdgOutputV1Interface;
|
|
|
|
|
|
|
|
class XdgOutputManagerV1InterfacePrivate;
|
|
|
|
class XdgOutputV1InterfacePrivate;
|
2018-05-15 09:45:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Global manager for XdgOutputs
|
|
|
|
*/
|
2020-08-20 11:26:19 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT XdgOutputManagerV1Interface : public QObject
|
2018-05-15 09:45:17 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2020-12-09 20:13:19 +00:00
|
|
|
|
2018-05-15 09:45:17 +00:00
|
|
|
public:
|
2020-12-09 20:13:19 +00:00
|
|
|
explicit XdgOutputManagerV1Interface(Display *display, QObject *parent = nullptr);
|
2020-08-20 11:26:19 +00:00
|
|
|
~XdgOutputManagerV1Interface() override;
|
2018-05-15 09:45:17 +00:00
|
|
|
/**
|
|
|
|
* Creates an XdgOutputInterface object for an existing Output
|
|
|
|
* which exposes XDG specific properties of outputs
|
|
|
|
*
|
|
|
|
* @arg output the wl_output interface this XDG output is for
|
|
|
|
* @parent the parent of the newly created object
|
|
|
|
*/
|
2021-08-29 05:11:06 +00:00
|
|
|
XdgOutputV1Interface *createXdgOutput(OutputInterface *output, QObject *parent);
|
|
|
|
|
2018-05-15 09:45:17 +00:00
|
|
|
private:
|
2020-08-20 11:26:19 +00:00
|
|
|
QScopedPointer<XdgOutputManagerV1InterfacePrivate> d;
|
2018-05-15 09:45:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Extension to Output
|
|
|
|
* Users should set all relevant values on creation and on future changes.
|
|
|
|
* done() should be explicitly called after change batches including initial setting.
|
|
|
|
*/
|
2020-08-20 11:26:19 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT XdgOutputV1Interface : public QObject
|
2018-05-15 09:45:17 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-08-20 11:26:19 +00:00
|
|
|
~XdgOutputV1Interface() override;
|
2018-05-15 09:45:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the size of this output in logical co-ordinates.
|
|
|
|
* Users should call done() after setting all values
|
|
|
|
*/
|
|
|
|
void setLogicalSize(const QSize &size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the last set logical size on this output
|
|
|
|
*/
|
|
|
|
QSize logicalSize() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the topleft position of this output in logical co-ordinates.
|
|
|
|
* Users should call done() after setting all values
|
|
|
|
* @see OutputInterface::setPosition
|
|
|
|
*/
|
|
|
|
void setLogicalPosition(const QPoint &pos);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the last set logical position on this output
|
|
|
|
*/
|
|
|
|
QPoint logicalPosition() const;
|
|
|
|
|
2020-03-24 10:50:08 +00:00
|
|
|
/**
|
|
|
|
* @brief Sets a short name of the output
|
|
|
|
* This should be consistent across reboots for the same monitor
|
|
|
|
* It should be set once before the first done call
|
|
|
|
*/
|
|
|
|
void setName(const QString &name);
|
|
|
|
/**
|
|
|
|
* The last set name
|
|
|
|
*/
|
|
|
|
void name() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets a longer description of the output
|
|
|
|
* This should be consistent across reboots for the same monitor
|
|
|
|
* It should be set once before the first done call
|
|
|
|
*/
|
|
|
|
void setDescription(const QString &description);
|
|
|
|
/**
|
|
|
|
* The last set description
|
|
|
|
*/
|
|
|
|
void description() const;
|
|
|
|
|
2018-05-15 09:45:17 +00:00
|
|
|
/**
|
|
|
|
* Submit changes to all clients
|
|
|
|
*/
|
|
|
|
void done();
|
|
|
|
|
|
|
|
private:
|
2021-03-18 01:14:44 +00:00
|
|
|
explicit XdgOutputV1Interface(OutputInterface *output, QObject *parent);
|
2020-08-20 11:26:19 +00:00
|
|
|
friend class XdgOutputManagerV1Interface;
|
|
|
|
friend class XdgOutputManagerV1InterfacePrivate;
|
2018-05-15 09:45:17 +00:00
|
|
|
|
2020-08-20 11:26:19 +00:00
|
|
|
QScopedPointer<XdgOutputV1InterfacePrivate> d;
|
2018-05-15 09:45:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|