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

« back to all changes in this revision

Viewing changes to .pc/03_git_fix_maprequest.patch/include/core/window.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 _COMPWINDOW_H
29
 
#define _COMPWINDOW_H
30
 
 
31
 
#include <boost/function.hpp>
32
 
 
33
 
#include <X11/Xlib-xcb.h>
34
 
#include <X11/Xutil.h>
35
 
#include <X11/Xregion.h>
36
 
#include <X11/extensions/Xdamage.h>
37
 
#include <X11/extensions/sync.h>
38
 
 
39
 
#include <core/action.h>
40
 
#include <core/pluginclasses.h>
41
 
#include <core/size.h>
42
 
#include <core/point.h>
43
 
#include <core/region.h>
44
 
 
45
 
#include <core/wrapsystem.h>
46
 
 
47
 
#include <map>
48
 
 
49
 
class CompWindow;
50
 
class CompIcon;
51
 
class PrivateWindow;
52
 
struct CompStartupSequence;
53
 
 
54
 
#define ROOTPARENT(x) (((x)->frame ()) ? (x)->frame () : (x)->id ())
55
 
 
56
 
#define CompWindowProtocolDeleteMask      (1 << 0)
57
 
#define CompWindowProtocolTakeFocusMask   (1 << 1)
58
 
#define CompWindowProtocolPingMask        (1 << 2)
59
 
#define CompWindowProtocolSyncRequestMask (1 << 3)
60
 
 
61
 
#define CompWindowTypeDesktopMask      (1 << 0)
62
 
#define CompWindowTypeDockMask         (1 << 1)
63
 
#define CompWindowTypeToolbarMask      (1 << 2)
64
 
#define CompWindowTypeMenuMask         (1 << 3)
65
 
#define CompWindowTypeUtilMask         (1 << 4)
66
 
#define CompWindowTypeSplashMask       (1 << 5)
67
 
#define CompWindowTypeDialogMask       (1 << 6)
68
 
#define CompWindowTypeNormalMask       (1 << 7)
69
 
#define CompWindowTypeDropdownMenuMask (1 << 8)
70
 
#define CompWindowTypePopupMenuMask    (1 << 9)
71
 
#define CompWindowTypeTooltipMask      (1 << 10)
72
 
#define CompWindowTypeNotificationMask (1 << 11)
73
 
#define CompWindowTypeComboMask        (1 << 12)
74
 
#define CompWindowTypeDndMask          (1 << 13)
75
 
#define CompWindowTypeModalDialogMask  (1 << 14)
76
 
#define CompWindowTypeFullscreenMask   (1 << 15)
77
 
#define CompWindowTypeUnknownMask      (1 << 16)
78
 
 
79
 
#define NO_FOCUS_MASK (CompWindowTypeDesktopMask | \
80
 
                       CompWindowTypeDockMask    | \
81
 
                       CompWindowTypeSplashMask)
82
 
 
83
 
#define CompWindowStateModalMask            (1 <<  0)
84
 
#define CompWindowStateStickyMask           (1 <<  1)
85
 
#define CompWindowStateMaximizedVertMask    (1 <<  2)
86
 
#define CompWindowStateMaximizedHorzMask    (1 <<  3)
87
 
#define CompWindowStateShadedMask           (1 <<  4)
88
 
#define CompWindowStateSkipTaskbarMask      (1 <<  5)
89
 
#define CompWindowStateSkipPagerMask        (1 <<  6)
90
 
#define CompWindowStateHiddenMask           (1 <<  7)
91
 
#define CompWindowStateFullscreenMask       (1 <<  8)
92
 
#define CompWindowStateAboveMask            (1 <<  9)
93
 
#define CompWindowStateBelowMask            (1 << 10)
94
 
#define CompWindowStateDemandsAttentionMask (1 << 11)
95
 
#define CompWindowStateDisplayModalMask     (1 << 12)
96
 
 
97
 
#define MAXIMIZE_STATE (CompWindowStateMaximizedHorzMask | \
98
 
                        CompWindowStateMaximizedVertMask)
99
 
 
100
 
#define CompWindowActionMoveMask          (1 << 0)
101
 
#define CompWindowActionResizeMask        (1 << 1)
102
 
#define CompWindowActionStickMask         (1 << 2)
103
 
#define CompWindowActionMinimizeMask      (1 << 3)
104
 
#define CompWindowActionMaximizeHorzMask  (1 << 4)
105
 
#define CompWindowActionMaximizeVertMask  (1 << 5)
106
 
#define CompWindowActionFullscreenMask    (1 << 6)
107
 
#define CompWindowActionCloseMask         (1 << 7)
108
 
#define CompWindowActionShadeMask         (1 << 8)
109
 
#define CompWindowActionChangeDesktopMask (1 << 9)
110
 
#define CompWindowActionAboveMask         (1 << 10)
111
 
#define CompWindowActionBelowMask         (1 << 11)
112
 
 
113
 
#define MwmFuncAll      (1L << 0)
114
 
#define MwmFuncResize   (1L << 1)
115
 
#define MwmFuncMove     (1L << 2)
116
 
#define MwmFuncIconify  (1L << 3)
117
 
#define MwmFuncMaximize (1L << 4)
118
 
#define MwmFuncClose    (1L << 5)
119
 
 
120
 
#define MwmDecorHandle   (1L << 2)
121
 
#define MwmDecorTitle    (1L << 3)
122
 
#define MwmDecorMenu     (1L << 4)
123
 
#define MwmDecorMinimize (1L << 5)
124
 
#define MwmDecorMaximize (1L << 6)
125
 
 
126
 
#define MwmDecorAll      (1L << 0)
127
 
#define MwmDecorBorder   (1L << 1)
128
 
#define MwmDecorHandle   (1L << 2)
129
 
#define MwmDecorTitle    (1L << 3)
130
 
#define MwmDecorMenu     (1L << 4)
131
 
#define MwmDecorMinimize (1L << 5)
132
 
#define MwmDecorMaximize (1L << 6)
133
 
 
134
 
#define WmMoveResizeSizeTopLeft      0
135
 
#define WmMoveResizeSizeTop          1
136
 
#define WmMoveResizeSizeTopRight     2
137
 
#define WmMoveResizeSizeRight        3
138
 
#define WmMoveResizeSizeBottomRight  4
139
 
#define WmMoveResizeSizeBottom       5
140
 
#define WmMoveResizeSizeBottomLeft   6
141
 
#define WmMoveResizeSizeLeft         7
142
 
#define WmMoveResizeMove             8
143
 
#define WmMoveResizeSizeKeyboard     9
144
 
#define WmMoveResizeMoveKeyboard    10
145
 
#define WmMoveResizeCancel          11
146
 
 
147
 
/* EWMH source indication client types */
148
 
#define ClientTypeUnknown      0
149
 
#define ClientTypeApplication  1
150
 
#define ClientTypePager        2
151
 
 
152
 
#define CompWindowGrabKeyMask         (1 << 0)
153
 
#define CompWindowGrabButtonMask      (1 << 1)
154
 
#define CompWindowGrabMoveMask        (1 << 2)
155
 
#define CompWindowGrabResizeMask      (1 << 3)
156
 
#define CompWindowGrabExternalAppMask (1 << 4)
157
 
 
158
 
/**
159
 
 * Enumeration value which represents
160
 
 * how a window will be stacked by compiz
161
 
 */
162
 
enum CompStackingUpdateMode {
163
 
    CompStackingUpdateModeNone = 0,
164
 
    CompStackingUpdateModeNormal,
165
 
    CompStackingUpdateModeAboveFullscreen,
166
 
    CompStackingUpdateModeInitialMap,
167
 
    CompStackingUpdateModeInitialMapDeniedFocus
168
 
};
169
 
 
170
 
/**
171
 
 * Enumeration value used by CompWindow::windowNotify
172
 
 * which specifies the type of event that occured.
173
 
 */
174
 
enum CompWindowNotify {
175
 
   CompWindowNotifyMap,
176
 
   CompWindowNotifyUnmap,
177
 
   CompWindowNotifyRestack,
178
 
   CompWindowNotifyHide,
179
 
   CompWindowNotifyShow,
180
 
   CompWindowNotifyAliveChanged,
181
 
   CompWindowNotifySyncAlarm,
182
 
   CompWindowNotifyReparent,
183
 
   CompWindowNotifyUnreparent,
184
 
   CompWindowNotifyFrameUpdate,
185
 
   CompWindowNotifyFocusChange,
186
 
   CompWindowNotifyBeforeUnmap,
187
 
   CompWindowNotifyBeforeDestroy,
188
 
   CompWindowNotifyClose,
189
 
   CompWindowNotifyMinimize,
190
 
   CompWindowNotifyUnminimize,
191
 
   CompWindowNotifyShade,
192
 
   CompWindowNotifyUnshade,
193
 
   CompWindowNotifyEnterShowDesktopMode,
194
 
   CompWindowNotifyLeaveShowDesktopMode,
195
 
   CompWindowNotifyBeforeMap
196
 
};
197
 
 
198
 
/**
199
 
 * Specifies the left, right, top and bottom positions of a window's
200
 
 * geometry
201
 
 */
202
 
struct CompWindowExtents {
203
 
    int left;
204
 
    int right;
205
 
    int top;
206
 
    int bottom;
207
 
};
208
 
 
209
 
/**
210
 
 * Specifies the area of the screen taken up by strut windows
211
 
 */
212
 
struct CompStruts {
213
 
    XRectangle left;
214
 
    XRectangle right;
215
 
    XRectangle top;
216
 
    XRectangle bottom;
217
 
};
218
 
 
219
 
/**
220
 
 * Wrappable core window functions. Derive from this class
221
 
 * and overload these functions in order to have your function called
222
 
 * after a core CompWindow function is called with the same name.
223
 
 */
224
 
class WindowInterface : public WrapableInterface<CompWindow, WindowInterface>
225
 
{
226
 
    public:
227
 
        virtual void getOutputExtents (CompWindowExtents& output);
228
 
 
229
 
        virtual void getAllowedActions (unsigned int &setActions,
230
 
                                        unsigned int &clearActions);
231
 
 
232
 
        virtual bool focus ();
233
 
        virtual void activate ();
234
 
        virtual bool place (CompPoint &pos);
235
 
 
236
 
        virtual void validateResizeRequest (unsigned int   &mask,
237
 
                                            XWindowChanges *xwc,
238
 
                                            unsigned int   source);
239
 
 
240
 
        virtual void resizeNotify (int dx, int dy, int dwidth, int dheight);
241
 
        virtual void moveNotify (int dx, int dy, bool immediate);
242
 
        virtual void windowNotify (CompWindowNotify n);
243
 
 
244
 
        virtual void grabNotify (int x, int y,
245
 
                                 unsigned int state, unsigned int mask);
246
 
        virtual void ungrabNotify ();
247
 
 
248
 
        virtual void stateChangeNotify (unsigned int lastState);
249
 
 
250
 
        virtual void updateFrameRegion (CompRegion &region);
251
 
 
252
 
        virtual void minimize ();
253
 
        virtual void unminimize ();
254
 
        virtual bool minimized ();
255
 
 
256
 
        virtual bool alpha ();
257
 
        virtual bool isFocussable ();
258
 
        virtual bool managed ();
259
 
};
260
 
 
261
 
/**
262
 
 * An Window object that wraps an X window. This handles snychronization of
263
 
 * window state, geometry, etc. between Compiz and the X server.
264
 
 */
265
 
class CompWindow :
266
 
    public WrapableHandler<WindowInterface, 19>,
267
 
    public PluginClassStorage
268
 
{
269
 
    public:
270
 
 
271
 
    /**
272
 
     * A mutable object about the dimensions and location of a CompWindow.
273
 
     */
274
 
        class Geometry : public CompRect
275
 
    {
276
 
            public:
277
 
                Geometry ();
278
 
                Geometry (int, int, int, int, int);
279
 
 
280
 
                int border () const;
281
 
 
282
 
                void set (int, int, int, int, int);
283
 
                void setBorder (int);
284
 
 
285
 
            private:
286
 
                int mBorder;
287
 
        };
288
 
 
289
 
        typedef boost::function<void (CompWindow *)> ForEach;
290
 
        typedef std::map<Window, CompWindow *> Map;
291
 
 
292
 
    public:
293
 
        CompWindow *next;
294
 
        CompWindow *prev;
295
 
 
296
 
    public:
297
 
        CompWindow (Window     id,
298
 
                    Window     aboveId);
299
 
        ~CompWindow ();
300
 
 
301
 
        /**
302
 
        *  Geometry retrieved from the
303
 
         * last ConfigureNotify event received
304
 
         */
305
 
        Geometry & geometry () const;
306
 
 
307
 
        int x () const;
308
 
        int y () const;
309
 
        CompPoint pos () const;
310
 
 
311
 
        /* With border */
312
 
        int width () const;
313
 
        int height () const;
314
 
        CompSize size () const;
315
 
 
316
 
        /**
317
 
         * Geometry last sent to the server
318
 
         */
319
 
        Geometry & serverGeometry () const;
320
 
 
321
 
        int serverX () const;
322
 
        int serverY () const;
323
 
        CompPoint serverPos () const;
324
 
 
325
 
        /* With border */
326
 
        int serverWidth () const;
327
 
        int serverHeight () const;
328
 
        const CompSize serverSize () const;
329
 
 
330
 
        /* includes decorations */
331
 
        CompRect inputRect () const;
332
 
        CompRect serverInputRect () const;
333
 
 
334
 
        /* includes decorations and shadows */
335
 
        CompRect outputRect () const;
336
 
        CompRect serverOutputRect () const;
337
 
 
338
 
        Window id ();
339
 
        Window frame ();
340
 
 
341
 
        CompString resName ();
342
 
 
343
 
        const CompRegion & region () const;
344
 
 
345
 
        const CompRegion & frameRegion () const;
346
 
 
347
 
        void updateFrameRegion ();
348
 
        void setWindowFrameExtents (CompWindowExtents *input);
349
 
 
350
 
        unsigned int & wmType ();
351
 
 
352
 
        unsigned int type ();
353
 
 
354
 
        unsigned int & state ();
355
 
 
356
 
        unsigned int actions ();
357
 
 
358
 
        unsigned int & protocols ();
359
 
 
360
 
        void close (Time serverTime);
361
 
 
362
 
        bool inShowDesktopMode ();
363
 
 
364
 
        void setShowDesktopMode (bool);
365
 
 
366
 
        bool grabbed ();
367
 
 
368
 
        int pendingMaps ();
369
 
 
370
 
        unsigned int activeNum ();
371
 
 
372
 
        int mapNum () const;
373
 
 
374
 
        CompStruts * struts ();
375
 
 
376
 
        int & saveMask ();
377
 
 
378
 
        XWindowChanges & saveWc ();
379
 
 
380
 
        void moveToViewportPosition (int x, int y, bool sync);
381
 
 
382
 
        char * startupId ();
383
 
 
384
 
        unsigned int desktop ();
385
 
 
386
 
        Window clientLeader (bool checkAncestor = false);
387
 
 
388
 
        void changeState (unsigned int newState);
389
 
 
390
 
        void recalcActions ();
391
 
 
392
 
        void recalcType ();
393
 
 
394
 
        void updateWindowOutputExtents ();
395
 
 
396
 
        void destroy ();
397
 
 
398
 
        void sendConfigureNotify ();
399
 
 
400
 
        void sendSyncRequest ();
401
 
 
402
 
        XSyncAlarm syncAlarm ();
403
 
 
404
 
        void map ();
405
 
 
406
 
        void unmap ();
407
 
 
408
 
        void incrementUnmapReference ();
409
 
 
410
 
        void incrementDestroyReference ();
411
 
 
412
 
        bool hasUnmapReference ();
413
 
 
414
 
        bool resize (XWindowAttributes);
415
 
 
416
 
        bool resize (Geometry);
417
 
 
418
 
        bool resize (int x, int y, int width, int height,
419
 
                     int border = 0);
420
 
 
421
 
        void move (int dx, int dy, bool immediate = true);
422
 
 
423
 
        void syncPosition ();
424
 
 
425
 
        void moveInputFocusTo ();
426
 
 
427
 
        void moveInputFocusToOtherWindow ();
428
 
 
429
 
        /* wraps XConfigureWindow and updates serverGeometry */
430
 
        void configureXWindow (unsigned int valueMask,
431
 
                               XWindowChanges *xwc);
432
 
 
433
 
        void moveResize (XWindowChanges *xwc,
434
 
                         unsigned int   xwcm,
435
 
                         int            gravity,
436
 
                         unsigned int   source);
437
 
 
438
 
        void raise ();
439
 
 
440
 
        void lower ();
441
 
 
442
 
        void restackAbove (CompWindow *sibling);
443
 
 
444
 
        void restackBelow (CompWindow *sibling);
445
 
 
446
 
        void updateAttributes (CompStackingUpdateMode stackingMode);
447
 
 
448
 
        void hide ();
449
 
 
450
 
        void show ();
451
 
 
452
 
        void maximize (unsigned int state = 0);
453
 
 
454
 
        CompPoint defaultViewport ();
455
 
 
456
 
        CompPoint & initialViewport () const;
457
 
 
458
 
        CompIcon * getIcon (int width, int height);
459
 
 
460
 
        const CompRect & iconGeometry () const;
461
 
 
462
 
        int outputDevice ();
463
 
 
464
 
        void setDesktop (unsigned int desktop);
465
 
 
466
 
        bool onCurrentDesktop ();
467
 
 
468
 
        bool onAllViewports ();
469
 
 
470
 
        CompPoint getMovementForOffset (CompPoint offset);
471
 
 
472
 
        Window transientFor ();
473
 
 
474
 
        int pendingUnmaps ();
475
 
 
476
 
        bool placed ();
477
 
 
478
 
        bool shaded ();
479
 
 
480
 
        CompWindowExtents & input () const;
481
 
 
482
 
        CompWindowExtents & output () const;
483
 
 
484
 
        XSizeHints & sizeHints () const;
485
 
 
486
 
        bool destroyed ();
487
 
 
488
 
        bool invisible ();
489
 
 
490
 
        bool syncWait ();
491
 
 
492
 
        bool alive ();
493
 
 
494
 
        bool overrideRedirect ();
495
 
 
496
 
        bool isMapped () const;
497
 
        bool isViewable () const;
498
 
 
499
 
        int windowClass ();
500
 
 
501
 
        unsigned int depth ();
502
 
 
503
 
        unsigned int mwmDecor ();
504
 
        unsigned int mwmFunc ();
505
 
 
506
 
        bool constrainNewWindowSize (int width,
507
 
                                     int height,
508
 
                                     int *newWidth,
509
 
                                     int *newHeight);
510
 
 
511
 
        static unsigned int constrainWindowState (unsigned int state,
512
 
                                                  unsigned int actions);
513
 
 
514
 
        static unsigned int allocPluginClassIndex ();
515
 
        static void freePluginClassIndex (unsigned int index);
516
 
 
517
 
        bool updateStruts ();
518
 
 
519
 
        WRAPABLE_HND (0, WindowInterface, void, getOutputExtents,
520
 
                      CompWindowExtents&);
521
 
        WRAPABLE_HND (1, WindowInterface, void, getAllowedActions,
522
 
                      unsigned int &, unsigned int &);
523
 
 
524
 
        WRAPABLE_HND (2, WindowInterface, bool, focus);
525
 
        WRAPABLE_HND (3, WindowInterface, void, activate);
526
 
        WRAPABLE_HND (4, WindowInterface, bool, place, CompPoint &);
527
 
        WRAPABLE_HND (5, WindowInterface, void, validateResizeRequest,
528
 
                      unsigned int &, XWindowChanges *, unsigned int);
529
 
 
530
 
        WRAPABLE_HND (6, WindowInterface, void, resizeNotify,
531
 
                      int, int, int, int);
532
 
        WRAPABLE_HND (7, WindowInterface, void, moveNotify, int, int, bool);
533
 
        WRAPABLE_HND (8, WindowInterface, void, windowNotify, CompWindowNotify);
534
 
        WRAPABLE_HND (9, WindowInterface, void, grabNotify, int, int,
535
 
                      unsigned int, unsigned int);
536
 
        WRAPABLE_HND (10, WindowInterface, void, ungrabNotify);
537
 
        WRAPABLE_HND (11, WindowInterface, void, stateChangeNotify,
538
 
                      unsigned int);
539
 
 
540
 
        WRAPABLE_HND (12, WindowInterface, void, updateFrameRegion,
541
 
                      CompRegion &);
542
 
 
543
 
        WRAPABLE_HND (13, WindowInterface, void, minimize);
544
 
        WRAPABLE_HND (14, WindowInterface, void, unminimize);
545
 
        WRAPABLE_HND (15, WindowInterface, bool, minimized);
546
 
 
547
 
        WRAPABLE_HND (16, WindowInterface, bool, alpha);
548
 
        WRAPABLE_HND (17, WindowInterface, bool, isFocussable);
549
 
        WRAPABLE_HND (18, WindowInterface, bool, managed);
550
 
 
551
 
        friend class PrivateWindow;
552
 
        friend class CompScreen;
553
 
        friend class PrivateScreen;
554
 
        friend class ModifierHandler;
555
 
        friend class SpewScreen;
556
 
        friend class SpewWindow;
557
 
 
558
 
    private:
559
 
        PrivateWindow *priv;
560
 
};
561
 
 
562
 
#endif