File indexing completed on 2022-12-06 15:16:36

0001 /*
0002     SPDX-FileCopyrightText: 2016 Smith AR <audoban@openmailbox.org>
0003     SPDX-FileCopyrightText: 2016 Michail Vourlakos <mvourlakos@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "quickwindowsystem.h"
0009 
0010 // Qt
0011 #include <QDebug>
0012 
0013 // X11
0014 #include <KWindowSystem>
0015 
0016 namespace Latte {
0017 
0018 QuickWindowSystem::QuickWindowSystem(QObject *parent)
0019     : QObject(parent)
0020 {
0021     if (KWindowSystem::isPlatformWayland()) {
0022         //! TODO: Wayland compositing active
0023         m_compositing = true;
0024     } else {
0025         connect(KWindowSystem::self(), &KWindowSystem::compositingChanged
0026         , this, [&](bool enabled) {
0027             if (m_compositing == enabled)
0028                 return;
0029 
0030             m_compositing = enabled;
0031             emit compositingChanged();
0032         });
0033 
0034         m_compositing = KWindowSystem::compositingActive();
0035     }
0036 }
0037 
0038 QuickWindowSystem::~QuickWindowSystem()
0039 {
0040     qDebug() << staticMetaObject.className() << "destructed";
0041 }
0042 
0043 bool QuickWindowSystem::compositingActive() const
0044 {
0045     return m_compositing;
0046 }
0047 
0048 bool QuickWindowSystem::isPlatformWayland() const
0049 {
0050     return KWindowSystem::isPlatformWayland();
0051 }
0052 
0053 bool QuickWindowSystem::isPlatformX11() const
0054 {
0055     return KWindowSystem::isPlatformX11();
0056 }
0057 
0058 } //end of namespace