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>
|
|
|
|
|
|
|
|
#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
|
|
|
|
{
|
|
|
|
|
2022-04-22 17:39:12 +00:00
|
|
|
class Window;
|
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
|
|
|
|
2021-02-24 08:35:18 +00:00
|
|
|
static bool hasPlugin();
|
|
|
|
|
2014-07-22 11:11:19 +00:00
|
|
|
void init();
|
2022-04-22 17:39:12 +00:00
|
|
|
KDecoration2::Decoration *createDecoration(Window *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
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
QString recommendedBorderSize() 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
|
|
|
return m_recommendedBorderSize;
|
|
|
|
}
|
2014-07-22 12:47:08 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
bool showToolTips() const
|
|
|
|
{
|
2019-02-19 10:18:28 +00:00
|
|
|
return m_showToolTips;
|
|
|
|
}
|
|
|
|
|
2014-10-28 10:22:22 +00:00
|
|
|
void reconfigure();
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
const QSharedPointer<KDecoration2::DecorationSettings> &settings() const
|
|
|
|
{
|
2014-10-29 15:11:20 +00:00
|
|
|
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-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
|