2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2018-03-19 11:05:57 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2018 Roman Gilg <subdiff@gmail.com>
|
2018-03-19 11:05:57 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2018-03-19 11:05:57 +00:00
|
|
|
#include "virtual_output.h"
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
VirtualOutput::VirtualOutput(QObject *parent)
|
2019-06-13 09:36:07 +00:00
|
|
|
: AbstractWaylandOutput()
|
2018-03-19 11:05:57 +00:00
|
|
|
{
|
2018-03-29 16:38:27 +00:00
|
|
|
Q_UNUSED(parent);
|
2020-04-08 09:38:41 +00:00
|
|
|
static int identifier = -1;
|
|
|
|
identifier++;
|
|
|
|
setName("Virtual-" + QString::number(identifier));
|
2018-03-19 11:05:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VirtualOutput::~VirtualOutput()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-08-26 21:16:53 +00:00
|
|
|
void VirtualOutput::init(const QPoint &logicalPosition, const QSize &pixelSize)
|
|
|
|
{
|
2020-04-29 15:18:41 +00:00
|
|
|
KWaylandServer::OutputDeviceInterface::Mode mode;
|
2019-08-26 21:16:53 +00:00
|
|
|
mode.id = 0;
|
|
|
|
mode.size = pixelSize;
|
2020-04-29 15:18:41 +00:00
|
|
|
mode.flags = KWaylandServer::OutputDeviceInterface::ModeFlag::Current;
|
2019-08-26 21:16:53 +00:00
|
|
|
mode.refreshRate = 60000; // TODO
|
2019-08-28 18:54:37 +00:00
|
|
|
initInterfaces("model_TODO", "manufacturer_TODO", "UUID_TODO", pixelSize, { mode });
|
2019-08-26 21:16:53 +00:00
|
|
|
setGeometry(QRect(logicalPosition, pixelSize));
|
|
|
|
}
|
|
|
|
|
2018-03-29 16:38:27 +00:00
|
|
|
void VirtualOutput::setGeometry(const QRect &geo)
|
|
|
|
{
|
2019-08-27 14:19:47 +00:00
|
|
|
// TODO: set mode to have updated pixelSize
|
2018-03-29 16:38:27 +00:00
|
|
|
setGlobalPos(geo.topLeft());
|
|
|
|
}
|
|
|
|
|
2018-03-19 11:05:57 +00:00
|
|
|
}
|