summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Martin <[email protected]>2017-01-04 13:23:15 +0100
committerMarco Martin <[email protected]>2017-01-04 13:23:22 +0100
commit81be6962b1e43ea4da7caa038fa87d84a3129937 (patch)
tree7952c1d7538365fce0ee53c9d9dc57062dc4c1be
parent4c8b2ea3ba886215b3cab396a707b61fbdf2e2a1 (diff)
import kwin deco and button order in l&f
Summary: support both button order and decoration theme of kwin when applying for a lnf theme. The deco theme is composed by library and theme entries. c++ themes will only use library, aurorae themes will use theme as well. BUG:370511 Test Plan: created some lnf packages that customize this and applied Reviewers: #plasma, graesslin Reviewed By: #plasma, graesslin Subscribers: Lucas, graesslin, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D3832
-rw-r--r--CMakeLists.txt14
-rw-r--r--config-workspace.h.cmake7
-rw-r--r--kcms/lookandfeel/kcm.cpp40
-rw-r--r--kcms/lookandfeel/kcm.h2
4 files changed, 57 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 87c66e6..ce30fd6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -125,6 +125,20 @@ else()
)
endif()
+find_package(Breeze ${PROJECT_VERSION} CONFIG)
+set_package_properties(Breeze PROPERTIES
+ TYPE OPTIONAL
+ PURPOSE "For setting the default window decoration plugin")
+if(${Breeze_FOUND})
+ if(${BREEZE_WITH_KDECORATION})
+ set(HAVE_BREEZE_DECO true)
+ else()
+ set(HAVE_BREEZE_DECO FALSE)
+ endif()
+else()
+ set(HAVE_BREEZE_DECO FALSE)
+endif()
+
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h)
diff --git a/config-workspace.h.cmake b/config-workspace.h.cmake
index 08f7503..c639971 100644
--- a/config-workspace.h.cmake
+++ b/config-workspace.h.cmake
@@ -149,6 +149,13 @@
/* Number of bits in a file offset, on hosts where this is settable. */
#define _FILE_OFFSET_BITS 64
+/* Define 1 if the Breeze window decoration was found */
+#cmakedefine HAVE_BREEZE_DECO 1
+
+#if HAVE_BREEZE_DECO
+#define BREEZE_KDECORATION_PLUGIN_ID "${BREEZE_KDECORATION_PLUGIN_ID}"
+#endif
+
/*
* On HP-UX, the declaration of vsnprintf() is needed every time !
*/
diff --git a/kcms/lookandfeel/kcm.cpp b/kcms/lookandfeel/kcm.cpp
index a8ceca2..0961d8a 100644
--- a/kcms/lookandfeel/kcm.cpp
+++ b/kcms/lookandfeel/kcm.cpp
@@ -21,6 +21,7 @@
#include "../krdb/krdb.h"
#include "../cursortheme/xcursor/xcursortheme.h"
#include "config-kcm.h"
+#include "config-workspace.h"
#include <klauncher_iface.h>
#include <KPluginFactory>
@@ -68,6 +69,7 @@ KCMLookandFeel::KCMLookandFeel(QObject* parent, const QVariantList& args)
, m_applyWindowSwitcher(true)
, m_applyDesktopSwitcher(true)
, m_resetDefaultLayout(false)
+ , m_applyWindowDecoration(true)
{
//This flag seems to be needed in order for QQuickWidget to work
//see https://bugreports.qt-project.org/browse/QTBUG-40765
@@ -329,6 +331,24 @@ void KCMLookandFeel::save()
cg = KConfigGroup(&cg, "DesktopSwitcher");
setDesktopSwitcher(cg.readEntry("LayoutName", QString()));
}
+
+ if (m_applyWindowDecoration) {
+ cg = KConfigGroup(conf, "kwinrc");
+ cg = KConfigGroup(&cg, "org.kde.kdecoration2");
+#if HAVE_BREEZE_DECO
+ setWindowDecoration(cg.readEntry("library", QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID)), cg.readEntry("theme", QString()));
+#else
+ setWindowDecoration(cg.readEntry("library", QStringLiteral("org.kde.kwin.aurorae")), cg.readEntry("theme", QString()));
+#endif
+ }
+
+ // Reload KWin if something changed, but only once.
+ if (m_applyWindowSwitcher || m_applyDesktopSwitcher || m_applyWindowDecoration) {
+ QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"),
+ QStringLiteral("org.kde.KWin"),
+ QStringLiteral("reloadConfig"));
+ QDBusConnection::sessionBus().send(message);
+ }
}
//TODO: option to enable/disable apply? they don't seem required by UI design
@@ -595,11 +615,6 @@ void KCMLookandFeel::setWindowSwitcher(const QString &theme)
KConfigGroup cg(&config, "TabBox");
cg.writeEntry("LayoutName", theme);
cg.sync();
- // Reload KWin.
- QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"),
- QStringLiteral("org.kde.KWin"),
- QStringLiteral("reloadConfig"));
- QDBusConnection::sessionBus().send(message);
}
void KCMLookandFeel::setDesktopSwitcher(const QString &theme)
@@ -613,6 +628,20 @@ void KCMLookandFeel::setDesktopSwitcher(const QString &theme)
cg.writeEntry("DesktopLayout", theme);
cg.writeEntry("DesktopListLayout", theme);
cg.sync();
+}
+
+void KCMLookandFeel::setWindowDecoration(const QString &library, const QString &theme)
+{
+ if (library.isEmpty()) {
+ return;
+ }
+
+ KConfig config(QStringLiteral("kwinrc"));
+ KConfigGroup cg(&config, "org.kde.kdecoration2");
+ cg.writeEntry("library", library);
+ cg.writeEntry("theme", theme);
+
+ cg.sync();
// Reload KWin.
QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"),
QStringLiteral("org.kde.KWin"),
@@ -620,7 +649,6 @@ void KCMLookandFeel::setDesktopSwitcher(const QString &theme)
QDBusConnection::sessionBus().send(message);
}
-
void KCMLookandFeel::setApplyColors(bool apply)
{
if (m_applyColors == apply) {
diff --git a/kcms/lookandfeel/kcm.h b/kcms/lookandfeel/kcm.h
index 16df7fd..c27b7f3 100644
--- a/kcms/lookandfeel/kcm.h
+++ b/kcms/lookandfeel/kcm.h
@@ -87,6 +87,7 @@ public:
void setLockScreen(const QString &theme);
void setWindowSwitcher(const QString &theme);
void setDesktopSwitcher(const QString &theme);
+ void setWindowDecoration(const QString &library, const QString &theme);
void setApplyColors(bool apply);
bool applyColors() const;
@@ -142,6 +143,7 @@ private:
bool m_applyWindowSwitcher : 1;
bool m_applyDesktopSwitcher : 1;
bool m_resetDefaultLayout : 1;
+ bool m_applyWindowDecoration : 1;
};
#endif