From: Ivailo Monev Date: Fri, 16 Jul 2021 01:28:58 +0000 (+0300) Subject: kwin: remove unused kscreen effect X-Git-Tag: 4.22.0~975 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=dd91c12cef0351ba14213d36ac91970cf4fa537f;p=kde%2Fkde-workspace.git kwin: remove unused kscreen effect Signed-off-by: Ivailo Monev --- diff --git a/kwin/CMakeLists.txt b/kwin/CMakeLists.txt index 31b38c82..c41e65ab 100644 --- a/kwin/CMakeLists.txt +++ b/kwin/CMakeLists.txt @@ -45,7 +45,6 @@ set(kwin4_effect_builtins_sources) set(kwin4_effect_builtins_config_sources effects/configs_builtins.cpp) set(kwin4_effect_include_directories) -include( effects/kscreen/CMakeLists.txt ) include( effects/presentwindows/CMakeLists.txt ) include( effects/slidingpopups/CMakeLists.txt ) include( effects/taskbarthumbnail/CMakeLists.txt ) diff --git a/kwin/effects.cpp b/kwin/effects.cpp index 2ae454c3..3739eac2 100644 --- a/kwin/effects.cpp +++ b/kwin/effects.cpp @@ -68,7 +68,6 @@ along with this program. If not, see . #include "effects/diminactive/diminactive.h" #include "effects/dimscreen/dimscreen.h" #include "effects/highlightwindow/highlightwindow.h" -#include "effects/kscreen/kscreen.h" #include "effects/logout/logout.h" #include "effects/magnifier/magnifier.h" #include "effects/minimizeanimation/minimizeanimation.h" @@ -1375,9 +1374,7 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault) Effect* effect = 0; QLibrary* library = 0; // builtins first - if (internalname == "kwin4_effect_kscreen") { - effect = new KscreenEffect(); - } else if (internalname == "kwin4_effect_presentwindows") { + if (internalname == "kwin4_effect_presentwindows") { effect = new PresentWindowsEffect(); } else if (internalname == "kwin4_effect_slidingpopups") { effect = new SlidingPopupsEffect(); diff --git a/kwin/effects/kscreen/CMakeLists.txt b/kwin/effects/kscreen/CMakeLists.txt deleted file mode 100644 index 28a7afdc..00000000 --- a/kwin/effects/kscreen/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -####################################### -# Effect - -# Source files -set(kwin4_effect_builtins_sources - ${kwin4_effect_builtins_sources} - effects/kscreen/kscreen.cpp -) - -kde4_add_kcfg_files(kwin4_effect_builtins_sources effects/kscreen/kscreenconfig.kcfgc) - -# .desktop files -install(FILES effects/kscreen/kscreen.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin) diff --git a/kwin/effects/kscreen/kscreen.cpp b/kwin/effects/kscreen/kscreen.cpp deleted file mode 100644 index 684a11b1..00000000 --- a/kwin/effects/kscreen/kscreen.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2013 Martin Gräßlin - -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 . -*********************************************************************/ -// own -#include "kscreen.h" -// KConfigSkeleton -#include "kscreenconfig.h" - -/** - * How this effect works: - * - * Effect announces that it is around through property _KDE_KWIN_KSCREEN_SUPPORT on the root window. - * - * KScreen watches for this property and when it wants to adjust screens, KScreen goes - * through the following protocol: - * 1. KScreen sets the property value to 1 - * 2. Effect starts to fade out all windows - * 3. When faded out the effect sets property value to 2 - * 4. KScreen adjusts the screens - * 5. KScreen sets property value to 3 - * 6. Effect starts to fade in all windows again - * 7. Effect sets back property value to 0 - * - * The property has type 32 bits cardinal. To test it use: - * xprop -root -f _KDE_KWIN_KSCREEN_SUPPORT 32c -set _KDE_KWIN_KSCREEN_SUPPORT 1 - * - * The states are: - * 0: normal - * 1: fading out - * 2: faded out - * 3: fading in - **/ - -namespace KWin -{ - -KscreenEffect::KscreenEffect() - : Effect() - , m_state(StateNormal) - , m_atom(effects->announceSupportProperty("_KDE_KWIN_KSCREEN_SUPPORT", this)) -{ - connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), SLOT(propertyNotify(KWin::EffectWindow*,long))); - reconfigure(ReconfigureAll); -} - -KscreenEffect::~KscreenEffect() -{ -} - -void KscreenEffect::reconfigure(ReconfigureFlags flags) -{ - Q_UNUSED(flags) - - KscreenConfig::self()->readConfig(); - m_timeLine.setDuration(animationTime(250)); -} - -void KscreenEffect::prePaintScreen(ScreenPrePaintData &data, int time) -{ - if (m_state == StateFadingIn || m_state == StateFadingOut) { - m_timeLine.setCurrentTime(m_timeLine.currentTime() + time); - if (m_timeLine.currentValue() >= 1.0) { - switchState(); - } - } - effects->prePaintScreen(data, time); -} - -void KscreenEffect::postPaintScreen() -{ - if (m_state == StateFadingIn || m_state == StateFadingOut) { - effects->addRepaintFull(); - } -} - -void KscreenEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) -{ - if (m_state != StateNormal) { - data.setTranslucent(); - } - effects->prePaintWindow(w, data, time); -} - -void KscreenEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) -{ - switch (m_state) { - case StateFadingOut: - data.multiplyOpacity(1.0 - m_timeLine.currentValue()); - break; - case StateFadedOut: - data.multiplyOpacity(0.0); - break; - case StateFadingIn: - data.multiplyOpacity(m_timeLine.currentValue()); - break; - default: - // no adjustment - break; - } - effects->paintWindow(w, mask, region, data); -} - -void KscreenEffect::propertyNotify(EffectWindow *window, long atom) -{ - if (window || atom != m_atom) { - return; - } - QByteArray byteData = effects->readRootProperty(m_atom, XCB_ATOM_CARDINAL, 32); - long *data = reinterpret_cast(byteData.data()); - if (!data[0]) { - // Property was deleted - if (m_state != StateNormal) { - m_state = StateNormal; - effects->addRepaintFull(); - } - return; - } - if (data[0] == 0) { - // normal state - KWin should have switched to it - if (m_state != StateNormal) { - m_state = StateNormal; - effects->addRepaintFull(); - } - return; - } - if (data[0] == 2) { - // faded out state - KWin should have switched to it - if (m_state != StateFadedOut) { - m_state = StateFadedOut; - effects->addRepaintFull(); - } - return; - } - if (data[0] == 1) { - // kscreen wants KWin to fade out all windows - m_state = StateFadingOut; - m_timeLine.setCurrentTime(0); - effects->addRepaintFull(); - return; - } - if (data[0] == 3) { - // kscreen wants KWin to fade in again - m_state = StateFadingIn; - m_timeLine.setCurrentTime(0); - effects->addRepaintFull(); - return; - } - kDebug(1212) << "Incorrect Property state, immediate stop: " << data[0]; - m_state = StateNormal; - effects->addRepaintFull(); -} - -void KscreenEffect::switchState() -{ - long value = -1l; - if (m_state == StateFadingOut) { - m_state = StateFadedOut; - value = 2l; - } else if (m_state == StateFadingIn) { - m_state = StateNormal; - value = 0l; - } - if (value != -1l) { - xcb_change_property(connection(), XCB_PROP_MODE_REPLACE, rootWindow(), m_atom, XCB_ATOM_CARDINAL, 32, 1, &value); - } -} - -bool KscreenEffect::isActive() const -{ - return m_state != StateNormal; -} - -} // namespace KWin diff --git a/kwin/effects/kscreen/kscreen.desktop b/kwin/effects/kscreen/kscreen.desktop deleted file mode 100644 index f7c5bbcf..00000000 --- a/kwin/effects/kscreen/kscreen.desktop +++ /dev/null @@ -1,93 +0,0 @@ -[Desktop Entry] -Name=Kscreen -Name[bs]=KScreen -Name[ca]=Kscreen -Name[ca@valencia]=Kscreen -Name[cs]=Kscreen -Name[da]=KScreen -Name[de]=Kscreen -Name[el]=Kscreen -Name[en_GB]=Kscreen -Name[es]=Kscreen -Name[et]=Kscreen -Name[eu]=Kscreen -Name[fi]=Kscreen -Name[gl]=KScreen -Name[hu]=Kscreen -Name[ia]=Kscreen -Name[kk]=Kscreen -Name[ko]=Kscreen -Name[nb]=Kscreen -Name[nds]=KScreen -Name[nl]=Kscreen -Name[pa]=ਕੇਸਕਰੀਨ -Name[pl]=Kscreen -Name[pt]=Kscreen -Name[pt_BR]=KScreen -Name[ro]=Kscreen -Name[ru]=Kscreen -Name[sk]=Kscreen -Name[sl]=Kscreen -Name[sr]=К‑екран -Name[sr@ijekavian]=К‑екран -Name[sr@ijekavianlatin]=K‑ekran -Name[sr@latin]=K‑ekran -Name[sv]=Kskärm -Name[tr]=Kscreen -Name[uk]=Kscreen -Name[x-test]=xxKscreenxx -Name[zh_CN]=Kscreen -Name[zh_TW]=Kscreen -Icon=preferences-system-windows-effect-kscreen -Comment=Helper Effect for KScreen -Comment[bs]=Pomoćni efekat za KScreen -Comment[ca]=Efecte auxiliar pel KScreen -Comment[ca@valencia]=Efecte auxiliar pel KScreen -Comment[cs]=Pomocný efekt pro KScreen -Comment[da]=Hjælpeeffekt til KScreen -Comment[de]=Hilfseffekt für KScreen -Comment[el]=Βοηθητικό εφέ για το KScreen -Comment[en_GB]=Helper Effect for KScreen -Comment[es]=Efecto auxiliar para KScreen -Comment[et]=KScreeni abiefekt -Comment[eu]=KScreen-entzako efektu laguntzailea -Comment[fi]=KScreenin avustustehoste -Comment[gl]=Efecto auxiliar para KScreen. -Comment[hu]=Segédeffektus a KScreenhez -Comment[ia]=Effecto de adjutante pro KScreen -Comment[kk]=KScreen-нің көмек эффекті -Comment[ko]=KScreen 도우미 효과 -Comment[nb]=Hjelpereffekt for KScreen -Comment[nds]=Hülpeffekt för KScreen -Comment[nl]=Effect van hulp voor KScreen -Comment[pa]=ਕੇਸਕਰੀਨ ਲਈ ਮੱਦਦ ਪ੍ਰਭਾਵ -Comment[pl]=Efekt pomocniczy dla KScreen -Comment[pt]=Efeito auxiliar do KScreen -Comment[pt_BR]=Efeito auxiliar do KScreen -Comment[ro]=Efect ajutător pentru KScreen -Comment[ru]=Вспомогательный эффект для KScreen -Comment[sk]=Pomocný efekt pre KScreen -Comment[sl]=Pomožni učinek za KScreen -Comment[sr]=Помоћни ефекат за К‑екран -Comment[sr@ijekavian]=Помоћни ефекат за К‑екран -Comment[sr@ijekavianlatin]=Pomoćni efekat za K‑ekran -Comment[sr@latin]=Pomoćni efekat za K‑ekran -Comment[sv]=Hjälpeffekt för Kskärm -Comment[tr]=KScreen için Yardımcı Efekt -Comment[uk]=Допоміжний ефект KScreen -Comment[x-test]=xxHelper Effect for KScreenxx -Comment[zh_CN]=KScreen 的帮助效果 -Comment[zh_TW]=KScreen 輔助效果 - -Type=Service -X-KDE-ServiceTypes=KWin/Effect -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=mgraesslin@kde.org -X-KDE-PluginInfo-Name=kwin4_effect_kscreen -X-KDE-PluginInfo-Version=0.1.0 -X-KDE-PluginInfo-Category=Appearance -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true -X-KDE-Ordering=99 -X-KWin-Requires-Shaders=false diff --git a/kwin/effects/kscreen/kscreen.h b/kwin/effects/kscreen/kscreen.h deleted file mode 100644 index 278deeda..00000000 --- a/kwin/effects/kscreen/kscreen.h +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2013 Martin Gräßlin - -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_KSCREEN_H -#define KWIN_KSCREEN_H - -#include -// Qt -#include - -namespace KWin -{ - -class KscreenEffect : public Effect -{ - Q_OBJECT - -public: - KscreenEffect(); - virtual ~KscreenEffect(); - - virtual void prePaintScreen(ScreenPrePaintData &data, int time); - virtual void postPaintScreen(); - virtual void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time); - virtual void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data); - - void reconfigure(ReconfigureFlags flags); - virtual bool isActive() const; - -private Q_SLOTS: - void propertyNotify(KWin::EffectWindow *window, long atom); - -private: - void switchState(); - enum FadeOutState { - StateNormal, - StateFadingOut, - StateFadedOut, - StateFadingIn - }; - QTimeLine m_timeLine; - FadeOutState m_state; - xcb_atom_t m_atom; -}; - - -} // namespace KWin -#endif // KWIN_KSCREEN_H diff --git a/kwin/effects/kscreen/kscreen.kcfg b/kwin/effects/kscreen/kscreen.kcfg deleted file mode 100644 index 41232357..00000000 --- a/kwin/effects/kscreen/kscreen.kcfg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - 0 - - - diff --git a/kwin/effects/kscreen/kscreenconfig.kcfgc b/kwin/effects/kscreen/kscreenconfig.kcfgc deleted file mode 100644 index c2b8bbbe..00000000 --- a/kwin/effects/kscreen/kscreenconfig.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=kscreen.kcfg -ClassName=KscreenConfig -NameSpace=KWin -Singleton=true -Mutators=true