~lbrulet-8/compiz-plugins-main/fix-876591

« back to all changes in this revision

Viewing changes to debian/patches/fix-862260.patch

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-10-10 13:04:09 UTC
  • Revision ID: james.westby@ubuntu.com-20111010130409-ni1kh90p0za5cv7i
Tags: 1:0.9.6-0ubuntu3
* Cherry-pick upstream fixes:
  - unmaximizable windows still show orange glow but fail to maximize
    (LP: #827560)
  - compiz crashed with SIGSEGV in CompWindow::serverBorderRect()
    (LP: #834585)
  - Workspace switcher makes windows lose decorations (LP: #853951)
  - Windows get corrupted sometimes when semi-maximizing them (LP: #865177)
  - Windows like gnome-terminal have awkward space around them after being
    semi-maximized (LP: #865179)
  - Grid plugin behaviour random (LP: #862260)
  - Don't apply snapping to maximized windows (LP: #862261)
  - snap movements can cause infinite loops in window movements (LP: #860646)
  - it is possible to see a window in it's pre-animation state during unmap
    animations (LP: #864476)
  - Rendering glitches when resuming from expo mode (LP: #868121)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=== modified file 'CMakeLists.txt'
 
2
Index: compiz-plugins-main-0.9.6/grid/src/grid.cpp
 
3
===================================================================
 
4
--- compiz-plugins-main-0.9.6.orig/grid/src/grid.cpp    2011-10-07 20:51:50.544182148 +0800
 
5
+++ compiz-plugins-main-0.9.6/grid/src/grid.cpp 2011-10-07 20:52:34.088398081 +0800
 
6
@@ -26,24 +26,7 @@
 
7
 
 
8
 using namespace GridWindowType;
 
9
 
 
10
-static const GridProps gridProps[] =
 
11
-{
 
12
-    {0,1, 1,1},
 
13
-
 
14
-    {0,1, 2,2},
 
15
-    {0,1, 1,2},
 
16
-    {1,1, 2,2},
 
17
-
 
18
-    {0,0, 2,1},
 
19
-    {0,0, 1,1},
 
20
-    {1,0, 2,1},
 
21
-
 
22
-    {0,0, 2,2},
 
23
-    {0,0, 1,2},
 
24
-    {1,0, 2,2},
 
25
-
 
26
-    {0,0, 1,1},
 
27
-};
 
28
+static std::map <unsigned int, GridProps> gridProps;
 
29
 
 
30
 void
 
31
 GridScreen::handleCompizEvent(const char*    plugin,
 
32
@@ -102,7 +85,7 @@
 
33
 void
 
34
 GridScreen::getPaintRectangle (CompRect &cRect)
 
35
 {
 
36
-    if (edgeToGridType () != GridUnknown && optionGetDrawIndicator ())
 
37
+    if (typeToMask (edgeToGridType ()) != GridUnknown && optionGetDrawIndicator ())
 
38
        cRect = desiredSlot;
 
39
     else
 
40
        cRect.setGeometry (0, 0, 0, 0);
 
41
@@ -137,7 +120,7 @@
 
42
 GridScreen::initiateCommon (CompAction         *action,
 
43
                            CompAction::State  state,
 
44
                            CompOption::Vector &option,
 
45
-                           GridType           where,
 
46
+                           unsigned int                where,
 
47
                            bool               resize,
 
48
                            bool               key)
 
49
 {
 
50
@@ -162,12 +145,12 @@
 
51
        if (maximizeV && !(cw->actions () & CompWindowActionMaximizeVertMask))
 
52
            return false;
 
53
 
 
54
-       if (where == GridUnknown)
 
55
+       if (where & GridUnknown)
 
56
            return false;
 
57
 
 
58
        GRID_WINDOW (cw);
 
59
 
 
60
-       if (gw->lastTarget != where)
 
61
+       if (gw->lastTarget & ~(where))
 
62
            gw->resizeCount = 0;
 
63
        else if (!key)
 
64
            return false;
 
65
@@ -197,7 +180,7 @@
 
66
            cw->maximize (0);
 
67
        }
 
68
 
 
69
-       if (where == GridMaximize && resize)
 
70
+       if ((where & GridMaximize) && resize)
 
71
        {
 
72
            /* move the window to the correct output */
 
73
            if (cw == mGrabWindow)
 
74
@@ -358,7 +341,7 @@
 
75
 
 
76
            /* Special case for left and right, actually vertically maximize
 
77
             * the window */
 
78
-           if (where == GridLeft || where == GridRight)
 
79
+           if (where & GridLeft || where & GridRight)
 
80
            {
 
81
                /* First restore the window to its original size */
 
82
                XWindowChanges rwc;
 
83
@@ -539,39 +522,72 @@
 
84
     return status;
 
85
 }
 
86
 
 
87
-GridType
 
88
+unsigned int
 
89
+GridScreen::typeToMask (int t)
 
90
+{
 
91
+    typedef struct {
 
92
+       unsigned int mask;
 
93
+       int type;
 
94
+    } GridTypeMask;
 
95
+
 
96
+    std::vector <GridTypeMask> type =
 
97
+    {
 
98
+       { GridWindowType::GridUnknown, 0 },
 
99
+       { GridWindowType::GridBottomLeft, 1 },
 
100
+       { GridWindowType::GridBottom, 2 },
 
101
+       { GridWindowType::GridBottomRight, 3 },
 
102
+       { GridWindowType::GridLeft, 4 },
 
103
+       { GridWindowType::GridCenter, 5 },
 
104
+       { GridWindowType::GridRight, 6 },
 
105
+       { GridWindowType::GridTopLeft, 7 },
 
106
+       { GridWindowType::GridTop, 8 },
 
107
+       { GridWindowType::GridTopRight, 9 },
 
108
+       { GridWindowType::GridMaximize, 10 }
 
109
+    };
 
110
+
 
111
+    for (unsigned int i = 0; i < type.size (); i++)
 
112
+    {
 
113
+       GridTypeMask &tm = type[i];
 
114
+       if (tm.type == t)
 
115
+           return tm.mask;
 
116
+    }
 
117
+
 
118
+    return GridWindowType::GridUnknown;
 
119
+}
 
120
+
 
121
+int
 
122
 GridScreen::edgeToGridType ()
 
123
 {
 
124
-    GridType ret;
 
125
+    int ret;
 
126
 
 
127
     switch (edge) {
 
128
     case Left:
 
129
-       ret = (GridType) optionGetLeftEdgeAction ();
 
130
+       ret = (int) optionGetLeftEdgeAction ();
 
131
        break;
 
132
     case Right:
 
133
-       ret = (GridType) optionGetRightEdgeAction ();
 
134
+       ret = (int) optionGetRightEdgeAction ();
 
135
        break;
 
136
     case Top:
 
137
-       ret = (GridType) optionGetTopEdgeAction ();
 
138
+       ret = (int) optionGetTopEdgeAction ();
 
139
        break;
 
140
     case Bottom:
 
141
-       ret = (GridType) optionGetBottomEdgeAction ();
 
142
+       ret = (int) optionGetBottomEdgeAction ();
 
143
        break;
 
144
     case TopLeft:
 
145
-       ret = (GridType) optionGetTopLeftCornerAction ();
 
146
+       ret = (int) optionGetTopLeftCornerAction ();
 
147
        break;
 
148
     case TopRight:
 
149
-       ret = (GridType) optionGetTopRightCornerAction ();
 
150
+       ret = (int) optionGetTopRightCornerAction ();
 
151
        break;
 
152
     case BottomLeft:
 
153
-       ret = (GridType) optionGetBottomLeftCornerAction ();
 
154
+       ret = (int) optionGetBottomLeftCornerAction ();
 
155
        break;
 
156
     case BottomRight:
 
157
-       ret = (GridType) optionGetBottomRightCornerAction ();
 
158
+       ret = (int) optionGetBottomRightCornerAction ();
 
159
        break;
 
160
     case NoEdge:
 
161
     default:
 
162
-       ret = GridUnknown;
 
163
+       ret = -1;
 
164
        break;
 
165
     }
 
166
 
 
167
@@ -637,7 +653,7 @@
 
168
        if (cScreen)
 
169
            cScreen->damageRegion (desiredSlot);
 
170
 
 
171
-       initiateCommon (0, 0, o, edgeToGridType (), false, false);
 
172
+       initiateCommon (0, 0, o, typeToMask (edgeToGridType ()), false, false);
 
173
 
 
174
        if (cScreen)
 
175
            cScreen->damageRegion (desiredSlot);
 
176
@@ -655,7 +671,7 @@
 
177
                if (cScreen)
 
178
                        cScreen->damageRegion (desiredSlot);
 
179
 
 
180
-               check = initiateCommon (0, 0, o, edgeToGridType (), false, false);
 
181
+               check = initiateCommon (NULL, 0, o, typeToMask (edgeToGridType ()), false, false);
 
182
 
 
183
                if (cScreen)
 
184
                        cScreen->damageRegion (desiredSlot);
 
185
@@ -742,7 +758,7 @@
 
186
     if (window == gScreen->mGrabWindow)
 
187
     {
 
188
        gScreen->initiateCommon
 
189
-                       (0, 0, gScreen->o, gScreen->edgeToGridType (), true,
 
190
+                       (NULL, 0, gScreen->o, gScreen->typeToMask (gScreen->edgeToGridType ()), true,
 
191
                         gScreen->edge != gScreen->lastResizeEdge);
 
192
 
 
193
        screen->handleEventSetEnabled (gScreen, false);
 
194
@@ -776,6 +792,8 @@
 
195
        dx = currentSize.x () - window->geometry ().x ();
 
196
        dy = currentSize.y () - window->geometry ().y ();
 
197
 
 
198
+       printf ("offset move\n");
 
199
+
 
200
        window->move (dx, dy);
 
201
     }
 
202
 }
 
203
@@ -983,6 +1001,17 @@
 
204
     edge = lastEdge = lastResizeEdge = NoEdge;
 
205
     currentWorkarea = lastWorkarea = screen->getWorkareaForOutput
 
206
                            (screen->outputDeviceForPoint (pointerX, pointerY));
 
207
+    gridProps[GridUnknown] = GridProps {0,1, 1,1};
 
208
+    gridProps[GridBottomLeft]  = GridProps {0,1, 2,2};
 
209
+    gridProps[GridBottom]  = GridProps {0,1, 1,2};
 
210
+    gridProps[GridBottomRight] = GridProps {1,1, 2,2};
 
211
+    gridProps[GridLeft]  = GridProps {0,0, 2,1};
 
212
+    gridProps[GridCenter]  = GridProps{0,0, 1,1};
 
213
+    gridProps[GridRight]  = GridProps {1,0, 2,1};
 
214
+    gridProps[GridTopLeft]  = GridProps{0,0, 2,2};
 
215
+    gridProps[GridTop]  = GridProps {0,0, 1,2};
 
216
+    gridProps[GridTopRight]  = GridProps {0,0, 1,2};
 
217
+    gridProps[GridMaximize]  = GridProps {0,0, 1,1};
 
218
 
 
219
        animations.clear ();
 
220
 
 
221
@@ -990,16 +1019,16 @@
 
222
     optionSet##opt##Initiate (boost::bind (&GridScreen::initiateCommon, this,  \
 
223
                                           _1, _2, _3, where, resize, key))
 
224
 
 
225
-    GRIDSET (PutCenterKey, GridCenter, true, true);
 
226
-    GRIDSET (PutLeftKey, GridLeft, true, true);
 
227
-    GRIDSET (PutRightKey, GridRight, true, true);
 
228
-    GRIDSET (PutTopKey, GridTop, true, true);
 
229
-    GRIDSET (PutBottomKey, GridBottom, true, true);
 
230
-    GRIDSET (PutTopleftKey, GridTopLeft, true, true);
 
231
-    GRIDSET (PutToprightKey, GridTopRight, true, true);
 
232
-    GRIDSET (PutBottomleftKey, GridBottomLeft, true, true);
 
233
-    GRIDSET (PutBottomrightKey, GridBottomRight, true, true);
 
234
-    GRIDSET (PutMaximizeKey, GridMaximize, true, true);
 
235
+    GRIDSET (PutCenterKey, GridWindowType::GridCenter, true, true);
 
236
+    GRIDSET (PutLeftKey, GridWindowType::GridLeft, true, true);
 
237
+    GRIDSET (PutRightKey, GridWindowType::GridRight, true, true);
 
238
+    GRIDSET (PutTopKey, GridWindowType::GridTop, true, true);
 
239
+    GRIDSET (PutBottomKey, GridWindowType::GridBottom, true, true);
 
240
+    GRIDSET (PutTopleftKey, GridWindowType::GridTopLeft, true, true);
 
241
+    GRIDSET (PutToprightKey, GridWindowType::GridTopRight, true, true);
 
242
+    GRIDSET (PutBottomleftKey, GridWindowType::GridBottomLeft, true, true);
 
243
+    GRIDSET (PutBottomrightKey, GridWindowType::GridBottomRight, true, true);
 
244
+    GRIDSET (PutMaximizeKey, GridWindowType::GridMaximize, true, true);
 
245
 
 
246
 #undef GRIDSET
 
247
 
 
248
Index: compiz-plugins-main-0.9.6/grid/src/grid.h
 
249
===================================================================
 
250
--- compiz-plugins-main-0.9.6.orig/grid/src/grid.h      2011-10-07 20:51:08.995976136 +0800
 
251
+++ compiz-plugins-main-0.9.6/grid/src/grid.h   2011-10-07 20:52:00.372230883 +0800
 
252
@@ -114,7 +114,7 @@
 
253
        void setCurrentRect (Animation&);
 
254
 
 
255
        bool initiateCommon (CompAction*, CompAction::State,
 
256
-                            CompOption::Vector&, GridType, bool, bool);
 
257
+                            CompOption::Vector&, unsigned int, bool, bool);
 
258
 
 
259
        void glPaintRectangle (const GLScreenPaintAttrib&,
 
260
                               const GLMatrix&, CompOutput *);
 
261
@@ -128,7 +128,8 @@
 
262
 
 
263
        std::vector <Animation> animations;
 
264
 
 
265
-       GridType edgeToGridType ();
 
266
+       int edgeToGridType ();
 
267
+       unsigned int typeToMask (int);
 
268
 
 
269
        void handleEvent (XEvent *event);
 
270
        void handleCompizEvent (const char *plugin, const char *event, CompOption::Vector &options);