2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 1999, 2000 Daniel M. Duley <mosfet@kde.org>
|
|
|
|
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-04-08 09:16:48 +00:00
|
|
|
#include "decorations.h"
|
2011-04-29 10:34:22 +00:00
|
|
|
#include "config-kwin.h"
|
2013-04-08 10:31:16 +00:00
|
|
|
#include <kdecorationfactory.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include <kglobal.h>
|
2013-03-07 11:55:39 +00:00
|
|
|
#include <KDE/KLocalizedString>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <QPixmap>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2013-04-08 09:05:42 +00:00
|
|
|
KWIN_SINGLETON_FACTORY(DecorationPlugin)
|
|
|
|
|
2013-04-09 06:32:49 +00:00
|
|
|
DecorationPlugin::DecorationPlugin(QObject *parent)
|
|
|
|
: QObject(parent)
|
|
|
|
, KDecorationPlugins(KGlobal::config())
|
2013-04-09 06:11:58 +00:00
|
|
|
, m_disabled(false)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-07-23 05:02:52 +00:00
|
|
|
defaultPlugin = QStringLiteral("kwin3_oxygen");
|
2012-09-01 10:43:13 +00:00
|
|
|
#ifndef KWIN_BUILD_OXYGEN
|
2013-07-23 05:02:52 +00:00
|
|
|
defaultPlugin = QStringLiteral("kwin3_aurorae");
|
2012-09-01 10:43:13 +00:00
|
|
|
#endif
|
2011-04-29 10:34:22 +00:00
|
|
|
#ifdef KWIN_BUILD_DECORATIONS
|
2013-07-23 05:02:52 +00:00
|
|
|
loadPlugin(QString()); // load the plugin specified in cfg file
|
2011-04-29 10:34:22 +00:00
|
|
|
#else
|
2013-04-09 06:11:58 +00:00
|
|
|
setDisabled(true);
|
2011-04-29 10:34:22 +00:00
|
|
|
#endif
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
2013-04-08 09:05:42 +00:00
|
|
|
DecorationPlugin::~DecorationPlugin()
|
|
|
|
{
|
|
|
|
s_self = NULL;
|
|
|
|
}
|
|
|
|
|
2013-04-08 08:57:32 +00:00
|
|
|
void DecorationPlugin::error(const QString &error_msg)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-05-22 11:53:25 +00:00
|
|
|
qWarning("%s", QString(i18n("KWin: ") + error_msg).toLocal8Bit().data());
|
2011-04-28 13:56:50 +00:00
|
|
|
|
2013-04-09 06:11:58 +00:00
|
|
|
setDisabled(true);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-04-08 08:57:32 +00:00
|
|
|
bool DecorationPlugin::provides(Requirement)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-04-09 06:11:58 +00:00
|
|
|
void DecorationPlugin::setDisabled(bool disabled)
|
2011-04-28 13:56:50 +00:00
|
|
|
{
|
2013-04-09 06:11:58 +00:00
|
|
|
m_disabled = disabled;
|
2011-04-28 13:56:50 +00:00
|
|
|
}
|
|
|
|
|
2013-04-09 06:11:58 +00:00
|
|
|
bool DecorationPlugin::isDisabled() const
|
2011-04-28 13:56:50 +00:00
|
|
|
{
|
2013-04-09 06:11:58 +00:00
|
|
|
return m_disabled;
|
2011-04-28 13:56:50 +00:00
|
|
|
}
|
|
|
|
|
2013-04-08 10:31:16 +00:00
|
|
|
bool DecorationPlugin::hasShadows() const
|
|
|
|
{
|
2013-04-09 06:11:58 +00:00
|
|
|
if (m_disabled) {
|
2013-04-08 10:31:16 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return factory()->supports(AbilityProvidesShadow);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DecorationPlugin::hasAlpha() const
|
|
|
|
{
|
2013-04-09 06:11:58 +00:00
|
|
|
if (m_disabled) {
|
2013-04-08 10:31:16 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return factory()->supports(AbilityUsesAlphaChannel);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DecorationPlugin::supportsAnnounceAlpha() const
|
|
|
|
{
|
2013-04-09 06:11:58 +00:00
|
|
|
if (m_disabled) {
|
2013-04-08 10:31:16 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return factory()->supports(AbilityAnnounceAlphaChannel);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DecorationPlugin::supportsTabbing() const
|
|
|
|
{
|
2013-04-09 06:11:58 +00:00
|
|
|
if (m_disabled) {
|
2013-04-08 10:31:16 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return factory()->supports(AbilityTabbing);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DecorationPlugin::supportsFrameOverlap() const
|
|
|
|
{
|
2013-04-09 06:11:58 +00:00
|
|
|
if (m_disabled) {
|
2013-04-08 10:31:16 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return factory()->supports(AbilityExtendIntoClientArea);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DecorationPlugin::supportsBlurBehind() const
|
|
|
|
{
|
2013-04-09 06:11:58 +00:00
|
|
|
if (m_disabled) {
|
2013-04-08 10:31:16 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return factory()->supports(AbilityUsesBlurBehind);
|
|
|
|
}
|
|
|
|
|
|
|
|
Qt::Corner DecorationPlugin::closeButtonCorner()
|
|
|
|
{
|
2013-04-09 06:11:58 +00:00
|
|
|
if (m_disabled) {
|
2013-04-08 10:31:16 +00:00
|
|
|
return Qt::TopRightCorner;
|
|
|
|
}
|
|
|
|
return factory()->closeButtonCorner();
|
|
|
|
}
|
|
|
|
|
2013-04-09 06:32:49 +00:00
|
|
|
void DecorationPlugin::resetCompositing()
|
|
|
|
{
|
|
|
|
if (m_disabled) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
factory()->reset(SettingCompositing);
|
|
|
|
}
|
|
|
|
|
2013-05-27 10:26:44 +00:00
|
|
|
QString DecorationPlugin::supportInformation()
|
|
|
|
{
|
|
|
|
if (m_disabled) {
|
2013-07-23 05:02:52 +00:00
|
|
|
return QStringLiteral("Decoration Plugin disabled\n");
|
2013-05-27 10:26:44 +00:00
|
|
|
}
|
|
|
|
QString support;
|
2013-07-23 05:02:52 +00:00
|
|
|
support.append(QStringLiteral("Current Plugin: "));
|
2013-05-27 10:26:44 +00:00
|
|
|
support.append(currentPlugin());
|
2013-07-23 05:02:52 +00:00
|
|
|
support.append(QStringLiteral("\n"));
|
2013-05-27 10:26:44 +00:00
|
|
|
|
2013-07-23 05:02:52 +00:00
|
|
|
support.append(QStringLiteral("Shadows: "));
|
|
|
|
support.append(hasShadows() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
|
2013-05-27 10:26:44 +00:00
|
|
|
|
2013-07-23 05:02:52 +00:00
|
|
|
support.append(QStringLiteral("Alpha: "));
|
|
|
|
support.append(hasAlpha() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
|
2013-05-27 10:26:44 +00:00
|
|
|
|
2013-07-23 05:02:52 +00:00
|
|
|
support.append(QStringLiteral("Announces Alpha: "));
|
|
|
|
support.append(supportsAnnounceAlpha() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
|
2013-05-27 10:26:44 +00:00
|
|
|
|
2013-07-23 05:02:52 +00:00
|
|
|
support.append(QStringLiteral("Tabbing: "));
|
|
|
|
support.append(supportsTabbing() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
|
2013-05-27 10:26:44 +00:00
|
|
|
|
2013-07-23 05:02:52 +00:00
|
|
|
support.append(QStringLiteral("Frame Overlap: "));
|
|
|
|
support.append(supportsFrameOverlap() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
|
2013-05-27 10:26:44 +00:00
|
|
|
|
2013-07-23 05:02:52 +00:00
|
|
|
support.append(QStringLiteral("Blur Behind: "));
|
|
|
|
support.append(supportsBlurBehind() ? QStringLiteral("yes\n") : QStringLiteral("no\n"));
|
2013-05-27 10:26:44 +00:00
|
|
|
// TODO: Qt5 - read support information from Factory
|
|
|
|
return support;
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|