~mc-return/compiz/compiz.merge-src-screen.cpp-improvements

« back to all changes in this revision

Viewing changes to plugins/fade.h

  • Committer: Dennis kasprzyk
  • Author(s): Dennis Kasprzyk
  • Date: 2009-03-15 05:09:18 UTC
  • Revision ID: git-v1:163f6b6f3c3b7764987cbdf8e03cc355edeaa499
New generalized build system.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2005 Novell, Inc.
3
 
 *
4
 
 * Permission to use, copy, modify, distribute, and sell this software
5
 
 * and its documentation for any purpose is hereby granted without
6
 
 * fee, provided that the above copyright notice appear in all copies
7
 
 * and that both that copyright notice and this permission notice
8
 
 * appear in supporting documentation, and that the name of
9
 
 * Novell, Inc. not be used in advertising or publicity pertaining to
10
 
 * distribution of the software without specific, written prior permission.
11
 
 * Novell, Inc. makes no representations about the suitability of this
12
 
 * software for any purpose. It is provided "as is" without express or
13
 
 * implied warranty.
14
 
 *
15
 
 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
 
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17
 
 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
 
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19
 
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20
 
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21
 
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22
 
 *
23
 
 * Author: David Reveman <davidr@novell.com>
24
 
 */
25
 
 
26
 
#include <core/core.h>
27
 
#include <core/privatehandler.h>
28
 
#include <composite/composite.h>
29
 
#include <opengl/opengl.h>
30
 
 
31
 
#define FADE_OPTION_FADE_MODE               0
32
 
#define FADE_OPTION_FADE_SPEED              1
33
 
#define FADE_OPTION_FADE_TIME               2
34
 
#define FADE_OPTION_WINDOW_MATCH            3
35
 
#define FADE_OPTION_VISUAL_BELL             4
36
 
#define FADE_OPTION_FULLSCREEN_VISUAL_BELL  5
37
 
#define FADE_OPTION_DIM_UNRESPONSIVE        6
38
 
#define FADE_OPTION_UNRESPONSIVE_BRIGHTNESS 7
39
 
#define FADE_OPTION_UNRESPONSIVE_SATURATION 8
40
 
#define FADE_OPTION_NUM                     9
41
 
 
42
 
#define FADE_MODE_CONSTANTSPEED 0
43
 
#define FADE_MODE_CONSTANTTIME  1
44
 
#define FADE_MODE_MAX           FADE_MODE_CONSTANTTIME
45
 
 
46
 
class FadeScreen :
47
 
    public ScreenInterface,
48
 
    public CompositeScreenInterface,
49
 
    public PrivateHandler<FadeScreen, CompScreen>
50
 
{
51
 
    public:
52
 
        FadeScreen (CompScreen *s);
53
 
 
54
 
        CompOption::Vector & getOptions ();
55
 
        bool setOption (const char *, CompOption::Value &);
56
 
 
57
 
        void handleEvent (XEvent *);
58
 
        void preparePaint (int);
59
 
 
60
 
        int displayModals;
61
 
        int fadeTime;
62
 
 
63
 
        CompOption::Vector opt;
64
 
 
65
 
        CompositeScreen *cScreen;
66
 
};
67
 
 
68
 
class FadeWindow :
69
 
    public WindowInterface,
70
 
    public GLWindowInterface,
71
 
    public PrivateHandler<FadeWindow, CompWindow>
72
 
{
73
 
    public:
74
 
        FadeWindow (CompWindow *w);
75
 
        ~FadeWindow ();
76
 
 
77
 
        void windowNotify (CompWindowNotify);
78
 
        void paintStep (unsigned int, int, int);
79
 
 
80
 
        bool glPaint (const GLWindowPaintAttrib&, const GLMatrix&,
81
 
                      const CompRegion&, unsigned int);
82
 
 
83
 
        void addDisplayModal ();
84
 
        void removeDisplayModal ();
85
 
 
86
 
        void dim (bool);
87
 
 
88
 
    private:
89
 
        FadeScreen      *fScreen;
90
 
        CompWindow      *window;
91
 
        CompositeWindow *cWindow;
92
 
        GLWindow        *gWindow;
93
 
 
94
 
        GLushort opacity;
95
 
        GLushort brightness;
96
 
        GLushort saturation;
97
 
 
98
 
        GLushort targetOpacity;
99
 
        GLushort targetBrightness;
100
 
        GLushort targetSaturation;
101
 
 
102
 
        bool dModal;
103
 
 
104
 
        int steps;
105
 
        int fadeTime;
106
 
 
107
 
        int opacityDiff;
108
 
        int brightnessDiff;
109
 
        int saturationDiff;
110
 
};
111
 
 
112
 
class FadePluginVTable :
113
 
    public CompPlugin::VTableForScreenAndWindow<FadeScreen, FadeWindow>
114
 
{
115
 
    public:
116
 
        bool init ();
117
 
 
118
 
        PLUGIN_OPTION_HELPER (FadeScreen);
119
 
};