~unity-team/compiz/plugins-main-trunk.fix_wrong_window_move_expo

« back to all changes in this revision

Viewing changes to kdecompat/src/kdecompat.h

  • Committer: David Barth
  • Date: 2011-03-29 16:36:40 UTC
  • Revision ID: david.barth@canonical.com-20110329163640-fpen5qsoo0lbjode
initial import from compiz-plugins-main_0.9.4git20110322.orig.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *
 
3
 * Compiz KDE compatibility plugin
 
4
 *
 
5
 * kdecompat.cpp
 
6
 *
 
7
 * Copyright : (C) 2007 by Danny Baumann
 
8
 * E-mail    : maniac@opencompositing.org
 
9
 *
 
10
 * Based on scale.c and switcher.c:
 
11
 * Copyright : (C) 2007 David Reveman
 
12
 * E-mail    : davidr@novell.com
 
13
 *
 
14
 * This program is free software; you can redistribute it and/or
 
15
 * modify it under the terms of the GNU General Public License
 
16
 * as published by the Free Software Foundation; either version 2
 
17
 * of the License, or (at your option) any later version.
 
18
 *
 
19
 * This program is distributed in the hope that it will be useful,
 
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
22
 * GNU General Public License for more details.
 
23
 *
 
24
 */
 
25
 
 
26
#include <core/core.h>
 
27
#include <core/pluginclasshandler.h>
 
28
#include <composite/composite.h>
 
29
#include <opengl/opengl.h>
 
30
#include <decoration.h>
 
31
 
 
32
#include <X11/Xatom.h>
 
33
#include <core/atoms.h>
 
34
 
 
35
#include "kdecompat_options.h"
 
36
 
 
37
#include <cmath>
 
38
 
 
39
class KDECompatScreen :
 
40
    public PluginClassHandler <KDECompatScreen, CompScreen>,
 
41
    public CompositeScreenInterface,
 
42
    public GLScreenInterface,
 
43
    public ScreenInterface,
 
44
    public KdecompatOptions
 
45
{
 
46
    public:
 
47
 
 
48
        KDECompatScreen (CompScreen *);
 
49
        ~KDECompatScreen ();
 
50
 
 
51
    public:
 
52
 
 
53
        void
 
54
        handleEvent (XEvent *);
 
55
 
 
56
        void
 
57
        advertiseSupport (Atom atom,
 
58
                          bool enable);
 
59
 
 
60
        void
 
61
        optionChanged (CompOption                *option,
 
62
                       KdecompatOptions::Options num);
 
63
 
 
64
        void
 
65
        preparePaint (int);
 
66
        
 
67
        bool
 
68
        glPaintOutput (const GLScreenPaintAttrib &attrib,
 
69
                       const GLMatrix            &transform,
 
70
                       const CompRegion          &region,
 
71
                       CompOutput                *output,
 
72
                       unsigned int              mask);
 
73
 
 
74
        void
 
75
        donePaint ();
 
76
 
 
77
        void
 
78
        handleCompizEvent (const char         *pluginName,
 
79
                           const char         *eventName,
 
80
                           CompOption::Vector options);
 
81
        
 
82
        CompAction *
 
83
        getScaleAction (const char *name);
 
84
 
 
85
        bool
 
86
        scaleActivate ();
 
87
        
 
88
        void
 
89
        freeScaleTimeout ();
 
90
 
 
91
        inline void
 
92
        checkPaintFunctions ();
 
93
 
 
94
        CompositeScreen *cScreen;
 
95
        GLScreen        *gScreen;
 
96
 
 
97
        Atom mKdePreviewAtom;
 
98
        Atom mKdeSlideAtom;
 
99
        Atom mKdePresentGroupAtom;
 
100
        Atom mKdeBlurBehindRegionAtom;
 
101
        Atom mCompizWindowBlurAtom;
 
102
 
 
103
        bool mHasSlidingPopups;
 
104
 
 
105
        int  mDestroyCnt;
 
106
        int  mUnmapCnt;
 
107
 
 
108
        CompPlugin *mScaleHandle;
 
109
        bool       mScaleActive;
 
110
        CompTimer  mScaleTimeout;
 
111
 
 
112
        bool       mBlurLoaded;
 
113
 
 
114
        CompWindow          *mPresentWindow;
 
115
        std::vector<Window> mPresentWindowList;
 
116
};
 
117
 
 
118
#define KDECOMPAT_SCREEN(s)                                                    \
 
119
    KDECompatScreen *ks = KDECompatScreen::get (s)
 
120
 
 
121
class KDECompatWindow :
 
122
    public PluginClassHandler <KDECompatWindow, CompWindow>,
 
123
    public WindowInterface,
 
124
    public CompositeWindowInterface,
 
125
    public GLWindowInterface
 
126
{
 
127
    public:
 
128
 
 
129
        KDECompatWindow (CompWindow *);
 
130
        ~KDECompatWindow ();
 
131
        
 
132
        CompWindow      *window;
 
133
        CompositeWindow *cWindow;
 
134
        GLWindow        *gWindow;
 
135
 
 
136
    public:
 
137
 
 
138
        typedef struct {
 
139
            Window   id;
 
140
            CompRect thumb;
 
141
        } Thumb;
 
142
 
 
143
        typedef enum {
 
144
            West  = 0,
 
145
            North = 1,
 
146
            East  = 2,
 
147
            South = 3
 
148
        } SlidePosition;
 
149
 
 
150
        typedef struct {
 
151
            SlidePosition position;
 
152
            int           start;
 
153
            bool          appearing;
 
154
            int           remaining;
 
155
            int           duration;
 
156
        } SlideData;
 
157
 
 
158
        std::list<Thumb> mPreviews;
 
159
        bool             mIsPreview;
 
160
 
 
161
        SlideData        *mSlideData;
 
162
        int              mDestroyCnt;
 
163
        int              mUnmapCnt;
 
164
 
 
165
        bool            mBlurPropertySet;
 
166
 
 
167
    public:
 
168
 
 
169
        bool
 
170
        glPaint (const GLWindowPaintAttrib &,
 
171
                 const GLMatrix            &,
 
172
                 const CompRegion          &,
 
173
                 unsigned int);
 
174
 
 
175
        bool
 
176
        damageRect (bool,
 
177
                    const CompRect &);
 
178
 
 
179
        void
 
180
        updatePreviews ();
 
181
 
 
182
        void
 
183
        stopCloseAnimation ();
 
184
 
 
185
        void
 
186
        sendSlideEvent (bool start);
 
187
 
 
188
        void
 
189
        startSlideAnimation (bool appearing);
 
190
 
 
191
        void
 
192
        endSlideAnimation ();
 
193
 
 
194
        void
 
195
        updateSlidePosition ();
 
196
 
 
197
        void
 
198
        updateBlurProperty (bool enabled);
 
199
 
 
200
        void
 
201
        handleClose (bool);
 
202
 
 
203
        void
 
204
        presentGroup ();
 
205
 
 
206
        void
 
207
        windowNotify (CompWindowNotify n);
 
208
};
 
209
 
 
210
#define KDECOMPAT_WINDOW(w)                                                    \
 
211
    KDECompatWindow *kw = KDECompatWindow::get(w)
 
212
 
 
213
class KDECompatPluginVTable :
 
214
    public CompPlugin::VTableForScreenAndWindow <KDECompatScreen,
 
215
                                                 KDECompatWindow>
 
216
{
 
217
    public:
 
218
 
 
219
        bool
 
220
        init ();
 
221
};