2017-01-02 17:05:30 -05:00
/*
2021-05-27 15:01:00 +00:00
SPDX - FileCopyrightText : 2016 Smith AR < audoban @ openmailbox . org >
SPDX - FileCopyrightText : 2016 Michail Vourlakos < mvourlakos @ gmail . com >
SPDX - License - Identifier : GPL - 2.0 - or - later
2017-01-02 17:05:30 -05:00
*/
2017-02-24 21:41:57 -05:00
# include "quickwindowsystem.h"
2018-12-02 02:05:52 +02:00
// Qt
2017-02-24 21:41:57 -05:00
# include <QDebug>
2017-03-12 20:56:03 -05:00
2018-12-02 02:05:52 +02:00
// X11
2019-04-03 22:24:21 +03:00
# include <KWindowSystem>
2016-12-25 09:25:27 +02:00
2016-12-25 21:28:00 +02:00
namespace Latte {
2016-12-25 09:25:27 +02:00
2017-03-12 20:56:03 -05:00
QuickWindowSystem : : QuickWindowSystem ( QObject * parent )
: QObject ( parent )
2016-12-25 09:25:27 +02:00
{
2016-12-30 16:25:27 -05:00
if ( KWindowSystem : : isPlatformWayland ( ) ) {
2017-01-01 18:50:51 -05:00
//! TODO: Wayland compositing active
2017-04-25 17:48:36 +03:00
m_compositing = true ;
2016-12-30 16:25:27 -05:00
} else {
2017-01-01 18:50:51 -05:00
connect ( KWindowSystem : : self ( ) , & KWindowSystem : : compositingChanged
2017-03-03 20:25:53 +02:00
, this , [ & ] ( bool enabled ) {
2017-02-24 21:41:57 -05:00
if ( m_compositing = = enabled )
return ;
2016-12-25 09:25:27 +02:00
2017-02-24 21:41:57 -05:00
m_compositing = enabled ;
emit compositingChanged ( ) ;
} ) ;
2016-12-25 09:25:27 +02:00
2017-02-24 21:41:57 -05:00
m_compositing = KWindowSystem : : compositingActive ( ) ;
}
2016-12-25 09:25:27 +02:00
}
2017-02-24 21:41:57 -05:00
QuickWindowSystem : : ~ QuickWindowSystem ( )
2017-01-29 00:16:28 -05:00
{
2017-02-24 21:41:57 -05:00
qDebug ( ) < < staticMetaObject . className ( ) < < " destructed " ;
2017-01-29 00:16:28 -05:00
}
2017-02-24 21:41:57 -05:00
bool QuickWindowSystem : : compositingActive ( ) const
2016-12-25 09:25:27 +02:00
{
2017-02-24 21:41:57 -05:00
return m_compositing ;
2016-12-25 09:25:27 +02:00
}
2018-03-02 21:17:16 +02:00
bool QuickWindowSystem : : isPlatformWayland ( ) const
{
return KWindowSystem : : isPlatformWayland ( ) ;
}
2020-07-19 15:04:46 +03:00
bool QuickWindowSystem : : isPlatformX11 ( ) const
{
return KWindowSystem : : isPlatformX11 ( ) ;
}
2016-12-25 15:19:01 +02:00
} //end of namespace