From 62d71bc2470829128cee4cee8e46cc8f28e748f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 26 Jan 2015 11:41:09 +0100 Subject: [PATCH] [kcmkwin/options] Load/Unload WindowGeometry effect Depending on the state of the show window geometry we need to load or unload the effect. BUG: 343272 FIXED-IN: 5.2.1 REVIEW: 122258 --- kcmkwin/kwinoptions/CMakeLists.txt | 6 ++++-- kcmkwin/kwinoptions/windows.cpp | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/kcmkwin/kwinoptions/CMakeLists.txt b/kcmkwin/kwinoptions/CMakeLists.txt index 458139ab68..ea719b391a 100644 --- a/kcmkwin/kwinoptions/CMakeLists.txt +++ b/kcmkwin/kwinoptions/CMakeLists.txt @@ -2,10 +2,12 @@ # KI18N Translation Domain for this library add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwm\") -set(kcm_kwinoptions_PART_SRCS windows.cpp mouse.cpp main.cpp ) +set(kcm_kwinoptions_PART_SRCS windows.cpp mouse.cpp main.cpp ${KWIN_SOURCE_DIR}/effects/effect_builtins.cpp ) ki18n_wrap_ui(kcm_kwinoptions_PART_SRCS actions.ui advanced.ui focus.ui mouse.ui moving.ui) +qt5_add_dbus_interface( kcm_kwinoptions_PART_SRCS + ${KWIN_SOURCE_DIR}/org.kde.kwin.Effects.xml kwin_effects_interface) add_library(kcm_kwinoptions MODULE ${kcm_kwinoptions_PART_SRCS}) -target_link_libraries(kcm_kwinoptions Qt5::DBus KF5::Completion KF5::I18n KF5::ConfigWidgets KF5::Service) +target_link_libraries(kcm_kwinoptions Qt5::DBus KF5::Completion KF5::I18n KF5::ConfigWidgets KF5::Service KF5::WindowSystem) install(TARGETS kcm_kwinoptions DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kcmkwin/kwinoptions/windows.cpp b/kcmkwin/kwinoptions/windows.cpp index 3ca2348d42..2eba5fed0e 100644 --- a/kcmkwin/kwinoptions/windows.cpp +++ b/kcmkwin/kwinoptions/windows.cpp @@ -41,6 +41,8 @@ #include #include "windows.h" +#include +#include // kwin config keywords #define KWIN_FOCUS "FocusPolicy" @@ -585,7 +587,8 @@ void KMovingConfig::save(void) cg.writeEntry(KWM_CNTR_SNAP_ZONE, getCenterSnapZone()); cg.writeEntry("SnapOnlyWhenOverlapping", m_ui->OverlapSnap->isChecked()); - KConfigGroup(config, "Plugins").writeEntry("windowgeometryEnabled", getGeometryTip()); + const bool geometryTip = getGeometryTip(); + KConfigGroup(config, "Plugins").writeEntry("windowgeometryEnabled", geometryTip); if (standAlone) { config->sync(); @@ -594,6 +597,15 @@ void KMovingConfig::save(void) QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); QDBusConnection::sessionBus().send(message); } + // and reconfigure the effect + OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"), + QStringLiteral("/Effects"), + QDBusConnection::sessionBus()); + if (geometryTip) { + interface.loadEffect(KWin::BuiltInEffects::nameForEffect(KWin::BuiltInEffect::WindowGeometry)); + } else { + interface.unloadEffect(KWin::BuiltInEffects::nameForEffect(KWin::BuiltInEffect::WindowGeometry)); + } emit KCModule::changed(false); }