Changeset View
Changeset View
Standalone View
Standalone View
decorations/decorationbridge.cpp
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | |||||
60 | #endif | 60 | #endif | ||
61 | 61 | | |||
62 | KWIN_SINGLETON_FACTORY(DecorationBridge) | 62 | KWIN_SINGLETON_FACTORY(DecorationBridge) | ||
63 | 63 | | |||
64 | DecorationBridge::DecorationBridge(QObject *parent) | 64 | DecorationBridge::DecorationBridge(QObject *parent) | ||
65 | : KDecoration2::DecorationBridge(parent) | 65 | : KDecoration2::DecorationBridge(parent) | ||
66 | , m_factory(nullptr) | 66 | , m_factory(nullptr) | ||
67 | , m_blur(false) | 67 | , m_blur(false) | ||
68 | , m_showToolTips(false) | ||||
68 | , m_settings() | 69 | , m_settings() | ||
69 | , m_noPlugin(false) | 70 | , m_noPlugin(false) | ||
70 | { | 71 | { | ||
71 | KConfigGroup cg(KSharedConfig::openConfig(), "KDE"); | 72 | KConfigGroup cg(KSharedConfig::openConfig(), "KDE"); | ||
72 | 73 | | |||
73 | // try to extract the proper defaults file from a lookandfeel package | 74 | // try to extract the proper defaults file from a lookandfeel package | ||
74 | const QString looknfeel = cg.readEntry(QStringLiteral("LookAndFeelPackage"), "org.kde.breeze.desktop"); | 75 | const QString looknfeel = cg.readEntry(QStringLiteral("LookAndFeelPackage"), "org.kde.breeze.desktop"); | ||
75 | m_lnfConfig = KSharedConfig::openConfig(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("plasma/look-and-feel/") + looknfeel + QStringLiteral("/contents/defaults"))); | 76 | m_lnfConfig = KSharedConfig::openConfig(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("plasma/look-and-feel/") + looknfeel + QStringLiteral("/contents/defaults"))); | ||
77 | | ||||
78 | readDecorationOptions(); | ||||
76 | } | 79 | } | ||
77 | 80 | | |||
78 | DecorationBridge::~DecorationBridge() | 81 | DecorationBridge::~DecorationBridge() | ||
79 | { | 82 | { | ||
80 | s_self = nullptr; | 83 | s_self = nullptr; | ||
81 | } | 84 | } | ||
82 | 85 | | |||
83 | QString DecorationBridge::readPlugin() | 86 | QString DecorationBridge::readPlugin() | ||
Show All 12 Lines | |||||
96 | QString DecorationBridge::readTheme() const | 99 | QString DecorationBridge::readTheme() const | ||
97 | { | 100 | { | ||
98 | //Try to get a default from look and feel | 101 | //Try to get a default from look and feel | ||
99 | KConfigGroup cg(m_lnfConfig, "kwinrc"); | 102 | KConfigGroup cg(m_lnfConfig, "kwinrc"); | ||
100 | cg = KConfigGroup(&cg, "org.kde.kdecoration2"); | 103 | cg = KConfigGroup(&cg, "org.kde.kdecoration2"); | ||
101 | return kwinApp()->config()->group(s_pluginName).readEntry("theme", cg.readEntry("theme", m_defaultTheme)); | 104 | return kwinApp()->config()->group(s_pluginName).readEntry("theme", cg.readEntry("theme", m_defaultTheme)); | ||
102 | } | 105 | } | ||
103 | 106 | | |||
107 | void DecorationBridge::readDecorationOptions() | ||||
108 | { | ||||
109 | m_showToolTips = kwinApp()->config()->group(s_pluginName).readEntry("ShowToolTips", true); | ||||
110 | } | ||||
111 | | ||||
104 | void DecorationBridge::init() | 112 | void DecorationBridge::init() | ||
105 | { | 113 | { | ||
106 | using namespace KWayland::Server; | 114 | using namespace KWayland::Server; | ||
107 | m_noPlugin = readNoPlugin(); | 115 | m_noPlugin = readNoPlugin(); | ||
108 | if (m_noPlugin) { | 116 | if (m_noPlugin) { | ||
109 | if (waylandServer()) { | 117 | if (waylandServer()) { | ||
110 | waylandServer()->decorationManager()->setDefaultMode(ServerSideDecorationManagerInterface::Mode::None); | 118 | waylandServer()->decorationManager()->setDefaultMode(ServerSideDecorationManagerInterface::Mode::None); | ||
111 | } | 119 | } | ||
Show All 39 Lines | |||||
151 | 159 | | |||
152 | static void recreateDecorations() | 160 | static void recreateDecorations() | ||
153 | { | 161 | { | ||
154 | Workspace::self()->forEachAbstractClient([](AbstractClient *c) { c->updateDecoration(true, true); }); | 162 | Workspace::self()->forEachAbstractClient([](AbstractClient *c) { c->updateDecoration(true, true); }); | ||
155 | } | 163 | } | ||
156 | 164 | | |||
157 | void DecorationBridge::reconfigure() | 165 | void DecorationBridge::reconfigure() | ||
158 | { | 166 | { | ||
167 | readDecorationOptions(); | ||||
168 | | ||||
159 | if (m_noPlugin != readNoPlugin()) { | 169 | if (m_noPlugin != readNoPlugin()) { | ||
160 | m_noPlugin = !m_noPlugin; | 170 | m_noPlugin = !m_noPlugin; | ||
161 | // no plugin setting changed | 171 | // no plugin setting changed | ||
162 | if (m_noPlugin) { | 172 | if (m_noPlugin) { | ||
163 | // decorations disabled now | 173 | // decorations disabled now | ||
164 | m_plugin = QString(); | 174 | m_plugin = QString(); | ||
165 | delete m_factory; | 175 | delete m_factory; | ||
166 | m_factory = nullptr; | 176 | m_factory = nullptr; | ||
▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines |