Merge lp:~timo-jyrinki/ubuntu/quantal/compiz/fix_expo into lp:ubuntu/quantal/compiz
- Quantal (12.10)
- fix_expo
- Merge into quantal
Proposed by
Timo Jyrinki
Status: | Merged |
---|---|
Merged at revision: | 3297 |
Proposed branch: | lp:~timo-jyrinki/ubuntu/quantal/compiz/fix_expo |
Merge into: | lp:ubuntu/quantal/compiz |
Diff against target: |
5842 lines (+1/-2906) 3 files modified
debian/changelog (+0/-2) debian/patches/100_expo_layout.patch (+0/-2903) debian/patches/series (+1/-1) |
To merge this branch: | bzr merge lp:~timo-jyrinki/ubuntu/quantal/compiz/fix_expo |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Timo Jyrinki | Needs Information | ||
Ubuntu branches | Pending | ||
Review via email: mp+124114@code.launchpad.net |
Commit message
Description of the change
Fix the expo patch and enable it again. Now works.
To post a comment you must log in.
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote : | # |
FFe now approved.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2012-09-12 12:59:32 +0000 | |||
3 | +++ debian/changelog 2012-09-13 07:34:23 +0000 | |||
4 | @@ -64,8 +64,6 @@ | |||
5 | 64 | * Drop dependency on libgconf2-dev, add gconf2 dependency to the | 64 | * Drop dependency on libgconf2-dev, add gconf2 dependency to the |
6 | 65 | transitional package for migrations | 65 | transitional package for migrations |
7 | 66 | * Add -DUSE_GCONF=OFF to debian/rules | 66 | * Add -DUSE_GCONF=OFF to debian/rules |
8 | 67 | * debian/patches/100_expo_layout.patch | ||
9 | 68 | - Disable temporarily until it really works | ||
10 | 69 | * debian/libdecoration0.symbols | 67 | * debian/libdecoration0.symbols |
11 | 70 | - Add decor_shadow_options_cmp | 68 | - Add decor_shadow_options_cmp |
12 | 71 | 69 | ||
13 | 72 | 70 | ||
14 | === added file 'debian/patches/100_expo_layout.patch' | |||
15 | --- debian/patches/100_expo_layout.patch 1970-01-01 00:00:00 +0000 | |||
16 | +++ debian/patches/100_expo_layout.patch 2012-09-13 07:34:23 +0000 | |||
17 | @@ -0,0 +1,2907 @@ | |||
18 | 1 | Index: ubuntu/plugins/expo/expo.xml.in | ||
19 | 2 | =================================================================== | ||
20 | 3 | --- ubuntu.orig/plugins/expo/expo.xml.in 2012-09-12 22:20:42.944758828 +0800 | ||
21 | 4 | +++ ubuntu/plugins/expo/expo.xml.in 2012-09-12 22:20:43.240760303 +0800 | ||
22 | 5 | @@ -17,6 +17,7 @@ | ||
23 | 6 | <plugin>wobbly</plugin> | ||
24 | 7 | <plugin>animation</plugin> | ||
25 | 8 | <plugin>wallpaper</plugin> | ||
26 | 9 | + <plugin>imgpng</plugin> | ||
27 | 10 | </relation> | ||
28 | 11 | </deps> | ||
29 | 12 | <options> | ||
30 | 13 | @@ -25,7 +26,7 @@ | ||
31 | 14 | <option name="expo_key" type="key"> | ||
32 | 15 | <_short>Expo key</_short> | ||
33 | 16 | <_long>Engage wall expo mode key binding</_long> | ||
34 | 17 | - <default><Super>e</default> | ||
35 | 18 | + <default><Super>s</default> | ||
36 | 19 | </option> | ||
37 | 20 | <option name="expo_button" type="button"> | ||
38 | 21 | <_short>Expo button</_short> | ||
39 | 22 | @@ -35,8 +36,6 @@ | ||
40 | 23 | <option name="expo_edge" type="edge"> | ||
41 | 24 | <_short>Expo edge</_short> | ||
42 | 25 | <_long>Engage wall expo mode edge binding</_long> | ||
43 | 26 | - <default> | ||
44 | 27 | - </default> | ||
45 | 28 | </option> | ||
46 | 29 | <option name="double_click_time" type="int"> | ||
47 | 30 | <_short>Double click time</_short> | ||
48 | 31 | @@ -79,7 +78,7 @@ | ||
49 | 32 | <option name="zoom_time" type="float"> | ||
50 | 33 | <_short>Zoom time</_short> | ||
51 | 34 | <_long>Duration of the zoomout animation</_long> | ||
52 | 35 | - <default>0.5</default> | ||
53 | 36 | + <default>0.3</default> | ||
54 | 37 | <min>0.1</min> | ||
55 | 38 | <max>5.0</max> | ||
56 | 39 | <precision>0.1</precision> | ||
57 | 40 | @@ -130,10 +129,24 @@ | ||
58 | 41 | <_name>Curve</_name> | ||
59 | 42 | </desc> | ||
60 | 43 | </option> | ||
61 | 44 | + <option name="x_offset" type="int"> | ||
62 | 45 | + <_short>X Space</_short> | ||
63 | 46 | + <_long> Left Side screen space of expo in pixels</_long> | ||
64 | 47 | + <min>-1680</min> | ||
65 | 48 | + <max>1680</max> | ||
66 | 49 | + <default>64</default> | ||
67 | 50 | + </option> | ||
68 | 51 | + <option name="y_offset" type="int"> | ||
69 | 52 | + <_short>Y Space</_short> | ||
70 | 53 | + <_long> Top Side screen space of expo in pixels</_long> | ||
71 | 54 | + <min>-100</min> | ||
72 | 55 | + <max>100</max> | ||
73 | 56 | + <default>24</default> | ||
74 | 57 | + </option> | ||
75 | 58 | <option name="distance" type="float"> | ||
76 | 59 | <_short>Distance</_short> | ||
77 | 60 | <_long>Distance of the expo wall</_long> | ||
78 | 61 | - <default>0.0</default> | ||
79 | 62 | + <default>0.005</default> | ||
80 | 63 | <min>0.0</min> | ||
81 | 64 | <max>1.0</max> | ||
82 | 65 | <precision>0.01</precision> | ||
83 | 66 | @@ -141,7 +154,7 @@ | ||
84 | 67 | <option name="vp_distance" type="float"> | ||
85 | 68 | <_short>Viewport distance</_short> | ||
86 | 69 | <_long>Distance between viewports</_long> | ||
87 | 70 | - <default>0.10</default> | ||
88 | 71 | + <default>0.2</default> | ||
89 | 72 | <min>0.0</min> | ||
90 | 73 | <max>1.0</max> | ||
91 | 74 | <precision>0.01</precision> | ||
92 | 75 | @@ -192,7 +205,7 @@ | ||
93 | 76 | <option name="vp_brightness" type="float"> | ||
94 | 77 | <_short>Brightness</_short> | ||
95 | 78 | <_long>Inactive viewport brightness.</_long> | ||
96 | 79 | - <default>75.0</default> | ||
97 | 80 | + <default>40.0</default> | ||
98 | 81 | <min>0.0</min> | ||
99 | 82 | <max>100.0</max> | ||
100 | 83 | <precision>0.1</precision> | ||
101 | 84 | @@ -200,18 +213,28 @@ | ||
102 | 85 | <option name="vp_saturation" type="float"> | ||
103 | 86 | <_short>Saturation</_short> | ||
104 | 87 | <_long>Inactive viewport saturation.</_long> | ||
105 | 88 | - <default>100.0</default> | ||
106 | 89 | + <default>40.0</default> | ||
107 | 90 | <min>0.0</min> | ||
108 | 91 | <max>100.0</max> | ||
109 | 92 | <precision>0.1</precision> | ||
110 | 93 | </option> | ||
111 | 94 | + <option name="selected_color" type="color"> | ||
112 | 95 | + <_short>Selected Color</_short> | ||
113 | 96 | + <_long>Color to use when highlighting the selected viewport</_long> | ||
114 | 97 | + <default> | ||
115 | 98 | + <red>0xfbfb</red> | ||
116 | 99 | + <green>0x8b8b</green> | ||
117 | 100 | + <blue>0x0</blue> | ||
118 | 101 | + <alpha>0xffff</alpha> | ||
119 | 102 | + </default> | ||
120 | 103 | + </option> | ||
121 | 104 | </subgroup> | ||
122 | 105 | <subgroup> | ||
123 | 106 | <short>Reflection</short> | ||
124 | 107 | <option name="reflection" type="bool"> | ||
125 | 108 | <_short>Reflection</_short> | ||
126 | 109 | <_long>Show a reflection of the viewports on the ground</_long> | ||
127 | 110 | - <default>true</default> | ||
128 | 111 | + <default>false</default> | ||
129 | 112 | </option> | ||
130 | 113 | <option name="ground_color1" type="color"> | ||
131 | 114 | <_short>Ground color(near)</_short> | ||
132 | 115 | @@ -244,7 +267,7 @@ | ||
133 | 116 | <option name="scale_factor" type="float"> | ||
134 | 117 | <_short>Reflection Scale</_short> | ||
135 | 118 | <_long>Scale factor of the expo wall reflection</_long> | ||
136 | 119 | - <default>0.75</default> | ||
137 | 120 | + <default>1.0</default> | ||
138 | 121 | <min>0.0</min> | ||
139 | 122 | <max>2.0</max> | ||
140 | 123 | <precision>0.01</precision> | ||
141 | 124 | Index: ubuntu/plugins/expo/src/expo.cpp | ||
142 | 125 | =================================================================== | ||
143 | 126 | --- ubuntu.orig/plugins/expo/src/expo.cpp 2012-09-12 22:09:32.323735000 +0800 | ||
144 | 127 | +++ ubuntu/plugins/expo/src/expo.cpp 2012-09-12 22:29:50.643474721 +0800 | ||
145 | 128 | @@ -27,6 +27,8 @@ | ||
146 | 129 | |||
147 | 130 | #include "expo.h" | ||
148 | 131 | #include "click-threshold.h" | ||
149 | 132 | +#include "wall-offset.h" | ||
150 | 133 | +#include "windows-on-viewport.h" | ||
151 | 134 | #include <math.h> | ||
152 | 135 | #ifndef USE_GLES | ||
153 | 136 | #include <GL/glu.h> | ||
154 | 137 | @@ -73,11 +75,10 @@ | ||
155 | 138 | |||
156 | 139 | if (dndState == DnDDuring || dndState == DnDStart) | ||
157 | 140 | { | ||
158 | 141 | - if (dndWindow) | ||
159 | 142 | + if (dndWindows.size ()) | ||
160 | 143 | finishWindowMovement (); | ||
161 | 144 | |||
162 | 145 | dndState = DnDNone; | ||
163 | 146 | - dndWindow = NULL; | ||
164 | 147 | |||
165 | 148 | action->setState (action->state () & CompAction::StateInitButton); | ||
166 | 149 | cScreen->damageScreen (); | ||
167 | 150 | @@ -113,7 +114,6 @@ | ||
168 | 151 | clickTime = 0; | ||
169 | 152 | |||
170 | 153 | dndState = DnDNone; | ||
171 | 154 | - dndWindow = NULL; | ||
172 | 155 | |||
173 | 156 | selectedVp = screen->vp (); | ||
174 | 157 | lastSelectedVp = screen->vp (); | ||
175 | 158 | @@ -156,8 +156,8 @@ | ||
176 | 159 | else | ||
177 | 160 | vpUpdateMode = VPUpdateMouseOver; | ||
178 | 161 | |||
179 | 162 | - dndState = DnDNone; | ||
180 | 163 | - dndWindow = NULL; | ||
181 | 164 | + dndState = DnDNone; | ||
182 | 165 | + dndWindows.clear (); | ||
183 | 166 | |||
184 | 167 | screen->removeAction (&optionGetDndButton ()); | ||
185 | 168 | screen->removeAction (&optionGetExitButton ()); | ||
186 | 169 | @@ -202,6 +202,8 @@ | ||
187 | 170 | if (!expoMode) | ||
188 | 171 | return false; | ||
189 | 172 | |||
190 | 173 | + lastSelectedVp = selectedVp; | ||
191 | 174 | + | ||
192 | 175 | newX = selectedVp.x () + 1; | ||
193 | 176 | newY = selectedVp.y (); | ||
194 | 177 | |||
195 | 178 | @@ -225,7 +227,7 @@ | ||
196 | 179 | CompAction::State state, | ||
197 | 180 | CompOption::Vector& options) | ||
198 | 181 | { | ||
199 | 182 | - int newX, newY; | ||
200 | 183 | + unsigned int newX, newY; | ||
201 | 184 | Window xid = CompOption::getIntOptionNamed (options, "root", 0); | ||
202 | 185 | if (xid != screen->root ()) | ||
203 | 186 | return false; | ||
204 | 187 | @@ -272,53 +274,39 @@ | ||
205 | 188 | void | ||
206 | 189 | ExpoScreen::finishWindowMovement () | ||
207 | 190 | { | ||
208 | 191 | - dndWindow->syncPosition (); | ||
209 | 192 | - dndWindow->ungrabNotify (); | ||
210 | 193 | - | ||
211 | 194 | - screen->moveViewport (screen->vp ().x () - selectedVp.x (), | ||
212 | 195 | - screen->vp ().y () - selectedVp.y (), true); | ||
213 | 196 | - | ||
214 | 197 | - /* update saved window attributes in case we moved the | ||
215 | 198 | - window to a new viewport */ | ||
216 | 199 | - if (dndWindow->saveMask () & CWX) | ||
217 | 200 | - { | ||
218 | 201 | - dndWindow->saveWc ().x = dndWindow->saveWc ().x % screen->width (); | ||
219 | 202 | - if (dndWindow->saveWc ().x < 0) | ||
220 | 203 | - dndWindow->saveWc ().x += screen->width (); | ||
221 | 204 | - } | ||
222 | 205 | - if (dndWindow->saveMask () & CWY) | ||
223 | 206 | + foreach (CompWindow *dndWindow, dndWindows) | ||
224 | 207 | { | ||
225 | 208 | - dndWindow->saveWc ().y = dndWindow->saveWc ().y % screen->height (); | ||
226 | 209 | - if (dndWindow->saveWc ().y < 0) | ||
227 | 210 | - dndWindow->saveWc ().y += screen->height (); | ||
228 | 211 | - } | ||
229 | 212 | - | ||
230 | 213 | - /* update window attibutes to make sure a moved maximized window | ||
231 | 214 | - is properly snapped to the work area */ | ||
232 | 215 | - if (dndWindow->state () & MAXIMIZE_STATE) | ||
233 | 216 | - dndWindow->updateAttributes (CompStackingUpdateModeNone); | ||
234 | 217 | - | ||
235 | 218 | -#if 0 /* FIXME: obsolete in the meantime? */ | ||
236 | 219 | - { | ||
237 | 220 | - int lastOutput; | ||
238 | 221 | - int centerX, centerY; | ||
239 | 222 | + if (dndWindow->grabbed ()) | ||
240 | 223 | + { | ||
241 | 224 | + dndWindow->syncPosition (); | ||
242 | 225 | + dndWindow->ungrabNotify (); | ||
243 | 226 | |||
244 | 227 | - /* make sure we snap to the correct output */ | ||
245 | 228 | - lastOutput = s->currentOutputDev; | ||
246 | 229 | - centerX = (WIN_X (w) + WIN_W (w) / 2) % s->width; | ||
247 | 230 | - if (centerX < 0) | ||
248 | 231 | - centerX += s->width; | ||
249 | 232 | - centerY = (WIN_Y (w) + WIN_H (w) / 2) % s->height; | ||
250 | 233 | - if (centerY < 0) | ||
251 | 234 | - centerY += s->height; | ||
252 | 235 | + screen->updateGrab (grabIndex, None); | ||
253 | 236 | |||
254 | 237 | - s->currentOutputDev = outputDeviceForPoint (s, centerX, centerY); | ||
255 | 238 | + screen->moveViewport (screen->vp ().x () - selectedVp.x (), | ||
256 | 239 | + screen->vp ().y () - selectedVp.y (), true); | ||
257 | 240 | |||
258 | 241 | - updateWindowAttributes (w, CompStackingUpdateModeNone); | ||
259 | 242 | + /* update saved window attributes in case we moved the | ||
260 | 243 | + window to a new viewport */ | ||
261 | 244 | + if (dndWindow->saveMask () & CWX) | ||
262 | 245 | + { | ||
263 | 246 | + dndWindow->saveWc ().x = dndWindow->saveWc ().x % screen->width (); | ||
264 | 247 | + if (dndWindow->saveWc ().x < 0) | ||
265 | 248 | + dndWindow->saveWc ().x += screen->width (); | ||
266 | 249 | + } | ||
267 | 250 | + if (dndWindow->saveMask () & CWY) | ||
268 | 251 | + { | ||
269 | 252 | + dndWindow->saveWc ().y = dndWindow->saveWc ().y % screen->height (); | ||
270 | 253 | + if (dndWindow->saveWc ().y < 0) | ||
271 | 254 | + dndWindow->saveWc ().y += screen->height (); | ||
272 | 255 | + } | ||
273 | 256 | |||
274 | 257 | - s->currentOutputDev = lastOutput; | ||
275 | 258 | + /* update window attibutes to make sure a moved maximized window | ||
276 | 259 | + is properly snapped to the work area */ | ||
277 | 260 | + if (dndWindow->state () & MAXIMIZE_STATE) | ||
278 | 261 | + dndWindow->updateAttributes (CompStackingUpdateModeNone); | ||
279 | 262 | + } | ||
280 | 263 | } | ||
281 | 264 | -#endif | ||
282 | 265 | } | ||
283 | 266 | |||
284 | 267 | void | ||
285 | 268 | @@ -402,6 +390,80 @@ | ||
286 | 269 | screen->handleEvent (event); | ||
287 | 270 | } | ||
288 | 271 | |||
289 | 272 | +bool | ||
290 | 273 | +ExpoWindow::dragged () const | ||
291 | 274 | +{ | ||
292 | 275 | + ExpoScreen *es = ExpoScreen::get (screen); | ||
293 | 276 | + | ||
294 | 277 | + return std::find (es->dndWindows.begin (), es->dndWindows.end (), window) != es->dndWindows.end (); | ||
295 | 278 | +} | ||
296 | 279 | + | ||
297 | 280 | +const compiz::window::Geometry & | ||
298 | 281 | +ExpoWindow::absoluteGeometry () const | ||
299 | 282 | +{ | ||
300 | 283 | + const compiz::window::Geometry &relativeGeometry (window->geometry ()); | ||
301 | 284 | + mAbsoluteGeometry.set ((screen->vp ().x () * screen->width ()) + relativeGeometry.x (), | ||
302 | 285 | + (screen->vp ().y () * screen->height ()) + relativeGeometry.y (), | ||
303 | 286 | + relativeGeometry.width (), | ||
304 | 287 | + relativeGeometry.height (), | ||
305 | 288 | + relativeGeometry.border ()); | ||
306 | 289 | + | ||
307 | 290 | + return mAbsoluteGeometry; | ||
308 | 291 | +} | ||
309 | 292 | + | ||
310 | 293 | +bool | ||
311 | 294 | +ExpoWindow::isDesktopOrDock () const | ||
312 | 295 | +{ | ||
313 | 296 | + return window->type () == CompWindowTypeDesktopMask || | ||
314 | 297 | + window->type () == CompWindowTypeDockMask; | ||
315 | 298 | +} | ||
316 | 299 | + | ||
317 | 300 | +namespace cei = compiz::expo::impl; | ||
318 | 301 | + | ||
319 | 302 | +cei::CompizClientListGenerator::CompizClientListGenerator (CompScreen *screen) : | ||
320 | 303 | + mScreen (screen), | ||
321 | 304 | + mClientList (&mScreen->clientList (true)), | ||
322 | 305 | + mClientListIterator (mClientList->begin ()) | ||
323 | 306 | +{ | ||
324 | 307 | +} | ||
325 | 308 | + | ||
326 | 309 | +compiz::expo::ViewportMemberWindow * | ||
327 | 310 | +cei::CompizClientListGenerator::nextClient () | ||
328 | 311 | +{ | ||
329 | 312 | + if (mClientListIterator == mClientList->end ()) | ||
330 | 313 | + return NULL; | ||
331 | 314 | + | ||
332 | 315 | + compiz::expo::ViewportMemberWindow *vpMemberWindow = ExpoWindow::get (*mClientListIterator); | ||
333 | 316 | + | ||
334 | 317 | + ++mClientListIterator; | ||
335 | 318 | + | ||
336 | 319 | + return vpMemberWindow; | ||
337 | 320 | +} | ||
338 | 321 | + | ||
339 | 322 | +bool | ||
340 | 323 | +ExpoScreen::windowsOnVp (compiz::expo::ClientListGenerator &clientList, | ||
341 | 324 | + CompPoint &p, | ||
342 | 325 | + const CompPoint &unprojectedCursor, | ||
343 | 326 | + const CompSize &screenSize, | ||
344 | 327 | + CompScreen *screen) | ||
345 | 328 | +{ | ||
346 | 329 | + return false; | ||
347 | 330 | +} | ||
348 | 331 | + | ||
349 | 332 | +namespace | ||
350 | 333 | +{ | ||
351 | 334 | + void fillInNewViewportActivityData (unsigned int vpCount, | ||
352 | 335 | + std::vector <float> &vpActivity) | ||
353 | 336 | + { | ||
354 | 337 | + if (vpActivity.size () < vpCount) | ||
355 | 338 | + { | ||
356 | 339 | + vpActivity.resize (vpCount); | ||
357 | 340 | + foreach (float& activity, vpActivity) | ||
358 | 341 | + activity = 1.0f; | ||
359 | 342 | + } | ||
360 | 343 | + } | ||
361 | 344 | +} | ||
362 | 345 | + | ||
363 | 346 | void | ||
364 | 347 | ExpoScreen::preparePaint (int msSinceLastPaint) | ||
365 | 348 | { | ||
366 | 349 | @@ -412,33 +474,43 @@ | ||
367 | 350 | else | ||
368 | 351 | expoCam = MAX (0.0, expoCam - val); | ||
369 | 352 | |||
370 | 353 | - if (expoCam) | ||
371 | 354 | + if (dndState == DnDDuring) | ||
372 | 355 | { | ||
373 | 356 | - unsigned int i, j, vp; | ||
374 | 357 | - unsigned int vpCount = screen->vpSize ().width () * | ||
375 | 358 | - screen->vpSize ().height (); | ||
376 | 359 | + foreach (CompWindow *w, dndWindows) | ||
377 | 360 | + ExpoWindow::get (w)->dndOpacity = MIN (1.0, ExpoWindow::get (w)->dndOpacity + val); | ||
378 | 361 | + } | ||
379 | 362 | + else if (dndState == DnDNone) | ||
380 | 363 | + { | ||
381 | 364 | + CompWindowList::iterator it = dndWindows.begin (); | ||
382 | 365 | |||
383 | 366 | - if (vpActivity.size () < vpCount) | ||
384 | 367 | + while (it != dndWindows.end ()) | ||
385 | 368 | { | ||
386 | 369 | - vpActivity.resize (vpCount); | ||
387 | 370 | - foreach (float& activity, vpActivity) | ||
388 | 371 | - activity = 1.0f; | ||
389 | 372 | - } | ||
390 | 373 | + ExpoWindow::get ((*it))->dndOpacity = MAX (0.0, ExpoWindow::get ((*it))->dndOpacity - val); | ||
391 | 374 | |||
392 | 375 | - for (i = 0; i < (unsigned int) screen->vpSize ().width (); i++) | ||
393 | 376 | - { | ||
394 | 377 | - for (j = 0; j < (unsigned int) screen->vpSize ().height (); j++) | ||
395 | 378 | + if (ExpoWindow::get ((*it))->dndOpacity <= 0.0f) | ||
396 | 379 | { | ||
397 | 380 | - vp = (j * screen->vpSize ().width ()) + i; | ||
398 | 381 | - | ||
399 | 382 | - if (CompPoint (i, j) == selectedVp) | ||
400 | 383 | - vpActivity[vp] = MIN (1.0, vpActivity[vp] + val); | ||
401 | 384 | - else | ||
402 | 385 | - vpActivity[vp] = MAX (0.0, vpActivity[vp] - val); | ||
403 | 386 | + dndWindows.erase (it); | ||
404 | 387 | + it = dndWindows.begin (); | ||
405 | 388 | } | ||
406 | 389 | + else | ||
407 | 390 | + it++; | ||
408 | 391 | } | ||
409 | 392 | + } | ||
410 | 393 | |||
411 | 394 | - for (i = 0; i < 360; i++) | ||
412 | 395 | + if (expoCam) | ||
413 | 396 | + { | ||
414 | 397 | + unsigned int vpCount = compiz::expo::countViewports (screen->vpSize ()); | ||
415 | 398 | + | ||
416 | 399 | + fillInNewViewportActivityData (vpCount, vpActivity); | ||
417 | 400 | + compiz::expo::fillInNewViewportActiveData (vpCount, vpActive); | ||
418 | 401 | + | ||
419 | 402 | + for (unsigned int i = 0; i < vpCount; i++) | ||
420 | 403 | + if (vpActive[i]) | ||
421 | 404 | + vpActivity[i] = MIN (1.0, vpActivity[i] + val); | ||
422 | 405 | + else | ||
423 | 406 | + vpActivity[i] = MAX (0.0, vpActivity[i] - val); | ||
424 | 407 | + | ||
425 | 408 | + for (int i = 0; i < 360; i++) | ||
426 | 409 | { | ||
427 | 410 | float fi = (float) i; | ||
428 | 411 | |||
429 | 412 | @@ -509,6 +581,31 @@ | ||
430 | 413 | cScreen->paint (outputs, mask); | ||
431 | 414 | } | ||
432 | 415 | |||
433 | 416 | +namespace | ||
434 | 417 | +{ | ||
435 | 418 | + void updateViewportActiveStates (CompScreen *screen) | ||
436 | 419 | + { | ||
437 | 420 | + ExpoScreen *es = ExpoScreen::get (screen); | ||
438 | 421 | + | ||
439 | 422 | + unsigned int vpCount = compiz::expo::countViewports (screen->vpSize ()); | ||
440 | 423 | + fillInNewViewportActivityData (vpCount, es->vpActivity); | ||
441 | 424 | + | ||
442 | 425 | + for (int i = 0; i < screen->vpSize ().width (); i++) | ||
443 | 426 | + { | ||
444 | 427 | + for (int j = 0; j < screen->vpSize ().height (); j++) | ||
445 | 428 | + { | ||
446 | 429 | + compiz::expo::impl::CompizClientListGenerator clientList (screen); | ||
447 | 430 | + | ||
448 | 431 | + compiz::expo::activeViewportsForMembers (clientList, | ||
449 | 432 | + es->newCursor, | ||
450 | 433 | + screen->vpSize (), | ||
451 | 434 | + *screen, | ||
452 | 435 | + es->vpActive); | ||
453 | 436 | + } | ||
454 | 437 | + } | ||
455 | 438 | + } | ||
456 | 439 | +} | ||
457 | 440 | + | ||
458 | 441 | void | ||
459 | 442 | ExpoScreen::donePaint () | ||
460 | 443 | { | ||
461 | 444 | @@ -539,6 +636,11 @@ | ||
462 | 445 | foreach (float& vp, vpActivity) | ||
463 | 446 | if (vp != 0.0 && vp != 1.0) | ||
464 | 447 | cScreen->damageScreen (); | ||
465 | 448 | + | ||
466 | 449 | + foreach (CompWindow *w, dndWindows) | ||
467 | 450 | + if (ExpoWindow::get (w)->dndOpacity != 0.0f && | ||
468 | 451 | + ExpoWindow::get (w)->dndOpacity != 1.0f) | ||
469 | 452 | + cScreen->damageScreen (); | ||
470 | 453 | } | ||
471 | 454 | |||
472 | 455 | if (grabIndex && expoCam <= 0.0f && !expoMode) | ||
473 | 456 | @@ -553,10 +655,25 @@ | ||
474 | 457 | switch (dndState) { | ||
475 | 458 | case DnDDuring: | ||
476 | 459 | { | ||
477 | 460 | - if (dndWindow) | ||
478 | 461 | - dndWindow->move (newCursor.x () - prevCursor.x (), | ||
479 | 462 | - newCursor.y () - prevCursor.y (), | ||
480 | 463 | - optionGetExpoImmediateMove ()); | ||
481 | 464 | + if (dndWindows.size ()) | ||
482 | 465 | + { | ||
483 | 466 | + foreach (CompWindow *dndWindow, dndWindows) | ||
484 | 467 | + { | ||
485 | 468 | + if (dndWindow->grabbed ()) | ||
486 | 469 | + { | ||
487 | 470 | + ExpoWindow *ew = ExpoWindow::get (dndWindow); | ||
488 | 471 | + | ||
489 | 472 | + /* No need to update twice */ | ||
490 | 473 | + dndWindow->moveNotifySetEnabled (ew, false); | ||
491 | 474 | + dndWindow->move (newCursor.x () - prevCursor.x (), | ||
492 | 475 | + newCursor.y () - prevCursor.y (), | ||
493 | 476 | + optionGetExpoImmediateMove ()); | ||
494 | 477 | + dndWindow->moveNotifySetEnabled (ew, true); | ||
495 | 478 | + | ||
496 | 479 | + updateViewportActiveStates (screen); | ||
497 | 480 | + } | ||
498 | 481 | + } | ||
499 | 482 | + } | ||
500 | 483 | |||
501 | 484 | prevCursor = newCursor; | ||
502 | 485 | cScreen->damageScreen (); | ||
503 | 486 | @@ -621,13 +738,13 @@ | ||
504 | 487 | break; | ||
505 | 488 | |||
506 | 489 | dndState = DnDDuring; | ||
507 | 490 | - dndWindow = w; | ||
508 | 491 | + dndWindows.push_back (w); | ||
509 | 492 | |||
510 | 493 | w->grabNotify (nx, ny, 0, | ||
511 | 494 | CompWindowGrabMoveMask | | ||
512 | 495 | CompWindowGrabButtonMask); | ||
513 | 496 | |||
514 | 497 | - screen->updateGrab (grabIndex, dragCursor); | ||
515 | 498 | + screen->updateGrab (grabIndex, mMoveCursor); | ||
516 | 499 | |||
517 | 500 | w->raise (); | ||
518 | 501 | w->moveInputFocusTo (); | ||
519 | 502 | @@ -762,6 +879,124 @@ | ||
520 | 503 | } | ||
521 | 504 | |||
522 | 505 | void | ||
523 | 506 | +ExpoScreen::paintViewport (const GLScreenPaintAttrib& attrib, | ||
524 | 507 | + const GLMatrix& transform, | ||
525 | 508 | + const CompRegion& region, | ||
526 | 509 | + CompOutput *output, | ||
527 | 510 | + unsigned int mask, | ||
528 | 511 | + CompPoint vpPos, | ||
529 | 512 | + GLVector &vpCamPos, | ||
530 | 513 | + bool reflection) | ||
531 | 514 | +{ | ||
532 | 515 | + GLMatrix sTransform (transform); | ||
533 | 516 | + GLMatrix sTransform2, sTransform3; | ||
534 | 517 | + float sx = (float) screen->width () / output->width (); | ||
535 | 518 | + float sy = (float) screen->height () / output->height (); | ||
536 | 519 | + float vpp; | ||
537 | 520 | + float progress = sigmoidProgress (expoCam); | ||
538 | 521 | + unsigned int vp; | ||
539 | 522 | + CompPoint vpSize (screen->vpSize ().width (), screen->vpSize ().height ()); | ||
540 | 523 | + | ||
541 | 524 | + const float gapY = optionGetVpDistance () * 0.1f * expoCam; | ||
542 | 525 | + const float gapX = optionGetVpDistance () * 0.1f * screen->height () / | ||
543 | 526 | + screen->width () * expoCam; | ||
544 | 527 | + | ||
545 | 528 | + /* not sure this will work with different resolutions */ | ||
546 | 529 | + sTransform.translate (0.0, MAX (0, vpPos.y ()) * -(sy + gapY), 0.0f); | ||
547 | 530 | + | ||
548 | 531 | + sTransform2 = sTransform; | ||
549 | 532 | + | ||
550 | 533 | + /* not sure this will work with different resolutions */ | ||
551 | 534 | + if (optionGetDeform () != DeformCurve) | ||
552 | 535 | + sTransform2.translate (MAX (0, vpPos.x ()) * (sx + gapX), 0.0f, 0.0); | ||
553 | 536 | + | ||
554 | 537 | + | ||
555 | 538 | + if (optionGetExpoAnimation () == ExpoAnimationVortex) | ||
556 | 539 | + sTransform2.rotate (360 * expoCam, | ||
557 | 540 | + 0.0f, 1.0f, 2.0f * expoCam); | ||
558 | 541 | + | ||
559 | 542 | + sTransform3 = sTransform2; | ||
560 | 543 | + | ||
561 | 544 | + sTransform3.translate (output->x () / output->width (), | ||
562 | 545 | + -output->y () / output->height (), 0.0); | ||
563 | 546 | + | ||
564 | 547 | + cScreen->setWindowPaintOffset ((screen->vp ().x () - vpPos.x ()) * | ||
565 | 548 | + screen->width (), | ||
566 | 549 | + (screen->vp ().y () - vpPos.y ()) * | ||
567 | 550 | + screen->height ()); | ||
568 | 551 | + | ||
569 | 552 | + vp = (vpPos.y () * vpSize.x ()) + vpPos.x (); | ||
570 | 553 | + | ||
571 | 554 | + vpp = (expoCam * vpActivity[vp]) + (1 - expoCam); | ||
572 | 555 | + vpp = sigmoidProgress (vpp); | ||
573 | 556 | + | ||
574 | 557 | + vpBrightness = vpp + ((1.0 - vpp) * | ||
575 | 558 | + optionGetVpBrightness () / 100.0); | ||
576 | 559 | + vpSaturation = vpp + ((1.0 - vpp) * | ||
577 | 560 | + optionGetVpSaturation () / 100.0); | ||
578 | 561 | + | ||
579 | 562 | + paintingVp = vpPos; | ||
580 | 563 | + | ||
581 | 564 | + if (optionGetDeform () == DeformCurve) | ||
582 | 565 | + { | ||
583 | 566 | + float rotateX; | ||
584 | 567 | + | ||
585 | 568 | + sTransform3.translate (-vpCamPos[GLVector::x], 0.0f, | ||
586 | 569 | + curveDistance - DEFAULT_Z_CAMERA); | ||
587 | 570 | + | ||
588 | 571 | + rotateX = -vpPos.x () + interpolate (((float) vpSize.x () / 2.0) - 0.5, | ||
589 | 572 | + screen->vp ().x (), progress); | ||
590 | 573 | + | ||
591 | 574 | + sTransform3.rotate (curveAngle * rotateX, 0.0, 1.0, 0.0); | ||
592 | 575 | + | ||
593 | 576 | + sTransform3.translate (vpCamPos[GLVector::x], 0.0f, | ||
594 | 577 | + DEFAULT_Z_CAMERA - curveDistance); | ||
595 | 578 | + } | ||
596 | 579 | + | ||
597 | 580 | + if (paintingDndWindow) | ||
598 | 581 | + cScreen->getWindowPaintListSetEnabled (this, true); | ||
599 | 582 | + gScreen->glPaintTransformedOutput (attrib, sTransform3, | ||
600 | 583 | + screen->region (), output, | ||
601 | 584 | + mask); | ||
602 | 585 | + | ||
603 | 586 | + if (paintingDndWindow) | ||
604 | 587 | + cScreen->getWindowPaintListSetEnabled (this, false); | ||
605 | 588 | + | ||
606 | 589 | + if (!reflection && !paintingDndWindow) | ||
607 | 590 | + { | ||
608 | 591 | + int cursor[2] = { pointerX, pointerY }; | ||
609 | 592 | + | ||
610 | 593 | + invertTransformedVertex (attrib, sTransform3, | ||
611 | 594 | + output, cursor); | ||
612 | 595 | + | ||
613 | 596 | + if ((cursor[0] > 0) && (cursor[0] < (int) screen->width ()) && | ||
614 | 597 | + (cursor[1] > 0) && (cursor[1] < (int) screen->height ())) | ||
615 | 598 | + { | ||
616 | 599 | + newCursor.setX (vpPos.x () * screen->width () + cursor[0]); | ||
617 | 600 | + newCursor.setY (vpPos.y () * screen->height () + cursor[1]); | ||
618 | 601 | + | ||
619 | 602 | + if (anyClick || dndState != DnDNone) | ||
620 | 603 | + { | ||
621 | 604 | + /* Used to save last viewport interaction was in */ | ||
622 | 605 | + selectedVp = vpPos; | ||
623 | 606 | + anyClick = false; | ||
624 | 607 | + } | ||
625 | 608 | + } | ||
626 | 609 | + } | ||
627 | 610 | + | ||
628 | 611 | + /* Calculate the current viewport size */ | ||
629 | 612 | + int tl[2] = { 0, 0 }; | ||
630 | 613 | + int br[2] = { screen->width (), screen->height () }; | ||
631 | 614 | + | ||
632 | 615 | + invertTransformedVertex (attrib, sTransform3, output, tl); | ||
633 | 616 | + invertTransformedVertex (attrib, sTransform3, output, br); | ||
634 | 617 | + | ||
635 | 618 | + viewport_size = CompSize (br[0] - tl[0], br[1] - tl[1]); | ||
636 | 619 | + | ||
637 | 620 | + cScreen->setWindowPaintOffset (0, 0); | ||
638 | 621 | +} | ||
639 | 622 | + | ||
640 | 623 | +void | ||
641 | 624 | ExpoScreen::paintWall (const GLScreenPaintAttrib& attrib, | ||
642 | 625 | const GLMatrix& transform, | ||
643 | 626 | const CompRegion& region, | ||
644 | 627 | @@ -772,13 +1007,11 @@ | ||
645 | 628 | GLfloat vertexData[12]; | ||
646 | 629 | GLushort colorData[16]; | ||
647 | 630 | GLMatrix sTransformW, sTransform (transform); | ||
648 | 631 | - int i, j, vp; | ||
649 | 632 | GLenum oldFilter = gScreen->textureFilter (); | ||
650 | 633 | - | ||
651 | 634 | - float sx = (float) screen->width () / output->width (); | ||
652 | 635 | - float sy = (float) screen->height () / output->height (); | ||
653 | 636 | + float sx = (float) screen->width () / output->width (); | ||
654 | 637 | + float sy = (float) screen->height () / output->height (); | ||
655 | 638 | float biasZ; | ||
656 | 639 | - float oScale, rotation = 0.0f, progress, vpp; | ||
657 | 640 | + float oScale, rotation = 0.0f, progress; | ||
658 | 641 | float aspectX = 1.0f, aspectY = 1.0f; | ||
659 | 642 | GLVector cam; | ||
660 | 643 | CompPoint vpSize (screen->vpSize ().width (), screen->vpSize ().height ()); | ||
661 | 644 | @@ -910,9 +1143,24 @@ | ||
662 | 645 | sTransform.rotate (rotation, 0.0f, 1.0f, 0.0f); | ||
663 | 646 | sTransform.scale (aspectX, aspectY, 1.0); | ||
664 | 647 | |||
665 | 648 | + CompPoint offsetInScreenCoords (optionGetXOffset (), | ||
666 | 649 | + optionGetYOffset ()); | ||
667 | 650 | + float offsetInWorldCoordX, offsetInWorldCoordY, worldScaleFactorX, worldScaleFactorY; | ||
668 | 651 | + | ||
669 | 652 | + compiz::expo::calculateWallOffset (*output, | ||
670 | 653 | + offsetInScreenCoords, | ||
671 | 654 | + vpSize, | ||
672 | 655 | + *screen, | ||
673 | 656 | + offsetInWorldCoordX, | ||
674 | 657 | + offsetInWorldCoordY, | ||
675 | 658 | + worldScaleFactorX, | ||
676 | 659 | + worldScaleFactorY, | ||
677 | 660 | + sigmoidProgress (expoCam)); | ||
678 | 661 | + | ||
679 | 662 | /* translate expo to center */ | ||
680 | 663 | - sTransform.translate (vpSize.x () * sx * -0.5, | ||
681 | 664 | - vpSize.y () * sy * 0.5, 0.0f); | ||
682 | 665 | + sTransform.translate (vpSize.x () * sx * -0.5 + offsetInWorldCoordX, | ||
683 | 666 | + vpSize.y () * sy * 0.5 - offsetInWorldCoordY, 0.0f); | ||
684 | 667 | + sTransform.scale (worldScaleFactorX, worldScaleFactorY, 1.0f); | ||
685 | 668 | |||
686 | 669 | if (optionGetDeform () == DeformCurve) | ||
687 | 670 | sTransform.translate ((vpSize.x () - 1) * sx * 0.5, 0.0, 0.0); | ||
688 | 671 | @@ -936,90 +1184,29 @@ | ||
689 | 672 | |||
690 | 673 | expoActive = true; | ||
691 | 674 | |||
692 | 675 | - for (j = 0; j < vpSize.y (); j++) | ||
693 | 676 | - { | ||
694 | 677 | - GLMatrix sTransform2 (sTransform), sTransform3; | ||
695 | 678 | - | ||
696 | 679 | - for (i = 0; i < vpSize.x (); i++) | ||
697 | 680 | - { | ||
698 | 681 | - if (optionGetExpoAnimation () == ExpoAnimationVortex) | ||
699 | 682 | - sTransform2.rotate (360 * expoCam, | ||
700 | 683 | - 0.0f, 1.0f, 2.0f * expoCam); | ||
701 | 684 | - | ||
702 | 685 | - sTransform3 = sTransform2; | ||
703 | 686 | - | ||
704 | 687 | - sTransform3.translate (output->x () / output->width (), | ||
705 | 688 | - -output->y () / output->height (), 0.0); | ||
706 | 689 | - | ||
707 | 690 | - cScreen->setWindowPaintOffset ((screen->vp ().x () - i) * | ||
708 | 691 | - screen->width (), | ||
709 | 692 | - (screen->vp ().y () - j) * | ||
710 | 693 | - screen->height ()); | ||
711 | 694 | - | ||
712 | 695 | - vp = (j * vpSize.x ()) + i; | ||
713 | 696 | - | ||
714 | 697 | - vpp = (expoCam * vpActivity[vp]) + (1 - expoCam); | ||
715 | 698 | - vpp = sigmoidProgress (vpp); | ||
716 | 699 | - | ||
717 | 700 | - vpBrightness = vpp + ((1.0 - vpp) * | ||
718 | 701 | - optionGetVpBrightness () / 100.0); | ||
719 | 702 | - vpSaturation = vpp + ((1.0 - vpp) * | ||
720 | 703 | - optionGetVpSaturation () / 100.0); | ||
721 | 704 | + for (int j = 0; j < screen->vpSize ().height (); j++) | ||
722 | 705 | + for (int i = 0; i < screen->vpSize().width (); i++) | ||
723 | 706 | + paintViewport (attrib, sTransform, region, output, mask, CompPoint (i, j), vpCamPos, reflection); | ||
724 | 707 | |||
725 | 708 | - paintingVp.set (i, j); | ||
726 | 709 | + paintingDndWindow = true; | ||
727 | 710 | |||
728 | 711 | - if (optionGetDeform () == DeformCurve) | ||
729 | 712 | - { | ||
730 | 713 | - float rotateX; | ||
731 | 714 | - | ||
732 | 715 | - sTransform3.translate (-vpCamPos[GLVector::x], 0.0f, | ||
733 | 716 | - curveDistance - DEFAULT_Z_CAMERA); | ||
734 | 717 | - | ||
735 | 718 | - rotateX = -i + interpolate (((float) vpSize.x () / 2.0) - 0.5, | ||
736 | 719 | - screen->vp ().x (), progress); | ||
737 | 720 | - | ||
738 | 721 | - sTransform3.rotate (curveAngle * rotateX, 0.0, 1.0, 0.0); | ||
739 | 722 | - | ||
740 | 723 | - sTransform3.translate (vpCamPos[GLVector::x], 0.0f, | ||
741 | 724 | - DEFAULT_Z_CAMERA - curveDistance); | ||
742 | 725 | - } | ||
743 | 726 | - | ||
744 | 727 | - gScreen->glPaintTransformedOutput (attrib, sTransform3, | ||
745 | 728 | - screen->region (), output, | ||
746 | 729 | - mask); | ||
747 | 730 | - | ||
748 | 731 | - if (!reflection) | ||
749 | 732 | - { | ||
750 | 733 | - int cursor[2] = { pointerX, pointerY }; | ||
751 | 734 | + foreach (CompWindow *dndWindow, dndWindows) | ||
752 | 735 | + { | ||
753 | 736 | + CompPoint vp; | ||
754 | 737 | |||
755 | 738 | - invertTransformedVertex (attrib, sTransform3, | ||
756 | 739 | - output, cursor); | ||
757 | 740 | + screen->viewportForGeometry (dndWindow->geometry (), vp); | ||
758 | 741 | |||
759 | 742 | - if ((cursor[0] > 0) && (cursor[0] < (int) screen->width ()) && | ||
760 | 743 | - (cursor[1] > 0) && (cursor[1] < (int) screen->height ())) | ||
761 | 744 | - { | ||
762 | 745 | - newCursor.setX (i * screen->width () + cursor[0]); | ||
763 | 746 | - newCursor.setY (j * screen->height () + cursor[1]); | ||
764 | 747 | + while (vp.x () < 0) | ||
765 | 748 | + vp.setX (screen->vpSize ().width () + vp.x ()); | ||
766 | 749 | |||
767 | 750 | - if (anyClick || dndState != DnDNone) | ||
768 | 751 | - { | ||
769 | 752 | - /* Used to save last viewport interaction was in */ | ||
770 | 753 | - lastSelectedVp = selectedVp; | ||
771 | 754 | - selectedVp.set (i, j); | ||
772 | 755 | - anyClick = false; | ||
773 | 756 | - } | ||
774 | 757 | - } | ||
775 | 758 | - } | ||
776 | 759 | + while (vp.y () < 0) | ||
777 | 760 | + vp.setY (screen->vpSize ().height () + vp.y ()); | ||
778 | 761 | |||
779 | 762 | - /* not sure this will work with different resolutions */ | ||
780 | 763 | - if (optionGetDeform () != DeformCurve) | ||
781 | 764 | - sTransform2.translate (sx + gapX, 0.0f, 0.0); | ||
782 | 765 | - } | ||
783 | 766 | - | ||
784 | 767 | - /* not sure this will work with different resolutions */ | ||
785 | 768 | - sTransform.translate (0.0, -(sy + gapY), 0.0f); | ||
786 | 769 | + paintViewport (attrib, sTransform, infiniteRegion, output, mask, vp, vpCamPos, reflection); | ||
787 | 770 | } | ||
788 | 771 | |||
789 | 772 | + paintingDndWindow = false; | ||
790 | 773 | + | ||
791 | 774 | // glNormal3f (0.0, 0.0, -1.0); | ||
792 | 775 | |||
793 | 776 | if (reflection) | ||
794 | 777 | @@ -1187,12 +1374,16 @@ | ||
795 | 778 | |||
796 | 779 | expoActive = false; | ||
797 | 780 | |||
798 | 781 | - cScreen->setWindowPaintOffset (0, 0); | ||
799 | 782 | - | ||
800 | 783 | gScreen->glPaintTransformedOutputSetCurrentIndex (glPaintTransformedOutputIndex); | ||
801 | 784 | gScreen->setTextureFilter (oldFilter); | ||
802 | 785 | } | ||
803 | 786 | |||
804 | 787 | +const CompWindowList & | ||
805 | 788 | +ExpoScreen::getWindowPaintList () | ||
806 | 789 | +{ | ||
807 | 790 | + return dndWindows; | ||
808 | 791 | +} | ||
809 | 792 | + | ||
810 | 793 | bool | ||
811 | 794 | ExpoScreen::glPaintOutput (const GLScreenPaintAttrib& attrib, | ||
812 | 795 | const GLMatrix& transform, | ||
813 | 796 | @@ -1243,10 +1434,15 @@ | ||
814 | 797 | |||
815 | 798 | bool | ||
816 | 799 | ExpoWindow::glDraw (const GLMatrix& transform, | ||
817 | 800 | - const GLWindowPaintAttrib &attrib, | ||
818 | 801 | + const GLWindowPaintAttrib &attrib, | ||
819 | 802 | const CompRegion& region, | ||
820 | 803 | unsigned int mask) | ||
821 | 804 | { | ||
822 | 805 | + GLMatrix wTransform (transform); | ||
823 | 806 | + CompPoint vp; | ||
824 | 807 | + | ||
825 | 808 | + screen->viewportForGeometry (window->geometry (), vp); | ||
826 | 809 | + | ||
827 | 810 | if (eScreen->expoCam == 0.0f) | ||
828 | 811 | return gWindow->glDraw (transform, attrib, region, mask); | ||
829 | 812 | |||
830 | 813 | @@ -1275,8 +1471,11 @@ | ||
831 | 814 | } | ||
832 | 815 | } | ||
833 | 816 | |||
834 | 817 | - eAttrib.brightness = attrib.brightness * eScreen->vpBrightness; | ||
835 | 818 | - eAttrib.saturation = attrib.saturation * eScreen->vpSaturation; | ||
836 | 819 | + if ((vp == eScreen->paintingVp || window->onAllViewports ()) && !eScreen->paintingDndWindow) | ||
837 | 820 | + { | ||
838 | 821 | + eAttrib.brightness = attrib.brightness * eScreen->vpBrightness; | ||
839 | 822 | + eAttrib.saturation = attrib.saturation * eScreen->vpSaturation; | ||
840 | 823 | + } | ||
841 | 824 | } | ||
842 | 825 | else | ||
843 | 826 | { | ||
844 | 827 | @@ -1287,7 +1486,79 @@ | ||
845 | 828 | (1 - sigmoidProgress (eScreen->expoCam)); | ||
846 | 829 | } | ||
847 | 830 | |||
848 | 831 | - return gWindow->glDraw (transform, eAttrib, region, mask); | ||
849 | 832 | + bool status = gWindow->glDraw (transform, eAttrib, region, mask); | ||
850 | 833 | + | ||
851 | 834 | + if (window->type () & CompWindowTypeDesktopMask) | ||
852 | 835 | + { | ||
853 | 836 | + /* We want to set the geometry of the polka dots to the window | ||
854 | 837 | + * region */ | ||
855 | 838 | + CompRegion reg = CompRegion (0, 0, window->width (), window->height ()); | ||
856 | 839 | + | ||
857 | 840 | + foreach(GLTexture * tex, eScreen->polkadots_texture) | ||
858 | 841 | + { | ||
859 | 842 | + GLTexture::MatrixList matl; | ||
860 | 843 | + GLTexture::Matrix mat = tex->matrix(); | ||
861 | 844 | + CompRegion paintRegion(region); | ||
862 | 845 | + | ||
863 | 846 | + float xScale = screen->width () / (float) eScreen->viewport_size.width (); | ||
864 | 847 | + float yScale = screen->height () / (float) eScreen->viewport_size.height (); | ||
865 | 848 | + | ||
866 | 849 | + mat.xx *= xScale; | ||
867 | 850 | + mat.yy *= yScale; | ||
868 | 851 | + | ||
869 | 852 | + /* Not sure what this does, but it is necessary | ||
870 | 853 | + * (adjusts for scale?) */ | ||
871 | 854 | + mat.x0 -= mat.xx * reg.boundingRect().x1(); | ||
872 | 855 | + mat.y0 -= mat.yy * reg.boundingRect().y1(); | ||
873 | 856 | + | ||
874 | 857 | + matl.push_back(mat); | ||
875 | 858 | + | ||
876 | 859 | + if (mask & PAINT_WINDOW_TRANSFORMED_MASK) | ||
877 | 860 | + paintRegion = infiniteRegion; | ||
878 | 861 | + | ||
879 | 862 | + /* Now allow plugins to mess with the geometry of our | ||
880 | 863 | + * dim (so we get a nice render for things like | ||
881 | 864 | + * wobbly etc etc */ | ||
882 | 865 | + gWindow->vertexBuffer ()->begin (); | ||
883 | 866 | + gWindow->glAddGeometry (matl, reg, paintRegion); | ||
884 | 867 | + if (gWindow->vertexBuffer ()->end ()) | ||
885 | 868 | + { | ||
886 | 869 | + unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex (); | ||
887 | 870 | + eAttrib.opacity = attrib.opacity * (((1.0 - eScreen->vpBrightness) + (1.0 - eScreen->vpSaturation) / 2.0)); | ||
888 | 871 | + /* Texture rendering set-up */ | ||
889 | 872 | + //eScreen->gScreen->setTexEnvMode(GL_MODULATE); | ||
890 | 873 | + glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | ||
891 | 874 | + /* Draw the dim texture with all of it's modified | ||
892 | 875 | + * geometry glory */ | ||
893 | 876 | + gWindow->glDrawTextureSetCurrentIndex (MAXSHORT); | ||
894 | 877 | + gWindow->glDrawTexture (tex, transform, eAttrib, mask | | ||
895 | 878 | + PAINT_WINDOW_BLEND_MASK | | ||
896 | 879 | + PAINT_WINDOW_TRANSLUCENT_MASK | | ||
897 | 880 | + PAINT_WINDOW_TRANSFORMED_MASK); | ||
898 | 881 | + gWindow->glDrawTextureSetCurrentIndex (glDrawTextureIndex); | ||
899 | 882 | + /* Texture rendering tear-down */ | ||
900 | 883 | + glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | ||
901 | 884 | + eScreen->gScreen->setTexEnvMode (GL_REPLACE); | ||
902 | 885 | + } | ||
903 | 886 | + } | ||
904 | 887 | + | ||
905 | 888 | + /* Paint the outline */ | ||
906 | 889 | + if (mGlowQuads && eScreen->paintingVp == eScreen->selectedVp) | ||
907 | 890 | + { | ||
908 | 891 | + if (region.numRects ()) | ||
909 | 892 | + { | ||
910 | 893 | + /* reset geometry and paint */ | ||
911 | 894 | + gWindow->vertexBuffer ()->begin (); | ||
912 | 895 | + gWindow->vertexBuffer ()->end (); | ||
913 | 896 | + | ||
914 | 897 | + paintGlow (transform, attrib, infiniteRegion, mask); | ||
915 | 898 | + } | ||
916 | 899 | + } | ||
917 | 900 | + | ||
918 | 901 | + } | ||
919 | 902 | + | ||
920 | 903 | + return status; | ||
921 | 904 | + | ||
922 | 905 | } | ||
923 | 906 | |||
924 | 907 | #define EXPO_GRID_SIZE 100 | ||
925 | 908 | @@ -1425,11 +1696,17 @@ | ||
926 | 909 | const CompRegion& region, | ||
927 | 910 | unsigned int mask) | ||
928 | 911 | { | ||
929 | 912 | + GLMatrix wTransform (transform); | ||
930 | 913 | + GLWindowPaintAttrib wAttrib (attrib); | ||
931 | 914 | + CompRegion clip (region); | ||
932 | 915 | + | ||
933 | 916 | if (eScreen->expoActive) | ||
934 | 917 | { | ||
935 | 918 | float opacity = 1.0; | ||
936 | 919 | bool hide; | ||
937 | 920 | bool zoomAnim; | ||
938 | 921 | + CompPoint vp; | ||
939 | 922 | + screen->viewportForGeometry (window->geometry (), vp); | ||
940 | 923 | |||
941 | 924 | zoomAnim = eScreen->optionGetExpoAnimation () == | ||
942 | 925 | ExpoScreen::ExpoAnimationZoom; | ||
943 | 926 | @@ -1458,9 +1735,47 @@ | ||
944 | 927 | |||
945 | 928 | if (opacity <= 0) | ||
946 | 929 | mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; | ||
947 | 930 | + else | ||
948 | 931 | + wAttrib.opacity = wAttrib.opacity * opacity; | ||
949 | 932 | + | ||
950 | 933 | + /* Stretch maximized windows a little so that you don't | ||
951 | 934 | + * have an awkward gap */ | ||
952 | 935 | + | ||
953 | 936 | + if (window->state () & MAXIMIZE_STATE && | ||
954 | 937 | + !window->border ().top) | ||
955 | 938 | + { | ||
956 | 939 | + CompOutput *o = &screen->outputDevs ()[screen->outputDeviceForGeometry(window->geometry())]; | ||
957 | 940 | + float yS = 1.0 + ((o->height () / (float) window->height ()) - 1.0f) * sigmoidProgress (eScreen->expoCam); | ||
958 | 941 | + float xS = 1.0 + ((o->width () / (float) window->width ()) - 1.0f) * sigmoidProgress (eScreen->expoCam); | ||
959 | 942 | + wTransform.translate (window->x () + window->width (), | ||
960 | 943 | + window->y () + window->height (), | ||
961 | 944 | + 0.0f); | ||
962 | 945 | + wTransform.scale (xS, yS, 1.0f); | ||
963 | 946 | + wTransform.translate (-(window->x () + window->width ()), | ||
964 | 947 | + -(window->y () + window->height ()), | ||
965 | 948 | + 0.0f); | ||
966 | 949 | + | ||
967 | 950 | + if (eScreen->paintingVp != vp) | ||
968 | 951 | + mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; | ||
969 | 952 | + | ||
970 | 953 | + mask |= PAINT_WINDOW_TRANSFORMED_MASK; | ||
971 | 954 | + } | ||
972 | 955 | + | ||
973 | 956 | + if (std::find (eScreen->dndWindows.begin(), eScreen->dndWindows.end (), window) != eScreen->dndWindows.end ()) | ||
974 | 957 | + { | ||
975 | 958 | + if (!eScreen->paintingDndWindow) | ||
976 | 959 | + { | ||
977 | 960 | + mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; | ||
978 | 961 | + } | ||
979 | 962 | + else | ||
980 | 963 | + { | ||
981 | 964 | + mask |= PAINT_WINDOW_TRANSFORMED_MASK; | ||
982 | 965 | + clip = infiniteRegion; | ||
983 | 966 | + } | ||
984 | 967 | + } | ||
985 | 968 | } | ||
986 | 969 | |||
987 | 970 | - return gWindow->glPaint (attrib, transform, region, mask); | ||
988 | 971 | + return gWindow->glPaint (wAttrib, wTransform, clip, mask); | ||
989 | 972 | } | ||
990 | 973 | |||
991 | 974 | bool | ||
992 | 975 | @@ -1489,7 +1804,7 @@ | ||
993 | 976 | expoActive (false), | ||
994 | 977 | expoMode (false), | ||
995 | 978 | dndState (DnDNone), | ||
996 | 979 | - dndWindow (NULL), | ||
997 | 980 | + dndWindows (0), | ||
998 | 981 | origVp (s->vp ()), | ||
999 | 982 | selectedVp (s->vp ()), | ||
1000 | 983 | lastSelectedVp (s->vp ()), | ||
1001 | 984 | @@ -1497,14 +1812,21 @@ | ||
1002 | 985 | clickTime (0), | ||
1003 | 986 | doubleClick (false), | ||
1004 | 987 | vpNormals (360 * 3), | ||
1005 | 988 | - grabIndex (0) | ||
1006 | 989 | -{ | ||
1007 | 990 | + grabIndex (0), | ||
1008 | 991 | + paintingDndWindow (false), | ||
1009 | 992 | + mGlowTextureProperties (&glowTextureProperties) | ||
1010 | 993 | +{ | ||
1011 | 994 | + CompString fname; | ||
1012 | 995 | + CompString pname = "expo"; | ||
1013 | 996 | + CompSize size; | ||
1014 | 997 | + | ||
1015 | 998 | + | ||
1016 | 999 | leftKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Left")); | ||
1017 | 1000 | rightKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Right")); | ||
1018 | 1001 | upKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Up")); | ||
1019 | 1002 | downKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Down")); | ||
1020 | 1003 | |||
1021 | 1004 | - dragCursor = XCreateFontCursor (screen->dpy (), XC_fleur); | ||
1022 | 1005 | + mMoveCursor = XCreateFontCursor (screen->dpy (), XC_fleur); | ||
1023 | 1006 | |||
1024 | 1007 | EXPOINITBIND (ExpoKey, doExpo); | ||
1025 | 1008 | EXPOTERMBIND (ExpoKey, termExpo); | ||
1026 | 1009 | @@ -1522,12 +1844,58 @@ | ||
1027 | 1010 | ScreenInterface::setHandler (screen, false); | ||
1028 | 1011 | CompositeScreenInterface::setHandler (cScreen, false); | ||
1029 | 1012 | GLScreenInterface::setHandler (gScreen, false); | ||
1030 | 1013 | + | ||
1031 | 1014 | + outline_texture = GLTexture::imageDataToTexture (mGlowTextureProperties->textureData, | ||
1032 | 1015 | + CompSize (mGlowTextureProperties->textureSize, | ||
1033 | 1016 | + mGlowTextureProperties->textureSize), | ||
1034 | 1017 | + GL_RGBA, GL_UNSIGNED_BYTE); | ||
1035 | 1018 | + fname = "texture_tile.png"; | ||
1036 | 1019 | + polkadots_texture = GLTexture::readImageToTexture (fname, pname, polkadots_texture_size); | ||
1037 | 1020 | + | ||
1038 | 1021 | + if (polkadots_texture.empty ()) | ||
1039 | 1022 | + compLogMessage ("expo", CompLogLevelWarn, "failed to bind image to texture"); | ||
1040 | 1023 | + else | ||
1041 | 1024 | + { | ||
1042 | 1025 | + foreach (GLTexture *tex, polkadots_texture) | ||
1043 | 1026 | + { | ||
1044 | 1027 | + tex->enable (GLTexture::Good); | ||
1045 | 1028 | + glTexParameteri (tex->target (), GL_TEXTURE_WRAP_S, GL_REPEAT); | ||
1046 | 1029 | + glTexParameteri (tex->target (), GL_TEXTURE_WRAP_T, GL_REPEAT); | ||
1047 | 1030 | + tex->disable (); | ||
1048 | 1031 | + } | ||
1049 | 1032 | + } | ||
1050 | 1033 | } | ||
1051 | 1034 | |||
1052 | 1035 | ExpoScreen::~ExpoScreen () | ||
1053 | 1036 | { | ||
1054 | 1037 | - if (dragCursor != None) | ||
1055 | 1038 | - XFreeCursor (screen->dpy (), dragCursor); | ||
1056 | 1039 | + if (mMoveCursor) | ||
1057 | 1040 | + XFreeCursor (screen->dpy (), mMoveCursor); | ||
1058 | 1041 | +} | ||
1059 | 1042 | + | ||
1060 | 1043 | +void | ||
1061 | 1044 | +ExpoWindow::moveNotify (int dx, int dy, bool immediate) | ||
1062 | 1045 | +{ | ||
1063 | 1046 | + window->moveNotify (dx, dy, immediate); | ||
1064 | 1047 | + | ||
1065 | 1048 | + if (!ExpoScreen::get (screen)->expoActive) | ||
1066 | 1049 | + return; | ||
1067 | 1050 | + | ||
1068 | 1051 | + updateViewportActiveStates (screen); | ||
1069 | 1052 | +} | ||
1070 | 1053 | + | ||
1071 | 1054 | +void | ||
1072 | 1055 | +ExpoWindow::resizeNotify(int dx, int dy, int dw, int dh) | ||
1073 | 1056 | +{ | ||
1074 | 1057 | + window->resizeNotify (dx, dy, dw, dh); | ||
1075 | 1058 | + | ||
1076 | 1059 | + /* mGlowQuads contains positional info, so we need to recalc that */ | ||
1077 | 1060 | + if (mGlowQuads) | ||
1078 | 1061 | + { | ||
1079 | 1062 | + /* FIXME: we need to find a more multitexture friendly way | ||
1080 | 1063 | + * of doing this */ | ||
1081 | 1064 | + GLTexture::Matrix tMat = eScreen->outline_texture.at (0)->matrix (); | ||
1082 | 1065 | + computeGlowQuads (&tMat); | ||
1083 | 1066 | + } | ||
1084 | 1067 | } | ||
1085 | 1068 | |||
1086 | 1069 | ExpoWindow::ExpoWindow (CompWindow *w) : | ||
1087 | 1070 | @@ -1535,10 +1903,28 @@ | ||
1088 | 1071 | window (w), | ||
1089 | 1072 | cWindow (CompositeWindow::get (w)), | ||
1090 | 1073 | gWindow (GLWindow::get (w)), | ||
1091 | 1074 | - eScreen (ExpoScreen::get (screen)) | ||
1092 | 1075 | + eScreen (ExpoScreen::get (screen)), | ||
1093 | 1076 | + dndOpacity (0.0f), | ||
1094 | 1077 | + mGlowQuads (NULL) | ||
1095 | 1078 | { | ||
1096 | 1079 | CompositeWindowInterface::setHandler (cWindow, false); | ||
1097 | 1080 | GLWindowInterface::setHandler (gWindow, false); | ||
1098 | 1081 | + WindowInterface::setHandler (window, true); | ||
1099 | 1082 | + | ||
1100 | 1083 | + if (window->type () & CompWindowTypeDesktopMask) | ||
1101 | 1084 | + { | ||
1102 | 1085 | + foreach (GLTexture *tex, eScreen->outline_texture) | ||
1103 | 1086 | + { | ||
1104 | 1087 | + GLTexture::Matrix mat = tex->matrix (); | ||
1105 | 1088 | + computeGlowQuads (&mat); | ||
1106 | 1089 | + } | ||
1107 | 1090 | + } | ||
1108 | 1091 | +} | ||
1109 | 1092 | + | ||
1110 | 1093 | +ExpoWindow::~ExpoWindow () | ||
1111 | 1094 | +{ | ||
1112 | 1095 | + eScreen->dndWindows.remove (window); | ||
1113 | 1096 | + computeGlowQuads (NULL); | ||
1114 | 1097 | } | ||
1115 | 1098 | |||
1116 | 1099 | bool | ||
1117 | 1100 | Index: ubuntu/plugins/expo/src/expo.h | ||
1118 | 1101 | =================================================================== | ||
1119 | 1102 | --- ubuntu.orig/plugins/expo/src/expo.h 2012-09-08 17:26:40.599035911 +0800 | ||
1120 | 1103 | +++ ubuntu/plugins/expo/src/expo.h 2012-09-12 22:20:43.276760475 +0800 | ||
1121 | 1104 | @@ -30,6 +30,44 @@ | ||
1122 | 1105 | #include <opengl/opengl.h> | ||
1123 | 1106 | |||
1124 | 1107 | #include "expo_options.h" | ||
1125 | 1108 | +#include "glow.h" | ||
1126 | 1109 | +#include "viewport-member-window.h" | ||
1127 | 1110 | +#include "client-list-generator.h" | ||
1128 | 1111 | + | ||
1129 | 1112 | +#define WIN_REAL_X(w) (w->x () - w->border ().left) | ||
1130 | 1113 | +#define WIN_REAL_Y(w) (w->y () - w->border ().top) | ||
1131 | 1114 | +#define WIN_REAL_WIDTH(w) (w->width () + 2 * w->geometry ().border () + \ | ||
1132 | 1115 | + w->border ().left + w->border ().right) | ||
1133 | 1116 | +#define WIN_REAL_HEIGHT(w) (w->height () + 2 * w->geometry ().border () + \ | ||
1134 | 1117 | + w->border ().top + w->border ().bottom) | ||
1135 | 1118 | + | ||
1136 | 1119 | +namespace compiz | ||
1137 | 1120 | +{ | ||
1138 | 1121 | + namespace expo | ||
1139 | 1122 | + { | ||
1140 | 1123 | + namespace impl | ||
1141 | 1124 | + { | ||
1142 | 1125 | + namespace ce = compiz::expo; | ||
1143 | 1126 | + | ||
1144 | 1127 | + class CompizClientListGenerator : | ||
1145 | 1128 | + public ce::ClientListGenerator | ||
1146 | 1129 | + { | ||
1147 | 1130 | + public: | ||
1148 | 1131 | + | ||
1149 | 1132 | + CompizClientListGenerator (CompScreen *screen); | ||
1150 | 1133 | + | ||
1151 | 1134 | + void refreshClientList (); | ||
1152 | 1135 | + ViewportMemberWindow * nextClient (); | ||
1153 | 1136 | + | ||
1154 | 1137 | + private: | ||
1155 | 1138 | + | ||
1156 | 1139 | + CompScreen *mScreen; | ||
1157 | 1140 | + const CompWindowVector *mClientList; | ||
1158 | 1141 | + CompWindowVector::const_iterator mClientListIterator; | ||
1159 | 1142 | + }; | ||
1160 | 1143 | + } | ||
1161 | 1144 | + } | ||
1162 | 1145 | +} | ||
1163 | 1146 | |||
1164 | 1147 | class ExpoScreen : | ||
1165 | 1148 | public ScreenInterface, | ||
1166 | 1149 | @@ -51,8 +89,10 @@ | ||
1167 | 1150 | bool glPaintOutput (const GLScreenPaintAttrib&, const GLMatrix&, | ||
1168 | 1151 | const CompRegion&, CompOutput *, unsigned int); | ||
1169 | 1152 | void glPaintTransformedOutput (const GLScreenPaintAttrib&, | ||
1170 | 1153 | - const GLMatrix&, const CompRegion&, | ||
1171 | 1154 | - CompOutput *, unsigned int); | ||
1172 | 1155 | + const GLMatrix&, const CompRegion&, | ||
1173 | 1156 | + CompOutput*, unsigned int); | ||
1174 | 1157 | + | ||
1175 | 1158 | + const CompWindowList & getWindowPaintList (); | ||
1176 | 1159 | |||
1177 | 1160 | bool dndInit (CompAction *, CompAction::State, CompOption::Vector&); | ||
1178 | 1161 | bool dndFini (CompAction *, CompAction::State, CompOption::Vector&); | ||
1179 | 1162 | @@ -62,6 +102,8 @@ | ||
1180 | 1163 | bool nextVp (CompAction *, CompAction::State, CompOption::Vector&); | ||
1181 | 1164 | bool prevVp (CompAction *, CompAction::State, CompOption::Vector&); | ||
1182 | 1165 | |||
1183 | 1166 | + CompPoint currentViewport (); | ||
1184 | 1167 | + | ||
1185 | 1168 | typedef enum { | ||
1186 | 1169 | DnDNone, | ||
1187 | 1170 | DnDDuring, | ||
1188 | 1171 | @@ -82,7 +124,7 @@ | ||
1189 | 1172 | bool expoMode; | ||
1190 | 1173 | |||
1191 | 1174 | DnDState dndState; | ||
1192 | 1175 | - CompWindow *dndWindow; | ||
1193 | 1176 | + CompWindowList dndWindows; | ||
1194 | 1177 | |||
1195 | 1178 | CompPoint prevCursor; | ||
1196 | 1179 | CompPoint newCursor; | ||
1197 | 1180 | @@ -94,6 +136,7 @@ | ||
1198 | 1181 | CompPoint paintingVp; | ||
1199 | 1182 | |||
1200 | 1183 | std::vector<float> vpActivity; | ||
1201 | 1184 | + std::vector<bool> vpActive; | ||
1202 | 1185 | float vpBrightness; | ||
1203 | 1186 | float vpSaturation; | ||
1204 | 1187 | |||
1205 | 1188 | @@ -113,6 +156,17 @@ | ||
1206 | 1189 | |||
1207 | 1190 | CompScreen::GrabHandle grabIndex; | ||
1208 | 1191 | |||
1209 | 1192 | + GLTexture::List polkadots_texture; | ||
1210 | 1193 | + CompSize polkadots_texture_size; | ||
1211 | 1194 | + CompSize viewport_size; | ||
1212 | 1195 | + | ||
1213 | 1196 | + GLTexture::List outline_texture; | ||
1214 | 1197 | + CompSize outline_texture_size; | ||
1215 | 1198 | + | ||
1216 | 1199 | + bool paintingDndWindow; | ||
1217 | 1200 | + | ||
1218 | 1201 | + const GlowTextureProperties *mGlowTextureProperties; | ||
1219 | 1202 | + | ||
1220 | 1203 | private: | ||
1221 | 1204 | void moveFocusViewport (int, int); | ||
1222 | 1205 | void finishWindowMovement (); | ||
1223 | 1206 | @@ -123,24 +177,45 @@ | ||
1224 | 1207 | void paintWall (const GLScreenPaintAttrib&, const GLMatrix&, | ||
1225 | 1208 | const CompRegion&, CompOutput *, unsigned int, bool); | ||
1226 | 1209 | |||
1227 | 1210 | + void paintViewport (const GLScreenPaintAttrib& attrib, | ||
1228 | 1211 | + const GLMatrix& transform, | ||
1229 | 1212 | + const CompRegion& region, | ||
1230 | 1213 | + CompOutput *output, | ||
1231 | 1214 | + unsigned int mask, | ||
1232 | 1215 | + CompPoint vpPos, | ||
1233 | 1216 | + GLVector &vpCamPos, | ||
1234 | 1217 | + bool reflection); | ||
1235 | 1218 | + | ||
1236 | 1219 | + bool windowsOnVp (compiz::expo::ClientListGenerator &clientList, | ||
1237 | 1220 | + CompPoint &p, | ||
1238 | 1221 | + const CompPoint &unprojectedCursor, | ||
1239 | 1222 | + const CompSize &screenSize, | ||
1240 | 1223 | + CompScreen *screen); | ||
1241 | 1224 | + | ||
1242 | 1225 | KeyCode leftKey; | ||
1243 | 1226 | KeyCode rightKey; | ||
1244 | 1227 | KeyCode upKey; | ||
1245 | 1228 | KeyCode downKey; | ||
1246 | 1229 | |||
1247 | 1230 | - Cursor dragCursor; | ||
1248 | 1231 | + Cursor mMoveCursor; | ||
1249 | 1232 | }; | ||
1250 | 1233 | |||
1251 | 1234 | class ExpoWindow : | ||
1252 | 1235 | + public compiz::expo::ViewportMemberWindow, | ||
1253 | 1236 | public CompositeWindowInterface, | ||
1254 | 1237 | public GLWindowInterface, | ||
1255 | 1238 | + public WindowInterface, | ||
1256 | 1239 | public PluginClassHandler<ExpoWindow, CompWindow> | ||
1257 | 1240 | { | ||
1258 | 1241 | public: | ||
1259 | 1242 | ExpoWindow (CompWindow *); | ||
1260 | 1243 | + ~ExpoWindow (); | ||
1261 | 1244 | |||
1262 | 1245 | bool damageRect (bool, const CompRect&); | ||
1263 | 1246 | |||
1264 | 1247 | + void resizeNotify (int dx, int dy, int dw, int dh); | ||
1265 | 1248 | + void moveNotify (int dx, int dy, bool immediate); | ||
1266 | 1249 | + | ||
1267 | 1250 | bool glDraw (const GLMatrix&, const GLWindowPaintAttrib&, | ||
1268 | 1251 | const CompRegion&, unsigned int); | ||
1269 | 1252 | bool glPaint (const GLWindowPaintAttrib&, const GLMatrix&, | ||
1270 | 1253 | @@ -150,11 +225,31 @@ | ||
1271 | 1254 | unsigned int, unsigned int); | ||
1272 | 1255 | void glDrawTexture (GLTexture*, const GLMatrix&, | ||
1273 | 1256 | const GLWindowPaintAttrib&, unsigned int); | ||
1274 | 1257 | + void | ||
1275 | 1258 | + paintGlow (const GLMatrix &transform, | ||
1276 | 1259 | + const GLWindowPaintAttrib &attrib, | ||
1277 | 1260 | + const CompRegion &paintRegion, | ||
1278 | 1261 | + unsigned int mask); | ||
1279 | 1262 | + | ||
1280 | 1263 | + void | ||
1281 | 1264 | + computeGlowQuads (GLTexture::Matrix *matrix); | ||
1282 | 1265 | |||
1283 | 1266 | CompWindow *window; | ||
1284 | 1267 | CompositeWindow *cWindow; | ||
1285 | 1268 | GLWindow *gWindow; | ||
1286 | 1269 | ExpoScreen *eScreen; | ||
1287 | 1270 | + | ||
1288 | 1271 | + float dndOpacity; | ||
1289 | 1272 | + | ||
1290 | 1273 | + GlowQuad *mGlowQuads; | ||
1291 | 1274 | + | ||
1292 | 1275 | + private: | ||
1293 | 1276 | + | ||
1294 | 1277 | + bool isDesktopOrDock () const; | ||
1295 | 1278 | + bool dragged () const; | ||
1296 | 1279 | + const compiz::window::Geometry & absoluteGeometry () const; | ||
1297 | 1280 | + | ||
1298 | 1281 | + mutable compiz::window::Geometry mAbsoluteGeometry; | ||
1299 | 1282 | }; | ||
1300 | 1283 | |||
1301 | 1284 | class ExpoPluginVTable : | ||
1302 | 1285 | Index: ubuntu/plugins/expo/src/glow.cpp | ||
1303 | 1286 | =================================================================== | ||
1304 | 1287 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
1305 | 1288 | +++ ubuntu/plugins/expo/src/glow.cpp 2012-09-12 22:20:43.280760497 +0800 | ||
1306 | 1289 | @@ -0,0 +1,429 @@ | ||
1307 | 1290 | +/** | ||
1308 | 1291 | + * | ||
1309 | 1292 | + * Compiz group plugin | ||
1310 | 1293 | + * | ||
1311 | 1294 | + * glow.cpp | ||
1312 | 1295 | + * | ||
1313 | 1296 | + * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen, | ||
1314 | 1297 | + * Danny Baumann, Sam Spilsbury | ||
1315 | 1298 | + * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com> | ||
1316 | 1299 | + * Roi Cohen <roico.beryl@gmail.com> | ||
1317 | 1300 | + * Danny Baumann <maniac@opencompositing.org> | ||
1318 | 1301 | + * Sam Spilsbury <smspillaz@gmail.com> | ||
1319 | 1302 | + * | ||
1320 | 1303 | + * | ||
1321 | 1304 | + * This program is free software; you can redistribute it and/or | ||
1322 | 1305 | + * modify it under the terms of the GNU General Public License | ||
1323 | 1306 | + * as published by the Free Software Foundation; either version 2 | ||
1324 | 1307 | + * of the License, or (at your option) any later version. | ||
1325 | 1308 | + * | ||
1326 | 1309 | + * This program is distributed in the hope that it will be useful, | ||
1327 | 1310 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1328 | 1311 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1329 | 1312 | + * GNU General Public License for more details. | ||
1330 | 1313 | + * | ||
1331 | 1314 | + **/ | ||
1332 | 1315 | + | ||
1333 | 1316 | +#include "expo.h" | ||
1334 | 1317 | +#include "group_glow.h" | ||
1335 | 1318 | + | ||
1336 | 1319 | +const GlowTextureProperties glowTextureProperties = { | ||
1337 | 1320 | + /* GlowTextureRectangular */ | ||
1338 | 1321 | + glowTexRect, 32, 21 | ||
1339 | 1322 | +}; | ||
1340 | 1323 | + | ||
1341 | 1324 | +/* | ||
1342 | 1325 | + * GroupWindow::paintGlow | ||
1343 | 1326 | + * | ||
1344 | 1327 | + * Takes our glow texture, stretches the appropriate positions in the glow texture, | ||
1345 | 1328 | + * adds those geometries (so plugins like wobby and deform this texture correctly) | ||
1346 | 1329 | + * and then draws the glow texture with this geometry (plugins like wobbly and friends | ||
1347 | 1330 | + * will automatically deform the texture based on our set geometry) | ||
1348 | 1331 | + */ | ||
1349 | 1332 | + | ||
1350 | 1333 | +void | ||
1351 | 1334 | +ExpoWindow::paintGlow (const GLMatrix &transform, | ||
1352 | 1335 | + const GLWindowPaintAttrib &attrib, | ||
1353 | 1336 | + const CompRegion &paintRegion, | ||
1354 | 1337 | + unsigned int mask) | ||
1355 | 1338 | +{ | ||
1356 | 1339 | + CompRegion reg; | ||
1357 | 1340 | + int i; | ||
1358 | 1341 | + GLushort colorData[4]; | ||
1359 | 1342 | + const GLushort *selColorData = ExpoScreen::get (screen)->optionGetSelectedColor (); | ||
1360 | 1343 | + float alpha = (float) selColorData[3] / 65535.0f; | ||
1361 | 1344 | + | ||
1362 | 1345 | + /* Premultiply color */ | ||
1363 | 1346 | + colorData[0] = selColorData[0] * alpha; | ||
1364 | 1347 | + colorData[1] = selColorData[1] * alpha; | ||
1365 | 1348 | + colorData[2] = selColorData[2] * alpha; | ||
1366 | 1349 | + colorData[3] = selColorData[3]; | ||
1367 | 1350 | + | ||
1368 | 1351 | + gWindow->vertexBuffer ()->begin (); | ||
1369 | 1352 | + | ||
1370 | 1353 | + /* There are 8 glow parts of the glow texture which we wish to paint | ||
1371 | 1354 | + * separately with different transformations | ||
1372 | 1355 | + */ | ||
1373 | 1356 | + for (i = 0; i < NUM_GLOWQUADS; i++) | ||
1374 | 1357 | + { | ||
1375 | 1358 | + /* Using precalculated quads here */ | ||
1376 | 1359 | + reg = CompRegion (mGlowQuads[i].mBox); | ||
1377 | 1360 | + | ||
1378 | 1361 | + if (reg.boundingRect ().x1 () < reg.boundingRect ().x2 () && | ||
1379 | 1362 | + reg.boundingRect ().y1 () < reg.boundingRect ().y2 ()) | ||
1380 | 1363 | + { | ||
1381 | 1364 | + GLTexture::MatrixList matl; | ||
1382 | 1365 | + reg = CompRegion (reg.boundingRect ().x1 (), | ||
1383 | 1366 | + reg.boundingRect ().y1 (), | ||
1384 | 1367 | + reg.boundingRect ().width (), | ||
1385 | 1368 | + reg.boundingRect ().height ()); | ||
1386 | 1369 | + | ||
1387 | 1370 | + matl.push_back (mGlowQuads[i].mMatrix); | ||
1388 | 1371 | + /* Add color data for all 6 vertices of the quad */ | ||
1389 | 1372 | + for (int n = 0; n < 6; n++) | ||
1390 | 1373 | + gWindow->vertexBuffer ()->addColors (1, colorData); | ||
1391 | 1374 | + gWindow->glAddGeometry (matl, reg, paintRegion); | ||
1392 | 1375 | + } | ||
1393 | 1376 | + } | ||
1394 | 1377 | + | ||
1395 | 1378 | + if (gWindow->vertexBuffer ()->end ()) | ||
1396 | 1379 | + { | ||
1397 | 1380 | + //GLScreen::get (screen)->setTexEnvMode (GL_MODULATE); | ||
1398 | 1381 | + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||
1399 | 1382 | + | ||
1400 | 1383 | + /* we use PAINT_WINDOW_TRANSFORMED_MASK here to force | ||
1401 | 1384 | + the usage of a good texture filter */ | ||
1402 | 1385 | + foreach (GLTexture *tex, ExpoScreen::get (screen)->outline_texture) | ||
1403 | 1386 | + { | ||
1404 | 1387 | + gWindow->glDrawTexture (tex, transform, attrib, mask | | ||
1405 | 1388 | + PAINT_WINDOW_BLEND_MASK | | ||
1406 | 1389 | + PAINT_WINDOW_TRANSLUCENT_MASK | | ||
1407 | 1390 | + PAINT_WINDOW_TRANSFORMED_MASK); | ||
1408 | 1391 | + } | ||
1409 | 1392 | + | ||
1410 | 1393 | + glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | ||
1411 | 1394 | + GLScreen::get (screen)->setTexEnvMode (GL_REPLACE); | ||
1412 | 1395 | + } | ||
1413 | 1396 | +} | ||
1414 | 1397 | + | ||
1415 | 1398 | +/* | ||
1416 | 1399 | + * ExpoWindow::computeGlowQuads | ||
1417 | 1400 | + * | ||
1418 | 1401 | + * This function computures the matrix transformation required for each | ||
1419 | 1402 | + * part of the glow texture which we wish to stretch to some rectangular | ||
1420 | 1403 | + * dimentions | ||
1421 | 1404 | + * | ||
1422 | 1405 | + * There are eight quads different parts of the texture which we wish to | ||
1423 | 1406 | + * paint here, the 4 sides and four corners, eg: | ||
1424 | 1407 | + * | ||
1425 | 1408 | + * ------------------ | ||
1426 | 1409 | + * | 1 | 4 | 6 | | ||
1427 | 1410 | + * ------------- ------------------ | ||
1428 | 1411 | + * | 1 | 4 | 6 | | | | | | ||
1429 | 1412 | + * ------------- | | | | | ||
1430 | 1413 | + * | 2 | n | 7 | -> | 2 | n | 7 | | ||
1431 | 1414 | + * ------------- | | | | | ||
1432 | 1415 | + * | 3 | 5 | 8 | | | | | | ||
1433 | 1416 | + * ------------- ------------------ | ||
1434 | 1417 | + * | 3 | 5 | 8 | | ||
1435 | 1418 | + * ------------------ | ||
1436 | 1419 | + * | ||
1437 | 1420 | + * In this example here, 2, 4, 5 and 7 are stretched, and the matrices for | ||
1438 | 1421 | + * each quad rect adjusted accordingly for it's size compared to the original | ||
1439 | 1422 | + * texture size. | ||
1440 | 1423 | + * | ||
1441 | 1424 | + * When we are adjusting the matrices here, the initial size of each corner has | ||
1442 | 1425 | + * a size of of "1.0f", so according to 2x2 matrix rules, | ||
1443 | 1426 | + * the scale factor is the inverse of the size of the glow (which explains | ||
1444 | 1427 | + * while you will see here that matrix->xx is (1 / glowSize) | ||
1445 | 1428 | + * where glowSize is the size the user specifies they want their glow to extend. | ||
1446 | 1429 | + * (likewise, matrix->yy is adjusted similarly for corners and for top/bottom) | ||
1447 | 1430 | + * | ||
1448 | 1431 | + * matrix->x0 and matrix->y0 here are set to be the top left edge of the rect | ||
1449 | 1432 | + * adjusted by the matrix scale factor (matrix->xx and matrix->yy) | ||
1450 | 1433 | + * | ||
1451 | 1434 | + */ | ||
1452 | 1435 | +void | ||
1453 | 1436 | +ExpoWindow::computeGlowQuads (GLTexture::Matrix *matrix) | ||
1454 | 1437 | +{ | ||
1455 | 1438 | + CompRect *box; | ||
1456 | 1439 | + int x1, x2, y1, y2; | ||
1457 | 1440 | + GLTexture::Matrix *quadMatrix; | ||
1458 | 1441 | + int glowSize, glowOffset; | ||
1459 | 1442 | + CompWindow *w = window; | ||
1460 | 1443 | + | ||
1461 | 1444 | + /* Passing NULL to this function frees the glow quads | ||
1462 | 1445 | + * (so the window is not painted with glow) */ | ||
1463 | 1446 | + | ||
1464 | 1447 | + if (matrix) | ||
1465 | 1448 | + { | ||
1466 | 1449 | + if (!mGlowQuads) | ||
1467 | 1450 | + mGlowQuads = new GlowQuad[NUM_GLOWQUADS]; | ||
1468 | 1451 | + if (!mGlowQuads) | ||
1469 | 1452 | + return; | ||
1470 | 1453 | + } | ||
1471 | 1454 | + else | ||
1472 | 1455 | + { | ||
1473 | 1456 | + if (mGlowQuads) | ||
1474 | 1457 | + { | ||
1475 | 1458 | + delete[] mGlowQuads; | ||
1476 | 1459 | + mGlowQuads = NULL; | ||
1477 | 1460 | + } | ||
1478 | 1461 | + return; | ||
1479 | 1462 | + } | ||
1480 | 1463 | + | ||
1481 | 1464 | + glowSize = 48; | ||
1482 | 1465 | + glowOffset = (glowSize * ExpoScreen::get (screen)->mGlowTextureProperties->glowOffset / | ||
1483 | 1466 | + ExpoScreen::get (screen)->mGlowTextureProperties->textureSize) + 1; | ||
1484 | 1467 | + | ||
1485 | 1468 | + /* Top left corner */ | ||
1486 | 1469 | + box = &mGlowQuads[GLOWQUAD_TOPLEFT].mBox; | ||
1487 | 1470 | + mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix = *matrix; | ||
1488 | 1471 | + quadMatrix = &mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix; | ||
1489 | 1472 | + | ||
1490 | 1473 | + /* Set the desired rect dimentions | ||
1491 | 1474 | + * for the part of the glow we are painting */ | ||
1492 | 1475 | + | ||
1493 | 1476 | + x1 = WIN_REAL_X (w) - glowSize + glowOffset; | ||
1494 | 1477 | + y1 = WIN_REAL_Y (w) - glowSize + glowOffset; | ||
1495 | 1478 | + | ||
1496 | 1479 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
1497 | 1480 | + * and the x and y position | ||
1498 | 1481 | + * | ||
1499 | 1482 | + * Scaling both parts of the texture in a positive direction | ||
1500 | 1483 | + * here (left to right top to bottom) | ||
1501 | 1484 | + * | ||
1502 | 1485 | + * The base position (x0 and y0) here requires us to move backwards | ||
1503 | 1486 | + * on the x and y dimentions by the calculated rect dimentions | ||
1504 | 1487 | + * multiplied by the scale factors | ||
1505 | 1488 | + */ | ||
1506 | 1489 | + | ||
1507 | 1490 | + quadMatrix->xx = 1.0f / glowSize; | ||
1508 | 1491 | + quadMatrix->yy = 1.0f / (glowSize); | ||
1509 | 1492 | + quadMatrix->x0 = -(x1 * quadMatrix->xx); | ||
1510 | 1493 | + quadMatrix->y0 = -(y1 * quadMatrix->yy); | ||
1511 | 1494 | + | ||
1512 | 1495 | + x2 = MIN (WIN_REAL_X (w) + glowOffset, | ||
1513 | 1496 | + WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2)); | ||
1514 | 1497 | + y2 = MIN (WIN_REAL_Y (w) + glowOffset, | ||
1515 | 1498 | + WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2)); | ||
1516 | 1499 | + | ||
1517 | 1500 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
1518 | 1501 | + | ||
1519 | 1502 | + /* Top right corner */ | ||
1520 | 1503 | + box = &mGlowQuads[GLOWQUAD_TOPRIGHT].mBox; | ||
1521 | 1504 | + mGlowQuads[GLOWQUAD_TOPRIGHT].mMatrix = *matrix; | ||
1522 | 1505 | + quadMatrix = &mGlowQuads[GLOWQUAD_TOPRIGHT].mMatrix; | ||
1523 | 1506 | + | ||
1524 | 1507 | + /* Set the desired rect dimentions | ||
1525 | 1508 | + * for the part of the glow we are painting */ | ||
1526 | 1509 | + | ||
1527 | 1510 | + x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset; | ||
1528 | 1511 | + y1 = WIN_REAL_Y (w) - glowSize + glowOffset; | ||
1529 | 1512 | + x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset; | ||
1530 | 1513 | + | ||
1531 | 1514 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
1532 | 1515 | + * and the x and y position | ||
1533 | 1516 | + * | ||
1534 | 1517 | + * Scaling the y part of the texture in a positive direction | ||
1535 | 1518 | + * and the x part in a negative direction here | ||
1536 | 1519 | + * (right to left top to bottom) | ||
1537 | 1520 | + * | ||
1538 | 1521 | + * The base position (x0 and y0) here requires us to move backwards | ||
1539 | 1522 | + * on the y dimention and forwards on x by the calculated rect dimentions | ||
1540 | 1523 | + * multiplied by the scale factors (since we are moving forward on x we | ||
1541 | 1524 | + * need the inverse of that which is 1 - x1 * xx | ||
1542 | 1525 | + */ | ||
1543 | 1526 | + | ||
1544 | 1527 | + quadMatrix->xx = -1.0f / glowSize; | ||
1545 | 1528 | + quadMatrix->yy = 1.0f / glowSize; | ||
1546 | 1529 | + quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx); | ||
1547 | 1530 | + quadMatrix->y0 = -(y1 * quadMatrix->yy); | ||
1548 | 1531 | + | ||
1549 | 1532 | + x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset, | ||
1550 | 1533 | + WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2)); | ||
1551 | 1534 | + y2 = MIN (WIN_REAL_Y (w) + glowOffset, | ||
1552 | 1535 | + WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2)); | ||
1553 | 1536 | + | ||
1554 | 1537 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
1555 | 1538 | + | ||
1556 | 1539 | + /* Bottom left corner */ | ||
1557 | 1540 | + box = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mBox; | ||
1558 | 1541 | + mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix = *matrix; | ||
1559 | 1542 | + quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix; | ||
1560 | 1543 | + | ||
1561 | 1544 | + x1 = WIN_REAL_X (w) - glowSize + glowOffset; | ||
1562 | 1545 | + y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset; | ||
1563 | 1546 | + x2 = WIN_REAL_X (w) + glowOffset; | ||
1564 | 1547 | + y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset; | ||
1565 | 1548 | + | ||
1566 | 1549 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
1567 | 1550 | + * and the x and y position | ||
1568 | 1551 | + * | ||
1569 | 1552 | + * Scaling the x part of the texture in a positive direction | ||
1570 | 1553 | + * and the y part in a negative direction here | ||
1571 | 1554 | + * (left to right bottom to top) | ||
1572 | 1555 | + * | ||
1573 | 1556 | + * The base position (x0 and y0) here requires us to move backwards | ||
1574 | 1557 | + * on the x dimention and forwards on y by the calculated rect dimentions | ||
1575 | 1558 | + * multiplied by the scale factors (since we are moving forward on x we | ||
1576 | 1559 | + * need the inverse of that which is 1 - y1 * yy | ||
1577 | 1560 | + */ | ||
1578 | 1561 | + | ||
1579 | 1562 | + quadMatrix->xx = 1.0f / glowSize; | ||
1580 | 1563 | + quadMatrix->yy = -1.0f / glowSize; | ||
1581 | 1564 | + quadMatrix->x0 = -(x1 * quadMatrix->xx); | ||
1582 | 1565 | + quadMatrix->y0 = 1.0f - (y1 * quadMatrix->yy); | ||
1583 | 1566 | + | ||
1584 | 1567 | + y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset, | ||
1585 | 1568 | + WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2)); | ||
1586 | 1569 | + x2 = MIN (WIN_REAL_X (w) + glowOffset, | ||
1587 | 1570 | + WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2)); | ||
1588 | 1571 | + | ||
1589 | 1572 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
1590 | 1573 | + | ||
1591 | 1574 | + /* Bottom right corner */ | ||
1592 | 1575 | + box = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mBox; | ||
1593 | 1576 | + mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix = *matrix; | ||
1594 | 1577 | + quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix; | ||
1595 | 1578 | + | ||
1596 | 1579 | + x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset; | ||
1597 | 1580 | + y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset; | ||
1598 | 1581 | + x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset; | ||
1599 | 1582 | + y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset; | ||
1600 | 1583 | + | ||
1601 | 1584 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
1602 | 1585 | + * and the x and y position | ||
1603 | 1586 | + * | ||
1604 | 1587 | + * Scaling the both parts of the texture in a negative direction | ||
1605 | 1588 | + * (right to left bottom to top) | ||
1606 | 1589 | + * | ||
1607 | 1590 | + * The base position (x0 and y0) here requires us to move forwards | ||
1608 | 1591 | + * on both dimentions by the calculated rect dimentions | ||
1609 | 1592 | + * multiplied by the scale factors | ||
1610 | 1593 | + */ | ||
1611 | 1594 | + | ||
1612 | 1595 | + quadMatrix->xx = -1.0f / glowSize; | ||
1613 | 1596 | + quadMatrix->yy = -1.0f / glowSize; | ||
1614 | 1597 | + quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx); | ||
1615 | 1598 | + quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy); | ||
1616 | 1599 | + | ||
1617 | 1600 | + x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset, | ||
1618 | 1601 | + WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2)); | ||
1619 | 1602 | + y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset, | ||
1620 | 1603 | + WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2)); | ||
1621 | 1604 | + | ||
1622 | 1605 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
1623 | 1606 | + | ||
1624 | 1607 | + /* Top edge */ | ||
1625 | 1608 | + box = &mGlowQuads[GLOWQUAD_TOP].mBox; | ||
1626 | 1609 | + mGlowQuads[GLOWQUAD_TOP].mMatrix = *matrix; | ||
1627 | 1610 | + quadMatrix = &mGlowQuads[GLOWQUAD_TOP].mMatrix; | ||
1628 | 1611 | + | ||
1629 | 1612 | + x1 = WIN_REAL_X (w) + glowOffset; | ||
1630 | 1613 | + y1 = WIN_REAL_Y (w) - glowSize + glowOffset; | ||
1631 | 1614 | + x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset; | ||
1632 | 1615 | + y2 = WIN_REAL_Y (w) + glowOffset; | ||
1633 | 1616 | + | ||
1634 | 1617 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
1635 | 1618 | + * and the x and y position | ||
1636 | 1619 | + * | ||
1637 | 1620 | + * No need to scale the x part of the texture here, but we | ||
1638 | 1621 | + * are scaling on the y part in a positive direciton | ||
1639 | 1622 | + * | ||
1640 | 1623 | + * The base position (y0) here requires us to move backwards | ||
1641 | 1624 | + * on the x dimention and forwards on y by the calculated rect dimentions | ||
1642 | 1625 | + * multiplied by the scale factors | ||
1643 | 1626 | + */ | ||
1644 | 1627 | + | ||
1645 | 1628 | + quadMatrix->xx = 0.0f; | ||
1646 | 1629 | + quadMatrix->yy = 1.0f / glowSize; | ||
1647 | 1630 | + quadMatrix->x0 = 1.0; | ||
1648 | 1631 | + quadMatrix->y0 = -(y1 * quadMatrix->yy); | ||
1649 | 1632 | + | ||
1650 | 1633 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
1651 | 1634 | + | ||
1652 | 1635 | + /* Bottom edge */ | ||
1653 | 1636 | + box = &mGlowQuads[GLOWQUAD_BOTTOM].mBox; | ||
1654 | 1637 | + mGlowQuads[GLOWQUAD_BOTTOM].mMatrix = *matrix; | ||
1655 | 1638 | + quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOM].mMatrix; | ||
1656 | 1639 | + | ||
1657 | 1640 | + x1 = WIN_REAL_X (w) + glowOffset; | ||
1658 | 1641 | + y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset; | ||
1659 | 1642 | + x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset; | ||
1660 | 1643 | + y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset; | ||
1661 | 1644 | + | ||
1662 | 1645 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
1663 | 1646 | + * and the x and y position | ||
1664 | 1647 | + * | ||
1665 | 1648 | + * No need to scale the x part of the texture here, but we | ||
1666 | 1649 | + * are scaling on the y part in a negative direciton | ||
1667 | 1650 | + * | ||
1668 | 1651 | + * The base position (y0) here requires us to move forwards | ||
1669 | 1652 | + * on y by the calculated rect dimentions | ||
1670 | 1653 | + * multiplied by the scale factors | ||
1671 | 1654 | + */ | ||
1672 | 1655 | + | ||
1673 | 1656 | + quadMatrix->xx = 0.0f; | ||
1674 | 1657 | + quadMatrix->yy = -1.0f / glowSize; | ||
1675 | 1658 | + quadMatrix->x0 = 1.0; | ||
1676 | 1659 | + quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy); | ||
1677 | 1660 | + | ||
1678 | 1661 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
1679 | 1662 | + | ||
1680 | 1663 | + /* Left edge */ | ||
1681 | 1664 | + box = &mGlowQuads[GLOWQUAD_LEFT].mBox; | ||
1682 | 1665 | + mGlowQuads[GLOWQUAD_LEFT].mMatrix = *matrix; | ||
1683 | 1666 | + quadMatrix = &mGlowQuads[GLOWQUAD_LEFT].mMatrix; | ||
1684 | 1667 | + | ||
1685 | 1668 | + x1 = WIN_REAL_X (w) - glowSize + glowOffset; | ||
1686 | 1669 | + y1 = WIN_REAL_Y (w) + glowOffset; | ||
1687 | 1670 | + x2 = WIN_REAL_X (w) + glowOffset; | ||
1688 | 1671 | + y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset; | ||
1689 | 1672 | + | ||
1690 | 1673 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
1691 | 1674 | + * and the x and y position | ||
1692 | 1675 | + * | ||
1693 | 1676 | + * No need to scale the y part of the texture here, but we | ||
1694 | 1677 | + * are scaling on the x part in a positive direciton | ||
1695 | 1678 | + * | ||
1696 | 1679 | + * The base position (x0) here requires us to move backwards | ||
1697 | 1680 | + * on x by the calculated rect dimentions | ||
1698 | 1681 | + * multiplied by the scale factors | ||
1699 | 1682 | + */ | ||
1700 | 1683 | + | ||
1701 | 1684 | + quadMatrix->xx = 1.0f / glowSize; | ||
1702 | 1685 | + quadMatrix->yy = 0.0f; | ||
1703 | 1686 | + quadMatrix->x0 = -(x1 * quadMatrix->xx); | ||
1704 | 1687 | + quadMatrix->y0 = 1.0; | ||
1705 | 1688 | + | ||
1706 | 1689 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
1707 | 1690 | + | ||
1708 | 1691 | + /* Right edge */ | ||
1709 | 1692 | + box = &mGlowQuads[GLOWQUAD_RIGHT].mBox; | ||
1710 | 1693 | + mGlowQuads[GLOWQUAD_RIGHT].mMatrix = *matrix; | ||
1711 | 1694 | + quadMatrix = &mGlowQuads[GLOWQUAD_RIGHT].mMatrix; | ||
1712 | 1695 | + | ||
1713 | 1696 | + x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset; | ||
1714 | 1697 | + y1 = WIN_REAL_Y (w) + glowOffset; | ||
1715 | 1698 | + x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset; | ||
1716 | 1699 | + y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset; | ||
1717 | 1700 | + | ||
1718 | 1701 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
1719 | 1702 | + * and the x and y position | ||
1720 | 1703 | + * | ||
1721 | 1704 | + * No need to scale the y part of the texture here, but we | ||
1722 | 1705 | + * are scaling on the x part in a negative direciton | ||
1723 | 1706 | + * | ||
1724 | 1707 | + * The base position (x0) here requires us to move forwards | ||
1725 | 1708 | + * on x by the calculated rect dimentions | ||
1726 | 1709 | + * multiplied by the scale factors | ||
1727 | 1710 | + */ | ||
1728 | 1711 | + | ||
1729 | 1712 | + quadMatrix->xx = -1.0f / glowSize; | ||
1730 | 1713 | + quadMatrix->yy = 0.0f; | ||
1731 | 1714 | + quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx); | ||
1732 | 1715 | + quadMatrix->y0 = 1.0; | ||
1733 | 1716 | + | ||
1734 | 1717 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
1735 | 1718 | +} | ||
1736 | 1719 | Index: ubuntu/plugins/expo/src/glow.h | ||
1737 | 1720 | =================================================================== | ||
1738 | 1721 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
1739 | 1722 | +++ ubuntu/plugins/expo/src/glow.h 2012-09-12 22:20:43.280760497 +0800 | ||
1740 | 1723 | @@ -0,0 +1,66 @@ | ||
1741 | 1724 | +/** | ||
1742 | 1725 | + * | ||
1743 | 1726 | + * Compiz group plugin | ||
1744 | 1727 | + * | ||
1745 | 1728 | + * glow.h | ||
1746 | 1729 | + * | ||
1747 | 1730 | + * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen, | ||
1748 | 1731 | + * Danny Baumann, Sam Spilsbury | ||
1749 | 1732 | + * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com> | ||
1750 | 1733 | + * Roi Cohen <roico.beryl@gmail.com> | ||
1751 | 1734 | + * Danny Baumann <maniac@opencompositing.org> | ||
1752 | 1735 | + * Sam Spilsbury <smspillaz@gmail.com> | ||
1753 | 1736 | + * | ||
1754 | 1737 | + * | ||
1755 | 1738 | + * This program is free software; you can redistribute it and/or | ||
1756 | 1739 | + * modify it under the terms of the GNU General Public License | ||
1757 | 1740 | + * as published by the Free Software Foundation; either version 2 | ||
1758 | 1741 | + * of the License, or (at your option) any later version. | ||
1759 | 1742 | + * | ||
1760 | 1743 | + * This program is distributed in the hope that it will be useful, | ||
1761 | 1744 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1762 | 1745 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1763 | 1746 | + * GNU General Public License for more details. | ||
1764 | 1747 | + * | ||
1765 | 1748 | + **/ | ||
1766 | 1749 | + | ||
1767 | 1750 | +#ifndef _EXPO_GLOW_H | ||
1768 | 1751 | +#define _EXPO_GLOW_H | ||
1769 | 1752 | + | ||
1770 | 1753 | +#define GLOWQUAD_TOPLEFT 0 | ||
1771 | 1754 | +#define GLOWQUAD_TOPRIGHT 1 | ||
1772 | 1755 | +#define GLOWQUAD_BOTTOMLEFT 2 | ||
1773 | 1756 | +#define GLOWQUAD_BOTTOMRIGHT 3 | ||
1774 | 1757 | +#define GLOWQUAD_TOP 4 | ||
1775 | 1758 | +#define GLOWQUAD_BOTTOM 5 | ||
1776 | 1759 | +#define GLOWQUAD_LEFT 6 | ||
1777 | 1760 | +#define GLOWQUAD_RIGHT 7 | ||
1778 | 1761 | +#define NUM_GLOWQUADS 8 | ||
1779 | 1762 | + | ||
1780 | 1763 | +/* Represents a particular glow texture, so here | ||
1781 | 1764 | + * we have hardcoded in the texture data, the offset | ||
1782 | 1765 | + * and the size of the texture | ||
1783 | 1766 | + */ | ||
1784 | 1767 | + | ||
1785 | 1768 | +typedef struct _GlowTextureProperties { | ||
1786 | 1769 | + char *textureData; | ||
1787 | 1770 | + int textureSize; | ||
1788 | 1771 | + int glowOffset; | ||
1789 | 1772 | +} GlowTextureProperties; | ||
1790 | 1773 | + | ||
1791 | 1774 | +/* Each glow quad contains a 2x2 scale + positional matrix | ||
1792 | 1775 | + * (the 3rd column is not used since that is for matrix skew | ||
1793 | 1776 | + * operations which we do not care about) | ||
1794 | 1777 | + * and also a CompRect which describes the size and position of | ||
1795 | 1778 | + * the quad on the glow | ||
1796 | 1779 | + */ | ||
1797 | 1780 | + | ||
1798 | 1781 | +class GlowQuad { | ||
1799 | 1782 | + public: | ||
1800 | 1783 | + CompRect mBox; | ||
1801 | 1784 | + GLTexture::Matrix mMatrix; | ||
1802 | 1785 | +}; | ||
1803 | 1786 | + | ||
1804 | 1787 | +extern const GlowTextureProperties glowTextureProperties; | ||
1805 | 1788 | + | ||
1806 | 1789 | +#endif | ||
1807 | 1790 | Index: ubuntu/plugins/expo/src/group_glow.h | ||
1808 | 1791 | =================================================================== | ||
1809 | 1792 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
1810 | 1793 | +++ ubuntu/plugins/expo/src/group_glow.h 2012-09-12 22:20:43.280760497 +0800 | ||
1811 | 1794 | @@ -0,0 +1,197 @@ | ||
1812 | 1795 | +#ifndef _GROUP_GLOWTEX_H | ||
1813 | 1796 | +#define _GROUP_GLOWTEX_H | ||
1814 | 1797 | + | ||
1815 | 1798 | +/** | ||
1816 | 1799 | + * | ||
1817 | 1800 | + * Compiz group plugin | ||
1818 | 1801 | + * | ||
1819 | 1802 | + * group_glow.h | ||
1820 | 1803 | + * | ||
1821 | 1804 | + * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen, | ||
1822 | 1805 | + * Danny Baumann, Sam Spilsbury | ||
1823 | 1806 | + * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com> | ||
1824 | 1807 | + * Roi Cohen <roico.beryl@gmail.com> | ||
1825 | 1808 | + * Danny Baumann <maniac@opencompositing.org> | ||
1826 | 1809 | + * Sam Spilsbury <smspillaz@gmail.com> | ||
1827 | 1810 | + * | ||
1828 | 1811 | + * | ||
1829 | 1812 | + * This program is free software; you can redistribute it and/or | ||
1830 | 1813 | + * modify it under the terms of the GNU General Public License | ||
1831 | 1814 | + * as published by the Free Software Foundation; either version 2 | ||
1832 | 1815 | + * of the License, or (at your option) any later version. | ||
1833 | 1816 | + * | ||
1834 | 1817 | + * This program is distributed in the hope that it will be useful, | ||
1835 | 1818 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1836 | 1819 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1837 | 1820 | + * GNU General Public License for more details. | ||
1838 | 1821 | + * | ||
1839 | 1822 | + **/ | ||
1840 | 1823 | + | ||
1841 | 1824 | +/* | ||
1842 | 1825 | + * glowTex | ||
1843 | 1826 | + */ | ||
1844 | 1827 | + | ||
1845 | 1828 | +static char glowTexRect[4097] = { | ||
1846 | 1829 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1847 | 1830 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1848 | 1831 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377" | ||
1849 | 1832 | + "\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377" | ||
1850 | 1833 | + "\377\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1851 | 1834 | + "\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\6\377\377" | ||
1852 | 1835 | + "\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377" | ||
1853 | 1836 | + "\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6" | ||
1854 | 1837 | + "\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377" | ||
1855 | 1838 | + "\14\377\377\377\14\377\377\377\14\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1856 | 1839 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\14" | ||
1857 | 1840 | + "\377\377\377\14\377\377\377\22\377\377\377\22\377\377\377\22\377\377\377" | ||
1858 | 1841 | + "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377" | ||
1859 | 1842 | + "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377" | ||
1860 | 1843 | + "\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377" | ||
1861 | 1844 | + "\35\377\377\377\35\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377" | ||
1862 | 1845 | + "\377\6\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377\27\377\377" | ||
1863 | 1846 | + "\377\27\377\377\377\35\377\377\377#\377\377\377'\377\377\377'\377\377\377" | ||
1864 | 1847 | + "+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377" | ||
1865 | 1848 | + "\377+\377\377\377+\377\377\377+\377\377\3771\377\377\3771\377\377\3771\377" | ||
1866 | 1849 | + "\377\3771\377\377\3771\377\377\3771\377\377\3771\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1867 | 1850 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377" | ||
1868 | 1851 | + "\27\377\377\377\35\377\377\377#\377\377\377+\377\377\3771\377\377\3776\377" | ||
1869 | 1852 | + "\377\377<\377\377\377>\377\377\377C\377\377\377I\377\377\377I\377\377\377" | ||
1870 | 1853 | + "I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377" | ||
1871 | 1854 | + "\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377" | ||
1872 | 1855 | + "\377\377L\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377" | ||
1873 | 1856 | + "\377\377\22\377\377\377\27\377\377\377#\377\377\377+\377\377\3776\377\377" | ||
1874 | 1857 | + "\377C\377\377\377L\377\377\377U\377\377\377]\377\377\377`\377\377\377d\377" | ||
1875 | 1858 | + "\377\377h\377\377\377k\377\377\377k\377\377\377k\377\377\377k\377\377\377" | ||
1876 | 1859 | + "k\377\377\377k\377\377\377k\377\377\377p\377\377\377p\377\377\377p\377\377" | ||
1877 | 1860 | + "\377p\377\377\377p\377\377\377p\377\377\377p\0\0\0\0\0\0\0\0\0\0\0\0\377" | ||
1878 | 1861 | + "\377\377\6\377\377\377\14\377\377\377\22\314\314\314\35\377\377\377'\377" | ||
1879 | 1862 | + "\377\3771\377\377\377>\357\357\357P\377\377\377]\363\363\363k\365\365\365" | ||
1880 | 1863 | + "v\365\365\365|\377\377\377\202\367\367\367\210\367\367\367\214\367\367\367" | ||
1881 | 1864 | + "\216\367\367\367\221\367\367\367\221\367\367\367\221\367\367\367\221\367" | ||
1882 | 1865 | + "\367\367\221\367\367\367\221\367\367\367\224\367\367\367\224\367\367\367" | ||
1883 | 1866 | + "\224\367\367\367\224\367\367\367\224\367\367\367\224\367\367\367\224\0\0" | ||
1884 | 1867 | + "\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\27\377" | ||
1885 | 1868 | + "\377\377'\377\377\3776\377\377\377I\377\377\377Y\377\377\377k\376\376\376" | ||
1886 | 1869 | + "y\377\377\377\210\377\377\377\224\377\377\377\235\377\377\377\245\377\377" | ||
1887 | 1870 | + "\377\253\377\377\377\255\377\377\377\262\377\377\377\262\377\377\377\263" | ||
1888 | 1871 | + "\377\377\377\263\377\377\377\263\377\377\377\263\377\377\377\263\377\377" | ||
1889 | 1872 | + "\377\266\377\377\377\266\377\377\377\266\377\377\377\266\377\377\377\266" | ||
1890 | 1873 | + "\377\377\377\266\377\377\377\266\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377" | ||
1891 | 1874 | + "\14\377\377\377\27\377\377\377#\377\377\3771\377\377\377I\377\377\377]\377" | ||
1892 | 1875 | + "\377\377r\377\377\377\205\377\377\377\231\377\377\377\247\377\377\377\263" | ||
1893 | 1876 | + "\377\377\377\275\377\377\377\304\377\377\377\310\377\377\377\313\377\377" | ||
1894 | 1877 | + "\377\316\377\377\377\320\377\377\377\320\377\377\377\320\377\377\377\320" | ||
1895 | 1878 | + "\377\377\377\320\377\377\377\320\377\377\377\322\377\377\377\322\377\377" | ||
1896 | 1879 | + "\377\322\377\377\377\322\377\377\377\322\377\377\377\322\377\377\377\322" | ||
1897 | 1880 | + "\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\35\377\377" | ||
1898 | 1881 | + "\377+\377\377\377>\377\377\377Y\377\377\377r\377\377\377\210\376\376\376" | ||
1899 | 1882 | + "\237\377\377\377\262\377\377\377\302\377\377\377\313\377\377\377\324\377" | ||
1900 | 1883 | + "\377\377\332\376\376\376\336\377\377\377\341\377\377\377\342\377\377\377" | ||
1901 | 1884 | + "\344\377\377\377\344\377\377\377\344\377\377\377\344\377\377\377\344\377" | ||
1902 | 1885 | + "\377\377\344\377\377\377\345\377\377\377\345\377\377\377\345\377\377\377" | ||
1903 | 1886 | + "\345\377\377\377\345\377\377\377\345\377\377\377\345\0\0\0\0\377\377\377" | ||
1904 | 1887 | + "\6\377\377\377\14\377\377\377\27\377\377\377#\377\377\3776\377\377\377P\377" | ||
1905 | 1888 | + "\377\377k\377\377\377\205\376\376\376\237\372\372\372\266\377\377\377\307" | ||
1906 | 1889 | + "\373\373\373\325\373\373\373\337\374\374\374\345\374\374\374\352\374\374" | ||
1907 | 1890 | + "\374\355\374\374\374\357\374\374\374\360\374\374\374\361\374\374\374\361" | ||
1908 | 1891 | + "\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374" | ||
1909 | 1892 | + "\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362" | ||
1910 | 1893 | + "\374\374\374\362\374\374\374\362\0\0\0\0\377\377\377\6\377\377\377\14\377" | ||
1911 | 1894 | + "\377\377\35\377\377\377+\377\377\377C\377\377\377]\377\377\377|\377\377\377" | ||
1912 | 1895 | + "\231\377\377\377\263\377\377\377\307\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1913 | 1896 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1914 | 1897 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377" | ||
1915 | 1898 | + "\377\377\6\377\377\377\22\324\324\324#\377\377\3771\377\377\377L\363\363" | ||
1916 | 1899 | + "\363k\377\377\377\210\377\377\377\247\377\377\377\302\377\377\377\325\0\0" | ||
1917 | 1900 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1918 | 1901 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1919 | 1902 | + "\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\22\377\377" | ||
1920 | 1903 | + "\377#\377\377\377<\377\377\377U\377\377\377v\377\377\377\226\377\377\377" | ||
1921 | 1904 | + "\263\377\377\377\315\377\377\377\337\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1922 | 1905 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1923 | 1906 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377" | ||
1924 | 1907 | + "\6\377\377\377\14\377\377\377\27\377\377\377'\377\377\377>\377\377\377]\377" | ||
1925 | 1908 | + "\377\377|\370\370\370\237\377\377\377\275\373\373\373\325\377\377\377\345" | ||
1926 | 1909 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1927 | 1910 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1928 | 1911 | + "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\27\377" | ||
1929 | 1912 | + "\377\377+\377\377\377C\377\377\377`\377\377\377\202\377\377\377\247\377\377" | ||
1930 | 1913 | + "\377\304\377\377\377\332\377\377\377\352\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1931 | 1914 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1932 | 1915 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377" | ||
1933 | 1916 | + "\377\6\377\377\377\14\377\377\377\27\377\377\377+\377\377\377C\377\377\377" | ||
1934 | 1917 | + "d\377\377\377\210\377\377\377\253\377\377\377\310\376\376\376\336\374\374" | ||
1935 | 1918 | + "\374\355\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1936 | 1919 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1937 | 1920 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377" | ||
1938 | 1921 | + "\35\377\377\377+\377\377\377I\377\377\377h\377\377\377\214\377\377\377\260" | ||
1939 | 1922 | + "\377\377\377\313\374\374\374\342\374\374\374\357\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1940 | 1923 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1941 | 1924 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1942 | 1925 | + "\377\377\377\6\377\377\377\14\377\377\377\35\342\342\3421\377\377\377I\377" | ||
1943 | 1926 | + "\377\377k\377\377\377\216\377\377\377\262\377\377\377\316\374\374\374\344" | ||
1944 | 1927 | + "\377\377\377\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1945 | 1928 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1946 | 1929 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377" | ||
1947 | 1930 | + "\377\377\35\377\377\3771\377\377\377L\377\377\377k\377\377\377\221\377\377" | ||
1948 | 1931 | + "\377\263\377\377\377\320\377\377\377\344\377\377\377\361\0\0\0\0\0\0\0\0" | ||
1949 | 1932 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1950 | 1933 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1951 | 1934 | + "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377" | ||
1952 | 1935 | + "\377L\377\377\377k\377\377\377\221\377\377\377\263\377\377\377\320\377\377" | ||
1953 | 1936 | + "\377\344\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1954 | 1937 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1955 | 1938 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377" | ||
1956 | 1939 | + "\14\377\377\377\35\377\377\3771\377\377\377L\364\364\364p\377\377\377\221" | ||
1957 | 1940 | + "\372\372\372\266\377\377\377\320\374\374\374\345\377\377\377\362\0\0\0\0" | ||
1958 | 1941 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1959 | 1942 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1960 | 1943 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377" | ||
1961 | 1944 | + "1\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373\373\322" | ||
1962 | 1945 | + "\377\377\377\345\377\377\377\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1963 | 1946 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1964 | 1947 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377" | ||
1965 | 1948 | + "\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\377\377" | ||
1966 | 1949 | + "\377\221\377\377\377\266\373\373\373\322\377\377\377\345\377\377\377\362" | ||
1967 | 1950 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1968 | 1951 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1969 | 1952 | + "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377" | ||
1970 | 1953 | + "\377\3771\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373" | ||
1971 | 1954 | + "\373\322\377\377\377\345\377\377\377\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1972 | 1955 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1973 | 1956 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377" | ||
1974 | 1957 | + "\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377" | ||
1975 | 1958 | + "p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345\374\374" | ||
1976 | 1959 | + "\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1977 | 1960 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1978 | 1961 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377" | ||
1979 | 1962 | + "\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266" | ||
1980 | 1963 | + "\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1981 | 1964 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1982 | 1965 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1983 | 1966 | + "\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377" | ||
1984 | 1967 | + "\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345" | ||
1985 | 1968 | + "\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1986 | 1969 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1987 | 1970 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377" | ||
1988 | 1971 | + "\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377" | ||
1989 | 1972 | + "\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0" | ||
1990 | 1973 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1991 | 1974 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1992 | 1975 | + "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377" | ||
1993 | 1976 | + "\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377" | ||
1994 | 1977 | + "\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1995 | 1978 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
1996 | 1979 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377" | ||
1997 | 1980 | + "\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224" | ||
1998 | 1981 | + "\377\377\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0" | ||
1999 | 1982 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
2000 | 1983 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
2001 | 1984 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377" | ||
2002 | 1985 | + "1\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322" | ||
2003 | 1986 | + "\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
2004 | 1987 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
2005 | 1988 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", | ||
2006 | 1989 | +}; | ||
2007 | 1990 | + | ||
2008 | 1991 | +#endif | ||
2009 | 1992 | Index: ubuntu/plugins/expo/src/wall_offset/CMakeLists.txt | ||
2010 | 1993 | =================================================================== | ||
2011 | 1994 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2012 | 1995 | +++ ubuntu/plugins/expo/src/wall_offset/CMakeLists.txt 2012-09-12 22:20:43.280760497 +0800 | ||
2013 | 1996 | @@ -0,0 +1,33 @@ | ||
2014 | 1997 | +include_directories ( | ||
2015 | 1998 | + ${CMAKE_CURRENT_SOURCE_DIR}/include | ||
2016 | 1999 | + ${CMAKE_CURRENT_SOURCE_DIR}/src | ||
2017 | 2000 | + ${Boost_INCLUDE_DIRS} | ||
2018 | 2001 | + ${GLIBMM_INCLUDE_DIRS} | ||
2019 | 2002 | +) | ||
2020 | 2003 | + | ||
2021 | 2004 | +link_directories (${GLIBMM_LIBRARY_DIRS} ${COMPIZ_LIBRARY_DIRS}) | ||
2022 | 2005 | + | ||
2023 | 2006 | +set ( | ||
2024 | 2007 | + PRIVATE_HEADERS | ||
2025 | 2008 | + ${CMAKE_CURRENT_SOURCE_DIR}/include/wall-offset.h | ||
2026 | 2009 | +) | ||
2027 | 2010 | + | ||
2028 | 2011 | +set ( | ||
2029 | 2012 | + SRCS | ||
2030 | 2013 | + ${CMAKE_CURRENT_SOURCE_DIR}/src/wall-offset.cpp | ||
2031 | 2014 | +) | ||
2032 | 2015 | + | ||
2033 | 2016 | +add_library ( | ||
2034 | 2017 | + compiz_expo_wall_offset STATIC | ||
2035 | 2018 | + ${SRCS} | ||
2036 | 2019 | + ${PRIVATE_HEADERS} | ||
2037 | 2020 | +) | ||
2038 | 2021 | + | ||
2039 | 2022 | +if (COMPIZ_BUILD_TESTING) | ||
2040 | 2023 | + add_subdirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/tests ) | ||
2041 | 2024 | +endif (COMPIZ_BUILD_TESTING) | ||
2042 | 2025 | + | ||
2043 | 2026 | +target_link_libraries ( | ||
2044 | 2027 | + compiz_expo_wall_offset | ||
2045 | 2028 | + compiz_core | ||
2046 | 2029 | +) | ||
2047 | 2030 | Index: ubuntu/plugins/expo/src/wall_offset/include/wall-offset.h | ||
2048 | 2031 | =================================================================== | ||
2049 | 2032 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2050 | 2033 | +++ ubuntu/plugins/expo/src/wall_offset/include/wall-offset.h 2012-09-12 22:20:43.280760497 +0800 | ||
2051 | 2034 | @@ -0,0 +1,43 @@ | ||
2052 | 2035 | +/** | ||
2053 | 2036 | + * Copyright © 2012 Canonical Ltd. | ||
2054 | 2037 | + * | ||
2055 | 2038 | + * Authors: | ||
2056 | 2039 | + * Sam Spilsbury <sam.spilsbury@canonical.com> | ||
2057 | 2040 | + * | ||
2058 | 2041 | + * This program is free software; you can redistribute it and/or | ||
2059 | 2042 | + * modify it under the terms of the GNU General Public License | ||
2060 | 2043 | + * as published by the Free Software Foundation; either version 2 | ||
2061 | 2044 | + * of the License, or (at your option) any later version. | ||
2062 | 2045 | + * | ||
2063 | 2046 | + * This program is distributed in the hope that it will be useful, | ||
2064 | 2047 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2065 | 2048 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2066 | 2049 | + * GNU General Public License for more details. | ||
2067 | 2050 | + * | ||
2068 | 2051 | + **/ | ||
2069 | 2052 | + | ||
2070 | 2053 | +#ifndef _COMPIZ_EXPO_WALL_OFFSET_H | ||
2071 | 2054 | +#define _COMPIZ_EXPO_WALL_OFFSET_H | ||
2072 | 2055 | + | ||
2073 | 2056 | +#include <core/point.h> | ||
2074 | 2057 | +#include <core/size.h> | ||
2075 | 2058 | +#include <core/rect.h> | ||
2076 | 2059 | + | ||
2077 | 2060 | +namespace compiz | ||
2078 | 2061 | +{ | ||
2079 | 2062 | + namespace expo | ||
2080 | 2063 | + { | ||
2081 | 2064 | + void | ||
2082 | 2065 | + calculateWallOffset (const CompRect &output, | ||
2083 | 2066 | + const CompPoint &offsetInScreenCoords, | ||
2084 | 2067 | + const CompPoint &vpSize, | ||
2085 | 2068 | + const CompSize &screenSize, | ||
2086 | 2069 | + float &offsetInWorldX, | ||
2087 | 2070 | + float &offsetInWorldY, | ||
2088 | 2071 | + float &worldScaleFactorX, | ||
2089 | 2072 | + float &worldScaleFactorY, | ||
2090 | 2073 | + float animationProgress); | ||
2091 | 2074 | + } | ||
2092 | 2075 | +} | ||
2093 | 2076 | + | ||
2094 | 2077 | +#endif | ||
2095 | 2078 | Index: ubuntu/plugins/expo/src/wall_offset/src/wall-offset.cpp | ||
2096 | 2079 | =================================================================== | ||
2097 | 2080 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2098 | 2081 | +++ ubuntu/plugins/expo/src/wall_offset/src/wall-offset.cpp 2012-09-12 22:20:43.280760497 +0800 | ||
2099 | 2082 | @@ -0,0 +1,55 @@ | ||
2100 | 2083 | +/** | ||
2101 | 2084 | + * Copyright © 2012 Canonical Ltd. | ||
2102 | 2085 | + * | ||
2103 | 2086 | + * Authors: | ||
2104 | 2087 | + * Sam Spilsbury <sam.spilsbury@canonical.com> | ||
2105 | 2088 | + * | ||
2106 | 2089 | + * This program is free software; you can redistribute it and/or | ||
2107 | 2090 | + * modify it under the terms of the GNU General Public License | ||
2108 | 2091 | + * as published by the Free Software Foundation; either version 2 | ||
2109 | 2092 | + * of the License, or (at your option) any later version. | ||
2110 | 2093 | + * | ||
2111 | 2094 | + * This program is distributed in the hope that it will be useful, | ||
2112 | 2095 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2113 | 2096 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2114 | 2097 | + * GNU General Public License for more details. | ||
2115 | 2098 | + * | ||
2116 | 2099 | + **/ | ||
2117 | 2100 | +#include "wall-offset.h" | ||
2118 | 2101 | + | ||
2119 | 2102 | +namespace compiz | ||
2120 | 2103 | +{ | ||
2121 | 2104 | + namespace expo | ||
2122 | 2105 | + { | ||
2123 | 2106 | + void | ||
2124 | 2107 | + calculateWallOffset (const CompRect &output, | ||
2125 | 2108 | + const CompPoint &offsetInScreenCoords, | ||
2126 | 2109 | + const CompPoint &vpSize, | ||
2127 | 2110 | + const CompSize &screenSize, | ||
2128 | 2111 | + float &offsetInWorldX, | ||
2129 | 2112 | + float &offsetInWorldY, | ||
2130 | 2113 | + float &worldScaleFactorX, | ||
2131 | 2114 | + float &worldScaleFactorY, | ||
2132 | 2115 | + float animationProgress) | ||
2133 | 2116 | + { | ||
2134 | 2117 | + const float sx = screenSize.width () / static_cast <float> (output.width ()); | ||
2135 | 2118 | + const float sy = screenSize.height () / static_cast <float> (output.height ()); | ||
2136 | 2119 | + offsetInWorldX = 0.0; | ||
2137 | 2120 | + offsetInWorldY = 0.0; | ||
2138 | 2121 | + worldScaleFactorX = 1.0f; | ||
2139 | 2122 | + worldScaleFactorY = 1.0f; | ||
2140 | 2123 | + | ||
2141 | 2124 | + if (output.left () == 0) | ||
2142 | 2125 | + { | ||
2143 | 2126 | + offsetInWorldX = ((vpSize.x () * sx) / ((float) output.width ()) * (offsetInScreenCoords.x ()) * animationProgress); | ||
2144 | 2127 | + worldScaleFactorX = 1.0f - ((float) (offsetInScreenCoords.x ()) / (float) (output.width ())) * animationProgress; | ||
2145 | 2128 | + } | ||
2146 | 2129 | + | ||
2147 | 2130 | + if (output.top () == 0) | ||
2148 | 2131 | + { | ||
2149 | 2132 | + offsetInWorldY = ((vpSize.y () * sy) / ((float) output.height ()) * (offsetInScreenCoords.y ()) * animationProgress); | ||
2150 | 2133 | + worldScaleFactorY = 1.0f - ((float) (offsetInScreenCoords.y ()) / (float) output.height ()) * animationProgress; | ||
2151 | 2134 | + } | ||
2152 | 2135 | + } | ||
2153 | 2136 | + } | ||
2154 | 2137 | +} | ||
2155 | 2138 | Index: ubuntu/plugins/expo/src/wall_offset/tests/CMakeLists.txt | ||
2156 | 2139 | =================================================================== | ||
2157 | 2140 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2158 | 2141 | +++ ubuntu/plugins/expo/src/wall_offset/tests/CMakeLists.txt 2012-09-12 22:20:43.280760497 +0800 | ||
2159 | 2142 | @@ -0,0 +1,19 @@ | ||
2160 | 2143 | +if (NOT GTEST_FOUND) | ||
2161 | 2144 | + message ("Google Test not found - cannot build tests!") | ||
2162 | 2145 | + set (COMPIZ_BUILD_TESTING OFF) | ||
2163 | 2146 | +endif (NOT GTEST_FOUND) | ||
2164 | 2147 | + | ||
2165 | 2148 | +include_directories (${GTEST_INCLUDE_DIRS}) | ||
2166 | 2149 | + | ||
2167 | 2150 | +link_directories (${COMPIZ_LIBRARY_DIRS}) | ||
2168 | 2151 | + | ||
2169 | 2152 | +add_executable (compiz_test_expo_wall_offset | ||
2170 | 2153 | + ${CMAKE_CURRENT_SOURCE_DIR}/test-expo-wall-offset.cpp) | ||
2171 | 2154 | + | ||
2172 | 2155 | +target_link_libraries (compiz_test_expo_wall_offset | ||
2173 | 2156 | + compiz_expo_wall_offset | ||
2174 | 2157 | + ${GTEST_BOTH_LIBRARIES} | ||
2175 | 2158 | + ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. | ||
2176 | 2159 | + ) | ||
2177 | 2160 | + | ||
2178 | 2161 | +compiz_discover_tests (compiz_test_expo_wall_offset COVERAGE compiz_expo_wall_offset) | ||
2179 | 2162 | Index: ubuntu/plugins/expo/src/wall_offset/tests/test-expo-wall-offset.cpp | ||
2180 | 2163 | =================================================================== | ||
2181 | 2164 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2182 | 2165 | +++ ubuntu/plugins/expo/src/wall_offset/tests/test-expo-wall-offset.cpp 2012-09-12 22:20:43.280760497 +0800 | ||
2183 | 2166 | @@ -0,0 +1,263 @@ | ||
2184 | 2167 | +/* | ||
2185 | 2168 | + * Copyright © 2012 Canonical Ltd. | ||
2186 | 2169 | + * | ||
2187 | 2170 | + * Permission to use, copy, modify, distribute, and sell this software | ||
2188 | 2171 | + * and its documentation for any purpose is hereby granted without | ||
2189 | 2172 | + * fee, provided that the above copyright notice appear in all copies | ||
2190 | 2173 | + * and that both that copyright notice and this permission notice | ||
2191 | 2174 | + * appear in supporting documentation, and that the name of | ||
2192 | 2175 | + * Canonical Ltd. not be used in advertising or publicity pertaining to | ||
2193 | 2176 | + * distribution of the software without specific, written prior permission. | ||
2194 | 2177 | + * Canonical Ltd. makes no representations about the suitability of this | ||
2195 | 2178 | + * software for any purpose. It is provided "as is" without express or | ||
2196 | 2179 | + * implied warranty. | ||
2197 | 2180 | + * | ||
2198 | 2181 | + * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
2199 | 2182 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
2200 | 2183 | + * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
2201 | 2184 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
2202 | 2185 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
2203 | 2186 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
2204 | 2187 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
2205 | 2188 | + * | ||
2206 | 2189 | + * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com> | ||
2207 | 2190 | + */ | ||
2208 | 2191 | +#include <tr1/tuple> | ||
2209 | 2192 | +#include <gtest/gtest.h> | ||
2210 | 2193 | +#include "wall-offset.h" | ||
2211 | 2194 | + | ||
2212 | 2195 | +using ::testing::WithParamInterface; | ||
2213 | 2196 | +using ::testing::ValuesIn; | ||
2214 | 2197 | +using ::testing::Combine; | ||
2215 | 2198 | +using ::testing::Range; | ||
2216 | 2199 | + | ||
2217 | 2200 | +class ExpoWallOffsetTest : | ||
2218 | 2201 | + public ::testing::Test | ||
2219 | 2202 | +{ | ||
2220 | 2203 | + protected: | ||
2221 | 2204 | + | ||
2222 | 2205 | + float offsetInWorldX; | ||
2223 | 2206 | + float offsetInWorldY; | ||
2224 | 2207 | + float worldScaleFactorX; | ||
2225 | 2208 | + float worldScaleFactorY; | ||
2226 | 2209 | +}; | ||
2227 | 2210 | + | ||
2228 | 2211 | +namespace | ||
2229 | 2212 | +{ | ||
2230 | 2213 | + const unsigned int nAnimationsBegin = 0; | ||
2231 | 2214 | + const unsigned int nAnimationSteps = 20; | ||
2232 | 2215 | + | ||
2233 | 2216 | + struct OffsetAnimationParameters | ||
2234 | 2217 | + { | ||
2235 | 2218 | + float offsetInWorldX; | ||
2236 | 2219 | + float offsetInWorldY; | ||
2237 | 2220 | + float worldScaleFactorX; | ||
2238 | 2221 | + float worldScaleFactorY; | ||
2239 | 2222 | + }; | ||
2240 | 2223 | + | ||
2241 | 2224 | + struct OffsetParameters | ||
2242 | 2225 | + { | ||
2243 | 2226 | + float offsetX; | ||
2244 | 2227 | + float offsetY; | ||
2245 | 2228 | + int vpSizeWidth; | ||
2246 | 2229 | + int vpSizeHeight; | ||
2247 | 2230 | + int screenWidth; | ||
2248 | 2231 | + int screenHeight; | ||
2249 | 2232 | + int outputWidth; | ||
2250 | 2233 | + int outputHeight; | ||
2251 | 2234 | + OffsetAnimationParameters animationParameters[20]; | ||
2252 | 2235 | + }; | ||
2253 | 2236 | + | ||
2254 | 2237 | + const OffsetParameters testingOffsetParameters[] = | ||
2255 | 2238 | + { | ||
2256 | 2239 | + { | ||
2257 | 2240 | + 0, | ||
2258 | 2241 | + 0, | ||
2259 | 2242 | + 1, | ||
2260 | 2243 | + 1, | ||
2261 | 2244 | + 100, | ||
2262 | 2245 | + 100, | ||
2263 | 2246 | + 100, | ||
2264 | 2247 | + 100, | ||
2265 | 2248 | + { | ||
2266 | 2249 | + { 0, 0, 1.0, 1.0 }, | ||
2267 | 2250 | + { 0, 0, 1.0, 1.0 }, | ||
2268 | 2251 | + { 0, 0, 1.0, 1.0 }, | ||
2269 | 2252 | + { 0, 0, 1.0, 1.0 }, | ||
2270 | 2253 | + { 0, 0, 1.0, 1.0 }, | ||
2271 | 2254 | + { 0, 0, 1.0, 1.0 }, | ||
2272 | 2255 | + { 0, 0, 1.0, 1.0 }, | ||
2273 | 2256 | + { 0, 0, 1.0, 1.0 }, | ||
2274 | 2257 | + { 0, 0, 1.0, 1.0 }, | ||
2275 | 2258 | + { 0, 0, 1.0, 1.0 }, | ||
2276 | 2259 | + { 0, 0, 1.0, 1.0 }, | ||
2277 | 2260 | + { 0, 0, 1.0, 1.0 }, | ||
2278 | 2261 | + { 0, 0, 1.0, 1.0 }, | ||
2279 | 2262 | + { 0, 0, 1.0, 1.0 }, | ||
2280 | 2263 | + { 0, 0, 1.0, 1.0 }, | ||
2281 | 2264 | + { 0, 0, 1.0, 1.0 }, | ||
2282 | 2265 | + { 0, 0, 1.0, 1.0 }, | ||
2283 | 2266 | + { 0, 0, 1.0, 1.0 }, | ||
2284 | 2267 | + { 0, 0, 1.0, 1.0 }, | ||
2285 | 2268 | + { 0, 0, 1.0, 1.0 } | ||
2286 | 2269 | + } | ||
2287 | 2270 | + }, | ||
2288 | 2271 | + /* Monitor 1280x800, Screen: 1280x800, Viewport Layout: 2x2, Offset: 32, 24 */ | ||
2289 | 2272 | + { | ||
2290 | 2273 | + 32, | ||
2291 | 2274 | + 24, | ||
2292 | 2275 | + 2, | ||
2293 | 2276 | + 2, | ||
2294 | 2277 | + 1280, | ||
2295 | 2278 | + 800, | ||
2296 | 2279 | + 1280, | ||
2297 | 2280 | + 800, | ||
2298 | 2281 | + { | ||
2299 | 2282 | + { 0, 0, 1, 1 }, | ||
2300 | 2283 | + { 0.0025000001769512892, 0.0011718750465661287, 0.99874997138977051, 0.99906247854232788 }, | ||
2301 | 2284 | + { 0.0050000003539025784, 0.0023437500931322575, 0.99750000238418579, 0.99812501668930054 }, | ||
2302 | 2285 | + { 0.0075000002980232239, 0.0035156251396983862, 0.9962499737739563, 0.99718749523162842 }, | ||
2303 | 2286 | + { 0.010000000707805157, 0.0046875001862645149, 0.99500000476837158, 0.9962499737739563 }, | ||
2304 | 2287 | + { 0.012500000186264515, 0.005859375, 0.99374997615814209, 0.99531251192092896 }, | ||
2305 | 2288 | + { 0.015000000596046448, 0.0070312502793967724, 0.99250000715255737, 0.99437499046325684 }, | ||
2306 | 2289 | + { 0.017500000074505806, 0.0082031246274709702, 0.99124997854232788, 0.99343752861022949 }, | ||
2307 | 2290 | + { 0.020000001415610313, 0.0093750003725290298, 0.99000000953674316, 0.99250000715255737 }, | ||
2308 | 2291 | + { 0.022499999031424522, 0.01054687425494194, 0.98874998092651367, 0.99156248569488525 }, | ||
2309 | 2292 | + { 0.02500000037252903, 0.01171875, 0.98750001192092896, 0.99062502384185791 }, | ||
2310 | 2293 | + { 0.027500001713633537, 0.01289062574505806, 0.98624998331069946, 0.98968750238418579 }, | ||
2311 | 2294 | + { 0.030000001192092896, 0.014062500558793545, 0.98500001430511475, 0.98874998092651367 }, | ||
2312 | 2295 | + { 0.032499998807907104, 0.015234374441206455, 0.98374998569488525, 0.98781251907348633 }, | ||
2313 | 2296 | + { 0.035000000149011612, 0.01640624925494194, 0.98250001668930054, 0.98687499761581421 }, | ||
2314 | 2297 | + { 0.037500001490116119, 0.017578125, 0.98124998807907104, 0.98593747615814209 }, | ||
2315 | 2298 | + { 0.040000002831220627, 0.01875000074505806, 0.98000001907348633, 0.98500001430511475 }, | ||
2316 | 2299 | + { 0.042500000447034836, 0.019921876490116119, 0.97874999046325684, 0.98406249284744263 }, | ||
2317 | 2300 | + { 0.044999998062849045, 0.021093748509883881, 0.97750002145767212, 0.98312497138977051 }, | ||
2318 | 2301 | + { 0.047499999403953552, 0.02226562425494194, 0.97624999284744263, 0.98218750953674316 } | ||
2319 | 2302 | + } | ||
2320 | 2303 | + }, | ||
2321 | 2304 | + /* Monitor 1280x1024, Screen: 2560x1024, Viewport Layout: 2x2, Offset: 32, 24 */ | ||
2322 | 2305 | + { | ||
2323 | 2306 | + 32, | ||
2324 | 2307 | + 24, | ||
2325 | 2308 | + 2, | ||
2326 | 2309 | + 2, | ||
2327 | 2310 | + 2560, | ||
2328 | 2311 | + 1024, | ||
2329 | 2312 | + 1280, | ||
2330 | 2313 | + 1024, | ||
2331 | 2314 | + { | ||
2332 | 2315 | + { 0, 0, 1, 1 }, | ||
2333 | 2316 | + { 0.0050000003539025784, 0.001500000013038516, 0.99874997138977051, 0.99906247854232788 }, | ||
2334 | 2317 | + { 0.010000000707805157, 0.0030000000260770321, 0.99750000238418579, 0.99812501668930054 }, | ||
2335 | 2318 | + { 0.015000000596046448, 0.0045000002719461918, 0.9962499737739563, 0.99718749523162842 }, | ||
2336 | 2319 | + { 0.020000001415610313, 0.0060000000521540642, 0.99500000476837158, 0.9962499737739563 }, | ||
2337 | 2320 | + { 0.02500000037252903, 0.0074999998323619366, 0.99374997615814209, 0.99531251192092896 }, | ||
2338 | 2321 | + { 0.030000001192092896, 0.0090000005438923836, 0.99250000715255737, 0.99437499046325684 }, | ||
2339 | 2322 | + { 0.035000000149011612, 0.010499999858438969, 0.99124997854232788, 0.99343752861022949 }, | ||
2340 | 2323 | + { 0.040000002831220627, 0.012000000104308128, 0.99000000953674316, 0.99250000715255737 }, | ||
2341 | 2324 | + { 0.044999998062849045, 0.013499999418854713, 0.98874998092651367, 0.99156248569488525 }, | ||
2342 | 2325 | + { 0.05000000074505806, 0.014999999664723873, 0.98750001192092896, 0.99062502384185791 }, | ||
2343 | 2326 | + { 0.055000003427267075, 0.016499999910593033, 0.98624998331069946, 0.98968750238418579 }, | ||
2344 | 2327 | + { 0.060000002384185791, 0.018000001087784767, 0.98500001430511475, 0.98874998092651367 }, | ||
2345 | 2328 | + { 0.064999997615814209, 0.019499998539686203, 0.98374998569488525, 0.98781251907348633 }, | ||
2346 | 2329 | + { 0.070000000298023224, 0.020999999716877937, 0.98250001668930054, 0.98687499761581421 }, | ||
2347 | 2330 | + { 0.075000002980232239, 0.022499999031424522, 0.98124998807907104, 0.98593747615814209 }, | ||
2348 | 2331 | + { 0.080000005662441254, 0.024000000208616257, 0.98000001907348633, 0.98500001430511475 }, | ||
2349 | 2332 | + { 0.085000000894069672, 0.025499999523162842, 0.97874999046325684, 0.98406249284744263 }, | ||
2350 | 2333 | + { 0.08999999612569809, 0.026999998837709427, 0.97750002145767212, 0.98312497138977051 }, | ||
2351 | 2334 | + { 0.094999998807907104, 0.028499998152256012, 0.97624999284744263, 0.98218750953674316 } | ||
2352 | 2335 | + } | ||
2353 | 2336 | + }, | ||
2354 | 2337 | + }; | ||
2355 | 2338 | + | ||
2356 | 2339 | + typedef std::tr1::tuple <OffsetParameters, unsigned int> AnimParam; | ||
2357 | 2340 | +} | ||
2358 | 2341 | + | ||
2359 | 2342 | +class ExpoWallOffsetTestAnimations : | ||
2360 | 2343 | + public ExpoWallOffsetTest, | ||
2361 | 2344 | + public ::testing::WithParamInterface <AnimParam> | ||
2362 | 2345 | +{ | ||
2363 | 2346 | + public: | ||
2364 | 2347 | + | ||
2365 | 2348 | + void | ||
2366 | 2349 | + RecordProperty (const char *name, float value) | ||
2367 | 2350 | + { | ||
2368 | 2351 | + ::testing::Message message; | ||
2369 | 2352 | + message << value; | ||
2370 | 2353 | + Test::RecordProperty (name, message.GetString ().c_str ()); | ||
2371 | 2354 | + } | ||
2372 | 2355 | +}; | ||
2373 | 2356 | + | ||
2374 | 2357 | +TEST_P (ExpoWallOffsetTestAnimations, TestAnimationValues) | ||
2375 | 2358 | +{ | ||
2376 | 2359 | + const OffsetParameters &offset (std::tr1::get <0> (GetParam ())); | ||
2377 | 2360 | + const unsigned int &index (std::tr1::get <1> (GetParam ())); | ||
2378 | 2361 | + | ||
2379 | 2362 | + RecordProperty ("outputWidth", offset.outputWidth); | ||
2380 | 2363 | + RecordProperty ("outputHeight", offset.outputHeight); | ||
2381 | 2364 | + RecordProperty ("screenWidth", offset.screenWidth); | ||
2382 | 2365 | + RecordProperty ("screenHeight", offset.screenHeight); | ||
2383 | 2366 | + RecordProperty ("offsetX", offset.offsetX); | ||
2384 | 2367 | + RecordProperty ("offsetY", offset.offsetY); | ||
2385 | 2368 | + | ||
2386 | 2369 | + RecordProperty ("expected.offsetInWorldX", offset.animationParameters[index].offsetInWorldX); | ||
2387 | 2370 | + RecordProperty ("expected.offsetInWorldY", offset.animationParameters[index].offsetInWorldY); | ||
2388 | 2371 | + RecordProperty ("expected.worldScaleFactorX", offset.animationParameters[index].worldScaleFactorX); | ||
2389 | 2372 | + RecordProperty ("expected.worldScaleFactorY", offset.animationParameters[index].worldScaleFactorY); | ||
2390 | 2373 | + | ||
2391 | 2374 | + compiz::expo::calculateWallOffset (CompRect (0, | ||
2392 | 2375 | + 0, | ||
2393 | 2376 | + offset.outputWidth, | ||
2394 | 2377 | + offset.outputWidth), | ||
2395 | 2378 | + CompPoint (offset.offsetX, | ||
2396 | 2379 | + offset.offsetY), | ||
2397 | 2380 | + CompPoint (offset.vpSizeWidth, | ||
2398 | 2381 | + offset.vpSizeHeight), | ||
2399 | 2382 | + CompSize (offset.screenWidth, | ||
2400 | 2383 | + offset.screenHeight), | ||
2401 | 2384 | + offsetInWorldX, | ||
2402 | 2385 | + offsetInWorldY, | ||
2403 | 2386 | + worldScaleFactorX, | ||
2404 | 2387 | + worldScaleFactorY, | ||
2405 | 2388 | + index / static_cast <float> (nAnimationSteps)); | ||
2406 | 2389 | + | ||
2407 | 2390 | + RecordProperty ("offsetInWorldX", offsetInWorldX); | ||
2408 | 2391 | + RecordProperty ("offsetInWorldY", offsetInWorldY); | ||
2409 | 2392 | + RecordProperty ("worldScaleFactorX", worldScaleFactorX); | ||
2410 | 2393 | + RecordProperty ("worldScaleFactorY", worldScaleFactorY); | ||
2411 | 2394 | + | ||
2412 | 2395 | + EXPECT_EQ (offsetInWorldX, offset.animationParameters[index].offsetInWorldX); | ||
2413 | 2396 | + EXPECT_EQ (offsetInWorldY, offset.animationParameters[index].offsetInWorldY); | ||
2414 | 2397 | + EXPECT_EQ (worldScaleFactorX, offset.animationParameters[index].worldScaleFactorX); | ||
2415 | 2398 | + EXPECT_EQ (worldScaleFactorY, offset.animationParameters[index].worldScaleFactorY); | ||
2416 | 2399 | +} | ||
2417 | 2400 | + | ||
2418 | 2401 | +TEST_F (ExpoWallOffsetTest, TestNoOffsetIfOutputIsNotOrigin) | ||
2419 | 2402 | +{ | ||
2420 | 2403 | + compiz::expo::calculateWallOffset (CompRect (1, | ||
2421 | 2404 | + 1, | ||
2422 | 2405 | + 100, | ||
2423 | 2406 | + 100), | ||
2424 | 2407 | + CompPoint (100, | ||
2425 | 2408 | + 100), | ||
2426 | 2409 | + CompPoint (1, | ||
2427 | 2410 | + 1), | ||
2428 | 2411 | + CompSize (100, | ||
2429 | 2412 | + 100), | ||
2430 | 2413 | + offsetInWorldX, | ||
2431 | 2414 | + offsetInWorldY, | ||
2432 | 2415 | + worldScaleFactorX, | ||
2433 | 2416 | + worldScaleFactorY, | ||
2434 | 2417 | + 1.0); | ||
2435 | 2418 | + | ||
2436 | 2419 | + EXPECT_EQ (offsetInWorldX, 0.0f); | ||
2437 | 2420 | + EXPECT_EQ (offsetInWorldY, 0.0f); | ||
2438 | 2421 | + EXPECT_EQ (worldScaleFactorX, 1.0f); | ||
2439 | 2422 | + EXPECT_EQ (worldScaleFactorY, 1.0f); | ||
2440 | 2423 | +} | ||
2441 | 2424 | + | ||
2442 | 2425 | +INSTANTIATE_TEST_CASE_P (ExpoAnimationOffsetTest, | ||
2443 | 2426 | + ExpoWallOffsetTestAnimations, | ||
2444 | 2427 | + Combine (ValuesIn (testingOffsetParameters), | ||
2445 | 2428 | + Range (nAnimationsBegin, | ||
2446 | 2429 | + nAnimationSteps))); | ||
2447 | 2430 | Index: ubuntu/plugins/expo/CMakeLists.txt | ||
2448 | 2431 | =================================================================== | ||
2449 | 2432 | --- ubuntu.orig/plugins/expo/CMakeLists.txt 2012-09-08 17:26:40.599035911 +0800 | ||
2450 | 2433 | +++ ubuntu/plugins/expo/CMakeLists.txt 2012-09-12 22:20:43.300760590 +0800 | ||
2451 | 2434 | @@ -1,7 +1,16 @@ | ||
2452 | 2435 | find_package (Compiz REQUIRED) | ||
2453 | 2436 | include (CompizPlugin) | ||
2454 | 2437 | |||
2455 | 2438 | +set (COMPIZ_EXPO_PLUGIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) | ||
2456 | 2439 | + | ||
2457 | 2440 | add_subdirectory (src/click_threshold) | ||
2458 | 2441 | include_directories (src/click_threshold/include) | ||
2459 | 2442 | +add_subdirectory (src/wall_offset) | ||
2460 | 2443 | +include_directories (src/wall_offset/include) | ||
2461 | 2444 | +add_subdirectory (src/windows_on_viewport) | ||
2462 | 2445 | +include_directories (src/windows_on_viewport/include) | ||
2463 | 2446 | |||
2464 | 2447 | -compiz_plugin (expo PLUGINDEPS composite opengl LIBRARIES compiz_expo_click_threshold) | ||
2465 | 2448 | +compiz_plugin (expo PLUGINDEPS composite opengl LIBRARIES | ||
2466 | 2449 | + compiz_expo_click_threshold | ||
2467 | 2450 | + compiz_expo_wall_offset | ||
2468 | 2451 | + compiz_expo_windows_on_viewport) | ||
2469 | 2452 | Index: ubuntu/plugins/expo/src/windows_on_viewport/CMakeLists.txt | ||
2470 | 2453 | =================================================================== | ||
2471 | 2454 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2472 | 2455 | +++ ubuntu/plugins/expo/src/windows_on_viewport/CMakeLists.txt 2012-09-12 22:20:43.300760590 +0800 | ||
2473 | 2456 | @@ -0,0 +1,36 @@ | ||
2474 | 2457 | +include_directories ( | ||
2475 | 2458 | + ${CMAKE_CURRENT_SOURCE_DIR}/include | ||
2476 | 2459 | + ${CMAKE_CURRENT_SOURCE_DIR}/src | ||
2477 | 2460 | + ${COMPIZ_INCLUDE_DIRS} | ||
2478 | 2461 | + ${COMPIZ_EXPO_PLUGIN_SOURCE_DIR} | ||
2479 | 2462 | + ${Boost_INCLUDE_DIRS} | ||
2480 | 2463 | + ${GLIBMM_INCLUDE_DIRS} | ||
2481 | 2464 | +) | ||
2482 | 2465 | + | ||
2483 | 2466 | +link_directories (${GLIBMM_LIBRARY_DIRS} ${COMPIZ_LIBRARY_DIRS}) | ||
2484 | 2467 | + | ||
2485 | 2468 | +set ( | ||
2486 | 2469 | + PRIVATE_HEADERS | ||
2487 | 2470 | + ${CMAKE_CURRENT_SOURCE_DIR}/include/windows-on-viewport.h | ||
2488 | 2471 | +) | ||
2489 | 2472 | + | ||
2490 | 2473 | +set ( | ||
2491 | 2474 | + SRCS | ||
2492 | 2475 | + ${CMAKE_CURRENT_SOURCE_DIR}/src/windows-on-viewport.cpp | ||
2493 | 2476 | +) | ||
2494 | 2477 | + | ||
2495 | 2478 | +add_library ( | ||
2496 | 2479 | + compiz_expo_windows_on_viewport STATIC | ||
2497 | 2480 | + ${SRCS} | ||
2498 | 2481 | + ${PRIVATE_HEADERS} | ||
2499 | 2482 | +) | ||
2500 | 2483 | + | ||
2501 | 2484 | +if (COMPIZ_BUILD_TESTING) | ||
2502 | 2485 | + add_subdirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/tests ) | ||
2503 | 2486 | +endif (COMPIZ_BUILD_TESTING) | ||
2504 | 2487 | + | ||
2505 | 2488 | +target_link_libraries ( | ||
2506 | 2489 | + compiz_expo_windows_on_viewport | ||
2507 | 2490 | + compiz_window_geometry | ||
2508 | 2491 | + compiz_core | ||
2509 | 2492 | +) | ||
2510 | 2493 | Index: ubuntu/plugins/expo/src/windows_on_viewport/include/windows-on-viewport.h | ||
2511 | 2494 | =================================================================== | ||
2512 | 2495 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2513 | 2496 | +++ ubuntu/plugins/expo/src/windows_on_viewport/include/windows-on-viewport.h 2012-09-12 22:31:06.807852402 +0800 | ||
2514 | 2497 | @@ -0,0 +1,43 @@ | ||
2515 | 2498 | +/** | ||
2516 | 2499 | + * Copyright © 2012 Canonical Ltd. | ||
2517 | 2500 | + * | ||
2518 | 2501 | + * Authors: | ||
2519 | 2502 | + * Sam Spilsbury <sam.spilsbury@canonical.com> | ||
2520 | 2503 | + * | ||
2521 | 2504 | + * This program is free software; you can redistribute it and/or | ||
2522 | 2505 | + * modify it under the terms of the GNU General Public License | ||
2523 | 2506 | + * as published by the Free Software Foundation; either version 2 | ||
2524 | 2507 | + * of the License, or (at your option) any later version. | ||
2525 | 2508 | + * | ||
2526 | 2509 | + * This program is distributed in the hope that it will be useful, | ||
2527 | 2510 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2528 | 2511 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2529 | 2512 | + * GNU General Public License for more details. | ||
2530 | 2513 | + * | ||
2531 | 2514 | + **/ | ||
2532 | 2515 | +#ifndef _COMPIZ_EXPO_WINDOWS_ON_VIEWPORT_H | ||
2533 | 2516 | +#define _COMPIZ_EXPO_WINDOWS_ON_VIEWPORT_H | ||
2534 | 2517 | + | ||
2535 | 2518 | +#include <core/point.h> | ||
2536 | 2519 | +#include <core/size.h> | ||
2537 | 2520 | +#include <core/rect.h> | ||
2538 | 2521 | +#include "client-list-generator.h" | ||
2539 | 2522 | + | ||
2540 | 2523 | +namespace compiz | ||
2541 | 2524 | +{ | ||
2542 | 2525 | + namespace expo | ||
2543 | 2526 | + { | ||
2544 | 2527 | + unsigned int countViewports (const CompSize &vpSize); | ||
2545 | 2528 | + | ||
2546 | 2529 | + void fillInNewViewportActiveData (unsigned int vpCount, | ||
2547 | 2530 | + std::vector <bool> &vpActive); | ||
2548 | 2531 | + | ||
2549 | 2532 | + void activeViewportsForMembers (compiz::expo::ClientListGenerator &clientList, | ||
2550 | 2533 | + const CompPoint &cursor, | ||
2551 | 2534 | + const CompSize &vpSize, | ||
2552 | 2535 | + const CompSize &screenSize, | ||
2553 | 2536 | + std::vector <bool> &viewportActiveStates); | ||
2554 | 2537 | + } | ||
2555 | 2538 | +} | ||
2556 | 2539 | + | ||
2557 | 2540 | +#endif | ||
2558 | 2541 | Index: ubuntu/plugins/expo/src/windows_on_viewport/src/windows-on-viewport.cpp | ||
2559 | 2542 | =================================================================== | ||
2560 | 2543 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2561 | 2544 | +++ ubuntu/plugins/expo/src/windows_on_viewport/src/windows-on-viewport.cpp 2012-09-12 22:20:43.300760590 +0800 | ||
2562 | 2545 | @@ -0,0 +1,80 @@ | ||
2563 | 2546 | +/** | ||
2564 | 2547 | + * Copyright © 2012 Canonical Ltd. | ||
2565 | 2548 | + * | ||
2566 | 2549 | + * Authors: | ||
2567 | 2550 | + * Sam Spilsbury <sam.spilsbury@canonical.com> | ||
2568 | 2551 | + * | ||
2569 | 2552 | + * This program is free software; you can redistribute it and/or | ||
2570 | 2553 | + * modify it under the terms of the GNU General Public License | ||
2571 | 2554 | + * as published by the Free Software Foundation; either version 2 | ||
2572 | 2555 | + * of the License, or (at your option) any later version. | ||
2573 | 2556 | + * | ||
2574 | 2557 | + * This program is distributed in the hope that it will be useful, | ||
2575 | 2558 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2576 | 2559 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2577 | 2560 | + * GNU General Public License for more details. | ||
2578 | 2561 | + * | ||
2579 | 2562 | + **/ | ||
2580 | 2563 | +#include <cstdio> | ||
2581 | 2564 | +#include <algorithm> | ||
2582 | 2565 | +#include "windows-on-viewport.h" | ||
2583 | 2566 | +#include "viewport-member-window.h" | ||
2584 | 2567 | + | ||
2585 | 2568 | +namespace compiz | ||
2586 | 2569 | +{ | ||
2587 | 2570 | + namespace expo | ||
2588 | 2571 | + { | ||
2589 | 2572 | + unsigned int countViewports (const CompSize &vpSize) | ||
2590 | 2573 | + { | ||
2591 | 2574 | + return vpSize.width () * vpSize.height (); | ||
2592 | 2575 | + } | ||
2593 | 2576 | + | ||
2594 | 2577 | + void fillInNewViewportActiveData (unsigned int vpCount, | ||
2595 | 2578 | + std::vector <bool> &vpActive) | ||
2596 | 2579 | + { | ||
2597 | 2580 | + if (vpActive.size () < vpCount) | ||
2598 | 2581 | + { | ||
2599 | 2582 | + unsigned int last = vpActive.size () - 1; | ||
2600 | 2583 | + vpActive.resize (vpCount); | ||
2601 | 2584 | + for (unsigned int i = last; i < vpActive.size (); i++) | ||
2602 | 2585 | + vpActive[i] = false; | ||
2603 | 2586 | + } | ||
2604 | 2587 | + } | ||
2605 | 2588 | + | ||
2606 | 2589 | + void activeViewportsForMembers (compiz::expo::ClientListGenerator &clientList, | ||
2607 | 2590 | + const CompPoint &cursor, | ||
2608 | 2591 | + const CompSize &vpSize, | ||
2609 | 2592 | + const CompSize &screenSize, | ||
2610 | 2593 | + std::vector <bool> &viewportActiveStates) | ||
2611 | 2594 | + { | ||
2612 | 2595 | + compiz::expo::ViewportMemberWindow *vpMemberWindow = clientList.nextClient (); | ||
2613 | 2596 | + | ||
2614 | 2597 | + fillInNewViewportActiveData (countViewports (vpSize), viewportActiveStates); | ||
2615 | 2598 | + std::fill_n (viewportActiveStates.begin (), viewportActiveStates.size (), false); | ||
2616 | 2599 | + | ||
2617 | 2600 | + while (vpMemberWindow) | ||
2618 | 2601 | + { | ||
2619 | 2602 | + if (!vpMemberWindow->isDesktopOrDock ()) | ||
2620 | 2603 | + { | ||
2621 | 2604 | + CompPoint viewport; | ||
2622 | 2605 | + | ||
2623 | 2606 | + /* If this is a dragged window, use the cursor position */ | ||
2624 | 2607 | + if (vpMemberWindow->dragged ()) | ||
2625 | 2608 | + viewport.set (cursor.x () / screenSize.width (), | ||
2626 | 2609 | + cursor.y () / screenSize.height ()); | ||
2627 | 2610 | + else | ||
2628 | 2611 | + { | ||
2629 | 2612 | + const compiz::window::Geometry &geom = vpMemberWindow->absoluteGeometry (); | ||
2630 | 2613 | + viewport.set (geom.centerX () / screenSize.width (), | ||
2631 | 2614 | + geom.centerY () / screenSize.height ()); | ||
2632 | 2615 | + } | ||
2633 | 2616 | + | ||
2634 | 2617 | + unsigned int vpIndex = vpSize.width () * viewport.y () + viewport.x (); | ||
2635 | 2618 | + viewportActiveStates[vpIndex] = true; | ||
2636 | 2619 | + } | ||
2637 | 2620 | + | ||
2638 | 2621 | + vpMemberWindow = clientList.nextClient (); | ||
2639 | 2622 | + } | ||
2640 | 2623 | + } | ||
2641 | 2624 | + } | ||
2642 | 2625 | +} | ||
2643 | 2626 | Index: ubuntu/plugins/expo/src/windows_on_viewport/tests/CMakeLists.txt | ||
2644 | 2627 | =================================================================== | ||
2645 | 2628 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2646 | 2629 | +++ ubuntu/plugins/expo/src/windows_on_viewport/tests/CMakeLists.txt 2012-09-12 22:20:43.300760590 +0800 | ||
2647 | 2630 | @@ -0,0 +1,22 @@ | ||
2648 | 2631 | +if (NOT GTEST_FOUND) | ||
2649 | 2632 | + message ("Google Test not found - cannot build tests!") | ||
2650 | 2633 | + set (COMPIZ_BUILD_TESTING OFF) | ||
2651 | 2634 | +endif (NOT GTEST_FOUND) | ||
2652 | 2635 | + | ||
2653 | 2636 | +include_directories (${GTEST_INCLUDE_DIRS}) | ||
2654 | 2637 | +include_directories (${CMAKE_EXPO_PLUGIN_SOURCE_DIR}) | ||
2655 | 2638 | + | ||
2656 | 2639 | +link_directories (${COMPIZ_LIBRARY_DIRS}) | ||
2657 | 2640 | + | ||
2658 | 2641 | +add_executable (compiz_test_expo_windows_on_viewport | ||
2659 | 2642 | + ${CMAKE_CURRENT_SOURCE_DIR}/test-windows-on-viewport.cpp) | ||
2660 | 2643 | + | ||
2661 | 2644 | +target_link_libraries (compiz_test_expo_windows_on_viewport | ||
2662 | 2645 | + compiz_expo_windows_on_viewport | ||
2663 | 2646 | + ${GTEST_BOTH_LIBRARIES} | ||
2664 | 2647 | + ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. | ||
2665 | 2648 | + ${GMOCK_LIBRARY} | ||
2666 | 2649 | + ${GMOCK_MAIN_LIBRARY} | ||
2667 | 2650 | + ) | ||
2668 | 2651 | + | ||
2669 | 2652 | +compiz_discover_tests (compiz_test_expo_windows_on_viewport COVERAGE compiz_expo_windows_on_viewport) | ||
2670 | 2653 | Index: ubuntu/plugins/expo/src/windows_on_viewport/tests/test-windows-on-viewport.cpp | ||
2671 | 2654 | =================================================================== | ||
2672 | 2655 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2673 | 2656 | +++ ubuntu/plugins/expo/src/windows_on_viewport/tests/test-windows-on-viewport.cpp 2012-09-12 22:20:43.304760606 +0800 | ||
2674 | 2657 | @@ -0,0 +1,149 @@ | ||
2675 | 2658 | +/* | ||
2676 | 2659 | + * Copyright © 2012 Canonical Ltd. | ||
2677 | 2660 | + * | ||
2678 | 2661 | + * Permission to use, copy, modify, distribute, and sell this software | ||
2679 | 2662 | + * and its documentation for any purpose is hereby granted without | ||
2680 | 2663 | + * fee, provided that the above copyright notice appear in all copies | ||
2681 | 2664 | + * and that both that copyright notice and this permission notice | ||
2682 | 2665 | + * appear in supporting documentation, and that the name of | ||
2683 | 2666 | + * Canonical Ltd. not be used in advertising or publicity pertaining to | ||
2684 | 2667 | + * distribution of the software without specific, written prior permission. | ||
2685 | 2668 | + * Canonical Ltd. makes no representations about the suitability of this | ||
2686 | 2669 | + * software for any purpose. It is provided "as is" without express or | ||
2687 | 2670 | + * implied warranty. | ||
2688 | 2671 | + * | ||
2689 | 2672 | + * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
2690 | 2673 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
2691 | 2674 | + * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
2692 | 2675 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
2693 | 2676 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
2694 | 2677 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
2695 | 2678 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
2696 | 2679 | + * | ||
2697 | 2680 | + * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com> | ||
2698 | 2681 | + */ | ||
2699 | 2682 | +#include <gtest/gtest.h> | ||
2700 | 2683 | +#include <gmock/gmock.h> | ||
2701 | 2684 | +#include "windows-on-viewport.h" | ||
2702 | 2685 | +#include "client-list-generator.h" | ||
2703 | 2686 | +#include "viewport-member-window.h" | ||
2704 | 2687 | + | ||
2705 | 2688 | +using ::testing::InSequence; | ||
2706 | 2689 | +using ::testing::Return; | ||
2707 | 2690 | +using ::testing::ReturnNull; | ||
2708 | 2691 | +using ::testing::ReturnRef; | ||
2709 | 2692 | + | ||
2710 | 2693 | +namespace | ||
2711 | 2694 | +{ | ||
2712 | 2695 | + namespace ce = compiz::expo; | ||
2713 | 2696 | + | ||
2714 | 2697 | + class MockViewportMemberWindow : | ||
2715 | 2698 | + public ce::ViewportMemberWindow | ||
2716 | 2699 | + { | ||
2717 | 2700 | + public: | ||
2718 | 2701 | + | ||
2719 | 2702 | + MOCK_CONST_METHOD0 (absoluteGeometry, const compiz::window::Geometry & ()); | ||
2720 | 2703 | + MOCK_CONST_METHOD0 (isDesktopOrDock, bool ()); | ||
2721 | 2704 | + MOCK_CONST_METHOD0 (dragged, bool ()); | ||
2722 | 2705 | + }; | ||
2723 | 2706 | + | ||
2724 | 2707 | + class MockClientListGenerator : | ||
2725 | 2708 | + public ce::ClientListGenerator | ||
2726 | 2709 | + { | ||
2727 | 2710 | + public: | ||
2728 | 2711 | + | ||
2729 | 2712 | + MOCK_METHOD0 (nextClient, ce::ViewportMemberWindow * ()); | ||
2730 | 2713 | + }; | ||
2731 | 2714 | +} | ||
2732 | 2715 | + | ||
2733 | 2716 | +class ExpoWindowsOnViewportTest : | ||
2734 | 2717 | + public ::testing::Test | ||
2735 | 2718 | +{ | ||
2736 | 2719 | + protected: | ||
2737 | 2720 | + | ||
2738 | 2721 | + MockClientListGenerator mockClientListGenerator; | ||
2739 | 2722 | + std::vector <bool> activeStates; | ||
2740 | 2723 | +}; | ||
2741 | 2724 | + | ||
2742 | 2725 | +namespace | ||
2743 | 2726 | +{ | ||
2744 | 2727 | + const CompSize vpSize (2, 2); | ||
2745 | 2728 | + const CompSize screenSize (1000, 1000); | ||
2746 | 2729 | +} | ||
2747 | 2730 | + | ||
2748 | 2731 | +TEST_F (ExpoWindowsOnViewportTest, TestNoDocksMakeViewportsActive) | ||
2749 | 2732 | +{ | ||
2750 | 2733 | + MockViewportMemberWindow mockViewportMembers[1]; | ||
2751 | 2734 | + InSequence s; | ||
2752 | 2735 | + | ||
2753 | 2736 | + EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (Return (&mockViewportMembers[0])); | ||
2754 | 2737 | + EXPECT_CALL (mockViewportMembers[0], isDesktopOrDock ()).WillOnce (Return (true)); | ||
2755 | 2738 | + EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (ReturnNull ()); | ||
2756 | 2739 | + | ||
2757 | 2740 | + compiz::expo::activeViewportsForMembers (mockClientListGenerator, | ||
2758 | 2741 | + CompPoint (1, 1), | ||
2759 | 2742 | + vpSize, | ||
2760 | 2743 | + screenSize, | ||
2761 | 2744 | + activeStates); | ||
2762 | 2745 | + | ||
2763 | 2746 | + ASSERT_EQ (activeStates.size (), vpSize.width () * vpSize.height ()); | ||
2764 | 2747 | + EXPECT_EQ (activeStates[0], false); | ||
2765 | 2748 | + EXPECT_EQ (activeStates[1], false); | ||
2766 | 2749 | + EXPECT_EQ (activeStates[2], false); | ||
2767 | 2750 | + EXPECT_EQ (activeStates[3], false); | ||
2768 | 2751 | +} | ||
2769 | 2752 | + | ||
2770 | 2753 | +TEST_F (ExpoWindowsOnViewportTest, TestGrabbedWindowUsesCursorPosition) | ||
2771 | 2754 | +{ | ||
2772 | 2755 | + MockViewportMemberWindow mockViewportMembers[1]; | ||
2773 | 2756 | + InSequence s; | ||
2774 | 2757 | + | ||
2775 | 2758 | + EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (Return (&mockViewportMembers[0])); | ||
2776 | 2759 | + EXPECT_CALL (mockViewportMembers[0], isDesktopOrDock ()).WillOnce (Return (false)); | ||
2777 | 2760 | + EXPECT_CALL (mockViewportMembers[0], dragged ()).WillOnce (Return (true)); | ||
2778 | 2761 | + EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (ReturnNull ()); | ||
2779 | 2762 | + | ||
2780 | 2763 | + compiz::expo::activeViewportsForMembers (mockClientListGenerator, | ||
2781 | 2764 | + CompPoint (screenSize.width () * 1.5, | ||
2782 | 2765 | + screenSize.height () * 1.5), | ||
2783 | 2766 | + vpSize, | ||
2784 | 2767 | + screenSize, | ||
2785 | 2768 | + activeStates); | ||
2786 | 2769 | + | ||
2787 | 2770 | + ASSERT_EQ (activeStates.size (), vpSize.width () * vpSize.height ()); | ||
2788 | 2771 | + EXPECT_EQ (activeStates[0], false); | ||
2789 | 2772 | + EXPECT_EQ (activeStates[1], false); | ||
2790 | 2773 | + EXPECT_EQ (activeStates[2], false); | ||
2791 | 2774 | + EXPECT_EQ (activeStates[3], true); // 2,2 has the cursor of a dragged window | ||
2792 | 2775 | +} | ||
2793 | 2776 | + | ||
2794 | 2777 | +TEST_F (ExpoWindowsOnViewportTest, TestUngrabbedWindowUsesGeometry) | ||
2795 | 2778 | +{ | ||
2796 | 2779 | + MockViewportMemberWindow mockViewportMembers[1]; | ||
2797 | 2780 | + InSequence s; | ||
2798 | 2781 | + | ||
2799 | 2782 | + compiz::window::Geometry vpMemberGeometry1 (screenSize.width () * 1.1, | ||
2800 | 2783 | + screenSize.height () * 1.1, | ||
2801 | 2784 | + screenSize.width () / 2, | ||
2802 | 2785 | + screenSize.height () / 2, | ||
2803 | 2786 | + 0); | ||
2804 | 2787 | + | ||
2805 | 2788 | + EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (Return (&mockViewportMembers[0])); | ||
2806 | 2789 | + EXPECT_CALL (mockViewportMembers[0], isDesktopOrDock ()).WillOnce (Return (false)); | ||
2807 | 2790 | + EXPECT_CALL (mockViewportMembers[0], dragged ()).WillOnce (Return (false)); | ||
2808 | 2791 | + EXPECT_CALL (mockViewportMembers[0], absoluteGeometry ()).WillOnce (ReturnRef (vpMemberGeometry1)); | ||
2809 | 2792 | + EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (ReturnNull ()); | ||
2810 | 2793 | + | ||
2811 | 2794 | + compiz::expo::activeViewportsForMembers (mockClientListGenerator, | ||
2812 | 2795 | + CompPoint (screenSize.width () * 1.5, | ||
2813 | 2796 | + screenSize.height () * 1.5), | ||
2814 | 2797 | + vpSize, | ||
2815 | 2798 | + screenSize, | ||
2816 | 2799 | + activeStates); | ||
2817 | 2800 | + | ||
2818 | 2801 | + ASSERT_EQ (activeStates.size (), vpSize.width () * vpSize.height ()); | ||
2819 | 2802 | + EXPECT_EQ (activeStates[0], false); | ||
2820 | 2803 | + EXPECT_EQ (activeStates[1], false); | ||
2821 | 2804 | + EXPECT_EQ (activeStates[2], false); | ||
2822 | 2805 | + EXPECT_EQ (activeStates[3], true); // 2,2 has a window on it | ||
2823 | 2806 | +} | ||
2824 | 2807 | Index: ubuntu/plugins/expo/src/client-list-generator.h | ||
2825 | 2808 | =================================================================== | ||
2826 | 2809 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2827 | 2810 | +++ ubuntu/plugins/expo/src/client-list-generator.h 2012-09-12 22:20:43.304760606 +0800 | ||
2828 | 2811 | @@ -0,0 +1,45 @@ | ||
2829 | 2812 | +/* | ||
2830 | 2813 | + * Copyright © 2012 Canonical Ltd. | ||
2831 | 2814 | + * | ||
2832 | 2815 | + * Permission to use, copy, modify, distribute, and sell this software | ||
2833 | 2816 | + * and its documentation for any purpose is hereby granted without | ||
2834 | 2817 | + * fee, provided that the above copyright notice appear in all copies | ||
2835 | 2818 | + * and that both that copyright notice and this permission notice | ||
2836 | 2819 | + * appear in supporting documentation, and that the name of | ||
2837 | 2820 | + * Canonical Ltd. not be used in advertising or publicity pertaining to | ||
2838 | 2821 | + * distribution of the software without specific, written prior permission. | ||
2839 | 2822 | + * Canonical Ltd. makes no representations about the suitability of this | ||
2840 | 2823 | + * software for any purpose. It is provided "as is" without express or | ||
2841 | 2824 | + * implied warranty. | ||
2842 | 2825 | + * | ||
2843 | 2826 | + * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
2844 | 2827 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
2845 | 2828 | + * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
2846 | 2829 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
2847 | 2830 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
2848 | 2831 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
2849 | 2832 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
2850 | 2833 | + * | ||
2851 | 2834 | + * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com> | ||
2852 | 2835 | + */ | ||
2853 | 2836 | +#ifndef _COMPIZ_EXPO_CLIENT_LIST_GENERATOR_H | ||
2854 | 2837 | +#define _COMPIZ_EXPO_CLIENT_LIST_GENERATOR_H | ||
2855 | 2838 | + | ||
2856 | 2839 | +namespace compiz | ||
2857 | 2840 | +{ | ||
2858 | 2841 | + namespace expo | ||
2859 | 2842 | + { | ||
2860 | 2843 | + class ViewportMemberWindow; | ||
2861 | 2844 | + | ||
2862 | 2845 | + class ClientListGenerator | ||
2863 | 2846 | + { | ||
2864 | 2847 | + public: | ||
2865 | 2848 | + | ||
2866 | 2849 | + virtual ~ClientListGenerator () {}; | ||
2867 | 2850 | + virtual ViewportMemberWindow * nextClient () = 0; | ||
2868 | 2851 | + }; | ||
2869 | 2852 | + } | ||
2870 | 2853 | +} | ||
2871 | 2854 | +#endif | ||
2872 | 2855 | + | ||
2873 | 2856 | + | ||
2874 | 2857 | Index: ubuntu/plugins/expo/src/viewport-member-window.h | ||
2875 | 2858 | =================================================================== | ||
2876 | 2859 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2877 | 2860 | +++ ubuntu/plugins/expo/src/viewport-member-window.h 2012-09-12 22:20:43.304760606 +0800 | ||
2878 | 2861 | @@ -0,0 +1,46 @@ | ||
2879 | 2862 | +/* | ||
2880 | 2863 | + * Copyright © 2012 Canonical Ltd. | ||
2881 | 2864 | + * | ||
2882 | 2865 | + * Permission to use, copy, modify, distribute, and sell this software | ||
2883 | 2866 | + * and its documentation for any purpose is hereby granted without | ||
2884 | 2867 | + * fee, provided that the above copyright notice appear in all copies | ||
2885 | 2868 | + * and that both that copyright notice and this permission notice | ||
2886 | 2869 | + * appear in supporting documentation, and that the name of | ||
2887 | 2870 | + * Canonical Ltd. not be used in advertising or publicity pertaining to | ||
2888 | 2871 | + * distribution of the software without specific, written prior permission. | ||
2889 | 2872 | + * Canonical Ltd. makes no representations about the suitability of this | ||
2890 | 2873 | + * software for any purpose. It is provided "as is" without express or | ||
2891 | 2874 | + * implied warranty. | ||
2892 | 2875 | + * | ||
2893 | 2876 | + * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
2894 | 2877 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN | ||
2895 | 2878 | + * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
2896 | 2879 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
2897 | 2880 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
2898 | 2881 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
2899 | 2882 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
2900 | 2883 | + * | ||
2901 | 2884 | + * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com> | ||
2902 | 2885 | + */ | ||
2903 | 2886 | +#ifndef _COMPIZ_EXPO_VIEWPORT_MEMBER_WINDOW_H | ||
2904 | 2887 | +#define _COMPIZ_EXPO_VIEWPORT_MEMBER_WINDOW_H | ||
2905 | 2888 | + | ||
2906 | 2889 | +#include <core/windowgeometry.h> | ||
2907 | 2890 | + | ||
2908 | 2891 | +namespace compiz | ||
2909 | 2892 | +{ | ||
2910 | 2893 | + namespace expo | ||
2911 | 2894 | + { | ||
2912 | 2895 | + class ViewportMemberWindow | ||
2913 | 2896 | + { | ||
2914 | 2897 | + public: | ||
2915 | 2898 | + | ||
2916 | 2899 | + virtual ~ViewportMemberWindow () {}; | ||
2917 | 2900 | + virtual const compiz::window::Geometry & absoluteGeometry () const = 0; | ||
2918 | 2901 | + virtual bool dragged () const = 0; | ||
2919 | 2902 | + virtual bool isDesktopOrDock () const = 0; | ||
2920 | 2903 | + }; | ||
2921 | 2904 | + } | ||
2922 | 2905 | +} | ||
2923 | 2906 | + | ||
2924 | 2907 | +#endif | ||
2925 | 0 | 2908 | ||
2926 | === removed file 'debian/patches/100_expo_layout.patch' | |||
2927 | --- debian/patches/100_expo_layout.patch 2012-09-10 13:50:30 +0000 | |||
2928 | +++ debian/patches/100_expo_layout.patch 1970-01-01 00:00:00 +0000 | |||
2929 | @@ -1,2903 +0,0 @@ | |||
2930 | 1 | Index: ubuntu/plugins/expo/expo.xml.in | ||
2931 | 2 | =================================================================== | ||
2932 | 3 | --- ubuntu.orig/plugins/expo/expo.xml.in 2012-09-08 11:51:32.971327571 +0800 | ||
2933 | 4 | +++ ubuntu/plugins/expo/expo.xml.in 2012-09-08 11:51:33.103328227 +0800 | ||
2934 | 5 | @@ -17,6 +17,7 @@ | ||
2935 | 6 | <plugin>wobbly</plugin> | ||
2936 | 7 | <plugin>animation</plugin> | ||
2937 | 8 | <plugin>wallpaper</plugin> | ||
2938 | 9 | + <plugin>imgpng</plugin> | ||
2939 | 10 | </relation> | ||
2940 | 11 | </deps> | ||
2941 | 12 | <options> | ||
2942 | 13 | @@ -25,7 +26,7 @@ | ||
2943 | 14 | <option name="expo_key" type="key"> | ||
2944 | 15 | <_short>Expo key</_short> | ||
2945 | 16 | <_long>Engage wall expo mode key binding</_long> | ||
2946 | 17 | - <default><Super>e</default> | ||
2947 | 18 | + <default><Super>s</default> | ||
2948 | 19 | </option> | ||
2949 | 20 | <option name="expo_button" type="button"> | ||
2950 | 21 | <_short>Expo button</_short> | ||
2951 | 22 | @@ -35,8 +36,6 @@ | ||
2952 | 23 | <option name="expo_edge" type="edge"> | ||
2953 | 24 | <_short>Expo edge</_short> | ||
2954 | 25 | <_long>Engage wall expo mode edge binding</_long> | ||
2955 | 26 | - <default> | ||
2956 | 27 | - </default> | ||
2957 | 28 | </option> | ||
2958 | 29 | <option name="double_click_time" type="int"> | ||
2959 | 30 | <_short>Double click time</_short> | ||
2960 | 31 | @@ -79,7 +78,7 @@ | ||
2961 | 32 | <option name="zoom_time" type="float"> | ||
2962 | 33 | <_short>Zoom time</_short> | ||
2963 | 34 | <_long>Duration of the zoomout animation</_long> | ||
2964 | 35 | - <default>0.5</default> | ||
2965 | 36 | + <default>0.3</default> | ||
2966 | 37 | <min>0.1</min> | ||
2967 | 38 | <max>5.0</max> | ||
2968 | 39 | <precision>0.1</precision> | ||
2969 | 40 | @@ -130,10 +129,24 @@ | ||
2970 | 41 | <_name>Curve</_name> | ||
2971 | 42 | </desc> | ||
2972 | 43 | </option> | ||
2973 | 44 | + <option name="x_offset" type="int"> | ||
2974 | 45 | + <_short>X Space</_short> | ||
2975 | 46 | + <_long> Left Side screen space of expo in pixels</_long> | ||
2976 | 47 | + <min>-1680</min> | ||
2977 | 48 | + <max>1680</max> | ||
2978 | 49 | + <default>64</default> | ||
2979 | 50 | + </option> | ||
2980 | 51 | + <option name="y_offset" type="int"> | ||
2981 | 52 | + <_short>Y Space</_short> | ||
2982 | 53 | + <_long> Top Side screen space of expo in pixels</_long> | ||
2983 | 54 | + <min>-100</min> | ||
2984 | 55 | + <max>100</max> | ||
2985 | 56 | + <default>24</default> | ||
2986 | 57 | + </option> | ||
2987 | 58 | <option name="distance" type="float"> | ||
2988 | 59 | <_short>Distance</_short> | ||
2989 | 60 | <_long>Distance of the expo wall</_long> | ||
2990 | 61 | - <default>0.0</default> | ||
2991 | 62 | + <default>0.005</default> | ||
2992 | 63 | <min>0.0</min> | ||
2993 | 64 | <max>1.0</max> | ||
2994 | 65 | <precision>0.01</precision> | ||
2995 | 66 | @@ -141,7 +154,7 @@ | ||
2996 | 67 | <option name="vp_distance" type="float"> | ||
2997 | 68 | <_short>Viewport distance</_short> | ||
2998 | 69 | <_long>Distance between viewports</_long> | ||
2999 | 70 | - <default>0.10</default> | ||
3000 | 71 | + <default>0.2</default> | ||
3001 | 72 | <min>0.0</min> | ||
3002 | 73 | <max>1.0</max> | ||
3003 | 74 | <precision>0.01</precision> | ||
3004 | 75 | @@ -192,7 +205,7 @@ | ||
3005 | 76 | <option name="vp_brightness" type="float"> | ||
3006 | 77 | <_short>Brightness</_short> | ||
3007 | 78 | <_long>Inactive viewport brightness.</_long> | ||
3008 | 79 | - <default>75.0</default> | ||
3009 | 80 | + <default>40.0</default> | ||
3010 | 81 | <min>0.0</min> | ||
3011 | 82 | <max>100.0</max> | ||
3012 | 83 | <precision>0.1</precision> | ||
3013 | 84 | @@ -200,18 +213,28 @@ | ||
3014 | 85 | <option name="vp_saturation" type="float"> | ||
3015 | 86 | <_short>Saturation</_short> | ||
3016 | 87 | <_long>Inactive viewport saturation.</_long> | ||
3017 | 88 | - <default>100.0</default> | ||
3018 | 89 | + <default>40.0</default> | ||
3019 | 90 | <min>0.0</min> | ||
3020 | 91 | <max>100.0</max> | ||
3021 | 92 | <precision>0.1</precision> | ||
3022 | 93 | </option> | ||
3023 | 94 | + <option name="selected_color" type="color"> | ||
3024 | 95 | + <_short>Selected Color</_short> | ||
3025 | 96 | + <_long>Color to use when highlighting the selected viewport</_long> | ||
3026 | 97 | + <default> | ||
3027 | 98 | + <red>0xfbfb</red> | ||
3028 | 99 | + <green>0x8b8b</green> | ||
3029 | 100 | + <blue>0x0</blue> | ||
3030 | 101 | + <alpha>0xffff</alpha> | ||
3031 | 102 | + </default> | ||
3032 | 103 | + </option> | ||
3033 | 104 | </subgroup> | ||
3034 | 105 | <subgroup> | ||
3035 | 106 | <short>Reflection</short> | ||
3036 | 107 | <option name="reflection" type="bool"> | ||
3037 | 108 | <_short>Reflection</_short> | ||
3038 | 109 | <_long>Show a reflection of the viewports on the ground</_long> | ||
3039 | 110 | - <default>true</default> | ||
3040 | 111 | + <default>false</default> | ||
3041 | 112 | </option> | ||
3042 | 113 | <option name="ground_color1" type="color"> | ||
3043 | 114 | <_short>Ground color(near)</_short> | ||
3044 | 115 | @@ -244,7 +267,7 @@ | ||
3045 | 116 | <option name="scale_factor" type="float"> | ||
3046 | 117 | <_short>Reflection Scale</_short> | ||
3047 | 118 | <_long>Scale factor of the expo wall reflection</_long> | ||
3048 | 119 | - <default>0.75</default> | ||
3049 | 120 | + <default>1.0</default> | ||
3050 | 121 | <min>0.0</min> | ||
3051 | 122 | <max>2.0</max> | ||
3052 | 123 | <precision>0.01</precision> | ||
3053 | 124 | Index: ubuntu/plugins/expo/src/expo.cpp | ||
3054 | 125 | =================================================================== | ||
3055 | 126 | --- ubuntu.orig/plugins/expo/src/expo.cpp 2012-09-08 11:51:02.279175377 +0800 | ||
3056 | 127 | +++ ubuntu/plugins/expo/src/expo.cpp 2012-09-08 15:18:15.744829608 +0800 | ||
3057 | 128 | @@ -27,6 +27,8 @@ | ||
3058 | 129 | |||
3059 | 130 | #include "expo.h" | ||
3060 | 131 | #include "click-threshold.h" | ||
3061 | 132 | +#include "wall-offset.h" | ||
3062 | 133 | +#include "windows-on-viewport.h" | ||
3063 | 134 | #include <math.h> | ||
3064 | 135 | #ifndef USE_GLES | ||
3065 | 136 | #include <GL/glu.h> | ||
3066 | 137 | @@ -73,11 +75,10 @@ | ||
3067 | 138 | |||
3068 | 139 | if (dndState == DnDDuring || dndState == DnDStart) | ||
3069 | 140 | { | ||
3070 | 141 | - if (dndWindow) | ||
3071 | 142 | + if (dndWindows.size ()) | ||
3072 | 143 | finishWindowMovement (); | ||
3073 | 144 | |||
3074 | 145 | dndState = DnDNone; | ||
3075 | 146 | - dndWindow = NULL; | ||
3076 | 147 | |||
3077 | 148 | action->setState (action->state () & CompAction::StateInitButton); | ||
3078 | 149 | cScreen->damageScreen (); | ||
3079 | 150 | @@ -113,7 +114,6 @@ | ||
3080 | 151 | clickTime = 0; | ||
3081 | 152 | |||
3082 | 153 | dndState = DnDNone; | ||
3083 | 154 | - dndWindow = NULL; | ||
3084 | 155 | |||
3085 | 156 | selectedVp = screen->vp (); | ||
3086 | 157 | lastSelectedVp = screen->vp (); | ||
3087 | 158 | @@ -156,8 +156,8 @@ | ||
3088 | 159 | else | ||
3089 | 160 | vpUpdateMode = VPUpdateMouseOver; | ||
3090 | 161 | |||
3091 | 162 | - dndState = DnDNone; | ||
3092 | 163 | - dndWindow = NULL; | ||
3093 | 164 | + dndState = DnDNone; | ||
3094 | 165 | + dndWindows.clear (); | ||
3095 | 166 | |||
3096 | 167 | screen->removeAction (&optionGetDndButton ()); | ||
3097 | 168 | screen->removeAction (&optionGetExitButton ()); | ||
3098 | 169 | @@ -202,6 +202,8 @@ | ||
3099 | 170 | if (!expoMode) | ||
3100 | 171 | return false; | ||
3101 | 172 | |||
3102 | 173 | + lastSelectedVp = selectedVp; | ||
3103 | 174 | + | ||
3104 | 175 | newX = selectedVp.x () + 1; | ||
3105 | 176 | newY = selectedVp.y (); | ||
3106 | 177 | |||
3107 | 178 | @@ -225,7 +227,7 @@ | ||
3108 | 179 | CompAction::State state, | ||
3109 | 180 | CompOption::Vector& options) | ||
3110 | 181 | { | ||
3111 | 182 | - int newX, newY; | ||
3112 | 183 | + unsigned int newX, newY; | ||
3113 | 184 | Window xid = CompOption::getIntOptionNamed (options, "root", 0); | ||
3114 | 185 | if (xid != screen->root ()) | ||
3115 | 186 | return false; | ||
3116 | 187 | @@ -272,53 +274,39 @@ | ||
3117 | 188 | void | ||
3118 | 189 | ExpoScreen::finishWindowMovement () | ||
3119 | 190 | { | ||
3120 | 191 | - dndWindow->syncPosition (); | ||
3121 | 192 | - dndWindow->ungrabNotify (); | ||
3122 | 193 | - | ||
3123 | 194 | - screen->moveViewport (screen->vp ().x () - selectedVp.x (), | ||
3124 | 195 | - screen->vp ().y () - selectedVp.y (), true); | ||
3125 | 196 | - | ||
3126 | 197 | - /* update saved window attributes in case we moved the | ||
3127 | 198 | - window to a new viewport */ | ||
3128 | 199 | - if (dndWindow->saveMask () & CWX) | ||
3129 | 200 | - { | ||
3130 | 201 | - dndWindow->saveWc ().x = dndWindow->saveWc ().x % screen->width (); | ||
3131 | 202 | - if (dndWindow->saveWc ().x < 0) | ||
3132 | 203 | - dndWindow->saveWc ().x += screen->width (); | ||
3133 | 204 | - } | ||
3134 | 205 | - if (dndWindow->saveMask () & CWY) | ||
3135 | 206 | + foreach (CompWindow *dndWindow, dndWindows) | ||
3136 | 207 | { | ||
3137 | 208 | - dndWindow->saveWc ().y = dndWindow->saveWc ().y % screen->height (); | ||
3138 | 209 | - if (dndWindow->saveWc ().y < 0) | ||
3139 | 210 | - dndWindow->saveWc ().y += screen->height (); | ||
3140 | 211 | - } | ||
3141 | 212 | - | ||
3142 | 213 | - /* update window attibutes to make sure a moved maximized window | ||
3143 | 214 | - is properly snapped to the work area */ | ||
3144 | 215 | - if (dndWindow->state () & MAXIMIZE_STATE) | ||
3145 | 216 | - dndWindow->updateAttributes (CompStackingUpdateModeNone); | ||
3146 | 217 | - | ||
3147 | 218 | -#if 0 /* FIXME: obsolete in the meantime? */ | ||
3148 | 219 | - { | ||
3149 | 220 | - int lastOutput; | ||
3150 | 221 | - int centerX, centerY; | ||
3151 | 222 | + if (dndWindow->grabbed ()) | ||
3152 | 223 | + { | ||
3153 | 224 | + dndWindow->syncPosition (); | ||
3154 | 225 | + dndWindow->ungrabNotify (); | ||
3155 | 226 | |||
3156 | 227 | - /* make sure we snap to the correct output */ | ||
3157 | 228 | - lastOutput = s->currentOutputDev; | ||
3158 | 229 | - centerX = (WIN_X (w) + WIN_W (w) / 2) % s->width; | ||
3159 | 230 | - if (centerX < 0) | ||
3160 | 231 | - centerX += s->width; | ||
3161 | 232 | - centerY = (WIN_Y (w) + WIN_H (w) / 2) % s->height; | ||
3162 | 233 | - if (centerY < 0) | ||
3163 | 234 | - centerY += s->height; | ||
3164 | 235 | + screen->updateGrab (grabIndex, None); | ||
3165 | 236 | |||
3166 | 237 | - s->currentOutputDev = outputDeviceForPoint (s, centerX, centerY); | ||
3167 | 238 | + screen->moveViewport (screen->vp ().x () - selectedVp.x (), | ||
3168 | 239 | + screen->vp ().y () - selectedVp.y (), true); | ||
3169 | 240 | |||
3170 | 241 | - updateWindowAttributes (w, CompStackingUpdateModeNone); | ||
3171 | 242 | + /* update saved window attributes in case we moved the | ||
3172 | 243 | + window to a new viewport */ | ||
3173 | 244 | + if (dndWindow->saveMask () & CWX) | ||
3174 | 245 | + { | ||
3175 | 246 | + dndWindow->saveWc ().x = dndWindow->saveWc ().x % screen->width (); | ||
3176 | 247 | + if (dndWindow->saveWc ().x < 0) | ||
3177 | 248 | + dndWindow->saveWc ().x += screen->width (); | ||
3178 | 249 | + } | ||
3179 | 250 | + if (dndWindow->saveMask () & CWY) | ||
3180 | 251 | + { | ||
3181 | 252 | + dndWindow->saveWc ().y = dndWindow->saveWc ().y % screen->height (); | ||
3182 | 253 | + if (dndWindow->saveWc ().y < 0) | ||
3183 | 254 | + dndWindow->saveWc ().y += screen->height (); | ||
3184 | 255 | + } | ||
3185 | 256 | |||
3186 | 257 | - s->currentOutputDev = lastOutput; | ||
3187 | 258 | + /* update window attibutes to make sure a moved maximized window | ||
3188 | 259 | + is properly snapped to the work area */ | ||
3189 | 260 | + if (dndWindow->state () & MAXIMIZE_STATE) | ||
3190 | 261 | + dndWindow->updateAttributes (CompStackingUpdateModeNone); | ||
3191 | 262 | + } | ||
3192 | 263 | } | ||
3193 | 264 | -#endif | ||
3194 | 265 | } | ||
3195 | 266 | |||
3196 | 267 | void | ||
3197 | 268 | @@ -402,6 +390,80 @@ | ||
3198 | 269 | screen->handleEvent (event); | ||
3199 | 270 | } | ||
3200 | 271 | |||
3201 | 272 | +bool | ||
3202 | 273 | +ExpoWindow::dragged () const | ||
3203 | 274 | +{ | ||
3204 | 275 | + ExpoScreen *es = ExpoScreen::get (screen); | ||
3205 | 276 | + | ||
3206 | 277 | + return std::find (es->dndWindows.begin (), es->dndWindows.end (), window) != es->dndWindows.end (); | ||
3207 | 278 | +} | ||
3208 | 279 | + | ||
3209 | 280 | +const compiz::window::Geometry & | ||
3210 | 281 | +ExpoWindow::absoluteGeometry () const | ||
3211 | 282 | +{ | ||
3212 | 283 | + const compiz::window::Geometry &relativeGeometry (window->geometry ()); | ||
3213 | 284 | + mAbsoluteGeometry.set ((screen->vp ().x () * screen->width ()) + relativeGeometry.x (), | ||
3214 | 285 | + (screen->vp ().y () * screen->height ()) + relativeGeometry.y (), | ||
3215 | 286 | + relativeGeometry.width (), | ||
3216 | 287 | + relativeGeometry.height (), | ||
3217 | 288 | + relativeGeometry.border ()); | ||
3218 | 289 | + | ||
3219 | 290 | + return mAbsoluteGeometry; | ||
3220 | 291 | +} | ||
3221 | 292 | + | ||
3222 | 293 | +bool | ||
3223 | 294 | +ExpoWindow::isDesktopOrDock () const | ||
3224 | 295 | +{ | ||
3225 | 296 | + return window->type () == CompWindowTypeDesktopMask || | ||
3226 | 297 | + window->type () == CompWindowTypeDockMask; | ||
3227 | 298 | +} | ||
3228 | 299 | + | ||
3229 | 300 | +namespace cei = compiz::expo::impl; | ||
3230 | 301 | + | ||
3231 | 302 | +cei::CompizClientListGenerator::CompizClientListGenerator (CompScreen *screen) : | ||
3232 | 303 | + mScreen (screen), | ||
3233 | 304 | + mClientList (&mScreen->clientList (true)), | ||
3234 | 305 | + mClientListIterator (mClientList->begin ()) | ||
3235 | 306 | +{ | ||
3236 | 307 | +} | ||
3237 | 308 | + | ||
3238 | 309 | +compiz::expo::ViewportMemberWindow * | ||
3239 | 310 | +cei::CompizClientListGenerator::nextClient () | ||
3240 | 311 | +{ | ||
3241 | 312 | + if (mClientListIterator == mClientList->end ()) | ||
3242 | 313 | + return NULL; | ||
3243 | 314 | + | ||
3244 | 315 | + compiz::expo::ViewportMemberWindow *vpMemberWindow = ExpoWindow::get (*mClientListIterator); | ||
3245 | 316 | + | ||
3246 | 317 | + ++mClientListIterator; | ||
3247 | 318 | + | ||
3248 | 319 | + return vpMemberWindow; | ||
3249 | 320 | +} | ||
3250 | 321 | + | ||
3251 | 322 | +bool | ||
3252 | 323 | +ExpoScreen::windowsOnVp (compiz::expo::ClientListGenerator &clientList, | ||
3253 | 324 | + CompPoint &p, | ||
3254 | 325 | + const CompPoint &unprojectedCursor, | ||
3255 | 326 | + const CompSize &screenSize, | ||
3256 | 327 | + CompScreen *screen) | ||
3257 | 328 | +{ | ||
3258 | 329 | + return false; | ||
3259 | 330 | +} | ||
3260 | 331 | + | ||
3261 | 332 | +namespace | ||
3262 | 333 | +{ | ||
3263 | 334 | + void fillInNewViewportActivityData (unsigned int vpCount, | ||
3264 | 335 | + std::vector <float> &vpActivity) | ||
3265 | 336 | + { | ||
3266 | 337 | + if (vpActivity.size () < vpCount) | ||
3267 | 338 | + { | ||
3268 | 339 | + vpActivity.resize (vpCount); | ||
3269 | 340 | + foreach (float& activity, vpActivity) | ||
3270 | 341 | + activity = 1.0f; | ||
3271 | 342 | + } | ||
3272 | 343 | + } | ||
3273 | 344 | +} | ||
3274 | 345 | + | ||
3275 | 346 | void | ||
3276 | 347 | ExpoScreen::preparePaint (int msSinceLastPaint) | ||
3277 | 348 | { | ||
3278 | 349 | @@ -412,33 +474,42 @@ | ||
3279 | 350 | else | ||
3280 | 351 | expoCam = MAX (0.0, expoCam - val); | ||
3281 | 352 | |||
3282 | 353 | - if (expoCam) | ||
3283 | 354 | + if (dndState == DnDDuring) | ||
3284 | 355 | { | ||
3285 | 356 | - unsigned int i, j, vp; | ||
3286 | 357 | - unsigned int vpCount = screen->vpSize ().width () * | ||
3287 | 358 | - screen->vpSize ().height (); | ||
3288 | 359 | + foreach (CompWindow *w, dndWindows) | ||
3289 | 360 | + ExpoWindow::get (w)->dndOpacity = MIN (1.0, ExpoWindow::get (w)->dndOpacity + val); | ||
3290 | 361 | + } | ||
3291 | 362 | + else if (dndState == DnDNone) | ||
3292 | 363 | + { | ||
3293 | 364 | + CompWindowList::iterator it = dndWindows.begin (); | ||
3294 | 365 | |||
3295 | 366 | - if (vpActivity.size () < vpCount) | ||
3296 | 367 | + while (it != dndWindows.end ()) | ||
3297 | 368 | { | ||
3298 | 369 | - vpActivity.resize (vpCount); | ||
3299 | 370 | - foreach (float& activity, vpActivity) | ||
3300 | 371 | - activity = 1.0f; | ||
3301 | 372 | - } | ||
3302 | 373 | + ExpoWindow::get ((*it))->dndOpacity = MAX (0.0, ExpoWindow::get ((*it))->dndOpacity - val); | ||
3303 | 374 | |||
3304 | 375 | - for (i = 0; i < (unsigned int) screen->vpSize ().width (); i++) | ||
3305 | 376 | - { | ||
3306 | 377 | - for (j = 0; j < (unsigned int) screen->vpSize ().height (); j++) | ||
3307 | 378 | + if (ExpoWindow::get ((*it))->dndOpacity <= 0.0f) | ||
3308 | 379 | { | ||
3309 | 380 | - vp = (j * screen->vpSize ().width ()) + i; | ||
3310 | 381 | - | ||
3311 | 382 | - if (CompPoint (i, j) == selectedVp) | ||
3312 | 383 | - vpActivity[vp] = MIN (1.0, vpActivity[vp] + val); | ||
3313 | 384 | - else | ||
3314 | 385 | - vpActivity[vp] = MAX (0.0, vpActivity[vp] - val); | ||
3315 | 386 | + dndWindows.erase (it); | ||
3316 | 387 | + it = dndWindows.begin (); | ||
3317 | 388 | } | ||
3318 | 389 | + else | ||
3319 | 390 | + it++; | ||
3320 | 391 | } | ||
3321 | 392 | + } | ||
3322 | 393 | |||
3323 | 394 | - for (i = 0; i < 360; i++) | ||
3324 | 395 | + if (expoCam) | ||
3325 | 396 | + { | ||
3326 | 397 | + unsigned int vpCount = compiz::expo::countViewports (screen->vpSize ()); | ||
3327 | 398 | + | ||
3328 | 399 | + fillInNewViewportActivityData (vpCount, vpActivity); | ||
3329 | 400 | + | ||
3330 | 401 | + for (unsigned int i = 0; i < vpCount; i++) | ||
3331 | 402 | + if (vpActive[i]) | ||
3332 | 403 | + vpActivity[i] = MIN (1.0, vpActivity[i] + val); | ||
3333 | 404 | + else | ||
3334 | 405 | + vpActivity[i] = MAX (0.0, vpActivity[i] - val); | ||
3335 | 406 | + | ||
3336 | 407 | + for (int i = 0; i < 360; i++) | ||
3337 | 408 | { | ||
3338 | 409 | float fi = (float) i; | ||
3339 | 410 | |||
3340 | 411 | @@ -509,6 +580,31 @@ | ||
3341 | 412 | cScreen->paint (outputs, mask); | ||
3342 | 413 | } | ||
3343 | 414 | |||
3344 | 415 | +namespace | ||
3345 | 416 | +{ | ||
3346 | 417 | + void updateViewportActiveStates (CompScreen *screen) | ||
3347 | 418 | + { | ||
3348 | 419 | + ExpoScreen *es = ExpoScreen::get (screen); | ||
3349 | 420 | + | ||
3350 | 421 | + unsigned int vpCount = compiz::expo::countViewports (screen->vpSize ()); | ||
3351 | 422 | + fillInNewViewportActivityData (vpCount, es->vpActivity); | ||
3352 | 423 | + | ||
3353 | 424 | + for (int i = 0; i < screen->vpSize ().width (); i++) | ||
3354 | 425 | + { | ||
3355 | 426 | + for (int j = 0; j < screen->vpSize ().height (); j++) | ||
3356 | 427 | + { | ||
3357 | 428 | + compiz::expo::impl::CompizClientListGenerator clientList (screen); | ||
3358 | 429 | + | ||
3359 | 430 | + compiz::expo::activeViewportsForMembers (clientList, | ||
3360 | 431 | + es->newCursor, | ||
3361 | 432 | + screen->vpSize (), | ||
3362 | 433 | + *screen, | ||
3363 | 434 | + es->vpActive); | ||
3364 | 435 | + } | ||
3365 | 436 | + } | ||
3366 | 437 | + } | ||
3367 | 438 | +} | ||
3368 | 439 | + | ||
3369 | 440 | void | ||
3370 | 441 | ExpoScreen::donePaint () | ||
3371 | 442 | { | ||
3372 | 443 | @@ -539,6 +635,11 @@ | ||
3373 | 444 | foreach (float& vp, vpActivity) | ||
3374 | 445 | if (vp != 0.0 && vp != 1.0) | ||
3375 | 446 | cScreen->damageScreen (); | ||
3376 | 447 | + | ||
3377 | 448 | + foreach (CompWindow *w, dndWindows) | ||
3378 | 449 | + if (ExpoWindow::get (w)->dndOpacity != 0.0f && | ||
3379 | 450 | + ExpoWindow::get (w)->dndOpacity != 1.0f) | ||
3380 | 451 | + cScreen->damageScreen (); | ||
3381 | 452 | } | ||
3382 | 453 | |||
3383 | 454 | if (grabIndex && expoCam <= 0.0f && !expoMode) | ||
3384 | 455 | @@ -553,10 +654,25 @@ | ||
3385 | 456 | switch (dndState) { | ||
3386 | 457 | case DnDDuring: | ||
3387 | 458 | { | ||
3388 | 459 | - if (dndWindow) | ||
3389 | 460 | - dndWindow->move (newCursor.x () - prevCursor.x (), | ||
3390 | 461 | - newCursor.y () - prevCursor.y (), | ||
3391 | 462 | - optionGetExpoImmediateMove ()); | ||
3392 | 463 | + if (dndWindows.size ()) | ||
3393 | 464 | + { | ||
3394 | 465 | + foreach (CompWindow *dndWindow, dndWindows) | ||
3395 | 466 | + { | ||
3396 | 467 | + if (dndWindow->grabbed ()) | ||
3397 | 468 | + { | ||
3398 | 469 | + ExpoWindow *ew = ExpoWindow::get (dndWindow); | ||
3399 | 470 | + | ||
3400 | 471 | + /* No need to update twice */ | ||
3401 | 472 | + dndWindow->moveNotifySetEnabled (ew, false); | ||
3402 | 473 | + dndWindow->move (newCursor.x () - prevCursor.x (), | ||
3403 | 474 | + newCursor.y () - prevCursor.y (), | ||
3404 | 475 | + optionGetExpoImmediateMove ()); | ||
3405 | 476 | + dndWindow->moveNotifySetEnabled (ew, true); | ||
3406 | 477 | + | ||
3407 | 478 | + updateViewportActiveStates (screen); | ||
3408 | 479 | + } | ||
3409 | 480 | + } | ||
3410 | 481 | + } | ||
3411 | 482 | |||
3412 | 483 | prevCursor = newCursor; | ||
3413 | 484 | cScreen->damageScreen (); | ||
3414 | 485 | @@ -621,13 +737,13 @@ | ||
3415 | 486 | break; | ||
3416 | 487 | |||
3417 | 488 | dndState = DnDDuring; | ||
3418 | 489 | - dndWindow = w; | ||
3419 | 490 | + dndWindows.push_back (w); | ||
3420 | 491 | |||
3421 | 492 | w->grabNotify (nx, ny, 0, | ||
3422 | 493 | CompWindowGrabMoveMask | | ||
3423 | 494 | CompWindowGrabButtonMask); | ||
3424 | 495 | |||
3425 | 496 | - screen->updateGrab (grabIndex, dragCursor); | ||
3426 | 497 | + screen->updateGrab (grabIndex, mMoveCursor); | ||
3427 | 498 | |||
3428 | 499 | w->raise (); | ||
3429 | 500 | w->moveInputFocusTo (); | ||
3430 | 501 | @@ -762,6 +878,124 @@ | ||
3431 | 502 | } | ||
3432 | 503 | |||
3433 | 504 | void | ||
3434 | 505 | +ExpoScreen::paintViewport (const GLScreenPaintAttrib& attrib, | ||
3435 | 506 | + const GLMatrix& transform, | ||
3436 | 507 | + const CompRegion& region, | ||
3437 | 508 | + CompOutput *output, | ||
3438 | 509 | + unsigned int mask, | ||
3439 | 510 | + CompPoint vpPos, | ||
3440 | 511 | + GLVector &vpCamPos, | ||
3441 | 512 | + bool reflection) | ||
3442 | 513 | +{ | ||
3443 | 514 | + GLMatrix sTransform (transform); | ||
3444 | 515 | + GLMatrix sTransform2, sTransform3; | ||
3445 | 516 | + float sx = (float) screen->width () / output->width (); | ||
3446 | 517 | + float sy = (float) screen->height () / output->height (); | ||
3447 | 518 | + float vpp; | ||
3448 | 519 | + float progress = sigmoidProgress (expoCam); | ||
3449 | 520 | + unsigned int vp; | ||
3450 | 521 | + CompPoint vpSize (screen->vpSize ().width (), screen->vpSize ().height ()); | ||
3451 | 522 | + | ||
3452 | 523 | + const float gapY = optionGetVpDistance () * 0.1f * expoCam; | ||
3453 | 524 | + const float gapX = optionGetVpDistance () * 0.1f * screen->height () / | ||
3454 | 525 | + screen->width () * expoCam; | ||
3455 | 526 | + | ||
3456 | 527 | + /* not sure this will work with different resolutions */ | ||
3457 | 528 | + sTransform.translate (0.0, MAX (0, vpPos.y ()) * -(sy + gapY), 0.0f); | ||
3458 | 529 | + | ||
3459 | 530 | + sTransform2 = sTransform; | ||
3460 | 531 | + | ||
3461 | 532 | + /* not sure this will work with different resolutions */ | ||
3462 | 533 | + if (optionGetDeform () != DeformCurve) | ||
3463 | 534 | + sTransform2.translate (MAX (0, vpPos.x ()) * (sx + gapX), 0.0f, 0.0); | ||
3464 | 535 | + | ||
3465 | 536 | + | ||
3466 | 537 | + if (optionGetExpoAnimation () == ExpoAnimationVortex) | ||
3467 | 538 | + sTransform2.rotate (360 * expoCam, | ||
3468 | 539 | + 0.0f, 1.0f, 2.0f * expoCam); | ||
3469 | 540 | + | ||
3470 | 541 | + sTransform3 = sTransform2; | ||
3471 | 542 | + | ||
3472 | 543 | + sTransform3.translate (output->x () / output->width (), | ||
3473 | 544 | + -output->y () / output->height (), 0.0); | ||
3474 | 545 | + | ||
3475 | 546 | + cScreen->setWindowPaintOffset ((screen->vp ().x () - vpPos.x ()) * | ||
3476 | 547 | + screen->width (), | ||
3477 | 548 | + (screen->vp ().y () - vpPos.y ()) * | ||
3478 | 549 | + screen->height ()); | ||
3479 | 550 | + | ||
3480 | 551 | + vp = (vpPos.y () * vpSize.x ()) + vpPos.x (); | ||
3481 | 552 | + | ||
3482 | 553 | + vpp = (expoCam * vpActivity[vp]) + (1 - expoCam); | ||
3483 | 554 | + vpp = sigmoidProgress (vpp); | ||
3484 | 555 | + | ||
3485 | 556 | + vpBrightness = vpp + ((1.0 - vpp) * | ||
3486 | 557 | + optionGetVpBrightness () / 100.0); | ||
3487 | 558 | + vpSaturation = vpp + ((1.0 - vpp) * | ||
3488 | 559 | + optionGetVpSaturation () / 100.0); | ||
3489 | 560 | + | ||
3490 | 561 | + paintingVp = vpPos; | ||
3491 | 562 | + | ||
3492 | 563 | + if (optionGetDeform () == DeformCurve) | ||
3493 | 564 | + { | ||
3494 | 565 | + float rotateX; | ||
3495 | 566 | + | ||
3496 | 567 | + sTransform3.translate (-vpCamPos[GLVector::x], 0.0f, | ||
3497 | 568 | + curveDistance - DEFAULT_Z_CAMERA); | ||
3498 | 569 | + | ||
3499 | 570 | + rotateX = -vpPos.x () + interpolate (((float) vpSize.x () / 2.0) - 0.5, | ||
3500 | 571 | + screen->vp ().x (), progress); | ||
3501 | 572 | + | ||
3502 | 573 | + sTransform3.rotate (curveAngle * rotateX, 0.0, 1.0, 0.0); | ||
3503 | 574 | + | ||
3504 | 575 | + sTransform3.translate (vpCamPos[GLVector::x], 0.0f, | ||
3505 | 576 | + DEFAULT_Z_CAMERA - curveDistance); | ||
3506 | 577 | + } | ||
3507 | 578 | + | ||
3508 | 579 | + if (paintingDndWindow) | ||
3509 | 580 | + cScreen->getWindowPaintListSetEnabled (this, true); | ||
3510 | 581 | + gScreen->glPaintTransformedOutput (attrib, sTransform3, | ||
3511 | 582 | + screen->region (), output, | ||
3512 | 583 | + mask); | ||
3513 | 584 | + | ||
3514 | 585 | + if (paintingDndWindow) | ||
3515 | 586 | + cScreen->getWindowPaintListSetEnabled (this, false); | ||
3516 | 587 | + | ||
3517 | 588 | + if (!reflection && !paintingDndWindow) | ||
3518 | 589 | + { | ||
3519 | 590 | + int cursor[2] = { pointerX, pointerY }; | ||
3520 | 591 | + | ||
3521 | 592 | + invertTransformedVertex (attrib, sTransform3, | ||
3522 | 593 | + output, cursor); | ||
3523 | 594 | + | ||
3524 | 595 | + if ((cursor[0] > 0) && (cursor[0] < (int) screen->width ()) && | ||
3525 | 596 | + (cursor[1] > 0) && (cursor[1] < (int) screen->height ())) | ||
3526 | 597 | + { | ||
3527 | 598 | + newCursor.setX (vpPos.x () * screen->width () + cursor[0]); | ||
3528 | 599 | + newCursor.setY (vpPos.y () * screen->height () + cursor[1]); | ||
3529 | 600 | + | ||
3530 | 601 | + if (anyClick || dndState != DnDNone) | ||
3531 | 602 | + { | ||
3532 | 603 | + /* Used to save last viewport interaction was in */ | ||
3533 | 604 | + selectedVp = vpPos; | ||
3534 | 605 | + anyClick = false; | ||
3535 | 606 | + } | ||
3536 | 607 | + } | ||
3537 | 608 | + } | ||
3538 | 609 | + | ||
3539 | 610 | + /* Calculate the current viewport size */ | ||
3540 | 611 | + int tl[2] = { 0, 0 }; | ||
3541 | 612 | + int br[2] = { screen->width (), screen->height () }; | ||
3542 | 613 | + | ||
3543 | 614 | + invertTransformedVertex (attrib, sTransform3, output, tl); | ||
3544 | 615 | + invertTransformedVertex (attrib, sTransform3, output, br); | ||
3545 | 616 | + | ||
3546 | 617 | + viewport_size = CompSize (br[0] - tl[0], br[1] - tl[1]); | ||
3547 | 618 | + | ||
3548 | 619 | + cScreen->setWindowPaintOffset (0, 0); | ||
3549 | 620 | +} | ||
3550 | 621 | + | ||
3551 | 622 | +void | ||
3552 | 623 | ExpoScreen::paintWall (const GLScreenPaintAttrib& attrib, | ||
3553 | 624 | const GLMatrix& transform, | ||
3554 | 625 | const CompRegion& region, | ||
3555 | 626 | @@ -772,13 +1006,11 @@ | ||
3556 | 627 | GLfloat vertexData[12]; | ||
3557 | 628 | GLushort colorData[16]; | ||
3558 | 629 | GLMatrix sTransformW, sTransform (transform); | ||
3559 | 630 | - int i, j, vp; | ||
3560 | 631 | GLenum oldFilter = gScreen->textureFilter (); | ||
3561 | 632 | - | ||
3562 | 633 | - float sx = (float) screen->width () / output->width (); | ||
3563 | 634 | - float sy = (float) screen->height () / output->height (); | ||
3564 | 635 | + float sx = (float) screen->width () / output->width (); | ||
3565 | 636 | + float sy = (float) screen->height () / output->height (); | ||
3566 | 637 | float biasZ; | ||
3567 | 638 | - float oScale, rotation = 0.0f, progress, vpp; | ||
3568 | 639 | + float oScale, rotation = 0.0f, progress; | ||
3569 | 640 | float aspectX = 1.0f, aspectY = 1.0f; | ||
3570 | 641 | GLVector cam; | ||
3571 | 642 | CompPoint vpSize (screen->vpSize ().width (), screen->vpSize ().height ()); | ||
3572 | 643 | @@ -910,9 +1142,24 @@ | ||
3573 | 644 | sTransform.rotate (rotation, 0.0f, 1.0f, 0.0f); | ||
3574 | 645 | sTransform.scale (aspectX, aspectY, 1.0); | ||
3575 | 646 | |||
3576 | 647 | + CompPoint offsetInScreenCoords (optionGetXOffset (), | ||
3577 | 648 | + optionGetYOffset ()); | ||
3578 | 649 | + float offsetInWorldCoordX, offsetInWorldCoordY, worldScaleFactorX, worldScaleFactorY; | ||
3579 | 650 | + | ||
3580 | 651 | + compiz::expo::calculateWallOffset (*output, | ||
3581 | 652 | + offsetInScreenCoords, | ||
3582 | 653 | + vpSize, | ||
3583 | 654 | + *screen, | ||
3584 | 655 | + offsetInWorldCoordX, | ||
3585 | 656 | + offsetInWorldCoordY, | ||
3586 | 657 | + worldScaleFactorX, | ||
3587 | 658 | + worldScaleFactorY, | ||
3588 | 659 | + sigmoidProgress (expoCam)); | ||
3589 | 660 | + | ||
3590 | 661 | /* translate expo to center */ | ||
3591 | 662 | - sTransform.translate (vpSize.x () * sx * -0.5, | ||
3592 | 663 | - vpSize.y () * sy * 0.5, 0.0f); | ||
3593 | 664 | + sTransform.translate (vpSize.x () * sx * -0.5 + offsetInWorldCoordX, | ||
3594 | 665 | + vpSize.y () * sy * 0.5 - offsetInWorldCoordY, 0.0f); | ||
3595 | 666 | + sTransform.scale (worldScaleFactorX, worldScaleFactorY, 1.0f); | ||
3596 | 667 | |||
3597 | 668 | if (optionGetDeform () == DeformCurve) | ||
3598 | 669 | sTransform.translate ((vpSize.x () - 1) * sx * 0.5, 0.0, 0.0); | ||
3599 | 670 | @@ -936,90 +1183,29 @@ | ||
3600 | 671 | |||
3601 | 672 | expoActive = true; | ||
3602 | 673 | |||
3603 | 674 | - for (j = 0; j < vpSize.y (); j++) | ||
3604 | 675 | - { | ||
3605 | 676 | - GLMatrix sTransform2 (sTransform), sTransform3; | ||
3606 | 677 | - | ||
3607 | 678 | - for (i = 0; i < vpSize.x (); i++) | ||
3608 | 679 | - { | ||
3609 | 680 | - if (optionGetExpoAnimation () == ExpoAnimationVortex) | ||
3610 | 681 | - sTransform2.rotate (360 * expoCam, | ||
3611 | 682 | - 0.0f, 1.0f, 2.0f * expoCam); | ||
3612 | 683 | - | ||
3613 | 684 | - sTransform3 = sTransform2; | ||
3614 | 685 | - | ||
3615 | 686 | - sTransform3.translate (output->x () / output->width (), | ||
3616 | 687 | - -output->y () / output->height (), 0.0); | ||
3617 | 688 | - | ||
3618 | 689 | - cScreen->setWindowPaintOffset ((screen->vp ().x () - i) * | ||
3619 | 690 | - screen->width (), | ||
3620 | 691 | - (screen->vp ().y () - j) * | ||
3621 | 692 | - screen->height ()); | ||
3622 | 693 | - | ||
3623 | 694 | - vp = (j * vpSize.x ()) + i; | ||
3624 | 695 | - | ||
3625 | 696 | - vpp = (expoCam * vpActivity[vp]) + (1 - expoCam); | ||
3626 | 697 | - vpp = sigmoidProgress (vpp); | ||
3627 | 698 | - | ||
3628 | 699 | - vpBrightness = vpp + ((1.0 - vpp) * | ||
3629 | 700 | - optionGetVpBrightness () / 100.0); | ||
3630 | 701 | - vpSaturation = vpp + ((1.0 - vpp) * | ||
3631 | 702 | - optionGetVpSaturation () / 100.0); | ||
3632 | 703 | + for (int j = 0; j < screen->vpSize ().height (); j++) | ||
3633 | 704 | + for (int i = 0; i < screen->vpSize().width (); i++) | ||
3634 | 705 | + paintViewport (attrib, sTransform, region, output, mask, CompPoint (i, j), vpCamPos, reflection); | ||
3635 | 706 | |||
3636 | 707 | - paintingVp.set (i, j); | ||
3637 | 708 | + paintingDndWindow = true; | ||
3638 | 709 | |||
3639 | 710 | - if (optionGetDeform () == DeformCurve) | ||
3640 | 711 | - { | ||
3641 | 712 | - float rotateX; | ||
3642 | 713 | - | ||
3643 | 714 | - sTransform3.translate (-vpCamPos[GLVector::x], 0.0f, | ||
3644 | 715 | - curveDistance - DEFAULT_Z_CAMERA); | ||
3645 | 716 | - | ||
3646 | 717 | - rotateX = -i + interpolate (((float) vpSize.x () / 2.0) - 0.5, | ||
3647 | 718 | - screen->vp ().x (), progress); | ||
3648 | 719 | - | ||
3649 | 720 | - sTransform3.rotate (curveAngle * rotateX, 0.0, 1.0, 0.0); | ||
3650 | 721 | - | ||
3651 | 722 | - sTransform3.translate (vpCamPos[GLVector::x], 0.0f, | ||
3652 | 723 | - DEFAULT_Z_CAMERA - curveDistance); | ||
3653 | 724 | - } | ||
3654 | 725 | - | ||
3655 | 726 | - gScreen->glPaintTransformedOutput (attrib, sTransform3, | ||
3656 | 727 | - screen->region (), output, | ||
3657 | 728 | - mask); | ||
3658 | 729 | - | ||
3659 | 730 | - if (!reflection) | ||
3660 | 731 | - { | ||
3661 | 732 | - int cursor[2] = { pointerX, pointerY }; | ||
3662 | 733 | + foreach (CompWindow *dndWindow, dndWindows) | ||
3663 | 734 | + { | ||
3664 | 735 | + CompPoint vp; | ||
3665 | 736 | |||
3666 | 737 | - invertTransformedVertex (attrib, sTransform3, | ||
3667 | 738 | - output, cursor); | ||
3668 | 739 | + screen->viewportForGeometry (dndWindow->geometry (), vp); | ||
3669 | 740 | |||
3670 | 741 | - if ((cursor[0] > 0) && (cursor[0] < (int) screen->width ()) && | ||
3671 | 742 | - (cursor[1] > 0) && (cursor[1] < (int) screen->height ())) | ||
3672 | 743 | - { | ||
3673 | 744 | - newCursor.setX (i * screen->width () + cursor[0]); | ||
3674 | 745 | - newCursor.setY (j * screen->height () + cursor[1]); | ||
3675 | 746 | + while (vp.x () < 0) | ||
3676 | 747 | + vp.setX (screen->vpSize ().width () + vp.x ()); | ||
3677 | 748 | |||
3678 | 749 | - if (anyClick || dndState != DnDNone) | ||
3679 | 750 | - { | ||
3680 | 751 | - /* Used to save last viewport interaction was in */ | ||
3681 | 752 | - lastSelectedVp = selectedVp; | ||
3682 | 753 | - selectedVp.set (i, j); | ||
3683 | 754 | - anyClick = false; | ||
3684 | 755 | - } | ||
3685 | 756 | - } | ||
3686 | 757 | - } | ||
3687 | 758 | + while (vp.y () < 0) | ||
3688 | 759 | + vp.setY (screen->vpSize ().height () + vp.y ()); | ||
3689 | 760 | |||
3690 | 761 | - /* not sure this will work with different resolutions */ | ||
3691 | 762 | - if (optionGetDeform () != DeformCurve) | ||
3692 | 763 | - sTransform2.translate (sx + gapX, 0.0f, 0.0); | ||
3693 | 764 | - } | ||
3694 | 765 | - | ||
3695 | 766 | - /* not sure this will work with different resolutions */ | ||
3696 | 767 | - sTransform.translate (0.0, -(sy + gapY), 0.0f); | ||
3697 | 768 | + paintViewport (attrib, sTransform, infiniteRegion, output, mask, vp, vpCamPos, reflection); | ||
3698 | 769 | } | ||
3699 | 770 | |||
3700 | 771 | + paintingDndWindow = false; | ||
3701 | 772 | + | ||
3702 | 773 | // glNormal3f (0.0, 0.0, -1.0); | ||
3703 | 774 | |||
3704 | 775 | if (reflection) | ||
3705 | 776 | @@ -1187,12 +1373,16 @@ | ||
3706 | 777 | |||
3707 | 778 | expoActive = false; | ||
3708 | 779 | |||
3709 | 780 | - cScreen->setWindowPaintOffset (0, 0); | ||
3710 | 781 | - | ||
3711 | 782 | gScreen->glPaintTransformedOutputSetCurrentIndex (glPaintTransformedOutputIndex); | ||
3712 | 783 | gScreen->setTextureFilter (oldFilter); | ||
3713 | 784 | } | ||
3714 | 785 | |||
3715 | 786 | +const CompWindowList & | ||
3716 | 787 | +ExpoScreen::getWindowPaintList () | ||
3717 | 788 | +{ | ||
3718 | 789 | + return dndWindows; | ||
3719 | 790 | +} | ||
3720 | 791 | + | ||
3721 | 792 | bool | ||
3722 | 793 | ExpoScreen::glPaintOutput (const GLScreenPaintAttrib& attrib, | ||
3723 | 794 | const GLMatrix& transform, | ||
3724 | 795 | @@ -1243,10 +1433,15 @@ | ||
3725 | 796 | |||
3726 | 797 | bool | ||
3727 | 798 | ExpoWindow::glDraw (const GLMatrix& transform, | ||
3728 | 799 | - const GLWindowPaintAttrib &attrib, | ||
3729 | 800 | + const GLWindowPaintAttrib &attrib, | ||
3730 | 801 | const CompRegion& region, | ||
3731 | 802 | unsigned int mask) | ||
3732 | 803 | { | ||
3733 | 804 | + GLMatrix wTransform (transform); | ||
3734 | 805 | + CompPoint vp; | ||
3735 | 806 | + | ||
3736 | 807 | + screen->viewportForGeometry (window->geometry (), vp); | ||
3737 | 808 | + | ||
3738 | 809 | if (eScreen->expoCam == 0.0f) | ||
3739 | 810 | return gWindow->glDraw (transform, attrib, region, mask); | ||
3740 | 811 | |||
3741 | 812 | @@ -1275,8 +1470,11 @@ | ||
3742 | 813 | } | ||
3743 | 814 | } | ||
3744 | 815 | |||
3745 | 816 | - eAttrib.brightness = attrib.brightness * eScreen->vpBrightness; | ||
3746 | 817 | - eAttrib.saturation = attrib.saturation * eScreen->vpSaturation; | ||
3747 | 818 | + if ((vp == eScreen->paintingVp || window->onAllViewports ()) && !eScreen->paintingDndWindow) | ||
3748 | 819 | + { | ||
3749 | 820 | + eAttrib.brightness = attrib.brightness * eScreen->vpBrightness; | ||
3750 | 821 | + eAttrib.saturation = attrib.saturation * eScreen->vpSaturation; | ||
3751 | 822 | + } | ||
3752 | 823 | } | ||
3753 | 824 | else | ||
3754 | 825 | { | ||
3755 | 826 | @@ -1287,7 +1485,79 @@ | ||
3756 | 827 | (1 - sigmoidProgress (eScreen->expoCam)); | ||
3757 | 828 | } | ||
3758 | 829 | |||
3759 | 830 | - return gWindow->glDraw (transform, eAttrib, region, mask); | ||
3760 | 831 | + bool status = gWindow->glDraw (transform, eAttrib, region, mask); | ||
3761 | 832 | + | ||
3762 | 833 | + if (window->type () & CompWindowTypeDesktopMask) | ||
3763 | 834 | + { | ||
3764 | 835 | + /* We want to set the geometry of the polka dots to the window | ||
3765 | 836 | + * region */ | ||
3766 | 837 | + CompRegion reg = CompRegion (0, 0, window->width (), window->height ()); | ||
3767 | 838 | + | ||
3768 | 839 | + foreach(GLTexture * tex, eScreen->polkadots_texture) | ||
3769 | 840 | + { | ||
3770 | 841 | + GLTexture::MatrixList matl; | ||
3771 | 842 | + GLTexture::Matrix mat = tex->matrix(); | ||
3772 | 843 | + CompRegion paintRegion(region); | ||
3773 | 844 | + | ||
3774 | 845 | + float xScale = screen->width () / (float) eScreen->viewport_size.width (); | ||
3775 | 846 | + float yScale = screen->height () / (float) eScreen->viewport_size.height (); | ||
3776 | 847 | + | ||
3777 | 848 | + mat.xx *= xScale; | ||
3778 | 849 | + mat.yy *= yScale; | ||
3779 | 850 | + | ||
3780 | 851 | + /* Not sure what this does, but it is necessary | ||
3781 | 852 | + * (adjusts for scale?) */ | ||
3782 | 853 | + mat.x0 -= mat.xx * reg.boundingRect().x1(); | ||
3783 | 854 | + mat.y0 -= mat.yy * reg.boundingRect().y1(); | ||
3784 | 855 | + | ||
3785 | 856 | + matl.push_back(mat); | ||
3786 | 857 | + | ||
3787 | 858 | + if (mask & PAINT_WINDOW_TRANSFORMED_MASK) | ||
3788 | 859 | + paintRegion = infiniteRegion; | ||
3789 | 860 | + | ||
3790 | 861 | + /* Now allow plugins to mess with the geometry of our | ||
3791 | 862 | + * dim (so we get a nice render for things like | ||
3792 | 863 | + * wobbly etc etc */ | ||
3793 | 864 | + gWindow->vertexBuffer ()->begin (); | ||
3794 | 865 | + gWindow->glAddGeometry (matl, reg, paintRegion); | ||
3795 | 866 | + if (gWindow->vertexBuffer ()->end ()) | ||
3796 | 867 | + { | ||
3797 | 868 | + unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex (); | ||
3798 | 869 | + eAttrib.opacity = attrib.opacity * (((1.0 - eScreen->vpBrightness) + (1.0 - eScreen->vpSaturation) / 2.0)); | ||
3799 | 870 | + /* Texture rendering set-up */ | ||
3800 | 871 | + //eScreen->gScreen->setTexEnvMode(GL_MODULATE); | ||
3801 | 872 | + glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | ||
3802 | 873 | + /* Draw the dim texture with all of it's modified | ||
3803 | 874 | + * geometry glory */ | ||
3804 | 875 | + gWindow->glDrawTextureSetCurrentIndex (MAXSHORT); | ||
3805 | 876 | + gWindow->glDrawTexture (tex, transform, eAttrib, mask | | ||
3806 | 877 | + PAINT_WINDOW_BLEND_MASK | | ||
3807 | 878 | + PAINT_WINDOW_TRANSLUCENT_MASK | | ||
3808 | 879 | + PAINT_WINDOW_TRANSFORMED_MASK); | ||
3809 | 880 | + gWindow->glDrawTextureSetCurrentIndex (glDrawTextureIndex); | ||
3810 | 881 | + /* Texture rendering tear-down */ | ||
3811 | 882 | + glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | ||
3812 | 883 | + eScreen->gScreen->setTexEnvMode (GL_REPLACE); | ||
3813 | 884 | + } | ||
3814 | 885 | + } | ||
3815 | 886 | + | ||
3816 | 887 | + /* Paint the outline */ | ||
3817 | 888 | + if (mGlowQuads && eScreen->paintingVp == eScreen->selectedVp) | ||
3818 | 889 | + { | ||
3819 | 890 | + if (region.numRects ()) | ||
3820 | 891 | + { | ||
3821 | 892 | + /* reset geometry and paint */ | ||
3822 | 893 | + gWindow->vertexBuffer ()->begin (); | ||
3823 | 894 | + gWindow->vertexBuffer ()->end (); | ||
3824 | 895 | + | ||
3825 | 896 | + paintGlow (transform, attrib, infiniteRegion, mask); | ||
3826 | 897 | + } | ||
3827 | 898 | + } | ||
3828 | 899 | + | ||
3829 | 900 | + } | ||
3830 | 901 | + | ||
3831 | 902 | + return status; | ||
3832 | 903 | + | ||
3833 | 904 | } | ||
3834 | 905 | |||
3835 | 906 | #define EXPO_GRID_SIZE 100 | ||
3836 | 907 | @@ -1425,11 +1695,17 @@ | ||
3837 | 908 | const CompRegion& region, | ||
3838 | 909 | unsigned int mask) | ||
3839 | 910 | { | ||
3840 | 911 | + GLMatrix wTransform (transform); | ||
3841 | 912 | + GLWindowPaintAttrib wAttrib (attrib); | ||
3842 | 913 | + CompRegion clip (region); | ||
3843 | 914 | + | ||
3844 | 915 | if (eScreen->expoActive) | ||
3845 | 916 | { | ||
3846 | 917 | float opacity = 1.0; | ||
3847 | 918 | bool hide; | ||
3848 | 919 | bool zoomAnim; | ||
3849 | 920 | + CompPoint vp; | ||
3850 | 921 | + screen->viewportForGeometry (window->geometry (), vp); | ||
3851 | 922 | |||
3852 | 923 | zoomAnim = eScreen->optionGetExpoAnimation () == | ||
3853 | 924 | ExpoScreen::ExpoAnimationZoom; | ||
3854 | 925 | @@ -1458,9 +1734,47 @@ | ||
3855 | 926 | |||
3856 | 927 | if (opacity <= 0) | ||
3857 | 928 | mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; | ||
3858 | 929 | + else | ||
3859 | 930 | + wAttrib.opacity = wAttrib.opacity * opacity; | ||
3860 | 931 | + | ||
3861 | 932 | + /* Stretch maximized windows a little so that you don't | ||
3862 | 933 | + * have an awkward gap */ | ||
3863 | 934 | + | ||
3864 | 935 | + if (window->state () & MAXIMIZE_STATE && | ||
3865 | 936 | + !window->border ().top) | ||
3866 | 937 | + { | ||
3867 | 938 | + CompOutput *o = &screen->outputDevs ()[screen->outputDeviceForGeometry(window->geometry())]; | ||
3868 | 939 | + float yS = 1.0 + ((o->height () / (float) window->height ()) - 1.0f) * sigmoidProgress (eScreen->expoCam); | ||
3869 | 940 | + float xS = 1.0 + ((o->width () / (float) window->width ()) - 1.0f) * sigmoidProgress (eScreen->expoCam); | ||
3870 | 941 | + wTransform.translate (window->x () + window->width (), | ||
3871 | 942 | + window->y () + window->height (), | ||
3872 | 943 | + 0.0f); | ||
3873 | 944 | + wTransform.scale (xS, yS, 1.0f); | ||
3874 | 945 | + wTransform.translate (-(window->x () + window->width ()), | ||
3875 | 946 | + -(window->y () + window->height ()), | ||
3876 | 947 | + 0.0f); | ||
3877 | 948 | + | ||
3878 | 949 | + if (eScreen->paintingVp != vp) | ||
3879 | 950 | + mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; | ||
3880 | 951 | + | ||
3881 | 952 | + mask |= PAINT_WINDOW_TRANSFORMED_MASK; | ||
3882 | 953 | + } | ||
3883 | 954 | + | ||
3884 | 955 | + if (std::find (eScreen->dndWindows.begin(), eScreen->dndWindows.end (), window) != eScreen->dndWindows.end ()) | ||
3885 | 956 | + { | ||
3886 | 957 | + if (!eScreen->paintingDndWindow) | ||
3887 | 958 | + { | ||
3888 | 959 | + mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; | ||
3889 | 960 | + } | ||
3890 | 961 | + else | ||
3891 | 962 | + { | ||
3892 | 963 | + mask |= PAINT_WINDOW_TRANSFORMED_MASK; | ||
3893 | 964 | + clip = infiniteRegion; | ||
3894 | 965 | + } | ||
3895 | 966 | + } | ||
3896 | 967 | } | ||
3897 | 968 | |||
3898 | 969 | - return gWindow->glPaint (attrib, transform, region, mask); | ||
3899 | 970 | + return gWindow->glPaint (wAttrib, wTransform, clip, mask); | ||
3900 | 971 | } | ||
3901 | 972 | |||
3902 | 973 | bool | ||
3903 | 974 | @@ -1489,7 +1803,7 @@ | ||
3904 | 975 | expoActive (false), | ||
3905 | 976 | expoMode (false), | ||
3906 | 977 | dndState (DnDNone), | ||
3907 | 978 | - dndWindow (NULL), | ||
3908 | 979 | + dndWindows (0), | ||
3909 | 980 | origVp (s->vp ()), | ||
3910 | 981 | selectedVp (s->vp ()), | ||
3911 | 982 | lastSelectedVp (s->vp ()), | ||
3912 | 983 | @@ -1497,14 +1811,21 @@ | ||
3913 | 984 | clickTime (0), | ||
3914 | 985 | doubleClick (false), | ||
3915 | 986 | vpNormals (360 * 3), | ||
3916 | 987 | - grabIndex (0) | ||
3917 | 988 | -{ | ||
3918 | 989 | + grabIndex (0), | ||
3919 | 990 | + paintingDndWindow (false), | ||
3920 | 991 | + mGlowTextureProperties (&glowTextureProperties) | ||
3921 | 992 | +{ | ||
3922 | 993 | + CompString fname; | ||
3923 | 994 | + CompString pname = "expo"; | ||
3924 | 995 | + CompSize size; | ||
3925 | 996 | + | ||
3926 | 997 | + | ||
3927 | 998 | leftKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Left")); | ||
3928 | 999 | rightKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Right")); | ||
3929 | 1000 | upKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Up")); | ||
3930 | 1001 | downKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Down")); | ||
3931 | 1002 | |||
3932 | 1003 | - dragCursor = XCreateFontCursor (screen->dpy (), XC_fleur); | ||
3933 | 1004 | + mMoveCursor = XCreateFontCursor (screen->dpy (), XC_fleur); | ||
3934 | 1005 | |||
3935 | 1006 | EXPOINITBIND (ExpoKey, doExpo); | ||
3936 | 1007 | EXPOTERMBIND (ExpoKey, termExpo); | ||
3937 | 1008 | @@ -1522,12 +1843,58 @@ | ||
3938 | 1009 | ScreenInterface::setHandler (screen, false); | ||
3939 | 1010 | CompositeScreenInterface::setHandler (cScreen, false); | ||
3940 | 1011 | GLScreenInterface::setHandler (gScreen, false); | ||
3941 | 1012 | + | ||
3942 | 1013 | + outline_texture = GLTexture::imageDataToTexture (mGlowTextureProperties->textureData, | ||
3943 | 1014 | + CompSize (mGlowTextureProperties->textureSize, | ||
3944 | 1015 | + mGlowTextureProperties->textureSize), | ||
3945 | 1016 | + GL_RGBA, GL_UNSIGNED_BYTE); | ||
3946 | 1017 | + fname = "texture_tile.png"; | ||
3947 | 1018 | + polkadots_texture = GLTexture::readImageToTexture (fname, pname, polkadots_texture_size); | ||
3948 | 1019 | + | ||
3949 | 1020 | + if (polkadots_texture.empty ()) | ||
3950 | 1021 | + compLogMessage ("expo", CompLogLevelWarn, "failed to bind image to texture"); | ||
3951 | 1022 | + else | ||
3952 | 1023 | + { | ||
3953 | 1024 | + foreach (GLTexture *tex, polkadots_texture) | ||
3954 | 1025 | + { | ||
3955 | 1026 | + tex->enable (GLTexture::Good); | ||
3956 | 1027 | + glTexParameteri (tex->target (), GL_TEXTURE_WRAP_S, GL_REPEAT); | ||
3957 | 1028 | + glTexParameteri (tex->target (), GL_TEXTURE_WRAP_T, GL_REPEAT); | ||
3958 | 1029 | + tex->disable (); | ||
3959 | 1030 | + } | ||
3960 | 1031 | + } | ||
3961 | 1032 | } | ||
3962 | 1033 | |||
3963 | 1034 | ExpoScreen::~ExpoScreen () | ||
3964 | 1035 | { | ||
3965 | 1036 | - if (dragCursor != None) | ||
3966 | 1037 | - XFreeCursor (screen->dpy (), dragCursor); | ||
3967 | 1038 | + if (mMoveCursor) | ||
3968 | 1039 | + XFreeCursor (screen->dpy (), mMoveCursor); | ||
3969 | 1040 | +} | ||
3970 | 1041 | + | ||
3971 | 1042 | +void | ||
3972 | 1043 | +ExpoWindow::moveNotify (int dx, int dy, bool immediate) | ||
3973 | 1044 | +{ | ||
3974 | 1045 | + window->moveNotify (dx, dy, immediate); | ||
3975 | 1046 | + | ||
3976 | 1047 | + if (!ExpoScreen::get (screen)->expoActive) | ||
3977 | 1048 | + return; | ||
3978 | 1049 | + | ||
3979 | 1050 | + updateViewportActiveStates (screen); | ||
3980 | 1051 | +} | ||
3981 | 1052 | + | ||
3982 | 1053 | +void | ||
3983 | 1054 | +ExpoWindow::resizeNotify(int dx, int dy, int dw, int dh) | ||
3984 | 1055 | +{ | ||
3985 | 1056 | + window->resizeNotify (dx, dy, dw, dh); | ||
3986 | 1057 | + | ||
3987 | 1058 | + /* mGlowQuads contains positional info, so we need to recalc that */ | ||
3988 | 1059 | + if (mGlowQuads) | ||
3989 | 1060 | + { | ||
3990 | 1061 | + /* FIXME: we need to find a more multitexture friendly way | ||
3991 | 1062 | + * of doing this */ | ||
3992 | 1063 | + GLTexture::Matrix tMat = eScreen->outline_texture.at (0)->matrix (); | ||
3993 | 1064 | + computeGlowQuads (&tMat); | ||
3994 | 1065 | + } | ||
3995 | 1066 | } | ||
3996 | 1067 | |||
3997 | 1068 | ExpoWindow::ExpoWindow (CompWindow *w) : | ||
3998 | 1069 | @@ -1535,10 +1902,28 @@ | ||
3999 | 1070 | window (w), | ||
4000 | 1071 | cWindow (CompositeWindow::get (w)), | ||
4001 | 1072 | gWindow (GLWindow::get (w)), | ||
4002 | 1073 | - eScreen (ExpoScreen::get (screen)) | ||
4003 | 1074 | + eScreen (ExpoScreen::get (screen)), | ||
4004 | 1075 | + dndOpacity (0.0f), | ||
4005 | 1076 | + mGlowQuads (NULL) | ||
4006 | 1077 | { | ||
4007 | 1078 | CompositeWindowInterface::setHandler (cWindow, false); | ||
4008 | 1079 | GLWindowInterface::setHandler (gWindow, false); | ||
4009 | 1080 | + WindowInterface::setHandler (window, true); | ||
4010 | 1081 | + | ||
4011 | 1082 | + if (window->type () & CompWindowTypeDesktopMask) | ||
4012 | 1083 | + { | ||
4013 | 1084 | + foreach (GLTexture *tex, eScreen->outline_texture) | ||
4014 | 1085 | + { | ||
4015 | 1086 | + GLTexture::Matrix mat = tex->matrix (); | ||
4016 | 1087 | + computeGlowQuads (&mat); | ||
4017 | 1088 | + } | ||
4018 | 1089 | + } | ||
4019 | 1090 | +} | ||
4020 | 1091 | + | ||
4021 | 1092 | +ExpoWindow::~ExpoWindow () | ||
4022 | 1093 | +{ | ||
4023 | 1094 | + eScreen->dndWindows.remove (window); | ||
4024 | 1095 | + computeGlowQuads (NULL); | ||
4025 | 1096 | } | ||
4026 | 1097 | |||
4027 | 1098 | bool | ||
4028 | 1099 | Index: ubuntu/plugins/expo/src/expo.h | ||
4029 | 1100 | =================================================================== | ||
4030 | 1101 | --- ubuntu.orig/plugins/expo/src/expo.h 2012-09-08 11:51:02.279175377 +0800 | ||
4031 | 1102 | +++ ubuntu/plugins/expo/src/expo.h 2012-09-08 14:07:47.219861486 +0800 | ||
4032 | 1103 | @@ -30,6 +30,44 @@ | ||
4033 | 1104 | #include <opengl/opengl.h> | ||
4034 | 1105 | |||
4035 | 1106 | #include "expo_options.h" | ||
4036 | 1107 | +#include "glow.h" | ||
4037 | 1108 | +#include "viewport-member-window.h" | ||
4038 | 1109 | +#include "client-list-generator.h" | ||
4039 | 1110 | + | ||
4040 | 1111 | +#define WIN_REAL_X(w) (w->x () - w->border ().left) | ||
4041 | 1112 | +#define WIN_REAL_Y(w) (w->y () - w->border ().top) | ||
4042 | 1113 | +#define WIN_REAL_WIDTH(w) (w->width () + 2 * w->geometry ().border () + \ | ||
4043 | 1114 | + w->border ().left + w->border ().right) | ||
4044 | 1115 | +#define WIN_REAL_HEIGHT(w) (w->height () + 2 * w->geometry ().border () + \ | ||
4045 | 1116 | + w->border ().top + w->border ().bottom) | ||
4046 | 1117 | + | ||
4047 | 1118 | +namespace compiz | ||
4048 | 1119 | +{ | ||
4049 | 1120 | + namespace expo | ||
4050 | 1121 | + { | ||
4051 | 1122 | + namespace impl | ||
4052 | 1123 | + { | ||
4053 | 1124 | + namespace ce = compiz::expo; | ||
4054 | 1125 | + | ||
4055 | 1126 | + class CompizClientListGenerator : | ||
4056 | 1127 | + public ce::ClientListGenerator | ||
4057 | 1128 | + { | ||
4058 | 1129 | + public: | ||
4059 | 1130 | + | ||
4060 | 1131 | + CompizClientListGenerator (CompScreen *screen); | ||
4061 | 1132 | + | ||
4062 | 1133 | + void refreshClientList (); | ||
4063 | 1134 | + ViewportMemberWindow * nextClient (); | ||
4064 | 1135 | + | ||
4065 | 1136 | + private: | ||
4066 | 1137 | + | ||
4067 | 1138 | + CompScreen *mScreen; | ||
4068 | 1139 | + const CompWindowVector *mClientList; | ||
4069 | 1140 | + CompWindowVector::const_iterator mClientListIterator; | ||
4070 | 1141 | + }; | ||
4071 | 1142 | + } | ||
4072 | 1143 | + } | ||
4073 | 1144 | +} | ||
4074 | 1145 | |||
4075 | 1146 | class ExpoScreen : | ||
4076 | 1147 | public ScreenInterface, | ||
4077 | 1148 | @@ -51,8 +89,10 @@ | ||
4078 | 1149 | bool glPaintOutput (const GLScreenPaintAttrib&, const GLMatrix&, | ||
4079 | 1150 | const CompRegion&, CompOutput *, unsigned int); | ||
4080 | 1151 | void glPaintTransformedOutput (const GLScreenPaintAttrib&, | ||
4081 | 1152 | - const GLMatrix&, const CompRegion&, | ||
4082 | 1153 | - CompOutput *, unsigned int); | ||
4083 | 1154 | + const GLMatrix&, const CompRegion&, | ||
4084 | 1155 | + CompOutput*, unsigned int); | ||
4085 | 1156 | + | ||
4086 | 1157 | + const CompWindowList & getWindowPaintList (); | ||
4087 | 1158 | |||
4088 | 1159 | bool dndInit (CompAction *, CompAction::State, CompOption::Vector&); | ||
4089 | 1160 | bool dndFini (CompAction *, CompAction::State, CompOption::Vector&); | ||
4090 | 1161 | @@ -62,6 +102,8 @@ | ||
4091 | 1162 | bool nextVp (CompAction *, CompAction::State, CompOption::Vector&); | ||
4092 | 1163 | bool prevVp (CompAction *, CompAction::State, CompOption::Vector&); | ||
4093 | 1164 | |||
4094 | 1165 | + CompPoint currentViewport (); | ||
4095 | 1166 | + | ||
4096 | 1167 | typedef enum { | ||
4097 | 1168 | DnDNone, | ||
4098 | 1169 | DnDDuring, | ||
4099 | 1170 | @@ -82,7 +124,7 @@ | ||
4100 | 1171 | bool expoMode; | ||
4101 | 1172 | |||
4102 | 1173 | DnDState dndState; | ||
4103 | 1174 | - CompWindow *dndWindow; | ||
4104 | 1175 | + CompWindowList dndWindows; | ||
4105 | 1176 | |||
4106 | 1177 | CompPoint prevCursor; | ||
4107 | 1178 | CompPoint newCursor; | ||
4108 | 1179 | @@ -94,6 +136,7 @@ | ||
4109 | 1180 | CompPoint paintingVp; | ||
4110 | 1181 | |||
4111 | 1182 | std::vector<float> vpActivity; | ||
4112 | 1183 | + std::vector<bool> vpActive; | ||
4113 | 1184 | float vpBrightness; | ||
4114 | 1185 | float vpSaturation; | ||
4115 | 1186 | |||
4116 | 1187 | @@ -113,6 +156,17 @@ | ||
4117 | 1188 | |||
4118 | 1189 | CompScreen::GrabHandle grabIndex; | ||
4119 | 1190 | |||
4120 | 1191 | + GLTexture::List polkadots_texture; | ||
4121 | 1192 | + CompSize polkadots_texture_size; | ||
4122 | 1193 | + CompSize viewport_size; | ||
4123 | 1194 | + | ||
4124 | 1195 | + GLTexture::List outline_texture; | ||
4125 | 1196 | + CompSize outline_texture_size; | ||
4126 | 1197 | + | ||
4127 | 1198 | + bool paintingDndWindow; | ||
4128 | 1199 | + | ||
4129 | 1200 | + const GlowTextureProperties *mGlowTextureProperties; | ||
4130 | 1201 | + | ||
4131 | 1202 | private: | ||
4132 | 1203 | void moveFocusViewport (int, int); | ||
4133 | 1204 | void finishWindowMovement (); | ||
4134 | 1205 | @@ -123,24 +177,45 @@ | ||
4135 | 1206 | void paintWall (const GLScreenPaintAttrib&, const GLMatrix&, | ||
4136 | 1207 | const CompRegion&, CompOutput *, unsigned int, bool); | ||
4137 | 1208 | |||
4138 | 1209 | + void paintViewport (const GLScreenPaintAttrib& attrib, | ||
4139 | 1210 | + const GLMatrix& transform, | ||
4140 | 1211 | + const CompRegion& region, | ||
4141 | 1212 | + CompOutput *output, | ||
4142 | 1213 | + unsigned int mask, | ||
4143 | 1214 | + CompPoint vpPos, | ||
4144 | 1215 | + GLVector &vpCamPos, | ||
4145 | 1216 | + bool reflection); | ||
4146 | 1217 | + | ||
4147 | 1218 | + bool windowsOnVp (compiz::expo::ClientListGenerator &clientList, | ||
4148 | 1219 | + CompPoint &p, | ||
4149 | 1220 | + const CompPoint &unprojectedCursor, | ||
4150 | 1221 | + const CompSize &screenSize, | ||
4151 | 1222 | + CompScreen *screen); | ||
4152 | 1223 | + | ||
4153 | 1224 | KeyCode leftKey; | ||
4154 | 1225 | KeyCode rightKey; | ||
4155 | 1226 | KeyCode upKey; | ||
4156 | 1227 | KeyCode downKey; | ||
4157 | 1228 | |||
4158 | 1229 | - Cursor dragCursor; | ||
4159 | 1230 | + Cursor mMoveCursor; | ||
4160 | 1231 | }; | ||
4161 | 1232 | |||
4162 | 1233 | class ExpoWindow : | ||
4163 | 1234 | + public compiz::expo::ViewportMemberWindow, | ||
4164 | 1235 | public CompositeWindowInterface, | ||
4165 | 1236 | public GLWindowInterface, | ||
4166 | 1237 | + public WindowInterface, | ||
4167 | 1238 | public PluginClassHandler<ExpoWindow, CompWindow> | ||
4168 | 1239 | { | ||
4169 | 1240 | public: | ||
4170 | 1241 | ExpoWindow (CompWindow *); | ||
4171 | 1242 | + ~ExpoWindow (); | ||
4172 | 1243 | |||
4173 | 1244 | bool damageRect (bool, const CompRect&); | ||
4174 | 1245 | |||
4175 | 1246 | + void resizeNotify (int dx, int dy, int dw, int dh); | ||
4176 | 1247 | + void moveNotify (int dx, int dy, bool immediate); | ||
4177 | 1248 | + | ||
4178 | 1249 | bool glDraw (const GLMatrix&, const GLWindowPaintAttrib&, | ||
4179 | 1250 | const CompRegion&, unsigned int); | ||
4180 | 1251 | bool glPaint (const GLWindowPaintAttrib&, const GLMatrix&, | ||
4181 | 1252 | @@ -150,11 +225,31 @@ | ||
4182 | 1253 | unsigned int, unsigned int); | ||
4183 | 1254 | void glDrawTexture (GLTexture*, const GLMatrix&, | ||
4184 | 1255 | const GLWindowPaintAttrib&, unsigned int); | ||
4185 | 1256 | + void | ||
4186 | 1257 | + paintGlow (const GLMatrix &transform, | ||
4187 | 1258 | + const GLWindowPaintAttrib &attrib, | ||
4188 | 1259 | + const CompRegion &paintRegion, | ||
4189 | 1260 | + unsigned int mask); | ||
4190 | 1261 | + | ||
4191 | 1262 | + void | ||
4192 | 1263 | + computeGlowQuads (GLTexture::Matrix *matrix); | ||
4193 | 1264 | |||
4194 | 1265 | CompWindow *window; | ||
4195 | 1266 | CompositeWindow *cWindow; | ||
4196 | 1267 | GLWindow *gWindow; | ||
4197 | 1268 | ExpoScreen *eScreen; | ||
4198 | 1269 | + | ||
4199 | 1270 | + float dndOpacity; | ||
4200 | 1271 | + | ||
4201 | 1272 | + GlowQuad *mGlowQuads; | ||
4202 | 1273 | + | ||
4203 | 1274 | + private: | ||
4204 | 1275 | + | ||
4205 | 1276 | + bool isDesktopOrDock () const; | ||
4206 | 1277 | + bool dragged () const; | ||
4207 | 1278 | + const compiz::window::Geometry & absoluteGeometry () const; | ||
4208 | 1279 | + | ||
4209 | 1280 | + mutable compiz::window::Geometry mAbsoluteGeometry; | ||
4210 | 1281 | }; | ||
4211 | 1282 | |||
4212 | 1283 | class ExpoPluginVTable : | ||
4213 | 1284 | Index: ubuntu/plugins/expo/src/glow.cpp | ||
4214 | 1285 | =================================================================== | ||
4215 | 1286 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
4216 | 1287 | +++ ubuntu/plugins/expo/src/glow.cpp 2012-09-08 11:51:33.107328243 +0800 | ||
4217 | 1288 | @@ -0,0 +1,429 @@ | ||
4218 | 1289 | +/** | ||
4219 | 1290 | + * | ||
4220 | 1291 | + * Compiz group plugin | ||
4221 | 1292 | + * | ||
4222 | 1293 | + * glow.cpp | ||
4223 | 1294 | + * | ||
4224 | 1295 | + * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen, | ||
4225 | 1296 | + * Danny Baumann, Sam Spilsbury | ||
4226 | 1297 | + * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com> | ||
4227 | 1298 | + * Roi Cohen <roico.beryl@gmail.com> | ||
4228 | 1299 | + * Danny Baumann <maniac@opencompositing.org> | ||
4229 | 1300 | + * Sam Spilsbury <smspillaz@gmail.com> | ||
4230 | 1301 | + * | ||
4231 | 1302 | + * | ||
4232 | 1303 | + * This program is free software; you can redistribute it and/or | ||
4233 | 1304 | + * modify it under the terms of the GNU General Public License | ||
4234 | 1305 | + * as published by the Free Software Foundation; either version 2 | ||
4235 | 1306 | + * of the License, or (at your option) any later version. | ||
4236 | 1307 | + * | ||
4237 | 1308 | + * This program is distributed in the hope that it will be useful, | ||
4238 | 1309 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4239 | 1310 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4240 | 1311 | + * GNU General Public License for more details. | ||
4241 | 1312 | + * | ||
4242 | 1313 | + **/ | ||
4243 | 1314 | + | ||
4244 | 1315 | +#include "expo.h" | ||
4245 | 1316 | +#include "group_glow.h" | ||
4246 | 1317 | + | ||
4247 | 1318 | +const GlowTextureProperties glowTextureProperties = { | ||
4248 | 1319 | + /* GlowTextureRectangular */ | ||
4249 | 1320 | + glowTexRect, 32, 21 | ||
4250 | 1321 | +}; | ||
4251 | 1322 | + | ||
4252 | 1323 | +/* | ||
4253 | 1324 | + * GroupWindow::paintGlow | ||
4254 | 1325 | + * | ||
4255 | 1326 | + * Takes our glow texture, stretches the appropriate positions in the glow texture, | ||
4256 | 1327 | + * adds those geometries (so plugins like wobby and deform this texture correctly) | ||
4257 | 1328 | + * and then draws the glow texture with this geometry (plugins like wobbly and friends | ||
4258 | 1329 | + * will automatically deform the texture based on our set geometry) | ||
4259 | 1330 | + */ | ||
4260 | 1331 | + | ||
4261 | 1332 | +void | ||
4262 | 1333 | +ExpoWindow::paintGlow (const GLMatrix &transform, | ||
4263 | 1334 | + const GLWindowPaintAttrib &attrib, | ||
4264 | 1335 | + const CompRegion &paintRegion, | ||
4265 | 1336 | + unsigned int mask) | ||
4266 | 1337 | +{ | ||
4267 | 1338 | + CompRegion reg; | ||
4268 | 1339 | + int i; | ||
4269 | 1340 | + GLushort colorData[4]; | ||
4270 | 1341 | + const GLushort *selColorData = ExpoScreen::get (screen)->optionGetSelectedColor (); | ||
4271 | 1342 | + float alpha = (float) selColorData[3] / 65535.0f; | ||
4272 | 1343 | + | ||
4273 | 1344 | + /* Premultiply color */ | ||
4274 | 1345 | + colorData[0] = selColorData[0] * alpha; | ||
4275 | 1346 | + colorData[1] = selColorData[1] * alpha; | ||
4276 | 1347 | + colorData[2] = selColorData[2] * alpha; | ||
4277 | 1348 | + colorData[3] = selColorData[3]; | ||
4278 | 1349 | + | ||
4279 | 1350 | + gWindow->vertexBuffer ()->begin (); | ||
4280 | 1351 | + | ||
4281 | 1352 | + /* There are 8 glow parts of the glow texture which we wish to paint | ||
4282 | 1353 | + * separately with different transformations | ||
4283 | 1354 | + */ | ||
4284 | 1355 | + for (i = 0; i < NUM_GLOWQUADS; i++) | ||
4285 | 1356 | + { | ||
4286 | 1357 | + /* Using precalculated quads here */ | ||
4287 | 1358 | + reg = CompRegion (mGlowQuads[i].mBox); | ||
4288 | 1359 | + | ||
4289 | 1360 | + if (reg.boundingRect ().x1 () < reg.boundingRect ().x2 () && | ||
4290 | 1361 | + reg.boundingRect ().y1 () < reg.boundingRect ().y2 ()) | ||
4291 | 1362 | + { | ||
4292 | 1363 | + GLTexture::MatrixList matl; | ||
4293 | 1364 | + reg = CompRegion (reg.boundingRect ().x1 (), | ||
4294 | 1365 | + reg.boundingRect ().y1 (), | ||
4295 | 1366 | + reg.boundingRect ().width (), | ||
4296 | 1367 | + reg.boundingRect ().height ()); | ||
4297 | 1368 | + | ||
4298 | 1369 | + matl.push_back (mGlowQuads[i].mMatrix); | ||
4299 | 1370 | + /* Add color data for all 6 vertices of the quad */ | ||
4300 | 1371 | + for (int n = 0; n < 6; n++) | ||
4301 | 1372 | + gWindow->vertexBuffer ()->addColors (1, colorData); | ||
4302 | 1373 | + gWindow->glAddGeometry (matl, reg, paintRegion); | ||
4303 | 1374 | + } | ||
4304 | 1375 | + } | ||
4305 | 1376 | + | ||
4306 | 1377 | + if (gWindow->vertexBuffer ()->end ()) | ||
4307 | 1378 | + { | ||
4308 | 1379 | + //GLScreen::get (screen)->setTexEnvMode (GL_MODULATE); | ||
4309 | 1380 | + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||
4310 | 1381 | + | ||
4311 | 1382 | + /* we use PAINT_WINDOW_TRANSFORMED_MASK here to force | ||
4312 | 1383 | + the usage of a good texture filter */ | ||
4313 | 1384 | + foreach (GLTexture *tex, ExpoScreen::get (screen)->outline_texture) | ||
4314 | 1385 | + { | ||
4315 | 1386 | + gWindow->glDrawTexture (tex, transform, attrib, mask | | ||
4316 | 1387 | + PAINT_WINDOW_BLEND_MASK | | ||
4317 | 1388 | + PAINT_WINDOW_TRANSLUCENT_MASK | | ||
4318 | 1389 | + PAINT_WINDOW_TRANSFORMED_MASK); | ||
4319 | 1390 | + } | ||
4320 | 1391 | + | ||
4321 | 1392 | + glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | ||
4322 | 1393 | + GLScreen::get (screen)->setTexEnvMode (GL_REPLACE); | ||
4323 | 1394 | + } | ||
4324 | 1395 | +} | ||
4325 | 1396 | + | ||
4326 | 1397 | +/* | ||
4327 | 1398 | + * ExpoWindow::computeGlowQuads | ||
4328 | 1399 | + * | ||
4329 | 1400 | + * This function computures the matrix transformation required for each | ||
4330 | 1401 | + * part of the glow texture which we wish to stretch to some rectangular | ||
4331 | 1402 | + * dimentions | ||
4332 | 1403 | + * | ||
4333 | 1404 | + * There are eight quads different parts of the texture which we wish to | ||
4334 | 1405 | + * paint here, the 4 sides and four corners, eg: | ||
4335 | 1406 | + * | ||
4336 | 1407 | + * ------------------ | ||
4337 | 1408 | + * | 1 | 4 | 6 | | ||
4338 | 1409 | + * ------------- ------------------ | ||
4339 | 1410 | + * | 1 | 4 | 6 | | | | | | ||
4340 | 1411 | + * ------------- | | | | | ||
4341 | 1412 | + * | 2 | n | 7 | -> | 2 | n | 7 | | ||
4342 | 1413 | + * ------------- | | | | | ||
4343 | 1414 | + * | 3 | 5 | 8 | | | | | | ||
4344 | 1415 | + * ------------- ------------------ | ||
4345 | 1416 | + * | 3 | 5 | 8 | | ||
4346 | 1417 | + * ------------------ | ||
4347 | 1418 | + * | ||
4348 | 1419 | + * In this example here, 2, 4, 5 and 7 are stretched, and the matrices for | ||
4349 | 1420 | + * each quad rect adjusted accordingly for it's size compared to the original | ||
4350 | 1421 | + * texture size. | ||
4351 | 1422 | + * | ||
4352 | 1423 | + * When we are adjusting the matrices here, the initial size of each corner has | ||
4353 | 1424 | + * a size of of "1.0f", so according to 2x2 matrix rules, | ||
4354 | 1425 | + * the scale factor is the inverse of the size of the glow (which explains | ||
4355 | 1426 | + * while you will see here that matrix->xx is (1 / glowSize) | ||
4356 | 1427 | + * where glowSize is the size the user specifies they want their glow to extend. | ||
4357 | 1428 | + * (likewise, matrix->yy is adjusted similarly for corners and for top/bottom) | ||
4358 | 1429 | + * | ||
4359 | 1430 | + * matrix->x0 and matrix->y0 here are set to be the top left edge of the rect | ||
4360 | 1431 | + * adjusted by the matrix scale factor (matrix->xx and matrix->yy) | ||
4361 | 1432 | + * | ||
4362 | 1433 | + */ | ||
4363 | 1434 | +void | ||
4364 | 1435 | +ExpoWindow::computeGlowQuads (GLTexture::Matrix *matrix) | ||
4365 | 1436 | +{ | ||
4366 | 1437 | + CompRect *box; | ||
4367 | 1438 | + int x1, x2, y1, y2; | ||
4368 | 1439 | + GLTexture::Matrix *quadMatrix; | ||
4369 | 1440 | + int glowSize, glowOffset; | ||
4370 | 1441 | + CompWindow *w = window; | ||
4371 | 1442 | + | ||
4372 | 1443 | + /* Passing NULL to this function frees the glow quads | ||
4373 | 1444 | + * (so the window is not painted with glow) */ | ||
4374 | 1445 | + | ||
4375 | 1446 | + if (matrix) | ||
4376 | 1447 | + { | ||
4377 | 1448 | + if (!mGlowQuads) | ||
4378 | 1449 | + mGlowQuads = new GlowQuad[NUM_GLOWQUADS]; | ||
4379 | 1450 | + if (!mGlowQuads) | ||
4380 | 1451 | + return; | ||
4381 | 1452 | + } | ||
4382 | 1453 | + else | ||
4383 | 1454 | + { | ||
4384 | 1455 | + if (mGlowQuads) | ||
4385 | 1456 | + { | ||
4386 | 1457 | + delete[] mGlowQuads; | ||
4387 | 1458 | + mGlowQuads = NULL; | ||
4388 | 1459 | + } | ||
4389 | 1460 | + return; | ||
4390 | 1461 | + } | ||
4391 | 1462 | + | ||
4392 | 1463 | + glowSize = 48; | ||
4393 | 1464 | + glowOffset = (glowSize * ExpoScreen::get (screen)->mGlowTextureProperties->glowOffset / | ||
4394 | 1465 | + ExpoScreen::get (screen)->mGlowTextureProperties->textureSize) + 1; | ||
4395 | 1466 | + | ||
4396 | 1467 | + /* Top left corner */ | ||
4397 | 1468 | + box = &mGlowQuads[GLOWQUAD_TOPLEFT].mBox; | ||
4398 | 1469 | + mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix = *matrix; | ||
4399 | 1470 | + quadMatrix = &mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix; | ||
4400 | 1471 | + | ||
4401 | 1472 | + /* Set the desired rect dimentions | ||
4402 | 1473 | + * for the part of the glow we are painting */ | ||
4403 | 1474 | + | ||
4404 | 1475 | + x1 = WIN_REAL_X (w) - glowSize + glowOffset; | ||
4405 | 1476 | + y1 = WIN_REAL_Y (w) - glowSize + glowOffset; | ||
4406 | 1477 | + | ||
4407 | 1478 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
4408 | 1479 | + * and the x and y position | ||
4409 | 1480 | + * | ||
4410 | 1481 | + * Scaling both parts of the texture in a positive direction | ||
4411 | 1482 | + * here (left to right top to bottom) | ||
4412 | 1483 | + * | ||
4413 | 1484 | + * The base position (x0 and y0) here requires us to move backwards | ||
4414 | 1485 | + * on the x and y dimentions by the calculated rect dimentions | ||
4415 | 1486 | + * multiplied by the scale factors | ||
4416 | 1487 | + */ | ||
4417 | 1488 | + | ||
4418 | 1489 | + quadMatrix->xx = 1.0f / glowSize; | ||
4419 | 1490 | + quadMatrix->yy = 1.0f / (glowSize); | ||
4420 | 1491 | + quadMatrix->x0 = -(x1 * quadMatrix->xx); | ||
4421 | 1492 | + quadMatrix->y0 = -(y1 * quadMatrix->yy); | ||
4422 | 1493 | + | ||
4423 | 1494 | + x2 = MIN (WIN_REAL_X (w) + glowOffset, | ||
4424 | 1495 | + WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2)); | ||
4425 | 1496 | + y2 = MIN (WIN_REAL_Y (w) + glowOffset, | ||
4426 | 1497 | + WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2)); | ||
4427 | 1498 | + | ||
4428 | 1499 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
4429 | 1500 | + | ||
4430 | 1501 | + /* Top right corner */ | ||
4431 | 1502 | + box = &mGlowQuads[GLOWQUAD_TOPRIGHT].mBox; | ||
4432 | 1503 | + mGlowQuads[GLOWQUAD_TOPRIGHT].mMatrix = *matrix; | ||
4433 | 1504 | + quadMatrix = &mGlowQuads[GLOWQUAD_TOPRIGHT].mMatrix; | ||
4434 | 1505 | + | ||
4435 | 1506 | + /* Set the desired rect dimentions | ||
4436 | 1507 | + * for the part of the glow we are painting */ | ||
4437 | 1508 | + | ||
4438 | 1509 | + x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset; | ||
4439 | 1510 | + y1 = WIN_REAL_Y (w) - glowSize + glowOffset; | ||
4440 | 1511 | + x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset; | ||
4441 | 1512 | + | ||
4442 | 1513 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
4443 | 1514 | + * and the x and y position | ||
4444 | 1515 | + * | ||
4445 | 1516 | + * Scaling the y part of the texture in a positive direction | ||
4446 | 1517 | + * and the x part in a negative direction here | ||
4447 | 1518 | + * (right to left top to bottom) | ||
4448 | 1519 | + * | ||
4449 | 1520 | + * The base position (x0 and y0) here requires us to move backwards | ||
4450 | 1521 | + * on the y dimention and forwards on x by the calculated rect dimentions | ||
4451 | 1522 | + * multiplied by the scale factors (since we are moving forward on x we | ||
4452 | 1523 | + * need the inverse of that which is 1 - x1 * xx | ||
4453 | 1524 | + */ | ||
4454 | 1525 | + | ||
4455 | 1526 | + quadMatrix->xx = -1.0f / glowSize; | ||
4456 | 1527 | + quadMatrix->yy = 1.0f / glowSize; | ||
4457 | 1528 | + quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx); | ||
4458 | 1529 | + quadMatrix->y0 = -(y1 * quadMatrix->yy); | ||
4459 | 1530 | + | ||
4460 | 1531 | + x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset, | ||
4461 | 1532 | + WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2)); | ||
4462 | 1533 | + y2 = MIN (WIN_REAL_Y (w) + glowOffset, | ||
4463 | 1534 | + WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2)); | ||
4464 | 1535 | + | ||
4465 | 1536 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
4466 | 1537 | + | ||
4467 | 1538 | + /* Bottom left corner */ | ||
4468 | 1539 | + box = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mBox; | ||
4469 | 1540 | + mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix = *matrix; | ||
4470 | 1541 | + quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix; | ||
4471 | 1542 | + | ||
4472 | 1543 | + x1 = WIN_REAL_X (w) - glowSize + glowOffset; | ||
4473 | 1544 | + y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset; | ||
4474 | 1545 | + x2 = WIN_REAL_X (w) + glowOffset; | ||
4475 | 1546 | + y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset; | ||
4476 | 1547 | + | ||
4477 | 1548 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
4478 | 1549 | + * and the x and y position | ||
4479 | 1550 | + * | ||
4480 | 1551 | + * Scaling the x part of the texture in a positive direction | ||
4481 | 1552 | + * and the y part in a negative direction here | ||
4482 | 1553 | + * (left to right bottom to top) | ||
4483 | 1554 | + * | ||
4484 | 1555 | + * The base position (x0 and y0) here requires us to move backwards | ||
4485 | 1556 | + * on the x dimention and forwards on y by the calculated rect dimentions | ||
4486 | 1557 | + * multiplied by the scale factors (since we are moving forward on x we | ||
4487 | 1558 | + * need the inverse of that which is 1 - y1 * yy | ||
4488 | 1559 | + */ | ||
4489 | 1560 | + | ||
4490 | 1561 | + quadMatrix->xx = 1.0f / glowSize; | ||
4491 | 1562 | + quadMatrix->yy = -1.0f / glowSize; | ||
4492 | 1563 | + quadMatrix->x0 = -(x1 * quadMatrix->xx); | ||
4493 | 1564 | + quadMatrix->y0 = 1.0f - (y1 * quadMatrix->yy); | ||
4494 | 1565 | + | ||
4495 | 1566 | + y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset, | ||
4496 | 1567 | + WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2)); | ||
4497 | 1568 | + x2 = MIN (WIN_REAL_X (w) + glowOffset, | ||
4498 | 1569 | + WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2)); | ||
4499 | 1570 | + | ||
4500 | 1571 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
4501 | 1572 | + | ||
4502 | 1573 | + /* Bottom right corner */ | ||
4503 | 1574 | + box = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mBox; | ||
4504 | 1575 | + mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix = *matrix; | ||
4505 | 1576 | + quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix; | ||
4506 | 1577 | + | ||
4507 | 1578 | + x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset; | ||
4508 | 1579 | + y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset; | ||
4509 | 1580 | + x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset; | ||
4510 | 1581 | + y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset; | ||
4511 | 1582 | + | ||
4512 | 1583 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
4513 | 1584 | + * and the x and y position | ||
4514 | 1585 | + * | ||
4515 | 1586 | + * Scaling the both parts of the texture in a negative direction | ||
4516 | 1587 | + * (right to left bottom to top) | ||
4517 | 1588 | + * | ||
4518 | 1589 | + * The base position (x0 and y0) here requires us to move forwards | ||
4519 | 1590 | + * on both dimentions by the calculated rect dimentions | ||
4520 | 1591 | + * multiplied by the scale factors | ||
4521 | 1592 | + */ | ||
4522 | 1593 | + | ||
4523 | 1594 | + quadMatrix->xx = -1.0f / glowSize; | ||
4524 | 1595 | + quadMatrix->yy = -1.0f / glowSize; | ||
4525 | 1596 | + quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx); | ||
4526 | 1597 | + quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy); | ||
4527 | 1598 | + | ||
4528 | 1599 | + x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset, | ||
4529 | 1600 | + WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2)); | ||
4530 | 1601 | + y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset, | ||
4531 | 1602 | + WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2)); | ||
4532 | 1603 | + | ||
4533 | 1604 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
4534 | 1605 | + | ||
4535 | 1606 | + /* Top edge */ | ||
4536 | 1607 | + box = &mGlowQuads[GLOWQUAD_TOP].mBox; | ||
4537 | 1608 | + mGlowQuads[GLOWQUAD_TOP].mMatrix = *matrix; | ||
4538 | 1609 | + quadMatrix = &mGlowQuads[GLOWQUAD_TOP].mMatrix; | ||
4539 | 1610 | + | ||
4540 | 1611 | + x1 = WIN_REAL_X (w) + glowOffset; | ||
4541 | 1612 | + y1 = WIN_REAL_Y (w) - glowSize + glowOffset; | ||
4542 | 1613 | + x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset; | ||
4543 | 1614 | + y2 = WIN_REAL_Y (w) + glowOffset; | ||
4544 | 1615 | + | ||
4545 | 1616 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
4546 | 1617 | + * and the x and y position | ||
4547 | 1618 | + * | ||
4548 | 1619 | + * No need to scale the x part of the texture here, but we | ||
4549 | 1620 | + * are scaling on the y part in a positive direciton | ||
4550 | 1621 | + * | ||
4551 | 1622 | + * The base position (y0) here requires us to move backwards | ||
4552 | 1623 | + * on the x dimention and forwards on y by the calculated rect dimentions | ||
4553 | 1624 | + * multiplied by the scale factors | ||
4554 | 1625 | + */ | ||
4555 | 1626 | + | ||
4556 | 1627 | + quadMatrix->xx = 0.0f; | ||
4557 | 1628 | + quadMatrix->yy = 1.0f / glowSize; | ||
4558 | 1629 | + quadMatrix->x0 = 1.0; | ||
4559 | 1630 | + quadMatrix->y0 = -(y1 * quadMatrix->yy); | ||
4560 | 1631 | + | ||
4561 | 1632 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
4562 | 1633 | + | ||
4563 | 1634 | + /* Bottom edge */ | ||
4564 | 1635 | + box = &mGlowQuads[GLOWQUAD_BOTTOM].mBox; | ||
4565 | 1636 | + mGlowQuads[GLOWQUAD_BOTTOM].mMatrix = *matrix; | ||
4566 | 1637 | + quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOM].mMatrix; | ||
4567 | 1638 | + | ||
4568 | 1639 | + x1 = WIN_REAL_X (w) + glowOffset; | ||
4569 | 1640 | + y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset; | ||
4570 | 1641 | + x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset; | ||
4571 | 1642 | + y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset; | ||
4572 | 1643 | + | ||
4573 | 1644 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
4574 | 1645 | + * and the x and y position | ||
4575 | 1646 | + * | ||
4576 | 1647 | + * No need to scale the x part of the texture here, but we | ||
4577 | 1648 | + * are scaling on the y part in a negative direciton | ||
4578 | 1649 | + * | ||
4579 | 1650 | + * The base position (y0) here requires us to move forwards | ||
4580 | 1651 | + * on y by the calculated rect dimentions | ||
4581 | 1652 | + * multiplied by the scale factors | ||
4582 | 1653 | + */ | ||
4583 | 1654 | + | ||
4584 | 1655 | + quadMatrix->xx = 0.0f; | ||
4585 | 1656 | + quadMatrix->yy = -1.0f / glowSize; | ||
4586 | 1657 | + quadMatrix->x0 = 1.0; | ||
4587 | 1658 | + quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy); | ||
4588 | 1659 | + | ||
4589 | 1660 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
4590 | 1661 | + | ||
4591 | 1662 | + /* Left edge */ | ||
4592 | 1663 | + box = &mGlowQuads[GLOWQUAD_LEFT].mBox; | ||
4593 | 1664 | + mGlowQuads[GLOWQUAD_LEFT].mMatrix = *matrix; | ||
4594 | 1665 | + quadMatrix = &mGlowQuads[GLOWQUAD_LEFT].mMatrix; | ||
4595 | 1666 | + | ||
4596 | 1667 | + x1 = WIN_REAL_X (w) - glowSize + glowOffset; | ||
4597 | 1668 | + y1 = WIN_REAL_Y (w) + glowOffset; | ||
4598 | 1669 | + x2 = WIN_REAL_X (w) + glowOffset; | ||
4599 | 1670 | + y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset; | ||
4600 | 1671 | + | ||
4601 | 1672 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
4602 | 1673 | + * and the x and y position | ||
4603 | 1674 | + * | ||
4604 | 1675 | + * No need to scale the y part of the texture here, but we | ||
4605 | 1676 | + * are scaling on the x part in a positive direciton | ||
4606 | 1677 | + * | ||
4607 | 1678 | + * The base position (x0) here requires us to move backwards | ||
4608 | 1679 | + * on x by the calculated rect dimentions | ||
4609 | 1680 | + * multiplied by the scale factors | ||
4610 | 1681 | + */ | ||
4611 | 1682 | + | ||
4612 | 1683 | + quadMatrix->xx = 1.0f / glowSize; | ||
4613 | 1684 | + quadMatrix->yy = 0.0f; | ||
4614 | 1685 | + quadMatrix->x0 = -(x1 * quadMatrix->xx); | ||
4615 | 1686 | + quadMatrix->y0 = 1.0; | ||
4616 | 1687 | + | ||
4617 | 1688 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
4618 | 1689 | + | ||
4619 | 1690 | + /* Right edge */ | ||
4620 | 1691 | + box = &mGlowQuads[GLOWQUAD_RIGHT].mBox; | ||
4621 | 1692 | + mGlowQuads[GLOWQUAD_RIGHT].mMatrix = *matrix; | ||
4622 | 1693 | + quadMatrix = &mGlowQuads[GLOWQUAD_RIGHT].mMatrix; | ||
4623 | 1694 | + | ||
4624 | 1695 | + x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset; | ||
4625 | 1696 | + y1 = WIN_REAL_Y (w) + glowOffset; | ||
4626 | 1697 | + x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset; | ||
4627 | 1698 | + y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset; | ||
4628 | 1699 | + | ||
4629 | 1700 | + /* 2x2 Matrix here, adjust both x and y scale factors | ||
4630 | 1701 | + * and the x and y position | ||
4631 | 1702 | + * | ||
4632 | 1703 | + * No need to scale the y part of the texture here, but we | ||
4633 | 1704 | + * are scaling on the x part in a negative direciton | ||
4634 | 1705 | + * | ||
4635 | 1706 | + * The base position (x0) here requires us to move forwards | ||
4636 | 1707 | + * on x by the calculated rect dimentions | ||
4637 | 1708 | + * multiplied by the scale factors | ||
4638 | 1709 | + */ | ||
4639 | 1710 | + | ||
4640 | 1711 | + quadMatrix->xx = -1.0f / glowSize; | ||
4641 | 1712 | + quadMatrix->yy = 0.0f; | ||
4642 | 1713 | + quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx); | ||
4643 | 1714 | + quadMatrix->y0 = 1.0; | ||
4644 | 1715 | + | ||
4645 | 1716 | + *box = CompRect (x1, y1, x2 - x1, y2 - y1); | ||
4646 | 1717 | +} | ||
4647 | 1718 | Index: ubuntu/plugins/expo/src/glow.h | ||
4648 | 1719 | =================================================================== | ||
4649 | 1720 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
4650 | 1721 | +++ ubuntu/plugins/expo/src/glow.h 2012-09-08 11:51:33.107328243 +0800 | ||
4651 | 1722 | @@ -0,0 +1,66 @@ | ||
4652 | 1723 | +/** | ||
4653 | 1724 | + * | ||
4654 | 1725 | + * Compiz group plugin | ||
4655 | 1726 | + * | ||
4656 | 1727 | + * glow.h | ||
4657 | 1728 | + * | ||
4658 | 1729 | + * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen, | ||
4659 | 1730 | + * Danny Baumann, Sam Spilsbury | ||
4660 | 1731 | + * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com> | ||
4661 | 1732 | + * Roi Cohen <roico.beryl@gmail.com> | ||
4662 | 1733 | + * Danny Baumann <maniac@opencompositing.org> | ||
4663 | 1734 | + * Sam Spilsbury <smspillaz@gmail.com> | ||
4664 | 1735 | + * | ||
4665 | 1736 | + * | ||
4666 | 1737 | + * This program is free software; you can redistribute it and/or | ||
4667 | 1738 | + * modify it under the terms of the GNU General Public License | ||
4668 | 1739 | + * as published by the Free Software Foundation; either version 2 | ||
4669 | 1740 | + * of the License, or (at your option) any later version. | ||
4670 | 1741 | + * | ||
4671 | 1742 | + * This program is distributed in the hope that it will be useful, | ||
4672 | 1743 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4673 | 1744 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4674 | 1745 | + * GNU General Public License for more details. | ||
4675 | 1746 | + * | ||
4676 | 1747 | + **/ | ||
4677 | 1748 | + | ||
4678 | 1749 | +#ifndef _EXPO_GLOW_H | ||
4679 | 1750 | +#define _EXPO_GLOW_H | ||
4680 | 1751 | + | ||
4681 | 1752 | +#define GLOWQUAD_TOPLEFT 0 | ||
4682 | 1753 | +#define GLOWQUAD_TOPRIGHT 1 | ||
4683 | 1754 | +#define GLOWQUAD_BOTTOMLEFT 2 | ||
4684 | 1755 | +#define GLOWQUAD_BOTTOMRIGHT 3 | ||
4685 | 1756 | +#define GLOWQUAD_TOP 4 | ||
4686 | 1757 | +#define GLOWQUAD_BOTTOM 5 | ||
4687 | 1758 | +#define GLOWQUAD_LEFT 6 | ||
4688 | 1759 | +#define GLOWQUAD_RIGHT 7 | ||
4689 | 1760 | +#define NUM_GLOWQUADS 8 | ||
4690 | 1761 | + | ||
4691 | 1762 | +/* Represents a particular glow texture, so here | ||
4692 | 1763 | + * we have hardcoded in the texture data, the offset | ||
4693 | 1764 | + * and the size of the texture | ||
4694 | 1765 | + */ | ||
4695 | 1766 | + | ||
4696 | 1767 | +typedef struct _GlowTextureProperties { | ||
4697 | 1768 | + char *textureData; | ||
4698 | 1769 | + int textureSize; | ||
4699 | 1770 | + int glowOffset; | ||
4700 | 1771 | +} GlowTextureProperties; | ||
4701 | 1772 | + | ||
4702 | 1773 | +/* Each glow quad contains a 2x2 scale + positional matrix | ||
4703 | 1774 | + * (the 3rd column is not used since that is for matrix skew | ||
4704 | 1775 | + * operations which we do not care about) | ||
4705 | 1776 | + * and also a CompRect which describes the size and position of | ||
4706 | 1777 | + * the quad on the glow | ||
4707 | 1778 | + */ | ||
4708 | 1779 | + | ||
4709 | 1780 | +class GlowQuad { | ||
4710 | 1781 | + public: | ||
4711 | 1782 | + CompRect mBox; | ||
4712 | 1783 | + GLTexture::Matrix mMatrix; | ||
4713 | 1784 | +}; | ||
4714 | 1785 | + | ||
4715 | 1786 | +extern const GlowTextureProperties glowTextureProperties; | ||
4716 | 1787 | + | ||
4717 | 1788 | +#endif | ||
4718 | 1789 | Index: ubuntu/plugins/expo/src/group_glow.h | ||
4719 | 1790 | =================================================================== | ||
4720 | 1791 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
4721 | 1792 | +++ ubuntu/plugins/expo/src/group_glow.h 2012-09-08 11:51:33.107328243 +0800 | ||
4722 | 1793 | @@ -0,0 +1,197 @@ | ||
4723 | 1794 | +#ifndef _GROUP_GLOWTEX_H | ||
4724 | 1795 | +#define _GROUP_GLOWTEX_H | ||
4725 | 1796 | + | ||
4726 | 1797 | +/** | ||
4727 | 1798 | + * | ||
4728 | 1799 | + * Compiz group plugin | ||
4729 | 1800 | + * | ||
4730 | 1801 | + * group_glow.h | ||
4731 | 1802 | + * | ||
4732 | 1803 | + * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen, | ||
4733 | 1804 | + * Danny Baumann, Sam Spilsbury | ||
4734 | 1805 | + * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com> | ||
4735 | 1806 | + * Roi Cohen <roico.beryl@gmail.com> | ||
4736 | 1807 | + * Danny Baumann <maniac@opencompositing.org> | ||
4737 | 1808 | + * Sam Spilsbury <smspillaz@gmail.com> | ||
4738 | 1809 | + * | ||
4739 | 1810 | + * | ||
4740 | 1811 | + * This program is free software; you can redistribute it and/or | ||
4741 | 1812 | + * modify it under the terms of the GNU General Public License | ||
4742 | 1813 | + * as published by the Free Software Foundation; either version 2 | ||
4743 | 1814 | + * of the License, or (at your option) any later version. | ||
4744 | 1815 | + * | ||
4745 | 1816 | + * This program is distributed in the hope that it will be useful, | ||
4746 | 1817 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4747 | 1818 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4748 | 1819 | + * GNU General Public License for more details. | ||
4749 | 1820 | + * | ||
4750 | 1821 | + **/ | ||
4751 | 1822 | + | ||
4752 | 1823 | +/* | ||
4753 | 1824 | + * glowTex | ||
4754 | 1825 | + */ | ||
4755 | 1826 | + | ||
4756 | 1827 | +static char glowTexRect[4097] = { | ||
4757 | 1828 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4758 | 1829 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4759 | 1830 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377" | ||
4760 | 1831 | + "\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377" | ||
4761 | 1832 | + "\377\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4762 | 1833 | + "\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\6\377\377" | ||
4763 | 1834 | + "\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377" | ||
4764 | 1835 | + "\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6" | ||
4765 | 1836 | + "\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377" | ||
4766 | 1837 | + "\14\377\377\377\14\377\377\377\14\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4767 | 1838 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\14" | ||
4768 | 1839 | + "\377\377\377\14\377\377\377\22\377\377\377\22\377\377\377\22\377\377\377" | ||
4769 | 1840 | + "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377" | ||
4770 | 1841 | + "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377" | ||
4771 | 1842 | + "\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377" | ||
4772 | 1843 | + "\35\377\377\377\35\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377" | ||
4773 | 1844 | + "\377\6\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377\27\377\377" | ||
4774 | 1845 | + "\377\27\377\377\377\35\377\377\377#\377\377\377'\377\377\377'\377\377\377" | ||
4775 | 1846 | + "+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377" | ||
4776 | 1847 | + "\377+\377\377\377+\377\377\377+\377\377\3771\377\377\3771\377\377\3771\377" | ||
4777 | 1848 | + "\377\3771\377\377\3771\377\377\3771\377\377\3771\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4778 | 1849 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377" | ||
4779 | 1850 | + "\27\377\377\377\35\377\377\377#\377\377\377+\377\377\3771\377\377\3776\377" | ||
4780 | 1851 | + "\377\377<\377\377\377>\377\377\377C\377\377\377I\377\377\377I\377\377\377" | ||
4781 | 1852 | + "I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377" | ||
4782 | 1853 | + "\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377" | ||
4783 | 1854 | + "\377\377L\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377" | ||
4784 | 1855 | + "\377\377\22\377\377\377\27\377\377\377#\377\377\377+\377\377\3776\377\377" | ||
4785 | 1856 | + "\377C\377\377\377L\377\377\377U\377\377\377]\377\377\377`\377\377\377d\377" | ||
4786 | 1857 | + "\377\377h\377\377\377k\377\377\377k\377\377\377k\377\377\377k\377\377\377" | ||
4787 | 1858 | + "k\377\377\377k\377\377\377k\377\377\377p\377\377\377p\377\377\377p\377\377" | ||
4788 | 1859 | + "\377p\377\377\377p\377\377\377p\377\377\377p\0\0\0\0\0\0\0\0\0\0\0\0\377" | ||
4789 | 1860 | + "\377\377\6\377\377\377\14\377\377\377\22\314\314\314\35\377\377\377'\377" | ||
4790 | 1861 | + "\377\3771\377\377\377>\357\357\357P\377\377\377]\363\363\363k\365\365\365" | ||
4791 | 1862 | + "v\365\365\365|\377\377\377\202\367\367\367\210\367\367\367\214\367\367\367" | ||
4792 | 1863 | + "\216\367\367\367\221\367\367\367\221\367\367\367\221\367\367\367\221\367" | ||
4793 | 1864 | + "\367\367\221\367\367\367\221\367\367\367\224\367\367\367\224\367\367\367" | ||
4794 | 1865 | + "\224\367\367\367\224\367\367\367\224\367\367\367\224\367\367\367\224\0\0" | ||
4795 | 1866 | + "\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\27\377" | ||
4796 | 1867 | + "\377\377'\377\377\3776\377\377\377I\377\377\377Y\377\377\377k\376\376\376" | ||
4797 | 1868 | + "y\377\377\377\210\377\377\377\224\377\377\377\235\377\377\377\245\377\377" | ||
4798 | 1869 | + "\377\253\377\377\377\255\377\377\377\262\377\377\377\262\377\377\377\263" | ||
4799 | 1870 | + "\377\377\377\263\377\377\377\263\377\377\377\263\377\377\377\263\377\377" | ||
4800 | 1871 | + "\377\266\377\377\377\266\377\377\377\266\377\377\377\266\377\377\377\266" | ||
4801 | 1872 | + "\377\377\377\266\377\377\377\266\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377" | ||
4802 | 1873 | + "\14\377\377\377\27\377\377\377#\377\377\3771\377\377\377I\377\377\377]\377" | ||
4803 | 1874 | + "\377\377r\377\377\377\205\377\377\377\231\377\377\377\247\377\377\377\263" | ||
4804 | 1875 | + "\377\377\377\275\377\377\377\304\377\377\377\310\377\377\377\313\377\377" | ||
4805 | 1876 | + "\377\316\377\377\377\320\377\377\377\320\377\377\377\320\377\377\377\320" | ||
4806 | 1877 | + "\377\377\377\320\377\377\377\320\377\377\377\322\377\377\377\322\377\377" | ||
4807 | 1878 | + "\377\322\377\377\377\322\377\377\377\322\377\377\377\322\377\377\377\322" | ||
4808 | 1879 | + "\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\35\377\377" | ||
4809 | 1880 | + "\377+\377\377\377>\377\377\377Y\377\377\377r\377\377\377\210\376\376\376" | ||
4810 | 1881 | + "\237\377\377\377\262\377\377\377\302\377\377\377\313\377\377\377\324\377" | ||
4811 | 1882 | + "\377\377\332\376\376\376\336\377\377\377\341\377\377\377\342\377\377\377" | ||
4812 | 1883 | + "\344\377\377\377\344\377\377\377\344\377\377\377\344\377\377\377\344\377" | ||
4813 | 1884 | + "\377\377\344\377\377\377\345\377\377\377\345\377\377\377\345\377\377\377" | ||
4814 | 1885 | + "\345\377\377\377\345\377\377\377\345\377\377\377\345\0\0\0\0\377\377\377" | ||
4815 | 1886 | + "\6\377\377\377\14\377\377\377\27\377\377\377#\377\377\3776\377\377\377P\377" | ||
4816 | 1887 | + "\377\377k\377\377\377\205\376\376\376\237\372\372\372\266\377\377\377\307" | ||
4817 | 1888 | + "\373\373\373\325\373\373\373\337\374\374\374\345\374\374\374\352\374\374" | ||
4818 | 1889 | + "\374\355\374\374\374\357\374\374\374\360\374\374\374\361\374\374\374\361" | ||
4819 | 1890 | + "\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374" | ||
4820 | 1891 | + "\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362" | ||
4821 | 1892 | + "\374\374\374\362\374\374\374\362\0\0\0\0\377\377\377\6\377\377\377\14\377" | ||
4822 | 1893 | + "\377\377\35\377\377\377+\377\377\377C\377\377\377]\377\377\377|\377\377\377" | ||
4823 | 1894 | + "\231\377\377\377\263\377\377\377\307\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4824 | 1895 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4825 | 1896 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377" | ||
4826 | 1897 | + "\377\377\6\377\377\377\22\324\324\324#\377\377\3771\377\377\377L\363\363" | ||
4827 | 1898 | + "\363k\377\377\377\210\377\377\377\247\377\377\377\302\377\377\377\325\0\0" | ||
4828 | 1899 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4829 | 1900 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4830 | 1901 | + "\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\22\377\377" | ||
4831 | 1902 | + "\377#\377\377\377<\377\377\377U\377\377\377v\377\377\377\226\377\377\377" | ||
4832 | 1903 | + "\263\377\377\377\315\377\377\377\337\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4833 | 1904 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4834 | 1905 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377" | ||
4835 | 1906 | + "\6\377\377\377\14\377\377\377\27\377\377\377'\377\377\377>\377\377\377]\377" | ||
4836 | 1907 | + "\377\377|\370\370\370\237\377\377\377\275\373\373\373\325\377\377\377\345" | ||
4837 | 1908 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4838 | 1909 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4839 | 1910 | + "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\27\377" | ||
4840 | 1911 | + "\377\377+\377\377\377C\377\377\377`\377\377\377\202\377\377\377\247\377\377" | ||
4841 | 1912 | + "\377\304\377\377\377\332\377\377\377\352\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4842 | 1913 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4843 | 1914 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377" | ||
4844 | 1915 | + "\377\6\377\377\377\14\377\377\377\27\377\377\377+\377\377\377C\377\377\377" | ||
4845 | 1916 | + "d\377\377\377\210\377\377\377\253\377\377\377\310\376\376\376\336\374\374" | ||
4846 | 1917 | + "\374\355\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4847 | 1918 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4848 | 1919 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377" | ||
4849 | 1920 | + "\35\377\377\377+\377\377\377I\377\377\377h\377\377\377\214\377\377\377\260" | ||
4850 | 1921 | + "\377\377\377\313\374\374\374\342\374\374\374\357\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4851 | 1922 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4852 | 1923 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4853 | 1924 | + "\377\377\377\6\377\377\377\14\377\377\377\35\342\342\3421\377\377\377I\377" | ||
4854 | 1925 | + "\377\377k\377\377\377\216\377\377\377\262\377\377\377\316\374\374\374\344" | ||
4855 | 1926 | + "\377\377\377\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4856 | 1927 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4857 | 1928 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377" | ||
4858 | 1929 | + "\377\377\35\377\377\3771\377\377\377L\377\377\377k\377\377\377\221\377\377" | ||
4859 | 1930 | + "\377\263\377\377\377\320\377\377\377\344\377\377\377\361\0\0\0\0\0\0\0\0" | ||
4860 | 1931 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4861 | 1932 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4862 | 1933 | + "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377" | ||
4863 | 1934 | + "\377L\377\377\377k\377\377\377\221\377\377\377\263\377\377\377\320\377\377" | ||
4864 | 1935 | + "\377\344\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4865 | 1936 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4866 | 1937 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377" | ||
4867 | 1938 | + "\14\377\377\377\35\377\377\3771\377\377\377L\364\364\364p\377\377\377\221" | ||
4868 | 1939 | + "\372\372\372\266\377\377\377\320\374\374\374\345\377\377\377\362\0\0\0\0" | ||
4869 | 1940 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4870 | 1941 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4871 | 1942 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377" | ||
4872 | 1943 | + "1\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373\373\322" | ||
4873 | 1944 | + "\377\377\377\345\377\377\377\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4874 | 1945 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4875 | 1946 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377" | ||
4876 | 1947 | + "\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\377\377" | ||
4877 | 1948 | + "\377\221\377\377\377\266\373\373\373\322\377\377\377\345\377\377\377\362" | ||
4878 | 1949 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4879 | 1950 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4880 | 1951 | + "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377" | ||
4881 | 1952 | + "\377\3771\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373" | ||
4882 | 1953 | + "\373\322\377\377\377\345\377\377\377\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4883 | 1954 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4884 | 1955 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377" | ||
4885 | 1956 | + "\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377" | ||
4886 | 1957 | + "p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345\374\374" | ||
4887 | 1958 | + "\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4888 | 1959 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4889 | 1960 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377" | ||
4890 | 1961 | + "\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266" | ||
4891 | 1962 | + "\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4892 | 1963 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4893 | 1964 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4894 | 1965 | + "\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377" | ||
4895 | 1966 | + "\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345" | ||
4896 | 1967 | + "\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4897 | 1968 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4898 | 1969 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377" | ||
4899 | 1970 | + "\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377" | ||
4900 | 1971 | + "\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0" | ||
4901 | 1972 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4902 | 1973 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4903 | 1974 | + "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377" | ||
4904 | 1975 | + "\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377" | ||
4905 | 1976 | + "\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4906 | 1977 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4907 | 1978 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377" | ||
4908 | 1979 | + "\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224" | ||
4909 | 1980 | + "\377\377\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0" | ||
4910 | 1981 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4911 | 1982 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4912 | 1983 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377" | ||
4913 | 1984 | + "1\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322" | ||
4914 | 1985 | + "\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4915 | 1986 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
4916 | 1987 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", | ||
4917 | 1988 | +}; | ||
4918 | 1989 | + | ||
4919 | 1990 | +#endif | ||
4920 | 1991 | Index: ubuntu/plugins/expo/src/wall_offset/CMakeLists.txt | ||
4921 | 1992 | =================================================================== | ||
4922 | 1993 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
4923 | 1994 | +++ ubuntu/plugins/expo/src/wall_offset/CMakeLists.txt 2012-09-08 14:56:23.698323512 +0800 | ||
4924 | 1995 | @@ -0,0 +1,33 @@ | ||
4925 | 1996 | +include_directories ( | ||
4926 | 1997 | + ${CMAKE_CURRENT_SOURCE_DIR}/include | ||
4927 | 1998 | + ${CMAKE_CURRENT_SOURCE_DIR}/src | ||
4928 | 1999 | + ${Boost_INCLUDE_DIRS} | ||
4929 | 2000 | + ${GLIBMM_INCLUDE_DIRS} | ||
4930 | 2001 | +) | ||
4931 | 2002 | + | ||
4932 | 2003 | +link_directories (${GLIBMM_LIBRARY_DIRS} ${COMPIZ_LIBRARY_DIRS}) | ||
4933 | 2004 | + | ||
4934 | 2005 | +set ( | ||
4935 | 2006 | + PRIVATE_HEADERS | ||
4936 | 2007 | + ${CMAKE_CURRENT_SOURCE_DIR}/include/wall-offset.h | ||
4937 | 2008 | +) | ||
4938 | 2009 | + | ||
4939 | 2010 | +set ( | ||
4940 | 2011 | + SRCS | ||
4941 | 2012 | + ${CMAKE_CURRENT_SOURCE_DIR}/src/wall-offset.cpp | ||
4942 | 2013 | +) | ||
4943 | 2014 | + | ||
4944 | 2015 | +add_library ( | ||
4945 | 2016 | + compiz_expo_wall_offset STATIC | ||
4946 | 2017 | + ${SRCS} | ||
4947 | 2018 | + ${PRIVATE_HEADERS} | ||
4948 | 2019 | +) | ||
4949 | 2020 | + | ||
4950 | 2021 | +if (COMPIZ_BUILD_TESTING) | ||
4951 | 2022 | + add_subdirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/tests ) | ||
4952 | 2023 | +endif (COMPIZ_BUILD_TESTING) | ||
4953 | 2024 | + | ||
4954 | 2025 | +target_link_libraries ( | ||
4955 | 2026 | + compiz_expo_wall_offset | ||
4956 | 2027 | + compiz_core | ||
4957 | 2028 | +) | ||
4958 | 2029 | Index: ubuntu/plugins/expo/src/wall_offset/include/wall-offset.h | ||
4959 | 2030 | =================================================================== | ||
4960 | 2031 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
4961 | 2032 | +++ ubuntu/plugins/expo/src/wall_offset/include/wall-offset.h 2012-09-08 11:51:33.107328243 +0800 | ||
4962 | 2033 | @@ -0,0 +1,43 @@ | ||
4963 | 2034 | +/** | ||
4964 | 2035 | + * Copyright © 2012 Canonical Ltd. | ||
4965 | 2036 | + * | ||
4966 | 2037 | + * Authors: | ||
4967 | 2038 | + * Sam Spilsbury <sam.spilsbury@canonical.com> | ||
4968 | 2039 | + * | ||
4969 | 2040 | + * This program is free software; you can redistribute it and/or | ||
4970 | 2041 | + * modify it under the terms of the GNU General Public License | ||
4971 | 2042 | + * as published by the Free Software Foundation; either version 2 | ||
4972 | 2043 | + * of the License, or (at your option) any later version. | ||
4973 | 2044 | + * | ||
4974 | 2045 | + * This program is distributed in the hope that it will be useful, | ||
4975 | 2046 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4976 | 2047 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4977 | 2048 | + * GNU General Public License for more details. | ||
4978 | 2049 | + * | ||
4979 | 2050 | + **/ | ||
4980 | 2051 | + | ||
4981 | 2052 | +#ifndef _COMPIZ_EXPO_WALL_OFFSET_H | ||
4982 | 2053 | +#define _COMPIZ_EXPO_WALL_OFFSET_H | ||
4983 | 2054 | + | ||
4984 | 2055 | +#include <core/point.h> | ||
4985 | 2056 | +#include <core/size.h> | ||
4986 | 2057 | +#include <core/rect.h> | ||
4987 | 2058 | + | ||
4988 | 2059 | +namespace compiz | ||
4989 | 2060 | +{ | ||
4990 | 2061 | + namespace expo | ||
4991 | 2062 | + { | ||
4992 | 2063 | + void | ||
4993 | 2064 | + calculateWallOffset (const CompRect &output, | ||
4994 | 2065 | + const CompPoint &offsetInScreenCoords, | ||
4995 | 2066 | + const CompPoint &vpSize, | ||
4996 | 2067 | + const CompSize &screenSize, | ||
4997 | 2068 | + float &offsetInWorldX, | ||
4998 | 2069 | + float &offsetInWorldY, | ||
4999 | 2070 | + float &worldScaleFactorX, | ||
5000 | 2071 | + float &worldScaleFactorY, |
The diff has been truncated for viewing.
But still pending on FFe at LP: #1047067