File indexing completed on 2025-05-11 14:55:47
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #include "x11_standalone_output.h" 0010 #include "core/colorlut.h" 0011 #include "x11_standalone_backend.h" 0012 0013 namespace KWin 0014 { 0015 0016 X11Output::X11Output(X11StandaloneBackend *backend, QObject *parent) 0017 : Output(parent) 0018 , m_backend(backend) 0019 { 0020 } 0021 0022 RenderLoop *X11Output::renderLoop() const 0023 { 0024 return m_loop; 0025 } 0026 0027 void X11Output::setRenderLoop(RenderLoop *loop) 0028 { 0029 m_loop = loop; 0030 } 0031 0032 int X11Output::xineramaNumber() const 0033 { 0034 return m_xineramaNumber; 0035 } 0036 0037 void X11Output::setXineramaNumber(int number) 0038 { 0039 m_xineramaNumber = number; 0040 } 0041 0042 bool X11Output::setGammaRamp(const std::shared_ptr<ColorTransformation> &transformation) 0043 { 0044 if (m_crtc == XCB_NONE) { 0045 return true; 0046 } 0047 ColorLUT lut(transformation, m_gammaRampSize); 0048 xcb_randr_set_crtc_gamma(kwinApp()->x11Connection(), m_crtc, lut.size(), lut.red(), lut.green(), lut.blue()); 0049 return true; 0050 } 0051 0052 void X11Output::setCrtc(xcb_randr_crtc_t crtc) 0053 { 0054 m_crtc = crtc; 0055 } 0056 0057 void X11Output::setGammaRampSize(int size) 0058 { 0059 m_gammaRampSize = size; 0060 } 0061 0062 void X11Output::updateEnabled(bool enabled) 0063 { 0064 State next = m_state; 0065 next.enabled = enabled; 0066 setState(next); 0067 } 0068 0069 } // namespace KWin