platforms/wayland: Allow resizing outputs
This commit is contained in:
parent
60c3b3ddfa
commit
22eb154fa0
1 changed files with 22 additions and 10 deletions
|
@ -24,6 +24,7 @@ namespace Wayland
|
||||||
{
|
{
|
||||||
|
|
||||||
using namespace KWayland::Client;
|
using namespace KWayland::Client;
|
||||||
|
static const int s_refreshRate = 60000; // TODO: can we get refresh rate data from Wayland host?
|
||||||
|
|
||||||
WaylandOutput::WaylandOutput(Surface *surface, WaylandBackend *backend)
|
WaylandOutput::WaylandOutput(Surface *surface, WaylandBackend *backend)
|
||||||
: AbstractWaylandOutput(backend)
|
: AbstractWaylandOutput(backend)
|
||||||
|
@ -60,26 +61,37 @@ RenderLoop *WaylandOutput::renderLoop() const
|
||||||
|
|
||||||
void WaylandOutput::init(const QPoint &logicalPosition, const QSize &pixelSize)
|
void WaylandOutput::init(const QPoint &logicalPosition, const QSize &pixelSize)
|
||||||
{
|
{
|
||||||
const int refreshRate = 60000; // TODO: can we get refresh rate data from Wayland host?
|
m_renderLoop->setRefreshRate(s_refreshRate);
|
||||||
m_renderLoop->setRefreshRate(refreshRate);
|
|
||||||
|
const Mode mode {
|
||||||
|
.size = pixelSize,
|
||||||
|
.refreshRate = s_refreshRate,
|
||||||
|
.flags = ModeFlag::Current,
|
||||||
|
.id = 0,
|
||||||
|
};
|
||||||
|
|
||||||
Mode mode;
|
|
||||||
mode.id = 0;
|
|
||||||
mode.size = pixelSize;
|
|
||||||
mode.flags = ModeFlag::Current;
|
|
||||||
mode.refreshRate = refreshRate;
|
|
||||||
static uint i = 0;
|
static uint i = 0;
|
||||||
initialize(QStringLiteral("model_%1").arg(i++), "manufacturer_TODO", "eisa_TODO", "serial_TODO", pixelSize, { mode }, {});
|
initialize(QStringLiteral("model_%1").arg(i++), "manufacturer_TODO", "eisa_TODO", "serial_TODO", pixelSize, { mode }, {});
|
||||||
setGeometry(logicalPosition, pixelSize);
|
|
||||||
|
moveTo(logicalPosition);
|
||||||
|
setCurrentModeInternal(mode.size, mode.refreshRate);
|
||||||
setScale(backend()->initialOutputScale());
|
setScale(backend()->initialOutputScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandOutput::setGeometry(const QPoint &logicalPosition, const QSize &pixelSize)
|
void WaylandOutput::setGeometry(const QPoint &logicalPosition, const QSize &pixelSize)
|
||||||
{
|
{
|
||||||
// TODO: set mode to have updated pixelSize
|
const Mode mode {
|
||||||
Q_UNUSED(pixelSize)
|
.size = pixelSize,
|
||||||
|
.refreshRate = s_refreshRate,
|
||||||
|
.flags = ModeFlag::Current,
|
||||||
|
.id = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
setModes({mode});
|
||||||
|
setCurrentModeInternal(mode.size, mode.refreshRate);
|
||||||
|
|
||||||
moveTo(logicalPosition);
|
moveTo(logicalPosition);
|
||||||
|
Q_EMIT m_backend->screensQueried();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandOutput::updateTransform(Transform transform)
|
void WaylandOutput::updateTransform(Transform transform)
|
||||||
|
|
Loading…
Reference in a new issue