Changeset View
Changeset View
Standalone View
Standalone View
decorations/decorationbridge.cpp
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | |||||
54 | static const QString s_aurorae = QStringLiteral("org.kde.kwin.aurorae"); | 54 | static const QString s_aurorae = QStringLiteral("org.kde.kwin.aurorae"); | ||
55 | static const QString s_pluginName = QStringLiteral("org.kde.kdecoration2"); | 55 | static const QString s_pluginName = QStringLiteral("org.kde.kdecoration2"); | ||
56 | #if HAVE_BREEZE_DECO | 56 | #if HAVE_BREEZE_DECO | ||
57 | static const QString s_defaultPlugin = QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID); | 57 | static const QString s_defaultPlugin = QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID); | ||
58 | #else | 58 | #else | ||
59 | static const QString s_defaultPlugin = s_aurorae; | 59 | static const QString s_defaultPlugin = s_aurorae; | ||
60 | #endif | 60 | #endif | ||
61 | 61 | | |||
62 | KWIN_SINGLETON_FACTORY(DecorationBridge) | 62 | KWIN_SINGLETON_FACTORY(DecorationBridge) | ||
Lint: unknownMacro: There is an unknown macro here somewhere. Configuration is required. If KWIN_SINGLETON_FACTORY… | |||||
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_showToolTips(false) | ||
69 | , m_settings() | 69 | , m_settings() | ||
70 | , m_noPlugin(false) | 70 | , m_noPlugin(false) | ||
Show All 36 Lines | |||||
107 | void DecorationBridge::readDecorationOptions() | 107 | void DecorationBridge::readDecorationOptions() | ||
108 | { | 108 | { | ||
109 | m_showToolTips = kwinApp()->config()->group(s_pluginName).readEntry("ShowToolTips", true); | 109 | m_showToolTips = kwinApp()->config()->group(s_pluginName).readEntry("ShowToolTips", true); | ||
110 | } | 110 | } | ||
111 | 111 | | |||
112 | void DecorationBridge::init() | 112 | void DecorationBridge::init() | ||
113 | { | 113 | { | ||
114 | using namespace KWayland::Server; | 114 | using namespace KWayland::Server; | ||
115 | m_noPlugin = readNoPlugin(); | 115 | m_noPlugin = readNoPlugin(); | ||
@apol Is NoPlugin set on PlaMo? zzag: @apol Is `NoPlugin` set on PlaMo? | |||||
116 | if (m_noPlugin) { | 116 | if (m_noPlugin) { | ||
117 | if (waylandServer()) { | 117 | if (waylandServer()) { | ||
118 | waylandServer()->decorationManager()->setDefaultMode(ServerSideDecorationManagerInterface::Mode::None); | 118 | waylandServer()->decorationManager()->setDefaultMode(ServerSideDecorationManagerInterface::Mode::None); | ||
119 | } | 119 | } | ||
120 | return; | 120 | return; | ||
121 | } | 121 | } | ||
122 | m_plugin = readPlugin(); | 122 | m_plugin = readPlugin(); | ||
123 | m_settings = QSharedPointer<KDecoration2::DecorationSettings>::create(this); | 123 | m_settings = QSharedPointer<KDecoration2::DecorationSettings>::create(this); | ||
anthonyfieroni: It does not have settings? | |||||
apol: I guess it's never called? | |||||
124 | initPlugin(); | 124 | initPlugin(); | ||
125 | if (!m_factory) { | 125 | if (!m_factory) { | ||
126 | if (m_plugin != s_defaultPlugin) { | 126 | if (m_plugin != s_defaultPlugin) { | ||
127 | // try loading default plugin | 127 | // try loading default plugin | ||
128 | m_plugin = s_defaultPlugin; | 128 | m_plugin = s_defaultPlugin; | ||
129 | initPlugin(); | 129 | initPlugin(); | ||
130 | } | 130 | } | ||
131 | // default plugin failed to load, try fallback | 131 | // default plugin failed to load, try fallback | ||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Line(s) | 278 | if (!m_factory) { | |||
279 | return nullptr; | 279 | return nullptr; | ||
280 | } | 280 | } | ||
281 | QVariantMap args({ {QStringLiteral("bridge"), QVariant::fromValue(this)} }); | 281 | QVariantMap args({ {QStringLiteral("bridge"), QVariant::fromValue(this)} }); | ||
282 | 282 | | |||
283 | if (!m_theme.isEmpty()) { | 283 | if (!m_theme.isEmpty()) { | ||
284 | args.insert(QStringLiteral("theme"), m_theme); | 284 | args.insert(QStringLiteral("theme"), m_theme); | ||
285 | } | 285 | } | ||
286 | auto deco = m_factory->create<KDecoration2::Decoration>(client, QVariantList({args})); | 286 | auto deco = m_factory->create<KDecoration2::Decoration>(client, QVariantList({args})); | ||
287 | deco->setSettings(m_settings); | 287 | deco->setSettings(m_settings); | ||
anthonyfieroni: Is there problem here? | |||||
I can imagine this never reaches since there's no decoration on the phone. apol: I can imagine this never reaches since there's no decoration on the phone. | |||||
288 | deco->init(); | 288 | deco->init(); | ||
289 | return deco; | 289 | return deco; | ||
290 | } | 290 | } | ||
291 | 291 | | |||
292 | static | 292 | static | ||
293 | QString settingsProperty(const QVariant &variant) | 293 | QString settingsProperty(const QVariant &variant) | ||
294 | { | 294 | { | ||
295 | if (QLatin1String(variant.typeName()) == QLatin1String("KDecoration2::BorderSize")) { | 295 | if (QLatin1String(variant.typeName()) == QLatin1String("KDecoration2::BorderSize")) { | ||
Show All 10 Lines | 297 | } else if (QLatin1String(variant.typeName()) == QLatin1String("QVector<KDecoration2::DecorationButtonType>")) { | |||
306 | return buffer; | 306 | return buffer; | ||
307 | } | 307 | } | ||
308 | return variant.toString(); | 308 | return variant.toString(); | ||
309 | } | 309 | } | ||
310 | 310 | | |||
311 | QString DecorationBridge::supportInformation() const | 311 | QString DecorationBridge::supportInformation() const | ||
312 | { | 312 | { | ||
313 | QString b; | 313 | QString b; | ||
314 | | ||||
I see a potential crash when decorations are disabled. Perhaps we need to check m_noPlugin, e.g. if (m_noPlugin) { b.append(QStringLiteral("Decorations are disabled")); } else { b.append(QStringLiteral("Plugin: %1\n").arg(m_plugin)); b.append(QStringLiteral("Theme: %1\n").arg(m_theme)); b.append(QStringLiteral("Plugin recommends border size: %1\n").arg(m_recommendedBorderSize.isNull() ? "No" : m_recommendedBorderSize)); b.append(QStringLiteral("Blur: %1\n").arg(m_blur)); const QMetaObject *metaOptions = m_settings->metaObject(); for (int i=0; i<metaOptions->propertyCount(); ++i) { const QMetaProperty property = metaOptions->property(i); if (QLatin1String(property.name()) == QLatin1String("objectName")) { continue; } b.append(QStringLiteral("%1: %2\n").arg(property.name()).arg(settingsProperty(m_settings->property(property.name())))); } } zzag: I see a potential crash when decorations are disabled. Perhaps we need to check m_noPlugin, e.g. | |||||
314 | b.append(QStringLiteral("Plugin: %1\n").arg(m_plugin)); | 315 | b.append(QStringLiteral("Plugin: %1\n").arg(m_plugin)); | ||
315 | b.append(QStringLiteral("Theme: %1\n").arg(m_theme)); | 316 | b.append(QStringLiteral("Theme: %1\n").arg(m_theme)); | ||
316 | b.append(QStringLiteral("Plugin recommends border size: %1\n").arg(m_recommendedBorderSize.isNull() ? "No" : m_recommendedBorderSize)); | 317 | b.append(QStringLiteral("Plugin recommends border size: %1\n").arg(m_recommendedBorderSize.isNull() ? "No" : m_recommendedBorderSize)); | ||
317 | b.append(QStringLiteral("Blur: %1\n").arg(m_blur)); | 318 | b.append(QStringLiteral("Blur: %1\n").arg(m_blur)); | ||
319 | if (m_settings) { | ||||
318 | const QMetaObject *metaOptions = m_settings->metaObject(); | 320 | const QMetaObject *metaOptions = m_settings->metaObject(); | ||
319 | for (int i=0; i<metaOptions->propertyCount(); ++i) { | 321 | for (int i=0; i<metaOptions->propertyCount(); ++i) { | ||
320 | const QMetaProperty property = metaOptions->property(i); | 322 | const QMetaProperty property = metaOptions->property(i); | ||
321 | if (QLatin1String(property.name()) == QLatin1String("objectName")) { | 323 | if (QLatin1String(property.name()) == QLatin1String("objectName")) { | ||
322 | continue; | 324 | continue; | ||
323 | } | 325 | } | ||
324 | b.append(QStringLiteral("%1: %2\n").arg(property.name()).arg(settingsProperty(m_settings->property(property.name())))); | 326 | b.append(QStringLiteral("%1: %2\n").arg(property.name()).arg(settingsProperty(m_settings->property(property.name())))); | ||
zzag: Unrelated whitespace change. | |||||
325 | } | 327 | } | ||
328 | } | ||||
326 | return b; | 329 | return b; | ||
327 | } | 330 | } | ||
328 | 331 | | |||
329 | } // Decoration | 332 | } // Decoration | ||
330 | } // KWin | 333 | } // KWin |
There is an unknown macro here somewhere. Configuration is required. If KWIN_SINGLETON_FACTORY is a macro then please configure it.