~hypodermia/ubuntu/oneiric/compiz/fix-for-bug-301174

« back to all changes in this revision

Viewing changes to .pc/13_fix_window_geometries_and_properties.patch/src/privatewindow.h

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-02-24 17:31:29 UTC
  • mfrom: (0.167.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110224173129-hsczyk7yw7s21flf
Tags: 1:0.9.4-0ubuntu1
* New upstream release:
  - Fix no windows receiving the focus if someone got the focus then was
    destroyed
  - Fix crash when resizing using keybindings
  - Fix unresponsive inactive decorations (LP: #703755) 
  - Fix the long awaited gconf crash (LP: #691561)
  - gtk-window-decorator doesn't respect special decoration styles
    (LP: #290835)
* debian/compiz-core.links,
  debian/source_compiz.py,
  debian/compiz-core.install:
  - install again a richer apport hook to redirect nux/libunity/unityshell
    crash. It also asks the user to redirect unity issues against unity (still
    incuding xorg info when needed)
* Removed a bunch of patches either cherry-picked or pushed upstream. With the
  other fixes, the gconf workaround is hopefully not needed anymore.
* refresh existing patches to still apply
* debian/control:
  - rename dep on compiz-fusion* to compiz*
* debian/patches/085_add_grid_plugin.patch:
  - refresh the grid plugin from new release
* debian/patches/086_new_grid_defaults.patch
  - separate tweaking the default settings to only have the effect that were
    specified:
    top -> maximize, left (top or bottom left) -> window half left of the
    screen, right (top or bottom right) -> window half right of the screen,
    bottom -> do nothing

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2008 Dennis Kasprzyk
3
 
 * Copyright © 2007 Novell, Inc.
4
 
 *
5
 
 * Permission to use, copy, modify, distribute, and sell this software
6
 
 * and its documentation for any purpose is hereby granted without
7
 
 * fee, provided that the above copyright notice appear in all copies
8
 
 * and that both that copyright notice and this permission notice
9
 
 * appear in supporting documentation, and that the name of
10
 
 * Dennis Kasprzyk not be used in advertising or publicity pertaining to
11
 
 * distribution of the software without specific, written prior permission.
12
 
 * Dennis Kasprzyk makes no representations about the suitability of this
13
 
 * software for any purpose. It is provided "as is" without express or
14
 
 * implied warranty.
15
 
 *
16
 
 * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
 
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
18
 
 * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
 
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
20
 
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
21
 
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
22
 
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
 
 *
24
 
 * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
25
 
 *          David Reveman <davidr@novell.com>
26
 
 */
27
 
 
28
 
#ifndef _PRIVATEWINDOW_H
29
 
#define _PRIVATEWINDOW_H
30
 
 
31
 
#include <core/core.h>
32
 
#include <core/window.h>
33
 
#include <core/point.h>
34
 
#include <core/timer.h>
35
 
#include "privatescreen.h"
36
 
 
37
 
#define WINDOW_INVISIBLE(w)                                       \
38
 
    ((w)->attrib.map_state != IsViewable                       || \
39
 
     (w)->attrib.x + (w)->width  + (w)->output.right  <= 0     || \
40
 
     (w)->attrib.y + (w)->height + (w)->output.bottom <= 0     || \
41
 
     (w)->attrib.x - (w)->output.left >= (int) screen->width () || \
42
 
     (w)->attrib.y - (w)->output.top >= (int) screen->height () )
43
 
 
44
 
typedef CompWindowExtents CompFullscreenMonitorSet;
45
 
 
46
 
class PrivateWindow {
47
 
 
48
 
    public:
49
 
        PrivateWindow (CoreWindow *window);
50
 
        ~PrivateWindow ();
51
 
 
52
 
        void recalcNormalHints ();
53
 
 
54
 
        void updateFrameWindow ();
55
 
 
56
 
        void setWindowMatrix ();
57
 
 
58
 
        bool restack (Window aboveId);
59
 
 
60
 
        bool initializeSyncCounter ();
61
 
 
62
 
        bool isGroupTransient (Window clientLeader);
63
 
 
64
 
        static bool stackLayerCheck (CompWindow *w,
65
 
                                     Window     clientLeader,
66
 
                                     CompWindow *below);
67
 
 
68
 
        static bool avoidStackingRelativeTo (CompWindow *w);
69
 
 
70
 
        static CompWindow * findSiblingBelow (CompWindow *w,
71
 
                                              bool       aboveFs);
72
 
 
73
 
        static CompWindow * findLowestSiblingBelow (CompWindow *w);
74
 
 
75
 
        static bool validSiblingBelow (CompWindow *w,
76
 
                                       CompWindow *sibling);
77
 
 
78
 
        void saveGeometry (int mask);
79
 
 
80
 
        int restoreGeometry (XWindowChanges *xwc, int mask);
81
 
 
82
 
        void reconfigureXWindow (unsigned int   valueMask,
83
 
                                 XWindowChanges *xwc);
84
 
 
85
 
        static bool stackTransients (CompWindow     *w,
86
 
                                     CompWindow     *avoid,
87
 
                                     XWindowChanges *xwc,
88
 
                                     CompWindowList &updateList);
89
 
 
90
 
        static void stackAncestors (CompWindow *w,
91
 
                                    XWindowChanges *xwc,
92
 
                                    CompWindowList &updateList);
93
 
 
94
 
        static bool isAncestorTo (CompWindow *transient,
95
 
                                  CompWindow *ancestor);
96
 
 
97
 
        Window getClientLeaderOfAncestor ();
98
 
 
99
 
        CompWindow * getModalTransient ();
100
 
 
101
 
        int addWindowSizeChanges (XWindowChanges *xwc,
102
 
                                  CompWindow::Geometry old);
103
 
 
104
 
        int addWindowStackChanges (XWindowChanges *xwc,
105
 
                                   CompWindow     *sibling);
106
 
 
107
 
        static CompWindow * findValidStackSiblingBelow (CompWindow *w,
108
 
                                                        CompWindow *sibling);
109
 
 
110
 
        void ensureWindowVisibility ();
111
 
 
112
 
        void reveal ();
113
 
 
114
 
        static void revealAncestors (CompWindow *w,
115
 
                                     CompWindow *transient);
116
 
 
117
 
        static void minimizeTransients (CompWindow *w,
118
 
                                        CompWindow *ancestor);
119
 
 
120
 
        static void unminimizeTransients (CompWindow *w,
121
 
                                          CompWindow *ancestor);
122
 
 
123
 
        bool getUsageTimestamp (Time& timestamp);
124
 
 
125
 
        bool isWindowFocusAllowed (Time timestamp);
126
 
 
127
 
        static void handleDamageRect (CompWindow *w,
128
 
                                      int         x,
129
 
                                      int         y,
130
 
                                      int         width,
131
 
                                      int         height);
132
 
 
133
 
        bool reparent ();
134
 
        void unreparent ();
135
 
 
136
 
        void hide ();
137
 
 
138
 
        void show ();
139
 
 
140
 
        bool handlePingTimeout (unsigned int lastPing);
141
 
 
142
 
        void handlePing (int lastPing);
143
 
 
144
 
        void applyStartupProperties (CompStartupSequence *s);
145
 
 
146
 
        void updateNormalHints ();
147
 
 
148
 
        void updateWmHints ();
149
 
 
150
 
        void updateClassHints ();
151
 
 
152
 
        void updateTransientHint ();
153
 
 
154
 
        void updateIconGeometry ();
155
 
 
156
 
        Window getClientLeader ();
157
 
 
158
 
        char * getStartupId ();
159
 
 
160
 
        CompRegion
161
 
        rectsToRegion (unsigned int, XRectangle *);
162
 
 
163
 
        void updateRegion ();
164
 
 
165
 
        bool handleSyncAlarm ();
166
 
 
167
 
        void configure (XConfigureEvent *ce);
168
 
 
169
 
        void configureFrame (XConfigureEvent *ce);
170
 
 
171
 
        void circulate (XCirculateEvent *ce);
172
 
 
173
 
        unsigned int adjustConfigureRequestForGravity (XWindowChanges *xwc,
174
 
                                                       unsigned int   xwcm,
175
 
                                                       int            gravity,
176
 
                                                       int            direction);
177
 
 
178
 
        void updateSize ();
179
 
 
180
 
        bool getUserTime (Time& time);
181
 
        void setUserTime (Time time);
182
 
 
183
 
        bool allowWindowFocus (unsigned int noFocusMask,
184
 
                               Time         timestamp);
185
 
 
186
 
        void freeIcons ();
187
 
 
188
 
        void updateMwmHints ();
189
 
 
190
 
        void updateStartupId ();
191
 
 
192
 
        void processMap ();
193
 
 
194
 
        void updatePassiveButtonGrabs ();
195
 
 
196
 
        void setFullscreenMonitors (CompFullscreenMonitorSet *monitors);
197
 
 
198
 
        static unsigned int windowTypeFromString (const char *str);
199
 
 
200
 
        static int compareWindowActiveness (CompWindow *w1,
201
 
                                            CompWindow *w2);
202
 
 
203
 
        void setOverrideRedirect (bool overrideRedirect);
204
 
 
205
 
        void readIconHint ();
206
 
 
207
 
    public:
208
 
 
209
 
        PrivateWindow *priv;
210
 
 
211
 
        CompWindow *window;
212
 
 
213
 
        int                  refcnt;
214
 
        Window               id;
215
 
        Window               frame;
216
 
        Window               wrapper;
217
 
        unsigned int         mapNum;
218
 
        unsigned int         activeNum;
219
 
        XWindowAttributes    attrib;
220
 
        CompWindow::Geometry geometry;
221
 
        CompWindow::Geometry serverGeometry;
222
 
        Window               transientFor;
223
 
        Window               clientLeader;
224
 
        XSizeHints           sizeHints;
225
 
        XWMHints             *hints;
226
 
 
227
 
        bool       inputHint;
228
 
        bool       alpha;
229
 
        int        width;
230
 
        int        height;
231
 
        CompRegion region;
232
 
        CompRegion inputRegion;
233
 
        CompRegion frameRegion;
234
 
 
235
 
        unsigned int wmType;
236
 
        unsigned int type;
237
 
        unsigned int state;
238
 
        unsigned int actions;
239
 
        unsigned int protocols;
240
 
        unsigned int mwmDecor;
241
 
        unsigned int mwmFunc;
242
 
        bool         invisible;
243
 
        bool         destroyed;
244
 
        bool         managed;
245
 
        bool         unmanaging;
246
 
 
247
 
        int destroyRefCnt;
248
 
        int unmapRefCnt;
249
 
 
250
 
        CompPoint initialViewport;
251
 
 
252
 
        Time initialTimestamp;
253
 
        bool initialTimestampSet;
254
 
 
255
 
        bool     fullscreenMonitorsSet;
256
 
        CompRect fullscreenMonitorRect;
257
 
 
258
 
        bool placed;
259
 
        bool minimized;
260
 
        bool inShowDesktopMode;
261
 
        bool shaded;
262
 
        bool hidden;
263
 
        bool grabbed;
264
 
 
265
 
        unsigned int desktop;
266
 
 
267
 
        int pendingUnmaps;
268
 
        int pendingMaps;
269
 
 
270
 
        char *startupId;
271
 
        char *resName;
272
 
        char *resClass;
273
 
 
274
 
        CompGroup *group;
275
 
 
276
 
        unsigned int lastPong;
277
 
        bool         alive;
278
 
 
279
 
        CompWindowExtents input;
280
 
        CompWindowExtents output;
281
 
 
282
 
        CompStruts *struts;
283
 
 
284
 
        std::vector<CompIcon *> icons;
285
 
        bool noIcons;
286
 
 
287
 
        CompRect   iconGeometry;
288
 
 
289
 
        XWindowChanges saveWc;
290
 
        int                saveMask;
291
 
 
292
 
        XSyncCounter  syncCounter;
293
 
        XSyncValue    syncValue;
294
 
        XSyncAlarm    syncAlarm;
295
 
        CompTimer     syncWaitTimer;
296
 
 
297
 
        bool                 syncWait;
298
 
        CompWindow::Geometry syncGeometry;
299
 
 
300
 
        bool closeRequests;
301
 
        Time lastCloseRequestTime;
302
 
};
303
 
 
304
 
/* Minimal tracking of the window which happens
305
 
 * on CreateNotify */
306
 
 
307
 
class CoreWindow
308
 
{
309
 
    public:
310
 
 
311
 
        CoreWindow (Window id, XWindowAttributes &wa);
312
 
 
313
 
        CompWindow * manage (Window id);
314
 
 
315
 
        friend class PrivateWindow;
316
 
        friend class PrivateScreen;
317
 
        friend class CompScreen;
318
 
 
319
 
    private:
320
 
 
321
 
        PrivateWindow *priv;
322
 
};
323
 
 
324
 
#endif