diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index e89576c521..cd77323d40 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -146,7 +146,6 @@ include( screenshot/CMakeLists.txt ) if( NOT KWIN_MOBILE_EFFECTS ) include( coverswitch/CMakeLists.txt ) include( cube/CMakeLists.txt ) - include( explosion/CMakeLists.txt ) include( flipswitch/CMakeLists.txt ) include( glide/CMakeLists.txt ) include( invert/CMakeLists.txt ) diff --git a/effects/explosion/CMakeLists.txt b/effects/explosion/CMakeLists.txt deleted file mode 100644 index 0dce41f899..0000000000 --- a/effects/explosion/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -####################################### -# Effect - -# Source files -set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} - explosion/explosion.cpp - ) - -# .desktop files -install( FILES - explosion/explosion.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) - -# Data files -install( FILES - explosion/data/explosion-end.png - explosion/data/explosion-start.png - explosion/data/explosion.frag - DESTINATION ${DATA_INSTALL_DIR}/kwin ) diff --git a/effects/explosion/data/explosion-end.png b/effects/explosion/data/explosion-end.png deleted file mode 100644 index 572e6f988e..0000000000 Binary files a/effects/explosion/data/explosion-end.png and /dev/null differ diff --git a/effects/explosion/data/explosion-start.png b/effects/explosion/data/explosion-start.png deleted file mode 100644 index 07967dbc2c..0000000000 Binary files a/effects/explosion/data/explosion-start.png and /dev/null differ diff --git a/effects/explosion/data/explosion.frag b/effects/explosion/data/explosion.frag deleted file mode 100644 index e0c8f8aa3d..0000000000 --- a/effects/explosion/data/explosion.frag +++ /dev/null @@ -1,53 +0,0 @@ -uniform sampler2D sampler; -uniform sampler2D startOffsetTexture; -uniform sampler2D endOffsetTexture; -uniform float factor; -uniform float scale; -uniform vec2 windowSize; - -const float regionTexSize = 512.0; - -varying vec2 varyingTexCoords; - -vec2 getOffset(sampler2D texture, vec2 pos) -{ - return (texture2D(texture, pos / regionTexSize).xy - 0.5) / (5.0 / 256.0); -} - -vec2 pix2tex( vec2 pix ) -{ - return pix/windowSize; -} - -void main() -{ - // Original (unscaled) position in pixels - // ### FIXME: Use a custom vertex shader that outputs the untransformed texcoords - vec2 origpos = varyingTexCoords * windowSize; - // Position in pixels on the scaled window - vec2 pos = origpos * scale; - // Start/end position of current region - vec2 rstart = origpos + getOffset(startOffsetTexture, origpos); - vec2 rend = origpos + getOffset(endOffsetTexture, origpos); - float alpha = texture2D(startOffsetTexture, origpos / regionTexSize).b; - // Distance from the start of the region - vec2 dist = pos - rstart*scale; -#if 0 - // crashes kwin on nouveau - if(any(greaterThan(dist, rend-rstart))) - discard;//alpha = 0.0; -#endif - - vec2 transformedtexcoord = pix2tex(rstart + dist); - vec3 tex = texture2D(sampler, transformedtexcoord).rgb; -#if 0 - // ATM we ignore custom opacity values because Fade effect fades out the - // window which results in the explosion being way too quick. Once there's - // a way to suppress Fade effect when ExplosionEffect is active, we can - // use the custom opacity again - gl_FragColor = vec4(tex, (1.0 - factor*factor) * alpha * opacity); -#else - gl_FragColor = vec4(tex, (1.0 - factor*factor) * alpha); -#endif -} - diff --git a/effects/explosion/explosion.cpp b/effects/explosion/explosion.cpp deleted file mode 100644 index 9976ec8bc2..0000000000 --- a/effects/explosion/explosion.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2007 Rivo Laks - -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 "explosion.h" - -#include -#include - -#include -#include - -#include -#include -#include - -#include - - -namespace KWin -{ - -KWIN_EFFECT(explosion, ExplosionEffect) -KWIN_EFFECT_SUPPORTED(explosion, ExplosionEffect::supported()) - -ExplosionEffect::ExplosionEffect() : Effect() -{ - mShader = 0; - mStartOffsetTex = 0; - mEndOffsetTex = 0; - - mActiveAnimations = 0; - mValid = true; - mInited = false; - connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*))); - connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*))); -} - -ExplosionEffect::~ExplosionEffect() -{ - delete mShader; - delete mStartOffsetTex; - delete mEndOffsetTex; -} - -bool ExplosionEffect::supported() -{ - return effects->compositingType() == OpenGL2Compositing; -} - -bool ExplosionEffect::loadData() -{ - mInited = true; - QString shadername("explosion"); - const QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/explosion.frag"); - QString starttexture = KGlobal::dirs()->findResource("data", "kwin/explosion-start.png"); - QString endtexture = KGlobal::dirs()->findResource("data", "kwin/explosion-end.png"); - if (starttexture.isEmpty() || endtexture.isEmpty()) { - kError(1212) << "Couldn't locate texture files" << endl; - return false; - } - - mShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader); - if (!mShader->isValid()) { - kError(1212) << "The shader failed to load!" << endl; - return false; - } else { - ShaderBinder binder(mShader); - mShader->setUniform("startOffsetTexture", 4); - mShader->setUniform("endOffsetTexture", 5); - } - - mStartOffsetTex = new GLTexture(starttexture); - mEndOffsetTex = new GLTexture(endtexture); - if (mStartOffsetTex->isNull() || mEndOffsetTex->isNull()) { - kError(1212) << "The textures failed to load!" << endl; - return false; - } else { - mStartOffsetTex->setFilter(GL_LINEAR); - mEndOffsetTex->setFilter(GL_LINEAR); - } - - return true; -} - -void ExplosionEffect::prePaintScreen(ScreenPrePaintData& data, int time) -{ - if (mActiveAnimations > 0) - // We need to mark the screen as transformed. Otherwise the whole screen - // won't be repainted, resulting in artefacts - data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS; - - effects->prePaintScreen(data, time); -} - -void ExplosionEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) -{ - if (mWindows.contains(w)) { - if (mValid) { - mWindows[ w ] += time / animationTime(700.0); // complete change in 700ms - if (mWindows[ w ] < 1) { - data.setTranslucent(); - data.setTransformed(); - w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE); - } else { - mWindows.remove(w); - w->unrefWindow(); - mActiveAnimations--; - } - } - } - - effects->prePaintWindow(w, data, time); -} - -void ExplosionEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) -{ - // Make sure we have OpenGL compositing and the window is vidible and not a - // special window - bool useshader = (mValid && mWindows.contains(w)); - if (useshader) { - double maxscaleadd = 1.5f; - double scale = 1 + maxscaleadd * mWindows[w]; - data.setXScale(scale); - data.setYScale(scale); - data.translate(int(w->width() / 2 * (1 - scale)), int(w->height() / 2 * (1 - scale))); - data.multiplyOpacity(0.99); // Force blending - ShaderManager *manager = ShaderManager::instance(); - GLShader *shader = manager->pushShader(ShaderManager::GenericShader); - QMatrix4x4 screenTransformation = shader->getUniformMatrix4x4("screenTransformation"); - manager->popShader(); - ShaderManager::instance()->pushShader(mShader); - mShader->setUniform("screenTransformation", screenTransformation); - mShader->setUniform("factor", (float)mWindows[w]); - mShader->setUniform("scale", (float)scale); - mShader->setUniform("windowSize", QVector2D(w->width(), w->height())); - glActiveTexture(GL_TEXTURE4); - mStartOffsetTex->bind(); - glActiveTexture(GL_TEXTURE5); - mEndOffsetTex->bind(); - glActiveTexture(GL_TEXTURE0); - data.shader = mShader; - } - - // Call the next effect. - effects->paintWindow(w, mask, region, data); - - if (useshader) { - ShaderManager::instance()->popShader(); - glActiveTexture(GL_TEXTURE4); - mStartOffsetTex->unbind(); - glActiveTexture(GL_TEXTURE5); - mEndOffsetTex->unbind(); - glActiveTexture(GL_TEXTURE0); - } -} - -void ExplosionEffect::postPaintScreen() -{ - if (mActiveAnimations > 0) - effects->addRepaintFull(); - - // Call the next effect. - effects->postPaintScreen(); -} - -void ExplosionEffect::slotWindowClosed(EffectWindow* c) -{ - const void* e = c->data(WindowClosedGrabRole).value(); - if (e && e != this) - return; - if (c->isOnCurrentDesktop() && !c->isMinimized()) { - if (mValid && !mInited) - mValid = loadData(); - if (!mValid) { - // don't add to list as we cannot animate this window; - return; - } - mWindows[ c ] = 0; // count up to 1 - c->addRepaintFull(); - c->refWindow(); - mActiveAnimations++; - } -} - -void ExplosionEffect::slotWindowDeleted(EffectWindow* c) -{ - mWindows.remove(c); -} - -bool ExplosionEffect::isActive() const -{ - return mActiveAnimations > 0; -} - -} // namespace - diff --git a/effects/explosion/explosion.desktop b/effects/explosion/explosion.desktop deleted file mode 100644 index c28589ee07..0000000000 --- a/effects/explosion/explosion.desktop +++ /dev/null @@ -1,167 +0,0 @@ -[Desktop Entry] -Name=Explosion -Name[af]=Ontploffing -Name[ar]=انفجار -Name[ast]=Españíu -Name[be@latin]=Vybuch -Name[bg]=Експлозия -Name[bn]=বিস্ফোরণ -Name[br]=Tarzhad -Name[bs]=Eksplozija -Name[ca]=Explosió -Name[ca@valencia]=Explosió -Name[cs]=Exploze -Name[csb]=Wëbùch -Name[da]=Eksplosion -Name[de]=Explosion -Name[el]=Έκρηξη -Name[en_GB]=Explosion -Name[eo]=Eksplodo -Name[es]=Explosión -Name[et]=Plahvatus -Name[eu]=Leherketa -Name[fa]=انفجار -Name[fi]=Räjähdys -Name[fr]=Explosion -Name[fy]=Ekplosy -Name[ga]=Explosion -Name[gl]=Explosión -Name[gu]=ધડાકો -Name[he]=התפוצצות -Name[hi]=विस्फोटक -Name[hne]=विस्फोटक -Name[hr]=Eksplozija -Name[hu]=Robbanás -Name[ia]=Explosion -Name[id]=Ledakan -Name[is]=Sprenging -Name[it]=Esplosione -Name[ja]=爆発 -Name[kk]=Жарылыс -Name[km]=ការផ្ទុះ -Name[kn]=ಸ್ಫೋಟ -Name[ko]=폭발 -Name[ku]=Teqîn -Name[lt]=Sprogimas -Name[lv]=Eksplozija -Name[mai]=विस्फोट -Name[mk]=Експлозија -Name[ml]=പൊട്ടിത്തെറി -Name[mr]=विस्फोटक -Name[nb]=Eksplosjon -Name[nds]=Exploschoon -Name[ne]=विष्पोटन -Name[nl]=Explosie -Name[nn]=Eksplosjon -Name[pa]=ਧਮਾਕਾ -Name[pl]=Wybuch -Name[pt]=Explosão -Name[pt_BR]=Explosão -Name[ro]=Explozie -Name[ru]=Взрыв -Name[se]=Eksplošuvdna -Name[si]=පිපිරුම -Name[sk]=Explózia -Name[sl]=Eksplozija -Name[sr]=Експлозија -Name[sr@ijekavian]=Експлозија -Name[sr@ijekavianlatin]=Eksplozija -Name[sr@latin]=Eksplozija -Name[sv]=Explosion -Name[ta]=வெடித்தல் -Name[te]=ఎక్‍స్ ప్లోజన్ -Name[tg]=Таркиш -Name[th]=ระเบิดออก -Name[tr]=Patlama -Name[ug]=پارتلاش شەكلى -Name[uk]=Вибух -Name[vi]=Nổ bung -Name[wa]=Esplôzaedje -Name[x-test]=xxExplosionxx -Name[zh_CN]=爆炸 -Name[zh_TW]=爆炸 -Icon=preferences-system-windows-effect-explosion -Comment=Make windows explode when they are closed -Comment[ar]=يفجّر النافذة عند إغلاقها -Comment[ast]=Fai que les ventanes españen al zarrales -Comment[be@latin]=Vokny začyniajucca z vybucham. -Comment[bg]=Създава ефект на експлозия при затваряне на прозорците -Comment[bs]=Prozor eksplodiraju kada se zatvore -Comment[ca]=Provoca l'explosió de les finestres quan es tanquen -Comment[ca@valencia]=Provoca l'explosió de les finestres quan es tanquen -Comment[cs]=Nechá okna explodovat, pokud jsou uzavřena -Comment[da]=Få vinduer til at eksplodere når de lukkes -Comment[de]=Lässt Fenster beim Schließen explodieren. -Comment[el]=Έκρηξη των παραθύρων κατά το κλείσιμό τους -Comment[en_GB]=Make windows explode when they are closed -Comment[eo]=Eksplodigas la fenestrojn dum ili fermiĝas -Comment[es]=Hace que las ventanas exploten al cerrarlas -Comment[et]=Paneb aknad sulgemisel plahvatama -Comment[eu]=Leihoak ixtean lehertzen ditu -Comment[fi]=Räjäyttää ikkunat suljettaessa -Comment[fr]=Fait exploser les fenêtres lorsqu'elle sont fermées -Comment[fy]=Lit finsters eksplodearje as se sluten wurde -Comment[ga]=Leis seo, pléascfaidh fuinneoga nuair a dhúntar iad -Comment[gl]=Estoupa as xanelas cando se pechan -Comment[gu]=જ્યારે વિન્ડો બંધ થાય છે ત્યારે તેમને ધડાકાભેર બંધ કરે છે -Comment[he]=מפוצץ חלונות בעת סגירתם -Comment[hi]=विंडो को विस्फोट से उड़ाएं जब उन्हें बंद किया जाए -Comment[hne]=विंडो ल विस्फोट से उड़ाथे जब ओ मन ह बंद होथे -Comment[hr]=Prozori eksplodiraju kad ih se zatvori -Comment[hu]=Bezáráskor az ablakok "felrobbannak" -Comment[ia]=Face que fenestras explode quando los es claudite -Comment[id]=Buat jendela meledak ketika jendela ditutup -Comment[is]=Lætur glugga springa í tætlur þegar þeim er lokað -Comment[it]=Fai esplodere le finestre alla chiusura -Comment[ja]=ウィンドウを閉じるときに爆発させます -Comment[kk]=Жабылатын терезе жарылып кетіріледі -Comment[km]=ធ្វើ​ឲ្យ​បង្អួច​ផុស​ចេញ​ពេល​បិទ​ពួក​វា​ -Comment[kn]=ಕಿಟಕಿಗಳನ್ನು ಮುಚ್ಚಿದಾಗ ಅವು ಸಿಡಿಯುವಂತೆ ಮಾಡುತ್ತದೆ -Comment[ko]=창이 닫힐 때 폭발시킵니다 -Comment[lt]=Išsprogdina langus juos užveriant -Comment[lv]=Liek logiem eksplodēt, kad tos aizver -Comment[mk]=Прави прозорците да експлодираат кога се затвораат -Comment[ml]=അടയ്ക്കുമ്പോള്‍ ജാലകങ്ങള്‍ പൊട്ടിത്തെറിയ്ക്കുന്നു. -Comment[mr]=चौकटी बंद केल्यावर त्यांचा विस्फोट करा -Comment[nb]=Gjør at vinduer som lukkes, eksploderer -Comment[nds]=Finstern bi't Tomaken exploderen laten -Comment[nl]=Laat vensters uit elkaar spatten als ze worden gesloten -Comment[nn]=Eksploderer vindauge når dei vert lukka -Comment[pa]=ਜਦੋਂ ਵਿੰਡੋ ਬੰਦ ਕੀਤੀਆਂ ਜਾਣ ਤਾਂ ਧਮਾਕੇ ਨਾਲ ਕਰੋ -Comment[pl]=Wybuchanie okien przy ich zamykaniu -Comment[pt]=Fazer as janelas explodir ao serem fechadas -Comment[pt_BR]=Faz as janelas explodirem quando são fechadas -Comment[ro]=Face ferestrele să explodeze cînd sînt închise -Comment[ru]=Эффект взрыва окна при его закрытии -Comment[si]=කවුළු වැසූ විට ඒවා පුපුරුවන්න -Comment[sk]=Okná explodujú pri zatvorení -Comment[sl]=Ko se okna zaprejo, eksplodirajo -Comment[sr]=Прозор експлодирају када се затворе -Comment[sr@ijekavian]=Прозор експлодирају када се затворе -Comment[sr@ijekavianlatin]=Prozor eksplodiraju kada se zatvore -Comment[sr@latin]=Prozor eksplodiraju kada se zatvore -Comment[sv]=Gör att fönster exploderar när de stängs -Comment[ta]=Make windows explode when they are closed -Comment[th]=ทำให้หน้าต่างระเบิดออก เมื่อปิดหน้าต่าง -Comment[tr]=Kapatılırken pencerelere patlama efekti ver -Comment[ug]=كۆزنەك يېپىلغاندا پارتلاش ئۈنۈمىنى كۆرسەت -Comment[uk]=Вибух вікон після закриття -Comment[vi]=Làm cửa sổ nổ bung khi chúng được đóng -Comment[wa]=Fé peter les fniesses cwand ele sont cloyowes -Comment[x-test]=xxMake windows explode when they are closedxx -Comment[zh_CN]=当窗口被关闭时,使其呈现爆炸效果 -Comment[zh_TW]=視窗關閉時讓視窗「爆炸」 - -Type=Service -X-KDE-ServiceTypes=KWin/Effect -X-KDE-PluginInfo-Author=Rivo Laks -X-KDE-PluginInfo-Email=rivolaks@hot.ee -X-KDE-PluginInfo-Name=kwin4_effect_explosion -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=false -X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=70 -X-KWin-Requires-OpenGL2=true diff --git a/effects/explosion/explosion.h b/effects/explosion/explosion.h deleted file mode 100644 index 2528e8d3fd..0000000000 --- a/effects/explosion/explosion.h +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2007 Rivo Laks - -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_EXPLOSIONEFFECT_H -#define KWIN_EXPLOSIONEFFECT_H - -// Include with base class for effects. -#include - -#include - -namespace KWin -{ - -class GLShader; -class GLTexture; - -/** - * Makes windows explode into small pieces when they're closed - **/ -class ExplosionEffect - : public Effect -{ - Q_OBJECT -public: - ExplosionEffect(); - ~ExplosionEffect(); - - virtual void prePaintScreen(ScreenPrePaintData& data, int time); - virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time); - virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); - virtual void postPaintScreen(); - virtual bool isActive() const; - - static bool supported(); - -public Q_SLOTS: - void slotWindowClosed(KWin::EffectWindow *c); - void slotWindowDeleted(KWin::EffectWindow *w); - -protected: - bool loadData(); - -private: - GLShader* mShader; - GLTexture* mStartOffsetTex; - GLTexture* mEndOffsetTex; - QMap< const EffectWindow*, double > mWindows; - int mActiveAnimations; - bool mValid; - bool mInited; -}; - -} // namespace - -#endif