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
icc-effect-5.14.5
Martin Gräßlin 2015-10-18 13:19:39 +02:00
parent d2cb445f4c
commit 126263b6db
12 changed files with 0 additions and 741 deletions

View File

@ -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 )

View File

@ -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
)

View File

@ -1,182 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2010 Andreas Demmer <ademmer@opensuse.org>
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 <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "dashboard.h"
// KConfigSkeleton
#include "dashboardconfig.h"
#include <KConfigGroup>
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<DashboardConfig>(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<void*>(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<void*>(this)));
w->addRepaintFull();
}
}
bool DashboardEffect::isActive() const
{
return transformWindow;
}
} // namespace

View File

@ -1,80 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2010 Andreas Demmer <ademmer@opensuse.org>
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 <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_DASHBOARD_H
#define KWIN_DASHBOARD_H
#include <kwineffects.h>
#include <QTimeLine>
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

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<group name="Effect-Dashboard">
<entry name="Brightness" type="Int">
<default>50</default>
</entry>
<entry name="Saturation" type="Int">
<default>50</default>
</entry>
<entry name="Duration" type="Int">
<default>0</default>
</entry>
<entry name="Blur" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>

View File

@ -1,61 +0,0 @@
/*
* Copyright © 2010 Andreas Demmer <ademmer@opensuse.org>
*
* 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 <kwineffects_interface.h>
#include <KAboutData>
#include <KPluginFactory>
K_PLUGIN_FACTORY_WITH_JSON(DashboardEffectConfigFactory,
"dashboard_config.json",
registerPlugin<KWin::DashboardEffectConfig>();)
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"

View File

@ -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]=資訊看板

View File

@ -1,49 +0,0 @@
/*
* Copyright © 2010 Andreas Demmer <ademmer@opensuse.org>
*
* 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 <KCModule>
#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

View File

@ -1,217 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DashboardEffectConfig</class>
<widget class="QWidget" name="DashboardEffectConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>239</width>
<height>189</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Brightness of the background:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string comment="Less brightness">Darker</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="kcfg_Brightness">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="pageStep">
<number>20</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string comment="More brightness">Lighter</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Saturation of the background:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string comment="No saturation">Gray</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="kcfg_Saturation">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="pageStep">
<number>20</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string comment="High saturation">Colored</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Duration of the fade:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,0">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="kcfg_Duration">
<property name="maximum">
<number>3000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>1500</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>ms</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="kcfg_Blur">
<property name="toolTip">
<string>The blur effect must be enabled before it can be used.</string>
</property>
<property name="text">
<string>Apply blur effect to background</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,5 +0,0 @@
File=dashboard.kcfg
ClassName=DashboardConfig
NameSpace=KWin
Singleton=true
Mutators=true

View File

@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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<DashboardEffect>,
nullptr,
nullptr
#endif
EFFECT_FALLBACK
}, {
QStringLiteral("desktopgrid"),

View File

@ -39,7 +39,6 @@ enum class BuiltInEffect
CoverSwitch,
Cube,
CubeSlide,
Dashboard,
DesktopGrid,
DimInactive,
DimScreen,