File indexing completed on 2024-11-10 04:56:36

0001 /*
0002     SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "x11_standalone_placeholderoutput.h"
0008 #include "utils/xcbutils.h"
0009 #include "x11_standalone_backend.h"
0010 
0011 namespace KWin
0012 {
0013 
0014 X11PlaceholderOutput::X11PlaceholderOutput(X11StandaloneBackend *backend, QObject *parent)
0015     : Output(parent)
0016     , m_backend(backend)
0017 {
0018     QSize pixelSize;
0019     xcb_screen_t *screen = Xcb::defaultScreen();
0020     if (screen) {
0021         pixelSize = QSize(screen->width_in_pixels, screen->height_in_pixels);
0022     }
0023 
0024     auto mode = std::make_shared<OutputMode>(pixelSize, 60000);
0025 
0026     setInformation(Information{
0027         .name = QStringLiteral("Placeholder-0"),
0028     });
0029 
0030     setState(State{
0031         .modes = {mode},
0032         .currentMode = mode,
0033     });
0034 }
0035 
0036 RenderLoop *X11PlaceholderOutput::renderLoop() const
0037 {
0038     return m_backend->renderLoop();
0039 }
0040 
0041 void X11PlaceholderOutput::updateEnabled(bool enabled)
0042 {
0043     State next = m_state;
0044     next.enabled = enabled;
0045     setState(next);
0046 }
0047 
0048 } // namespace KWin
0049 
0050 #include "moc_x11_standalone_placeholderoutput.cpp"