~ubuntu-branches/ubuntu/precise/compiz-fusion-plugins-main/precise

« back to all changes in this revision

Viewing changes to src/animation/dream.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-10-19 12:07:20 UTC
  • mfrom: (1.1.38 upstream)
  • Revision ID: james.westby@ubuntu.com-20101019120720-c3wffrxv7khh2ll8
Tags: 0.9.2.1-0ubuntu1
* New upstream release
* debian/control, debian/rules:
  - convert to cmake, remove autoconf, and convert to debhelper7
* debian/control:
  - bump compiz build-dep and deps to 0.9,
  - reintroduce coreabiversion trick to dep on the good package
* debian/install:
  - removed, seems we shipped all files anyway. Now install in the package
    directly
* debian/docs:
  - adapt to latest upstream shipped file
* debian/source:
  - switch to quilt format
* debian/patches/01-animation-defaults.patch,
  debian/patches/03_default_options.patch,
  debian/patches/06_bug326995.patch,
  debian/patches/08_disable_desktop_vpswitch.patch:
  - adapt to latest version
* debian/patches/02_fix_edges.patch:
  - removed for now: the plugin has been rewritten and have a different
    behavior
* debian/control:
  - remove compiz-fusion-bcop as a build-dep, now built in the core itself
* debian/rules:
  - add some switch to build in package mode, not in debug one

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Animation plugin for compiz/beryl
3
 
 *
4
 
 * animation.c
5
 
 *
6
 
 * Copyright : (C) 2006 Erkin Bahceci
7
 
 * E-mail    : erkinbah@gmail.com
8
 
 *
9
 
 * Based on Wobbly and Minimize plugins by
10
 
 *           : David Reveman
11
 
 * E-mail    : davidr@novell.com>
12
 
 *
13
 
 * Particle system added by : (C) 2006 Dennis Kasprzyk
14
 
 * E-mail                   : onestone@beryl-project.org
15
 
 *
16
 
 * Beam-Up added by : Florencio Guimaraes
17
 
 * E-mail           : florencio@nexcorp.com.br
18
 
 *
19
 
 * Hexagon tessellator added by : Mike Slegeir
20
 
 * E-mail                       : mikeslegeir@mail.utexas.edu>
21
 
 *
22
 
 * This program is free software; you can redistribute it and/or
23
 
 * modify it under the terms of the GNU General Public License
24
 
 * as published by the Free Software Foundation; either version 2
25
 
 * of the License, or (at your option) any later version.
26
 
 *
27
 
 * This program is distributed in the hope that it will be useful,
28
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30
 
 * GNU General Public License for more details.
31
 
 *
32
 
 * You should have received a copy of the GNU General Public License
33
 
 * along with this program; if not, write to the Free Software
34
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
35
 
 */
36
 
 
37
 
#include "animation-internal.h"
38
 
 
39
 
Bool
40
 
fxDreamAnimInit (CompWindow * w)
41
 
{
42
 
    ANIM_WINDOW(w);
43
 
 
44
 
    if (fxDreamZoomToIcon (w))
45
 
    {
46
 
        aw->com.animTotalTime /= ZOOM_PERCEIVED_T;
47
 
        aw->com.usingTransform = TRUE;
48
 
    }
49
 
    else
50
 
        aw->com.animTotalTime /= DREAM_PERCEIVED_T;
51
 
 
52
 
    aw->com.animRemainingTime = aw->com.animTotalTime;
53
 
 
54
 
    return defaultAnimInit (w);
55
 
}
56
 
 
57
 
static void inline
58
 
fxDreamModelStepObject (CompWindow * w,
59
 
                        Model * model,
60
 
                        Object * object,
61
 
                        float forwardProgress,
62
 
                        float waveAmpMax)
63
 
{
64
 
    float waveWidth = 10.0f;
65
 
    float waveSpeed = 7.0f;
66
 
 
67
 
    float origx = w->attrib.x + (WIN_W(w) * object->gridPosition.x -
68
 
                                 w->output.left) * model->scale.x;
69
 
    float origy = w->attrib.y + (WIN_H(w) * object->gridPosition.y -
70
 
                                 w->output.top) * model->scale.y;
71
 
 
72
 
    object->position.x =
73
 
        origx +
74
 
        forwardProgress * waveAmpMax * model->scale.x *
75
 
        sin(object->gridPosition.y * M_PI * waveWidth +
76
 
            waveSpeed * forwardProgress);
77
 
    object->position.y = origy;
78
 
}
79
 
 
80
 
void
81
 
fxDreamModelStep (CompWindow *w, float time)
82
 
{
83
 
    defaultAnimStep (w, time);
84
 
 
85
 
    ANIM_WINDOW(w);
86
 
 
87
 
    Model *model = aw->com.model;
88
 
 
89
 
    float forwardProgress = getProgressAndCenter (w, NULL);
90
 
 
91
 
    float waveAmpMax = MIN(WIN_H(w), WIN_W(w)) * 0.125f;
92
 
 
93
 
    Object *object = model->objects;
94
 
    int i;
95
 
    for (i = 0; i < model->numObjects; i++, object++)
96
 
        fxDreamModelStepObject(w,
97
 
                               model,
98
 
                               object,
99
 
                               forwardProgress,
100
 
                               waveAmpMax);
101
 
}
102
 
 
103
 
void
104
 
fxDreamUpdateWindowAttrib (CompWindow * w,
105
 
                           WindowPaintAttrib * wAttrib)
106
 
{
107
 
    ANIM_WINDOW(w);
108
 
 
109
 
    if (fxDreamZoomToIcon (w))
110
 
    {
111
 
        fxZoomUpdateWindowAttrib (w, wAttrib);
112
 
        return;
113
 
    }
114
 
 
115
 
    float forwardProgress = defaultAnimProgress (w);
116
 
 
117
 
    wAttrib->opacity = (GLushort) (aw->com.storedOpacity * (1 - forwardProgress));
118
 
}
119
 
 
120
 
Bool
121
 
fxDreamZoomToIcon (CompWindow *w)
122
 
{
123
 
    ANIM_WINDOW(w);
124
 
    return ((aw->com.curWindowEvent == WindowEventMinimize ||
125
 
             aw->com.curWindowEvent == WindowEventUnminimize) &&
126
 
            animGetB (w, ANIM_SCREEN_OPTION_DREAM_Z2TOM));
127
 
}
128