File indexing completed on 2024-11-10 04:58:08

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #include "fakeoutput.h"
0010 
0011 FakeOutput::FakeOutput()
0012 {
0013     setMode(QSize(1024, 720), 60000);
0014 }
0015 
0016 KWin::RenderLoop *FakeOutput::renderLoop() const
0017 {
0018     return nullptr;
0019 }
0020 
0021 void FakeOutput::setMode(QSize size, uint32_t refreshRate)
0022 {
0023     auto mode = std::make_shared<KWin::OutputMode>(size, refreshRate);
0024 
0025     State state = m_state;
0026     state.modes = {mode};
0027     state.currentMode = mode;
0028     setState(state);
0029 }
0030 
0031 void FakeOutput::setTransform(KWin::OutputTransform transform)
0032 {
0033     State state = m_state;
0034     state.transform = transform;
0035     setState(state);
0036 }
0037 
0038 void FakeOutput::moveTo(const QPoint &pos)
0039 {
0040     State state = m_state;
0041     state.position = pos;
0042     setState(state);
0043 }
0044 
0045 void FakeOutput::setScale(qreal scale)
0046 {
0047     State state = m_state;
0048     state.scale = scale;
0049     setState(state);
0050 }
0051 
0052 void FakeOutput::setSubPixel(SubPixel subPixel)
0053 {
0054     setInformation({
0055         .subPixel = subPixel,
0056     });
0057 }
0058 
0059 void FakeOutput::setDpmsSupported(bool supported)
0060 {
0061     setInformation({
0062         .capabilities = supported ? Capability::Dpms : Capabilities(),
0063     });
0064 }
0065 
0066 void FakeOutput::setPhysicalSize(QSize size)
0067 {
0068     setInformation({
0069         .physicalSize = size,
0070     });
0071 }
0072 
0073 void FakeOutput::setName(const QString &name)
0074 {
0075     Information info = m_information;
0076     info.name = name;
0077     setInformation(info);
0078 }
0079 
0080 void FakeOutput::setManufacturer(const QString &manufacturer)
0081 {
0082     Information info = m_information;
0083     info.manufacturer = manufacturer;
0084     setInformation(info);
0085 }
0086 
0087 void FakeOutput::setModel(const QString &model)
0088 {
0089     Information info = m_information;
0090     info.model = model;
0091     setInformation(info);
0092 }
0093 
0094 #include "moc_fakeoutput.cpp"