From 126263b6dbffa8dc0cc86cc8dc2e89ce66841408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 18 Oct 2015 13:19:39 +0200 Subject: [PATCH] Drop the Dashboard Effect Basically dead code given that Plasma doesn't have a dedicated dashboard mode anymore and also doesn't set the required window role for it to work. By deleting we save one string comparison for each newly opened window. REVIEW: 125686 --- effects/CMakeLists.txt | 3 - effects/dashboard/CMakeLists.txt | 24 --- effects/dashboard/dashboard.cpp | 182 ----------------- effects/dashboard/dashboard.h | 80 -------- effects/dashboard/dashboard.kcfg | 21 -- effects/dashboard/dashboard_config.cpp | 61 ------ effects/dashboard/dashboard_config.desktop | 82 -------- effects/dashboard/dashboard_config.h | 49 ----- effects/dashboard/dashboard_config.ui | 217 --------------------- effects/dashboard/dashboardconfig.kcfgc | 5 - effects/effect_builtins.cpp | 16 -- effects/effect_builtins.h | 1 - 12 files changed, 741 deletions(-) delete mode 100644 effects/dashboard/CMakeLists.txt delete mode 100644 effects/dashboard/dashboard.cpp delete mode 100644 effects/dashboard/dashboard.h delete mode 100644 effects/dashboard/dashboard.kcfg delete mode 100644 effects/dashboard/dashboard_config.cpp delete mode 100644 effects/dashboard/dashboard_config.desktop delete mode 100644 effects/dashboard/dashboard_config.h delete mode 100644 effects/dashboard/dashboard_config.ui delete mode 100644 effects/dashboard/dashboardconfig.kcfgc diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 3e88bfa754..a869d6e162 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -82,7 +82,6 @@ set( kwin4_effect_builtins_sources cube/cube_proxy.cpp cube/cubeslide.cpp coverswitch/coverswitch.cpp - dashboard/dashboard.cpp desktopgrid/desktopgrid.cpp diminactive/diminactive.cpp flipswitch/flipswitch.cpp @@ -109,7 +108,6 @@ kconfig_add_kcfg_files(kwin4_effect_builtins_sources cube/cubeslideconfig.kcfgc cube/cubeconfig.kcfgc coverswitch/coverswitchconfig.kcfgc - dashboard/dashboardconfig.kcfgc desktopgrid/desktopgridconfig.kcfgc diminactive/diminactiveconfig.kcfgc flipswitch/flipswitchconfig.kcfgc @@ -144,7 +142,6 @@ add_subdirectory( windowaperture ) # Built-in effects go here # Common effects -add_subdirectory( dashboard ) add_subdirectory( desktopgrid ) add_subdirectory( diminactive ) include( dimscreen/CMakeLists.txt ) diff --git a/effects/dashboard/CMakeLists.txt b/effects/dashboard/CMakeLists.txt deleted file mode 100644 index 81c5ee1ff8..0000000000 --- a/effects/dashboard/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -####################################### -# Config -set(kwin_dashboard_config_SRCS dashboard_config.cpp) -ki18n_wrap_ui(kwin_dashboard_config_SRCS dashboard_config.ui) -qt5_add_dbus_interface(kwin_dashboard_config_SRCS ${kwin_effects_dbus_xml} kwineffects_interface) -kconfig_add_kcfg_files(kwin_dashboard_config_SRCS dashboardconfig.kcfgc) - -add_library(kwin_dashboard_config MODULE ${kwin_dashboard_config_SRCS}) - -target_link_libraries(kwin_dashboard_config - Qt5::DBus - KF5::ConfigWidgets - KF5::I18n - KF5::Service -) - -kcoreaddons_desktop_to_json(kwin_dashboard_config dashboard_config.desktop) - -install( - TARGETS - kwin_dashboard_config - DESTINATION - ${PLUGIN_INSTALL_DIR}/kwin/effects/configs -) diff --git a/effects/dashboard/dashboard.cpp b/effects/dashboard/dashboard.cpp deleted file mode 100644 index 42651ecce1..0000000000 --- a/effects/dashboard/dashboard.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2010 Andreas Demmer - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ - -#include "dashboard.h" -// KConfigSkeleton -#include "dashboardconfig.h" - -#include - -namespace KWin -{ - -DashboardEffect::DashboardEffect() - : transformWindow(false) - , retransformWindow(false) - , activateAnimation(false) - , deactivateAnimation(false) - , window(NULL) -{ - // TODO: better namespacing for atoms - atom = effects->announceSupportProperty("_WM_EFFECT_KDE_DASHBOARD", this); - - // read settings - reconfigure(ReconfigureAll); - connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*))); - connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*))); - connect(effects, SIGNAL(windowActivated(KWin::EffectWindow*)), this, SLOT(slotWindowActivated(KWin::EffectWindow*))); -} - -DashboardEffect::~DashboardEffect() -{ -} - -void DashboardEffect::reconfigure(ReconfigureFlags) -{ - DashboardConfig::self()->read(); - brightness = DashboardConfig::brightness()/ 100.0; - saturation = DashboardConfig::saturation()/ 100.0; - blur = DashboardConfig::blur(); - - timeline.setDuration(animationTime(500)); - if (transformWindow) - effects->addRepaintFull(); -} - -void DashboardEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) -{ - if (transformWindow && (w != window) && w->isManaged() && !isDashboard(w)) { - // dashboard active, transform other windows - data.multiplyBrightness((1 - ((1.0 - brightness) * timeline.currentValue()))); - data.multiplySaturation((1 - ((1.0 - saturation) * timeline.currentValue()))); - } - - else if (transformWindow && (w == window) && w->isManaged()) { - // transform dashboard - if ((timeline.currentValue() * 2) <= 1) { - data.multiplyOpacity(timeline.currentValue() * 2); - } - } - - effects->paintWindow(w, mask, region, data); -} - -void DashboardEffect::prePaintScreen(ScreenPrePaintData& data, int time) -{ - if (transformWindow) { - if (activateAnimation) - timeline.setCurrentTime(timeline.currentTime() + time); - if (deactivateAnimation) - timeline.setCurrentTime(timeline.currentTime() - time); - } - effects->prePaintScreen(data, time); -} - -void DashboardEffect::postPaintScreen() -{ - if (transformWindow) { - if (retransformWindow) { - retransformWindow = false; - transformWindow = false; - effects->addRepaintFull(); - window = NULL; - effects->setActiveFullScreenEffect(0); - } - - if (activateAnimation) { - if (timeline.currentValue() == 1.0) - activateAnimation = false; - - effects->addRepaintFull(); - } - - if (deactivateAnimation) { - if (timeline.currentValue() == 0.0) { - deactivateAnimation = false; - transformWindow = false; - window = NULL; - effects->setActiveFullScreenEffect(0); - } - - effects->addRepaintFull(); - } - } - - effects->postPaintScreen(); -} - -bool DashboardEffect::isDashboard(EffectWindow *w) -{ - return w->windowRole() == QStringLiteral("plasma-dashboard"); -} - -void DashboardEffect::slotWindowActivated(EffectWindow *w) -{ - if (!w) - return; - - // apply effect on dashboard activation - if (isDashboard(w)) { - effects->setActiveFullScreenEffect(this); - transformWindow = true; - window = w; - - effects->addRepaintFull(); - } else { - if (transformWindow) { - retransformWindow = true; - effects->addRepaintFull(); - } - } -} - -void DashboardEffect::slotWindowAdded(EffectWindow* w) -{ - if (isDashboard(w)) { - // Tell other windowAdded() effects to ignore this window - w->setData(WindowAddedGrabRole, QVariant::fromValue(static_cast(this))); - if (blur) { - w->setData(WindowBlurBehindRole, w->geometry()); - w->setData(WindowForceBlurRole, QVariant(true)); - } - - activateAnimation = true; - deactivateAnimation = false; - timeline.setCurrentTime(0); - - w->addRepaintFull(); - } -} - -void DashboardEffect::slotWindowClosed(EffectWindow* w) -{ - if (isDashboard(w)) { - // Tell other windowClosed() effects to ignore this window - w->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast(this))); - w->addRepaintFull(); - } -} - -bool DashboardEffect::isActive() const -{ - return transformWindow; -} - -} // namespace diff --git a/effects/dashboard/dashboard.h b/effects/dashboard/dashboard.h deleted file mode 100644 index 9c46f12ebf..0000000000 --- a/effects/dashboard/dashboard.h +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2010 Andreas Demmer - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ - -#ifndef KWIN_DASHBOARD_H -#define KWIN_DASHBOARD_H - -#include -#include - -namespace KWin -{ - - -class DashboardEffect : public KWin::Effect -{ - Q_OBJECT - Q_PROPERTY(qreal brightness READ configuredBrightness) - Q_PROPERTY(qreal saturation READ configuredSaturation) - Q_PROPERTY(bool blur READ isBlur) -public: - DashboardEffect(); - ~DashboardEffect(); - virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); - virtual void prePaintScreen(ScreenPrePaintData& data, int time); - virtual void postPaintScreen(); - virtual void reconfigure(ReconfigureFlags); - virtual bool isActive() const; - - int requestedEffectChainPosition() const override { - return 85; - } - - // for properties - qreal configuredBrightness() const { - return brightness; - } - qreal configuredSaturation() const { - return saturation; - } - bool isBlur() const { - return blur; - } -public Q_SLOTS: - void slotWindowAdded(KWin::EffectWindow* c); - void slotWindowClosed(KWin::EffectWindow *c); - void slotWindowActivated(KWin::EffectWindow *w); -private: - bool blur; - bool isDashboard(EffectWindow* w); - bool transformWindow; - bool retransformWindow; - bool activateAnimation; - bool deactivateAnimation; - QTimeLine timeline; - long atom; - qreal brightness; - qreal saturation; - EffectWindow* window; -}; - -} // namespace - -#endif diff --git a/effects/dashboard/dashboard.kcfg b/effects/dashboard/dashboard.kcfg deleted file mode 100644 index 9fbdf09c5a..0000000000 --- a/effects/dashboard/dashboard.kcfg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - 50 - - - 50 - - - 0 - - - false - - - diff --git a/effects/dashboard/dashboard_config.cpp b/effects/dashboard/dashboard_config.cpp deleted file mode 100644 index 75696bd07b..0000000000 --- a/effects/dashboard/dashboard_config.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright © 2010 Andreas Demmer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. if not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "dashboard_config.h" -// KConfigSkeleton -#include "dashboardconfig.h" - -#include -#include -#include - -K_PLUGIN_FACTORY_WITH_JSON(DashboardEffectConfigFactory, - "dashboard_config.json", - registerPlugin();) - -namespace KWin -{ - -DashboardEffectConfig::DashboardEffectConfig(QWidget *parent, const QVariantList &args) - : KCModule(KAboutData::pluginData(QStringLiteral("dashboard")), parent, args) -{ - ui.setupUi(this); - - addConfig(DashboardConfig::self(), this); - - load(); -} - -DashboardEffectConfig::~DashboardEffectConfig() -{ -} - -void DashboardEffectConfig::save() -{ - KCModule::save(); - - OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"), - QStringLiteral("/Effects"), - QDBusConnection::sessionBus()); - interface.reconfigureEffect(QStringLiteral("dashboard")); -} - -} // namespace KWin - -#include "dashboard_config.moc" diff --git a/effects/dashboard/dashboard_config.desktop b/effects/dashboard/dashboard_config.desktop deleted file mode 100644 index de25b623bc..0000000000 --- a/effects/dashboard/dashboard_config.desktop +++ /dev/null @@ -1,82 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KCModule - -X-KDE-Library=kwin_dashboard_config -X-KDE-ParentComponents=dashboard - -Name=Dashboard -Name[ar]=لوحة الودجات -Name[be@latin]=Dashboard -Name[bg]=Табло -Name[bn]=ড্যাশবোর্ড -Name[bn_IN]=Dashboard -Name[bs]=Instrument-tabla -Name[ca]=Tauler -Name[ca@valencia]=Tauler -Name[cs]=Dashboard -Name[csb]=Panel -Name[da]=Instrumentbræt -Name[de]=Übersichtsseite -Name[el]=Πίνακας συστατικών -Name[en_GB]=Dashboard -Name[eo]=Stirtablo -Name[es]=Tablero de mandos -Name[et]=Vidinavaade -Name[eu]=Agente-mahaia -Name[fi]=Kojelauta -Name[fr]=Panneau de contrôle -Name[fy]=Dashboard -Name[ga]=Dashboard -Name[gl]=Cadro de control -Name[gu]=ડેશબોર્ડ -Name[he]=מכתבה -Name[hi]=डैशबोर्ड -Name[hne]=डेशबोर्ड -Name[hr]=Nadzorna ploča -Name[hu]=Dashboard -Name[ia]=Pannello de instrumentos -Name[id]=Dasbor -Name[is]=Dashboard -Name[it]=Dashboard -Name[ja]=ダッシュボード -Name[kk]=Аспаптар панелі -Name[km]=ផ្ទាំង​គ្រប់គ្រង -Name[kn]=ಯಂತ್ರೋಪಕರಣ ಪಟ್ಟಿ (ಡಾಶ್ ಬೋರ್ಡ್) -Name[ko]=대시보드 -Name[ku]=Panela Kontrolê -Name[lt]=Prietaisų skydelis -Name[lv]=Dashboard -Name[ml]=ഡാഷ്ബോര്‍ഡ് -Name[mr]=डॅशबोर्ड -Name[nb]=Kontrollpult -Name[nds]=Klockpaneel -Name[nl]=Dashboard -Name[nn]=Kontrollpult -Name[or]=ଡ୍ୟାସବୋର୍ଡ -Name[pa]=ਡੈਸ਼ਬੋਰਡ -Name[pl]=Tablica -Name[pt]=Dashboard -Name[pt_BR]=Painel -Name[ro]=Tablou de bord -Name[ru]=Приборная доска -Name[si]=පාලක පුරුව -Name[sk]=Nástenka -Name[sl]=Nadzorna plošča -Name[sr]=инструмент-табла -Name[sr@ijekavian]=инструмент-табла -Name[sr@ijekavianlatin]=instrument-tabla -Name[sr@latin]=instrument-tabla -Name[sv]=Instrumentpanel -Name[ta]= எக்ஸ்போர்டு -Name[te]=డాష్‌బోర్‍డ్ -Name[tg]=Панели иловагиҳо -Name[th]=แดชบอร์ด -Name[tr]=Kontrol Paneli -Name[ug]=باشقۇرۇش بېتى -Name[uk]=Панель приладів -Name[vi]=Bảng thông tin -Name[wa]=Tåvlea d' boird -Name[x-test]=xxDashboardxx -Name[zh_CN]=部件板 -Name[zh_TW]=資訊看板 diff --git a/effects/dashboard/dashboard_config.h b/effects/dashboard/dashboard_config.h deleted file mode 100644 index aaa09d6fb9..0000000000 --- a/effects/dashboard/dashboard_config.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright © 2010 Andreas Demmer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. if not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef KWIN_DASHBOARD_CONFIG_H -#define KWIN_DASHBOARD_CONFIG_H - -#include -#include "ui_dashboard_config.h" - -namespace KWin -{ - -class DashboardEffectConfig : public KCModule -{ - Q_OBJECT - -public: - explicit DashboardEffectConfig(QWidget *parent = 0, const QVariantList& args = QVariantList()); - ~DashboardEffectConfig(); - - void save(); - -private: - bool isBlurEffectAvailable(); - long net_wm_dashboard; - ::Ui::DashboardEffectConfig ui; - -}; - -} // namespace KWin - -#endif - diff --git a/effects/dashboard/dashboard_config.ui b/effects/dashboard/dashboard_config.ui deleted file mode 100644 index fd9a19e0c5..0000000000 --- a/effects/dashboard/dashboard_config.ui +++ /dev/null @@ -1,217 +0,0 @@ - - - DashboardEffectConfig - - - - 0 - 0 - 239 - 189 - - - - - - - Brightness of the background: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 12 - 0 - - - - - - - - Darker - - - - - - - - 0 - 0 - - - - 100 - - - 10 - - - 20 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - Lighter - - - - - - - - - Saturation of the background: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 12 - 0 - - - - - - - - Gray - - - - - - - - 0 - 0 - - - - 100 - - - 10 - - - 20 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - Colored - - - - - - - - - Duration of the fade: - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 3000 - - - 100 - - - 1500 - - - - - - - ms - - - - - - - - - The blur effect must be enabled before it can be used. - - - Apply blur effect to background - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - diff --git a/effects/dashboard/dashboardconfig.kcfgc b/effects/dashboard/dashboardconfig.kcfgc deleted file mode 100644 index 772ad03cbe..0000000000 --- a/effects/dashboard/dashboardconfig.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=dashboard.kcfg -ClassName=DashboardConfig -NameSpace=KWin -Singleton=true -Mutators=true diff --git a/effects/effect_builtins.cpp b/effects/effect_builtins.cpp index be508e6fea..d59839bfe1 100644 --- a/effects/effect_builtins.cpp +++ b/effects/effect_builtins.cpp @@ -28,7 +28,6 @@ along with this program. If not, see . #include "screenshot/screenshot.h" #include "slidingpopups/slidingpopups.h" // Common effects only relevant to desktop -#include "dashboard/dashboard.h" #include "desktopgrid/desktopgrid.h" #include "diminactive/diminactive.h" #include "dimscreen/dimscreen.h" @@ -171,21 +170,6 @@ EFFECT_FALLBACK &CubeSlideEffect::supported, nullptr #endif -EFFECT_FALLBACK - }, { - QStringLiteral("dashboard"), - i18ndc("kwin_effects", "Name of a KWin Effect", "Dashboard"), - i18ndc("kwin_effects", "Comment describing the KWin Effect", "Desaturate the desktop when displaying the Plasma dashboard"), - QStringLiteral("Appearance"), - QString(), - QUrl(), - true, - true, -#ifdef EFFECT_BUILTINS - &createHelper, - nullptr, - nullptr -#endif EFFECT_FALLBACK }, { QStringLiteral("desktopgrid"), diff --git a/effects/effect_builtins.h b/effects/effect_builtins.h index b471cf077a..de584e3a0f 100644 --- a/effects/effect_builtins.h +++ b/effects/effect_builtins.h @@ -39,7 +39,6 @@ enum class BuiltInEffect CoverSwitch, Cube, CubeSlide, - Dashboard, DesktopGrid, DimInactive, DimScreen,