2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2014-07-22 11:11:19 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2014-07-22 11:11:19 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2014-07-22 11:11:19 +00:00
|
|
|
#ifndef KWIN_DECORATION_BRIDGE_H
|
|
|
|
#define KWIN_DECORATION_BRIDGE_H
|
|
|
|
|
2014-10-30 08:01:06 +00:00
|
|
|
#include <kwinglobals.h>
|
|
|
|
|
2014-07-22 11:11:19 +00:00
|
|
|
#include <KDecoration2/Private/DecorationBridge>
|
|
|
|
|
2019-01-15 14:07:11 +00:00
|
|
|
#include <KSharedConfig>
|
|
|
|
|
2014-07-22 11:11:19 +00:00
|
|
|
#include <QObject>
|
2014-10-29 15:11:20 +00:00
|
|
|
#include <QSharedPointer>
|
2014-07-22 11:11:19 +00:00
|
|
|
|
|
|
|
class KPluginFactory;
|
|
|
|
|
2014-10-29 15:11:20 +00:00
|
|
|
namespace KDecoration2
|
|
|
|
{
|
|
|
|
class DecorationSettings;
|
|
|
|
}
|
|
|
|
|
2014-07-22 11:11:19 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2015-12-04 08:29:22 +00:00
|
|
|
class AbstractClient;
|
2014-07-22 11:11:19 +00:00
|
|
|
|
|
|
|
namespace Decoration
|
|
|
|
{
|
|
|
|
|
2019-06-07 09:55:11 +00:00
|
|
|
class KWIN_EXPORT DecorationBridge : public KDecoration2::DecorationBridge
|
2014-07-22 11:11:19 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
~DecorationBridge() override;
|
2014-07-22 11:11:19 +00:00
|
|
|
|
|
|
|
void init();
|
2015-12-04 08:29:22 +00:00
|
|
|
KDecoration2::Decoration *createDecoration(AbstractClient *client);
|
2014-07-22 11:11:19 +00:00
|
|
|
|
2014-10-20 15:42:50 +00:00
|
|
|
std::unique_ptr<KDecoration2::DecoratedClientPrivate> createClient(KDecoration2::DecoratedClient *client, KDecoration2::Decoration *decoration) override;
|
|
|
|
std::unique_ptr<KDecoration2::DecorationSettingsPrivate> settings(KDecoration2::DecorationSettings *parent) override;
|
2014-07-22 11:11:19 +00:00
|
|
|
void update(KDecoration2::Decoration *decoration, const QRect &geometry) override;
|
|
|
|
|
2014-07-22 12:47:08 +00:00
|
|
|
bool needsBlur() const {
|
|
|
|
return m_blur;
|
|
|
|
}
|
[decorations] Let KDecoration plugins recommend a border size per default
Summary:
This is an alternative solution to T8707 and in comparision to D13276 a less
drastic change to KWin's default behavior.
Instead of changing the border size default for all KDecoration plugins by
switching the default from border size Normal to None introduce new
functionality, which allows a KDecoration plugin to recommend a border size in
its metadata. By default KWin listens for these recommendations and sets the
border size accordingly.
If there is no metadata recommending a border size, KWin falls back to the
current setting of Normal sized borders.
A user is able to override the recommendations from the KCM, which has been
extended accordingly.
Test Plan: Manually with adjusted metadata of Breeze.
Reviewers: #kwin, #plasma, #vdg, ngraham
Reviewed By: #vdg, ngraham
Subscribers: hpereiradacosta, filipf, anemeth, davidedmundson, abetts, graesslin, ngraham, zzag, kwin
Tags: #kwin
Maniphest Tasks: T8707
Differential Revision: https://phabricator.kde.org/D13284
2019-05-04 14:48:44 +00:00
|
|
|
QString recommendedBorderSize() const {
|
|
|
|
return m_recommendedBorderSize;
|
|
|
|
}
|
2014-07-22 12:47:08 +00:00
|
|
|
|
2019-02-19 10:18:28 +00:00
|
|
|
bool showToolTips() const {
|
|
|
|
return m_showToolTips;
|
|
|
|
}
|
|
|
|
|
2014-10-28 10:22:22 +00:00
|
|
|
void reconfigure();
|
|
|
|
|
2014-10-29 15:11:20 +00:00
|
|
|
const QSharedPointer<KDecoration2::DecorationSettings> &settings() const {
|
|
|
|
return m_settings;
|
|
|
|
}
|
|
|
|
|
2014-12-08 15:14:05 +00:00
|
|
|
QString supportInformation() const;
|
|
|
|
|
[decorations] Let KDecoration plugins recommend a border size per default
Summary:
This is an alternative solution to T8707 and in comparision to D13276 a less
drastic change to KWin's default behavior.
Instead of changing the border size default for all KDecoration plugins by
switching the default from border size Normal to None introduce new
functionality, which allows a KDecoration plugin to recommend a border size in
its metadata. By default KWin listens for these recommendations and sets the
border size accordingly.
If there is no metadata recommending a border size, KWin falls back to the
current setting of Normal sized borders.
A user is able to override the recommendations from the KCM, which has been
extended accordingly.
Test Plan: Manually with adjusted metadata of Breeze.
Reviewers: #kwin, #plasma, #vdg, ngraham
Reviewed By: #vdg, ngraham
Subscribers: hpereiradacosta, filipf, anemeth, davidedmundson, abetts, graesslin, ngraham, zzag, kwin
Tags: #kwin
Maniphest Tasks: T8707
Differential Revision: https://phabricator.kde.org/D13284
2019-05-04 14:48:44 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void metaDataLoaded();
|
|
|
|
|
2014-07-22 11:11:19 +00:00
|
|
|
private:
|
2019-01-15 14:07:11 +00:00
|
|
|
QString readPlugin();
|
2014-07-22 12:47:08 +00:00
|
|
|
void loadMetaData(const QJsonObject &object);
|
2014-10-24 11:05:41 +00:00
|
|
|
void findTheme(const QVariantMap &map);
|
2014-10-28 10:22:22 +00:00
|
|
|
void initPlugin();
|
|
|
|
QString readTheme() const;
|
2019-02-19 10:18:28 +00:00
|
|
|
void readDecorationOptions();
|
2014-07-22 11:11:19 +00:00
|
|
|
KPluginFactory *m_factory;
|
2019-01-15 14:07:11 +00:00
|
|
|
KSharedConfig::Ptr m_lnfConfig;
|
2014-07-22 12:47:08 +00:00
|
|
|
bool m_blur;
|
2019-02-19 10:18:28 +00:00
|
|
|
bool m_showToolTips;
|
[decorations] Let KDecoration plugins recommend a border size per default
Summary:
This is an alternative solution to T8707 and in comparision to D13276 a less
drastic change to KWin's default behavior.
Instead of changing the border size default for all KDecoration plugins by
switching the default from border size Normal to None introduce new
functionality, which allows a KDecoration plugin to recommend a border size in
its metadata. By default KWin listens for these recommendations and sets the
border size accordingly.
If there is no metadata recommending a border size, KWin falls back to the
current setting of Normal sized borders.
A user is able to override the recommendations from the KCM, which has been
extended accordingly.
Test Plan: Manually with adjusted metadata of Breeze.
Reviewers: #kwin, #plasma, #vdg, ngraham
Reviewed By: #vdg, ngraham
Subscribers: hpereiradacosta, filipf, anemeth, davidedmundson, abetts, graesslin, ngraham, zzag, kwin
Tags: #kwin
Maniphest Tasks: T8707
Differential Revision: https://phabricator.kde.org/D13284
2019-05-04 14:48:44 +00:00
|
|
|
QString m_recommendedBorderSize;
|
2014-10-28 10:22:22 +00:00
|
|
|
QString m_plugin;
|
|
|
|
QString m_defaultTheme;
|
2014-10-24 11:05:41 +00:00
|
|
|
QString m_theme;
|
2014-10-29 15:11:20 +00:00
|
|
|
QSharedPointer<KDecoration2::DecorationSettings> m_settings;
|
2015-08-12 08:29:03 +00:00
|
|
|
bool m_noPlugin;
|
2014-10-30 08:01:06 +00:00
|
|
|
KWIN_SINGLETON(DecorationBridge)
|
2014-07-22 11:11:19 +00:00
|
|
|
};
|
|
|
|
} // Decoration
|
|
|
|
} // KWin
|
|
|
|
|
|
|
|
#endif
|