~om26er/ubuntu/oneiric/compiz/sru-764330

« back to all changes in this revision

Viewing changes to .pc/java_offset_frame_extents_878934.patch/plugins/decor/src/decor.h

  • Committer: Package Import Robot
  • Author(s): Omer Akram
  • Date: 2012-01-17 15:08:38 UTC
  • Revision ID: package-import@ubuntu.com-20120117150838-p5pevojkyo01xv5k
Tags: 1:0.9.6+bzr20110929-0ubuntu6.1
* debian/patches/fix_890947_synthetic_notifications.patch:
  - Unity sends initial GDK_CONFIGURE event with position as (0,0).
    (LP: #890947)
* debian/patches/fix_focus_on_wrong_window_896762.patch:
  - Switching viewports with ctrl-alt-(left/right/up/down) does not
    give the highest window on the target viewport focus. (LP: #896762)
* debian/patches/java_offset_frame_extents_878934.patch:
  - Menu selection is wrong in Java apps. (LP: #878934)

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 <boost/shared_ptr.hpp>
 
27
#include <core/core.h>
 
28
#include <core/pluginclasshandler.h>
 
29
 
 
30
#include <composite/composite.h>
 
31
#include <opengl/opengl.h>
 
32
#include <core/atoms.h>
 
33
 
 
34
#include "decor_options.h"
 
35
 
 
36
#define DECOR_SCREEN(s) DecorScreen *ds = DecorScreen::get(s)
 
37
#define DECOR_WINDOW(w) DecorWindow *dw = DecorWindow::get(w)
 
38
 
 
39
struct Vector {
 
40
    int dx;
 
41
    int dy;
 
42
    int x0;
 
43
    int y0;
 
44
};
 
45
 
 
46
#define DECOR_BARE   0
 
47
#define DECOR_NORMAL 1
 
48
#define DECOR_ACTIVE 2
 
49
#define DECOR_NUM    3
 
50
 
 
51
class DecorTexture {
 
52
 
 
53
    public:
 
54
        DecorTexture (Pixmap pixmap);
 
55
        ~DecorTexture ();
 
56
 
 
57
    public:
 
58
        bool            status;
 
59
        int             refCount;
 
60
        Pixmap          pixmap;
 
61
        Damage          damage;
 
62
        GLTexture::List textures;
 
63
};
 
64
 
 
65
class DecorWindow;
 
66
 
 
67
class Decoration {
 
68
 
 
69
    public:
 
70
        static Decoration * create (Window id, Atom decorAtom);
 
71
        static void release (Decoration *);
 
72
 
 
73
    public:
 
74
        int                       refCount;
 
75
        DecorTexture              *texture;
 
76
        CompWindowExtents         output;
 
77
        CompWindowExtents         border;
 
78
        CompWindowExtents         input;
 
79
        CompWindowExtents         maxBorder;
 
80
        CompWindowExtents         maxInput;
 
81
        int                       minWidth;
 
82
        int                       minHeight;
 
83
        decor_quad_t              *quad;
 
84
        int                       nQuad;
 
85
        int                       type;
 
86
};
 
87
 
 
88
struct ScaledQuad {
 
89
    GLTexture::Matrix matrix;
 
90
    BoxRec            box;
 
91
    float             sx;
 
92
    float             sy;
 
93
};
 
94
 
 
95
class WindowDecoration {
 
96
    public:
 
97
        static WindowDecoration * create (Decoration *);
 
98
        static void destroy (WindowDecoration *);
 
99
 
 
100
    public:
 
101
        Decoration *decor;
 
102
        ScaledQuad *quad;
 
103
        int        nQuad;
 
104
};
 
105
 
 
106
class DecorWindow;
 
107
 
 
108
class DecorScreen :
 
109
    public ScreenInterface,
 
110
    public PluginClassHandler<DecorScreen,CompScreen>,
 
111
    public DecorOptions
 
112
{
 
113
    public:
 
114
        DecorScreen (CompScreen *s);
 
115
        ~DecorScreen ();
 
116
 
 
117
        bool setOption (const CompString &name, CompOption::Value &value);
 
118
 
 
119
        void handleEvent (XEvent *event);
 
120
        void matchPropertyChanged (CompWindow *);
 
121
        void addSupportedAtoms (std::vector<Atom>&);
 
122
 
 
123
        DecorTexture * getTexture (Pixmap);
 
124
        void releaseTexture (DecorTexture *);
 
125
 
 
126
        void checkForDm (bool);
 
127
        bool decoratorStartTimeout ();
 
128
 
 
129
        void updateDefaultShadowProperty ();
 
130
 
 
131
    public:
 
132
 
 
133
        CompositeScreen *cScreen;
 
134
 
 
135
        std::list<DecorTexture *> textures;
 
136
 
 
137
        Atom supportingDmCheckAtom;
 
138
        Atom winDecorAtom;
 
139
        Atom decorAtom[DECOR_NUM];
 
140
        Atom inputFrameAtom;
 
141
        Atom outputFrameAtom;
 
142
        Atom decorTypeAtom;
 
143
        Atom decorTypePixmapAtom;
 
144
        Atom decorTypeWindowAtom;
 
145
        Atom requestFrameExtentsAtom;
 
146
        Atom shadowColorAtom;
 
147
        Atom shadowInfoAtom;
 
148
        Atom decorSwitchWindowAtom;
 
149
 
 
150
        Window dmWin;
 
151
        int    dmSupports;
 
152
 
 
153
        Decoration *decor[DECOR_NUM];
 
154
        Decoration windowDefault;
 
155
 
 
156
        bool cmActive;
 
157
 
 
158
        std::map<Window, DecorWindow *> frames;
 
159
 
 
160
        CompTimer decoratorStart;
 
161
};
 
162
 
 
163
class DecorWindow :
 
164
    public WindowInterface,
 
165
    public CompositeWindowInterface,
 
166
    public GLWindowInterface,
 
167
    public PluginClassHandler<DecorWindow,CompWindow>
 
168
{
 
169
    public:
 
170
        DecorWindow (CompWindow *w);
 
171
        ~DecorWindow ();
 
172
 
 
173
        void getOutputExtents (CompWindowExtents&);
 
174
        void resizeNotify (int, int, int, int);
 
175
        void moveNotify (int, int, bool);
 
176
        void stateChangeNotify (unsigned int);
 
177
        void updateFrameRegion (CompRegion &region);
 
178
 
 
179
        bool damageRect (bool, const CompRect &);
 
180
 
 
181
        void computeShadowRegion ();
 
182
 
 
183
        bool glDraw (const GLMatrix &, GLFragment::Attrib &,
 
184
                     const CompRegion &, unsigned int);
 
185
        void glDecorate (const GLMatrix &, GLFragment::Attrib &,
 
186
                         const CompRegion &, unsigned int);
 
187
 
 
188
        void windowNotify (CompWindowNotify n);
 
189
 
 
190
        void updateDecoration ();
 
191
 
 
192
        void setDecorationMatrices ();
 
193
 
 
194
        void updateDecorationScale ();
 
195
 
 
196
        void updateFrame ();
 
197
        void updateInputFrame ();
 
198
        void updateOutputFrame ();
 
199
        void updateWindowRegions ();
 
200
 
 
201
        bool checkSize (Decoration *decor);
 
202
 
 
203
        int shiftX ();
 
204
        int shiftY ();
 
205
 
 
206
        bool update (bool);
 
207
 
 
208
        bool resizeTimeout ();
 
209
 
 
210
        void updateSwitcher ();
 
211
 
 
212
    public:
 
213
 
 
214
        CompWindow      *window;
 
215
        GLWindow        *gWindow;
 
216
        CompositeWindow *cWindow;
 
217
        DecorScreen     *dScreen;
 
218
 
 
219
        WindowDecoration *wd;
 
220
        Decoration       *decor;
 
221
 
 
222
        CompRegion frameRegion;
 
223
        CompRegion shadowRegion;
 
224
 
 
225
        Window inputFrame;
 
226
        Window outputFrame;
 
227
        Damage frameDamage;
 
228
 
 
229
        int    oldX;
 
230
        int    oldY;
 
231
        int    oldWidth;
 
232
        int    oldHeight;
 
233
 
 
234
        bool pixmapFailed;
 
235
 
 
236
        CompRegion::Vector regions;
 
237
        bool               updateReg;
 
238
 
 
239
        CompTimer resizeUpdate;
 
240
        CompTimer moveUpdate;
 
241
 
 
242
        bool      unshading;
 
243
        bool      shading;
 
244
        bool      isSwitcher;
 
245
};
 
246
 
 
247
class DecorPluginVTable :
 
248
    public CompPlugin::VTableForScreenAndWindow<DecorScreen, DecorWindow>
 
249
{
 
250
    public:
 
251
 
 
252
        bool init ();
 
253
};
 
254