All pastes #899246 Raw Edit

Diff to add wobbly windows to th

public diff v1 · immutable
·published 2008-02-11 00:12 UTC
rendered paste body
diff --git a/kde-base/kdebase/Manifest b/kde-base/kdebase/Manifestindex 6ad54ed..e3095da 100644--- a/kde-base/kdebase/Manifest+++ b/kde-base/kdebase/Manifest@@ -1,17 +1,8 @@------BEGIN PGP SIGNED MESSAGE------Hash: SHA1- AUX agent-shutdown.sh 320 RMD160 aca937be56a69b274c0756eca91456e00a91442b SHA1 65ce34500d82b2de0168b38058c9b198913d6a21 SHA256 1e53f9fc9155b38d8bb0ac36c8564898dbabc33f9ecaca933216a0ace4e30b33 AUX agent-startup.sh 550 RMD160 62b38cdc14970db4f8ae09c90d7bc2a388255301 SHA1 86efb56cb6c746fe069e964f5e2e3f521d782a0a SHA256 f43a591922dd5a2649cad7b3d42827ee56aa21c09564e5eebb0cf7fa2eeb5fc4 AUX gentoo-startkde.patch 2222 RMD160 7646dd205263f4e52cfbc963eaabb26208eb59c1 SHA1 b6d84cb5677061a76b3248a90335d7fc1b49cbb0 SHA256 06926741de14219d9ca8721ef742c585a7c2e38c18964554ca7302c9b2ef5d99 AUX kdebase-9999.4-pam-optional.patch 979 RMD160 abdb7293c02507dfd0a032e72f3e449405b6d8a0 SHA1 33e2f936f0548f9b19fe541c0f71db06f9daaf63 SHA256 efa4e0132687dbaa68ab5c8a5911c4a08b5d4e9eb4d2a04879f765b8e44ba9ea-EBUILD kdebase-9999.4.ebuild 8774 RMD160 9151d03eaf8383a06eba090d1428a5a11459a321 SHA1 110a4bd4c77e38841425d44cd4f677f82898e819 SHA256 20f44bf651e0f8c98d3614a5a25461a08bf789e69f4389afd96c367d172099bd+AUX kwin-wobblywindows.patch 34362 RMD160 01f2d03b7e462e3b80e55d9c134c9a17d9195bcb SHA1 e6cbe484b9afc9ba0b4e16418a2985c55d3dc775 SHA256 74f78f212ad6b4bb0bf97bfef66ed518009c14df00108875bdc72c62e2414ca9+EBUILD kdebase-9999.4.ebuild 8812 RMD160 a0e9c9952db510b726114503a2781fa8c7c6023a SHA1 b44817b7cd80393d7c5c9a8ed62d49c47318540a SHA256 3da9c3acb8f83797bfe5efd3d309fcfc83fcb2db495e2896873b2f6a8a420454 MISC ChangeLog 7903 RMD160 563d75ce5c6fa7f08974c2109176f954b0b721d1 SHA1 4aa27ff5595cc7025414eb107bf1720425686dc7 SHA256 46ba224190b224cb87f0813fcf26d7171cb61999153f2d0fad1982ec1df56ceb MISC metadata.xml 156 RMD160 ecce3b981f150c45ae1e84e2d208e678d6124259 SHA1 b64f7c0b4e5db816d82ad19848f72118af129d35 SHA256 2f4da28506b9d4185f320f67a6191d30c7a921217ed4447ed46ea0bc4aefc79a------BEGIN PGP SIGNATURE------Version: GnuPG v2.0.7 (GNU/Linux)--iD8DBQFHpi99fxJ68Jl1NeERApOVAKC2/PITr5f/GmnXakrgeA5zAM4XyQCdHr7O-Ht3wKHYCTyy2ftOSqD4PJyU=-=eZZK------END PGP SIGNATURE-----diff --git a/kde-base/kdebase/files/kwin-wobblywindows.patch b/kde-base/kdebase/files/kwin-wobblywindows.patchnew file mode 100644index 0000000..b186d00--- /dev/null+++ b/kde-base/kdebase/files/kwin-wobblywindows.patch@@ -0,0 +1,1153 @@+--- a/kdebase/workspace/kwin/effects/test/CMakeLists.txt	2008-02-10 23:51:00.000000000 +0000++++ b/kdebase/workspace/kwin/effects/test/CMakeLists.txt	2008-02-10 17:12:00.000000000 +0000+@@ -42,13 +42,15 @@+         demo_liquid.cpp+         demo_showpicture.cpp+         demo_wavywindows.cpp+-        test_fbo.cpp++        demo_wobblywindows.cpp++	test_fbo.cpp+         )+ +     install( FILES+         demo_liquid.desktop+         demo_showpicture.desktop+         demo_wavywindows.desktop++	demo_wobblywindows.desktop+         test_fbo.desktop+         DESTINATION ${SERVICES_INSTALL_DIR}/kwin )+ +--- a/kdebase/workspace/kwin/effects/test/demo_wobblywindows.cpp	1970-01-01 01:00:00.000000000 +0100++++ b/kdebase/workspace/kwin/effects/test/demo_wobblywindows.cpp	2008-02-10 16:51:19.000000000 +0000+@@ -0,0 +1,987 @@++/*****************************************************************++ KWin - the KDE window manager++ This file is part of the KDE project.++++Copyright (C) 2007++++You can Freely distribute this program under the GNU General Public++License. See the file "COPYING" for the exact licensing terms.++******************************************************************/++++++#include "demo_wobblywindows.h"++++#include <kdebug.h>++#include <math.h>++++++namespace KWin++{++++KWIN_EFFECT(demo_wobblywindows, WobblyWindowsEffect)++++WobblyWindowsEffect::WobblyWindowsEffect()++{++    raideur = 0.5;++    velocityThreshold = 0.5;++    accelerationThreshold = 0.1;++    amortissement = 0.93;++    move_factor = 0.01;++++    xTesselation = 20.0;++    yTesselation = 20.0;++++    squareRootMasterAcceleration = false;++++    velFilter = FourRingLinearMean;++    accFilter = NoFilter; //FourRingLinearMean;++}++++WobblyWindowsEffect::~WobblyWindowsEffect()++{++    if (windows.empty())++    {++        // we should be empty at this point...++        // emit a warning and clean the list.++        kDebug() << "Windows list not empty. Left items : " << windows.count();++        QHash< const EffectWindow*,  WindowWobblyInfos >::iterator i;++        for (i = windows.begin(); i != windows.end(); ++i)++        {++            freeWobblyInfo(i.value());++        }++    }++}++void WobblyWindowsEffect::setVelocityThreshold(qreal velocityThreshold)++{++    this->velocityThreshold = velocityThreshold;++}++++void WobblyWindowsEffect::setMoveFactor(qreal factor)++{++    move_factor = factor;++}++++void WobblyWindowsEffect::setRaideur(qreal raideur)++{++    this->raideur = raideur;++}++++void WobblyWindowsEffect::setVelocityFilter(GridFilter filter)++{++    velFilter = filter;++}++++void WobblyWindowsEffect::setAccelerationFilter(GridFilter filter)++{++    accFilter = filter;++}++++WobblyWindowsEffect::GridFilter WobblyWindowsEffect::velocityFilter() const++{++    return velFilter;++}++++WobblyWindowsEffect::GridFilter WobblyWindowsEffect::accelerationFilter() const++{++    return accFilter;++}++++void WobblyWindowsEffect::setAmortissement(qreal amortissement)++{++    this->amortissement = amortissement;++}++++void WobblyWindowsEffect::prePaintScreen(ScreenPrePaintData& data, int time)++{++    // We need to mark the screen windows as transformed. Otherwise the whole++    // screen won't be repainted, resulting in artefacts.++    // Could we just set a subset of the screen to be repainted ?++    if (windows.count() != 0)++    {++        data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;++    }++++    effects->prePaintScreen(data, time);++}++const qreal maxTime = 10.0;++void WobblyWindowsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time)++{++    if (windows.contains(w))++    {++        data.setTransformed();++        data.quads = data.quads.makeGrid((xTesselation>yTesselation) ?++                                        (w->geometry().width() / xTesselation) :++                                        (w->geometry().height() / yTesselation));++        bool stop = false;++        qreal updateTime = time;++        //kDebug() << "time " << updateTime;++        while (!stop && (updateTime > maxTime))++        {++            // ouch, I get a deadlock with this debug enabled++            //kDebug() << "loop time " << updateTime << " " << time;++            stop = !updateWindowWobblyDatas(w, maxTime);++            updateTime -= maxTime;++        }++        if (!stop && updateTime > 0)++        {++            updateWindowWobblyDatas(w, updateTime);++        }++    }++++    effects->prePaintWindow(w, data, time);++}++++void WobblyWindowsEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)++{++    if(windows.contains(w))++    {++        WindowWobblyInfos& wwi = windows[w];++        int tx = w->geometry().x();++        int ty = w->geometry().y();++        for (int i = 0; i < data.quads.count(); ++i)++        {++            for(int j = 0; j < 4; ++j)++            {++                WindowVertex& v = data.quads[i][j];++                Pair oldPos = {tx + v.x(), ty + v.y()};++                Pair newPos = computeBezierPoint(wwi, oldPos);++                v.move(newPos.x - tx, newPos.y - ty);++            }++        }++    }++++    // Call the next effect.++    effects->paintWindow(w, mask, region, data);++}++++void WobblyWindowsEffect::postPaintScreen()++{++    if (!windows.isEmpty())++    {++        // Repaint the workspace so that everything would be repainted next time++        effects->addRepaintFull();++    }++++    // Call the next effect.++    effects->postPaintScreen();++}++++void WobblyWindowsEffect::windowUserMovedResized(EffectWindow* w, bool first, bool last)++{++    if (first && !w->isSpecialWindow())++    {++        if (!windows.contains(w))++        {++            WindowWobblyInfos new_wwi;++            initWobblyInfo(new_wwi, w->geometry());++            windows[w] = new_wwi;++        }++++        WindowWobblyInfos& wwi = windows[w];++        wwi.onConstrain = true;++        const QRectF& rect = w->geometry();++++        qreal x_increment = rect.width() / (wwi.width-1.0);++        qreal y_increment = rect.height() / (wwi.height-1.0);++++        Pair picked = {cursorPos().x(), cursorPos().y()};++        //{ rect.x() + (rect.width()/2.0), rect.y() + (rect.height()/10.0) }; // TODO: use real picked point.++        int indx = (picked.x - rect.x()) / x_increment;++        int indy = (picked.y - rect.y()) / y_increment;++        wwi.mPickedPointIndex = indy*wwi.width + indx;++        if (wwi.mPickedPointIndex < 0)++        {++            kDebug() << "Picked index == " << wwi.mPickedPointIndex << " with (" << cursorPos().x() << "," << cursorPos().y() << ")";++            wwi.mPickedPointIndex = 0;++        }++        else if (static_cast<unsigned int>(wwi.mPickedPointIndex) > wwi.count - 1)++        {++            kDebug() << "Picked index == " << wwi.mPickedPointIndex << " with (" << cursorPos().x() << "," << cursorPos().y() << ")";++            wwi.mPickedPointIndex = wwi.count - 1;++        }++        //kDebug() << "Original Picked point -- x : " << picked.x << " - y : " << picked.y;++        wwi.mPickedPointTranslation.x = wwi.position[wwi.mPickedPointIndex].x - picked.x;++        wwi.mPickedPointTranslation.y = wwi.position[wwi.mPickedPointIndex].y - picked.y;++    }++    else if (last)++    {++        if (windows.contains(w))++        {++            WindowWobblyInfos& wwi = windows[w];++            wwi.onConstrain = false;++            wwi.mDestination.x = cursorPos().x();++            wwi.mDestination.y = cursorPos().y();++        }++    }++}++++void WobblyWindowsEffect::windowClosed(EffectWindow* w)++{++    if(windows.contains(w))++    {++        WindowWobblyInfos& wwi = windows[w];++        freeWobblyInfo(wwi);++        windows.remove(w);++    }++}++++void WobblyWindowsEffect::initWobblyInfo(WindowWobblyInfos& wwi, QRect geometry) const++{++    wwi.count = 4*4;++    wwi.width = 4;++    wwi.height = 4;++++    wwi.bezierWidth = xTesselation;++    wwi.bezierHeight = yTesselation;++    wwi.bezierCount = xTesselation * yTesselation;++++    wwi.origin = new Pair[wwi.count];++    wwi.position = new Pair[wwi.count];++    wwi.velocity = new Pair[wwi.count];++    wwi.acceleration = new Pair[wwi.count];++    wwi.buffer = new Pair[wwi.count];++    wwi.bezierSurface = new Pair[wwi.bezierCount];++++    wwi.onConstrain = true;++++    qreal x = geometry.x(), y = geometry.y();++    qreal width = geometry.width(), height = geometry.height();++++    Pair initValue = {x, y};++    static const Pair nullPair = {0.0, 0.0};++++    qreal x_increment = width / (wwi.width-1.0);++    qreal y_increment = height / (wwi.height-1.0);++++    for (unsigned int j=0; j<4; ++j)++    {++        for (unsigned int i=0; i<4; ++i)++        {++            unsigned int idx = j*4 + i;++            wwi.origin[idx] = initValue;++            wwi.position[idx] = initValue;++            wwi.velocity[idx] = nullPair;++            if (i != 4-2) // x grid count - 2, i.e. not the last point++            {++                initValue.x += x_increment;++            }++            else++            {++                initValue.x = width + x;++            }++            initValue.x = initValue.x;++        }++        initValue.x = x;++        initValue.x = initValue.x;++        if (j != 4-2) // y grid count - 2, i.e. not the last point++        {++            initValue.y += y_increment;++        }++        else++        {++            initValue.y = height + y;++        }++        initValue.y = initValue.y;++    }++}++++void WobblyWindowsEffect::freeWobblyInfo(WindowWobblyInfos& wwi) const++{++    delete wwi.origin;++    delete wwi.position;++    delete wwi.velocity;++    delete wwi.acceleration;++    delete wwi.buffer;++++    delete wwi.bezierSurface;++}++++#define USE_ASSERT++++#ifdef USE_ASSERT++#define ASSERT1 assert++#else++#define ASSERT1++#endif++++WobblyWindowsEffect::Pair WobblyWindowsEffect::computeBezierPoint(const WindowWobblyInfos& wwi, Pair point) const++{++    // compute the input value++    Pair topleft = wwi.origin[0];++    Pair bottomright = wwi.origin[wwi.count-1];++++    ASSERT1(point.x >= topleft.x);++    ASSERT1(point.y >= topleft.y);++    ASSERT1(point.x <= bottomright.x);++    ASSERT1(point.y <= bottomright.y);++++    qreal tx = (point.x - topleft.x) / (bottomright.x - topleft.x);++    qreal ty = (point.y - topleft.y) / (bottomright.y - topleft.y);++++    ASSERT1(tx >= 0);++    ASSERT1(tx <= 1);++    ASSERT1(ty >= 0);++    ASSERT1(ty <= 1);++++    // compute polinomial coeff++++    qreal px[4];++    px[0] = (1-tx)*(1-tx)*(1-tx);++    px[1] = 3*(1-tx)*(1-tx)*tx;++    px[2] = 3*(1-tx)*tx*tx;++    px[3] = tx*tx*tx;++++    qreal py[4];++    py[0] = (1-ty)*(1-ty)*(1-ty);++    py[1] = 3*(1-ty)*(1-ty)*ty;++    py[2] = 3*(1-ty)*ty*ty;++    py[3] = ty*ty*ty;++++    Pair res = {0.0, 0.0};++++    for (unsigned int j = 0; j < 4; ++j)++    {++        for (unsigned int i = 0; i < 4; ++i)++        {++            // this assume the grid is 4*4++            res.x += px[i] * py[j] * wwi.position[i + j * wwi.width].x;++            res.y += px[i] * py[j] * wwi.position[i + j * wwi.width].y;++        }++    }++++    return res;++}++++bool WobblyWindowsEffect::updateWindowWobblyDatas(EffectWindow* w, qreal time)++{++    // it is safer for now, I need to find safe constraints on the model's++    // parameters to ensure it doesn't diverge with too high time steps++    //kDebug() << "Time elapsed : " << mTimeElapsed;++    //mTimeElapsed = 1;++++    const QRectF& rect = w->geometry();++    WindowWobblyInfos& wwi = windows[w];++++    qreal x_length = rect.width() / (wwi.width-1.0);++    qreal y_length = rect.height() / (wwi.height-1.0);++++    Pair picked;++    if (wwi.onConstrain)++    {++        picked.x = cursorPos().x();++        picked.y = cursorPos().y();++    }++    else++    {++        picked = wwi.mDestination;++    }++++    Pair pickedTranslation = wwi.mPickedPointTranslation;++    picked.x += pickedTranslation.x;++    picked.y += pickedTranslation.y;++    Pair on_grid_picked = wwi.position[wwi.mPickedPointIndex];++    Pair move = {picked.x - on_grid_picked.x, picked.y - on_grid_picked.y};++++    //kDebug() << "Picked point -- x : " << picked.x << " - y : " << picked.y;++    //kDebug() << "On grid point -- x : " << on_grid_picked.x << " - y : " << on_grid_picked.y;++    //kDebug() << "Move -- x : " << move.x << " - y : " << move.y;++++    //kDebug() << "time " << time;++    Pair origine = {rect.x(), rect.y()};++++    //std::cout << "increment x " << x_length << " // y" <<  y_length << std::endl;++    for (unsigned int j=0; j<wwi.height; ++j)++    {++        for (unsigned int i=0; i<wwi.width; ++i)++        {++            wwi.origin[wwi.width*j + i] = origine;++            if (i != wwi.width-2)++            {++                origine.x += x_length;++            }++            else++            {++                origine.x = rect.width() + rect.x();++            }++         }++        //std::cout << "valur for " << j << " : " <<  origine.y << std::endl;++        origine.x = rect.x();++        if (j != wwi.height-2)++        {++            origine.y += y_length;++        }++        else++        {++            origine.y = rect.height() + rect.y();++        }++    }++++++    Pair acc = {move.x*raideur, move.y*raideur};++    if (squareRootMasterAcceleration)++    {++        if (acc.x < 0.0)++        {++            acc.x = -sqrt(-acc.x);++        }++        else++        {++            acc.x = sqrt(acc.x);++        }++++        if (acc.y < 0.0)++        {++            acc.y = -sqrt(-acc.y);++        }++        else++        {++            acc.y = sqrt(acc.y);++        }++    }++    //kDebug() << "Master acceleration -- x : " << acc.x << " - y : " << acc.y;++++    unsigned int fixedIndex = wwi.mPickedPointIndex;++    Pair neibourgs[4];++    Pair acceleration;++++    qreal acc_sum = 0.0;++    qreal vel_sum = 0.0;++++    // compute acceleration, velocity and position for each point++++    // for corners++++    // top-left++++    // acceleration is acc++    if (fixedIndex == 0)++    {++        wwi.acceleration[0] = acc;++    }++    else++    {++        Pair& pos = wwi.position[0];++        neibourgs[0] = wwi.position[1];++        neibourgs[1] = wwi.position[wwi.width];++++        acceleration.x = ((neibourgs[0].x - pos.x) - x_length)*raideur + (neibourgs[1].x - pos.x)*raideur;++        acceleration.y = ((neibourgs[1].y - pos.y) - y_length)*raideur + (neibourgs[0].y - pos.y)*raideur;++++        acceleration.x /= 2;++        acceleration.y /= 2;++++        wwi.acceleration[0] = acceleration;++    }++++    // top-right++++    // acceleration is acc++    if (fixedIndex == wwi.width-1)++    {++        wwi.acceleration[wwi.width-1] = acc;++    }++    else++    {++        Pair& pos = wwi.position[wwi.width-1];++        neibourgs[0] = wwi.position[wwi.width-2];++        neibourgs[1] = wwi.position[2*wwi.width-1];++++        acceleration.x = (x_length - (pos.x - neibourgs[0].x))*raideur + (neibourgs[1].x - pos.x)*raideur;++        acceleration.y = ((neibourgs[1].y - pos.y) - y_length)*raideur + (neibourgs[0].y - pos.y)*raideur;++++        acceleration.x /= 2;++        acceleration.y /= 2;++++        wwi.acceleration[wwi.width-1] = acceleration;++    }++++    // bottom-left++++    // acceleration is acc++    if (fixedIndex == wwi.width*(wwi.height-1))++    {++        wwi.acceleration[wwi.width*(wwi.height-1)] = acc;++    }++    else++    {++        Pair& pos = wwi.position[wwi.width*(wwi.height-1)];++        neibourgs[0] = wwi.position[wwi.width*(wwi.height-1)+1];++        neibourgs[1] = wwi.position[wwi.width*(wwi.height-2)];++++        acceleration.x = ((neibourgs[0].x - pos.x) - x_length)*raideur + (neibourgs[1].x - pos.x)*raideur;++        acceleration.y = (y_length - (pos.y - neibourgs[1].y))*raideur + (neibourgs[0].y - pos.y)*raideur;++++        acceleration.x /= 2;++        acceleration.y /= 2;++++        wwi.acceleration[wwi.width*(wwi.height-1)] = acceleration;++    }++++    // bottom-right++++    // acceleration is acc++    if (fixedIndex == wwi.count-1)++    {++        wwi.acceleration[wwi.count-1] = acc;++    }++    else++    {++        Pair& pos = wwi.position[wwi.count-1];++        neibourgs[0] = wwi.position[wwi.count-2];++        neibourgs[1] = wwi.position[wwi.width*(wwi.height-1)-1];++++        acceleration.x = (x_length - (pos.x - neibourgs[0].x))*raideur + (neibourgs[1].x - pos.x)*raideur;++        acceleration.y = (y_length - (pos.y - neibourgs[1].y))*raideur + (neibourgs[0].y - pos.y)*raideur;++++        acceleration.x /= 2;++        acceleration.y /= 2;++++        wwi.acceleration[wwi.count-1] = acceleration;++    }++++++    // for borders++++    // top border++    for (unsigned int i=1; i<wwi.width-1; ++i)++    {++        // acceleration is acc++        if (fixedIndex == i)++        {++            wwi.acceleration[i] = acc;++        }++        else++        {++            Pair& pos = wwi.position[i];++            neibourgs[0] = wwi.position[i-1];++            neibourgs[1] = wwi.position[i+1];++            neibourgs[2] = wwi.position[i+wwi.width];++++            acceleration.x = (x_length - (pos.x - neibourgs[0].x))*raideur + ((neibourgs[1].x - pos.x) - x_length)*raideur + (neibourgs[2].x - pos.x)*raideur;++            acceleration.y = ((neibourgs[2].y - pos.y) - y_length)*raideur + (neibourgs[0].y - pos.y)*raideur + (neibourgs[1].y - pos.y)*raideur;++++            acceleration.x /= 3;++            acceleration.y /= 3;++++            wwi.acceleration[i] = acceleration;++        }++    }++++    // bottom border++    for (unsigned int i=wwi.width*(wwi.height-1)+1; i<wwi.count-1; ++i)++    {++        // acceleration is acc++        if (fixedIndex == i)++        {++            wwi.acceleration[i] = acc;++        }++        else++        {++            Pair& pos = wwi.position[i];++            neibourgs[0] = wwi.position[i-1];++            neibourgs[1] = wwi.position[i+1];++            neibourgs[2] = wwi.position[i-wwi.width];++++            acceleration.x = (x_length - (pos.x - neibourgs[0].x))*raideur + ((neibourgs[1].x - pos.x) - x_length)*raideur + (neibourgs[2].x - pos.x)*raideur;++            acceleration.y = (y_length - (pos.y - neibourgs[2].y))*raideur + (neibourgs[0].y - pos.y)*raideur + (neibourgs[1].y - pos.y)*raideur;++++            acceleration.x /= 3;++            acceleration.y /= 3;++++            wwi.acceleration[i] = acceleration;++        }++    }++++    // left border++    for (unsigned int i=wwi.width; i<wwi.width*(wwi.height-1); i+=wwi.width)++    {++        // acceleration is acc++        if (fixedIndex == i)++        {++            wwi.acceleration[i] = acc;++        }++        else++        {++            Pair& pos = wwi.position[i];++            neibourgs[0] = wwi.position[i+1];++            neibourgs[1] = wwi.position[i-wwi.width];++            neibourgs[2] = wwi.position[i+wwi.width];++++            acceleration.x = ((neibourgs[0].x - pos.x) - x_length)*raideur + (neibourgs[1].x - pos.x)*raideur + (neibourgs[2].x - pos.x)*raideur;++            acceleration.y = (y_length - (pos.y - neibourgs[1].y))*raideur + ((neibourgs[2].y - pos.y) - y_length)*raideur + (neibourgs[0].y - pos.y)*raideur;++++            acceleration.x /= 3;++            acceleration.y /= 3;++++            wwi.acceleration[i] = acceleration;++        }++    }++++    // right border++    for (unsigned int i=2*wwi.width-1; i<wwi.count-1; i+=wwi.width)++    {++        // acceleration is acc++        if (fixedIndex == i)++        {++            wwi.acceleration[i] = acc;++        }++        else++        {++            Pair& pos = wwi.position[i];++            neibourgs[0] = wwi.position[i-1];++            neibourgs[1] = wwi.position[i-wwi.width];++            neibourgs[2] = wwi.position[i+wwi.width];++++            acceleration.x = (x_length - (pos.x - neibourgs[0].x))*raideur + (neibourgs[1].x - pos.x)*raideur + (neibourgs[2].x - pos.x)*raideur;++            acceleration.y = (y_length - (pos.y - neibourgs[1].y))*raideur + ((neibourgs[2].y - pos.y) - y_length)*raideur + (neibourgs[0].y - pos.y)*raideur;++++            acceleration.x /= 3;++            acceleration.y /= 3;++++            wwi.acceleration[i] = acceleration;++        }++    }++++    // for the inner points++    for (unsigned int j=1; j<wwi.height-1; ++j)++    {++        for (unsigned int i=1; i<wwi.width-1; ++i)++        {++            unsigned int index = i+j*wwi.width;++++            // acceleration is acc++            if (fixedIndex == index)++            {++                wwi.acceleration[index] = acc;++            }++            else++            {++                Pair& pos = wwi.position[index];++                neibourgs[0] = wwi.position[index-1];++                neibourgs[1] = wwi.position[index+1];++                neibourgs[2] = wwi.position[index-wwi.width];++                neibourgs[3] = wwi.position[index+wwi.width];++++                acceleration.x = ((neibourgs[0].x - pos.x) - x_length)*raideur +++                                 (x_length - (pos.x - neibourgs[1].x))*raideur +++                                 (neibourgs[2].x - pos.x)*raideur +++                                 (neibourgs[3].x - pos.x)*raideur;++                acceleration.y = (y_length - (pos.y - neibourgs[2].y))*raideur +++                                 ((neibourgs[3].y - pos.y) - y_length)*raideur +++                                 (neibourgs[0].y - pos.y)*raideur +++                                 (neibourgs[1].y - pos.y)*raideur;++++                acceleration.x /= 4;++                acceleration.y /= 4;++++                wwi.acceleration[index] = acceleration;++            }++        }++    }++++    switch (accFilter)++    {++    case NoFilter:++        break;++++    case FourRingLinearMean:++        fourRingLinearMean(&wwi.acceleration, wwi);++        break;++++    case MeanWithMean:++        meanWithMean(&wwi.acceleration, wwi);++        break;++++    case MeanWithMedian:++        meanWithMedian(&wwi.acceleration, wwi);++        break;++++    default:++        ASSERT1(false);++    }++++++    // compute the new velocity of each vertex.++    for (unsigned int i = 0; i < wwi.count; ++i)++    {++        Pair acc = wwi.acceleration[i];++        if (fabs(acc.x) < accelerationThreshold)++        {++            acc.x = 0;++        }++        if (fabs(acc.y) < accelerationThreshold)++        {++            acc.y = 0;++        }++++        Pair& vel = wwi.velocity[i];++        float vit;++        vit = acc.x*time + vel.x*amortissement;++        if (fabs(vit) < velocityThreshold)++        {++            vit = 0.0;++        }++        vel.x = vit;++++        vit = acc.y*time + vel.y*amortissement;++        if (fabs(vit) < velocityThreshold)++        {++            vit = 0.0;++        }++        vel.y = vit;++++        acc_sum += fabs(acc.x) + fabs(acc.y);++    }++++++    switch (velFilter)++    {++    case NoFilter:++        break;++++    case FourRingLinearMean:++        fourRingLinearMean(&wwi.velocity, wwi);++        break;++++    case MeanWithMean:++        meanWithMean(&wwi.velocity, wwi);++        break;++++    case MeanWithMedian:++        meanWithMedian(&wwi.velocity, wwi);++        break;++++    default:++        ASSERT1(false);++    }++++    // compute the new pos of each vertex.++    for (unsigned int i = 0; i < wwi.count; ++i)++    {++        Pair& pos = wwi.position[i];++        Pair& vel = wwi.velocity[i];++++        pos.x += vel.x*time*move_factor;++        pos.y += vel.y*time*move_factor;++++        vel_sum += fabs(vel.x) + fabs(vel.y);++++#if 0++        if (fixedIndex == i)++        {++            kDebug() << "Fixed item ** vel : " << vel.x << "," << vel.y << " ** move : " << vel.x*time << "," << vel.y*time;++        }++#endif++    }++++    //kDebug() << "acc : " << acc_sum << "  ***  vel :" << vel_sum;++    if (!wwi.onConstrain && acc_sum < 10.0 && vel_sum < 5.0)++    {++        freeWobblyInfo(wwi);++        windows.remove(w);++        return false;++    }++    return true;++}++++void WobblyWindowsEffect::fourRingLinearMean(Pair** datas_pointer, WindowWobblyInfos& wwi)++{++    Pair* datas = *datas_pointer;++    Pair neibourgs[4];++++    // for corners++++    // top-left++    {++        Pair& res = wwi.buffer[0];++        Pair vit = datas[0];++        neibourgs[0] = datas[1];++        neibourgs[1] = datas[wwi.width];++++        res.x = (neibourgs[0].x + neibourgs[1].x + 2.0*vit.x) / 4.0;++        res.y = (neibourgs[0].y + neibourgs[1].y + 2.0*vit.y) / 4.0;++    }++++++    // top-right++    {++        Pair& res = wwi.buffer[wwi.width-1];++        Pair vit = datas[wwi.width-1];++        neibourgs[0] = datas[wwi.width-2];++        neibourgs[1] = datas[2*wwi.width-1];++++        res.x = (neibourgs[0].x + neibourgs[1].x + 2.0*vit.x) / 4.0;++        res.y = (neibourgs[0].y + neibourgs[1].y + 2.0*vit.y) / 4.0;++    }++++++    // bottom-left++    {++        Pair& res = wwi.buffer[wwi.width*(wwi.height-1)];++        Pair vit = datas[wwi.width*(wwi.height-1)];++        neibourgs[0] = datas[wwi.width*(wwi.height-1)+1];++        neibourgs[1] = datas[wwi.width*(wwi.height-2)];++++        res.x = (neibourgs[0].x + neibourgs[1].x + 2.0*vit.x) / 4.0;++        res.y = (neibourgs[0].y + neibourgs[1].y + 2.0*vit.y) / 4.0;++    }++++++    // bottom-right++    {++        Pair& res = wwi.buffer[wwi.count-1];++        Pair vit = datas[wwi.count-1];++        neibourgs[0] = datas[wwi.count-2];++        neibourgs[1] = datas[wwi.width*(wwi.height-1)-1];++++        res.x = (neibourgs[0].x + neibourgs[1].x + 2.0*vit.x) / 4.0;++        res.y = (neibourgs[0].y + neibourgs[1].y + 2.0*vit.y) / 4.0;++    }++++++    // for borders++++    // top border++    for (unsigned int i=1; i<wwi.width-1; ++i)++    {++        Pair& res = wwi.buffer[i];++        Pair vit = datas[i];++        neibourgs[0] = datas[i-1];++        neibourgs[1] = datas[i+1];++        neibourgs[2] = datas[i+wwi.width];++++        res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0*vit.x) / 6.0;++        res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0*vit.y) / 6.0;++    }++++    // bottom border++    for (unsigned int i=wwi.width*(wwi.height-1)+1; i<wwi.count-1; ++i)++    {++        Pair& res = wwi.buffer[i];++        Pair vit = datas[i];++        neibourgs[0] = datas[i-1];++        neibourgs[1] = datas[i+1];++        neibourgs[2] = datas[i-wwi.width];++++        res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0*vit.x) / 6.0;++        res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0*vit.y) / 6.0;++    }++++    // left border++    for (unsigned int i=wwi.width; i<wwi.width*(wwi.height-1); i+=wwi.width)++    {++        Pair& res = wwi.buffer[i];++        Pair vit = datas[i];++        neibourgs[0] = datas[i+1];++        neibourgs[1] = datas[i-wwi.width];++        neibourgs[2] = datas[i+wwi.width];++++        res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0*vit.x) / 6.0;++        res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0*vit.y) / 6.0;++    }++++    // right border++    for (unsigned int i=2*wwi.width-1; i<wwi.count-1; i+=wwi.width)++    {++        Pair& res = wwi.buffer[i];++        Pair vit = datas[i];++        neibourgs[0] = datas[i-1];++        neibourgs[1] = datas[i-wwi.width];++        neibourgs[2] = datas[i+wwi.width];++++        res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0*vit.x) / 6.0;++        res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0*vit.y) / 6.0;++    }++++    // for the rest++    for (unsigned int j=1; j<wwi.height-1; ++j)++    {++        for (unsigned int i=1; i<wwi.width-1; ++i)++        {++            unsigned int index = i+j*wwi.width;++++            Pair& res = wwi.buffer[index];++            Pair& vit = datas[index];++            neibourgs[0] = datas[index-1];++            neibourgs[1] = datas[index+1];++            neibourgs[2] = datas[index-wwi.width];++            neibourgs[3] = datas[index+wwi.width];++++            res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + neibourgs[3].x + 4.0*vit.x) / 8.0;++            res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + neibourgs[3].y + 4.0*vit.y) / 8.0;++        }++    }++++    Pair* tmp = datas;++    *datas_pointer = wwi.buffer;++    wwi.buffer = tmp;++}++++void WobblyWindowsEffect::meanWithMean(Pair** datas_pointer, WindowWobblyInfos& wwi)++{++    Pair* datas = *datas_pointer;++++    Pair mean = {0.0, 0.0};++    for (unsigned int i = 0; i < wwi.count; ++i)++    {++        mean.x += datas[i].x;++        mean.y += datas[i].y;++    }++++    mean.x /= wwi.count;++    mean.y /= wwi.count;++++    for (unsigned int i = 0; i < wwi.count; ++i)++    {++        wwi.buffer[i].x = (datas[i].x + mean.x) / 2.0;++        wwi.buffer[i].y = (datas[i].y + mean.y) / 2.0;++    }++++    Pair* tmp = datas;++    *datas_pointer = wwi.buffer;++    wwi.buffer = tmp;++}++++void WobblyWindowsEffect::meanWithMedian(Pair** datas_pointer, WindowWobblyInfos& wwi)++{++    Pair* datas = *datas_pointer;++++    qreal xmin = datas[0].x, ymin = datas[0].y;++    qreal xmax = datas[0].x, ymax = datas[0].y;++    for (unsigned int i = 1; i < wwi.count; ++i)++    {++        if (datas[i].x < xmin)++        {++            xmin = datas[i].x;++        }++        if (datas[i].x > xmax)++        {++            xmax = datas[i].x;++        }++++        if (datas[i].y < ymin)++        {++            ymin = datas[i].y;++        }++        if (datas[i].y > ymax)++        {++            ymax = datas[i].y;++        }++    }++++    Pair median = {(xmin + xmax)/2.0, (ymin + ymax)/2.0};++++    for (unsigned int i = 0; i < wwi.count; ++i)++    {++        wwi.buffer[i].x = (datas[i].x + median.x) / 2.0;++        wwi.buffer[i].y = (datas[i].y + median.y) / 2.0;++    }++++    Pair* tmp = datas;++    *datas_pointer = wwi.buffer;++    wwi.buffer = tmp;++}++++++} // namespace+++--- a/kdebase/workspace/kwin/effects/test/demo_wobblywindows.h	1970-01-01 01:00:00.000000000 +0100++++ b/kdebase/workspace/kwin/effects/test/demo_wobblywindows.h	2008-02-10 16:51:19.000000000 +0000+@@ -0,0 +1,122 @@++/*****************************************************************++ KWin - the KDE window manager++ This file is part of the KDE project.++++Copyright (C) 2007++++You can Freely distribute this program under the GNU General Public++License. See the file "COPYING" for the exact licensing terms.++******************************************************************/++++#ifndef DEMO_WOBBLYWINDOWS_H++#define DEMO_WOBBLYWINDOWS_H++++// Include with base class for effects.++#include <kwineffects.h>++++namespace KWin++{++++/**++ * Demo effect which wobble windows++ **/++class WobblyWindowsEffect : public Effect++{++    public:++++        enum GridFilter++        {++            NoFilter,++            FourRingLinearMean,++            MeanWithMean,++            MeanWithMedian++        };++++++        WobblyWindowsEffect();++        virtual ~WobblyWindowsEffect();++++        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 void windowUserMovedResized( EffectWindow* c, bool first, bool last );++        virtual void windowClosed( EffectWindow* c );++++        // Wobbly model parameters++        void setRaideur(qreal raideur);++        void setAmortissement(qreal amortissement);++        void setVelocityThreshold(qreal velocityThreshold);++        void setMoveFactor(qreal factor);++++        void setVelocityFilter(GridFilter filter);++        void setAccelerationFilter(GridFilter filter);++        GridFilter velocityFilter() const;++        GridFilter accelerationFilter() const;++++    private:++++        bool updateWindowWobblyDatas(EffectWindow* w, qreal time);++++        struct Pair++        {++            qreal x;++            qreal y;++        };++++        struct WindowWobblyInfos++        {++            Pair* origin;++            Pair* position;++            Pair* velocity;++            Pair* acceleration;++            Pair* buffer;++++            unsigned int width;++            unsigned int height;++            unsigned int count;++++            int mPickedPointIndex;++            Pair mPickedPointTranslation;++            Pair mDestination;++++            Pair* bezierSurface;++            unsigned int bezierWidth;++            unsigned int bezierHeight;++            unsigned int bezierCount;++++            bool onConstrain;++        };++++        QHash< const EffectWindow*,  WindowWobblyInfos > windows;++++        qreal raideur;++        qreal velocityThreshold;++        qreal accelerationThreshold;++        qreal amortissement;++        qreal move_factor;++++        // the default tesselation for windows++        // use qreal instead of int as I really often need++        // these values as real to do divisions.++        qreal xTesselation;++        qreal yTesselation;++++        bool squareRootMasterAcceleration;++++        GridFilter velFilter;++        GridFilter accFilter;++++        void initWobblyInfo(WindowWobblyInfos& wwi, QRect geometry) const;++        void freeWobblyInfo(WindowWobblyInfos& wwi) const;++++        WobblyWindowsEffect::Pair computeBezierPoint(const WindowWobblyInfos& wwi, Pair point) const;++++        static void fourRingLinearMean(Pair** datas, WindowWobblyInfos& wwi);++        static void meanWithMean(Pair** datas, WindowWobblyInfos& wwi);++        static void meanWithMedian(Pair** datas, WindowWobblyInfos& wwi);++};++++} // namespace++++#endif // DEMO_WOBBLYWINDOWS_H+--- a/kdebase/workspace/kwin/effects/test/demo_wobblywindows.desktop	1970-01-01 01:00:00.000000000 +0100++++ b/kdebase/workspace/kwin/effects/test/demo_wobblywindows.desktop	2008-02-10 16:51:19.000000000 +0000+@@ -0,0 +1,16 @@++[Desktop Entry]++Encoding=UTF-8++Name=Demo Wobbly Windows++Icon=kwin-effect-wavywindows++++Type=Service++ServiceTypes=KWin/Effect++X-KDE-PluginInfo-Author=++X-KDE-PluginInfo-Email=++X-KDE-PluginInfo-Name=kwin4_effect_demo_wobblywindows++X-KDE-PluginInfo-Version=0.1.0++X-KDE-PluginInfo-Category=Demos++X-KDE-PluginInfo-Depends=++X-KDE-PluginInfo-License=GPL++X-KDE-PluginInfo-EnabledByDefault=false++X-KDE-Library=kwin4_effect_testsdiff --git a/kde-base/kdebase/kdebase-9999.4.ebuild b/kde-base/kdebase/kdebase-9999.4.ebuildindex 882e7cb..249feb8 100644--- a/kde-base/kdebase/kdebase-9999.4.ebuild+++ b/kde-base/kdebase/kdebase-9999.4.ebuild@@ -109,7 +109,8 @@ PDEPEND=" #	xscreensaver? ( x11-proto/scrnsaverproto )"  ESVN_PATCHES="${FILESDIR}/gentoo-startkde.patch-	${FILESDIR}/${P}-pam-optional.patch"+	${FILESDIR}/${P}-pam-optional.patch+	${FILESDIR}/kwin-wobblywindows.patch"  pkg_setup() { 	KDE4_BUILT_WITH_USE_CHECK="--missing false kde-base/kdelibs:${SLOT} alsa semantic-desktop