Merge lp:~timo-jyrinki/ubuntu/quantal/compiz/fix_expo into lp:ubuntu/quantal/compiz

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
Reviewer Review Type Date Requested Status
Timo Jyrinki Needs Information
Ubuntu branches Pending
Review via email: mp+124114@code.launchpad.net

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 :

But still pending on FFe at LP: #1047067

review: Needs Information
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
=== modified file 'debian/changelog'
--- debian/changelog 2012-09-12 12:59:32 +0000
+++ debian/changelog 2012-09-13 07:34:23 +0000
@@ -64,8 +64,6 @@
64 * Drop dependency on libgconf2-dev, add gconf2 dependency to the 64 * Drop dependency on libgconf2-dev, add gconf2 dependency to the
65 transitional package for migrations65 transitional package for migrations
66 * Add -DUSE_GCONF=OFF to debian/rules66 * Add -DUSE_GCONF=OFF to debian/rules
67 * debian/patches/100_expo_layout.patch
68 - Disable temporarily until it really works
69 * debian/libdecoration0.symbols67 * debian/libdecoration0.symbols
70 - Add decor_shadow_options_cmp68 - Add decor_shadow_options_cmp
7169
7270
=== added file 'debian/patches/100_expo_layout.patch'
--- debian/patches/100_expo_layout.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/100_expo_layout.patch 2012-09-13 07:34:23 +0000
@@ -0,0 +1,2907 @@
1Index: ubuntu/plugins/expo/expo.xml.in
2===================================================================
3--- ubuntu.orig/plugins/expo/expo.xml.in 2012-09-12 22:20:42.944758828 +0800
4+++ ubuntu/plugins/expo/expo.xml.in 2012-09-12 22:20:43.240760303 +0800
5@@ -17,6 +17,7 @@
6 <plugin>wobbly</plugin>
7 <plugin>animation</plugin>
8 <plugin>wallpaper</plugin>
9+ <plugin>imgpng</plugin>
10 </relation>
11 </deps>
12 <options>
13@@ -25,7 +26,7 @@
14 <option name="expo_key" type="key">
15 <_short>Expo key</_short>
16 <_long>Engage wall expo mode key binding</_long>
17- <default>&lt;Super&gt;e</default>
18+ <default>&lt;Super&gt;s</default>
19 </option>
20 <option name="expo_button" type="button">
21 <_short>Expo button</_short>
22@@ -35,8 +36,6 @@
23 <option name="expo_edge" type="edge">
24 <_short>Expo edge</_short>
25 <_long>Engage wall expo mode edge binding</_long>
26- <default>
27- </default>
28 </option>
29 <option name="double_click_time" type="int">
30 <_short>Double click time</_short>
31@@ -79,7 +78,7 @@
32 <option name="zoom_time" type="float">
33 <_short>Zoom time</_short>
34 <_long>Duration of the zoomout animation</_long>
35- <default>0.5</default>
36+ <default>0.3</default>
37 <min>0.1</min>
38 <max>5.0</max>
39 <precision>0.1</precision>
40@@ -130,10 +129,24 @@
41 <_name>Curve</_name>
42 </desc>
43 </option>
44+ <option name="x_offset" type="int">
45+ <_short>X Space</_short>
46+ <_long> Left Side screen space of expo in pixels</_long>
47+ <min>-1680</min>
48+ <max>1680</max>
49+ <default>64</default>
50+ </option>
51+ <option name="y_offset" type="int">
52+ <_short>Y Space</_short>
53+ <_long> Top Side screen space of expo in pixels</_long>
54+ <min>-100</min>
55+ <max>100</max>
56+ <default>24</default>
57+ </option>
58 <option name="distance" type="float">
59 <_short>Distance</_short>
60 <_long>Distance of the expo wall</_long>
61- <default>0.0</default>
62+ <default>0.005</default>
63 <min>0.0</min>
64 <max>1.0</max>
65 <precision>0.01</precision>
66@@ -141,7 +154,7 @@
67 <option name="vp_distance" type="float">
68 <_short>Viewport distance</_short>
69 <_long>Distance between viewports</_long>
70- <default>0.10</default>
71+ <default>0.2</default>
72 <min>0.0</min>
73 <max>1.0</max>
74 <precision>0.01</precision>
75@@ -192,7 +205,7 @@
76 <option name="vp_brightness" type="float">
77 <_short>Brightness</_short>
78 <_long>Inactive viewport brightness.</_long>
79- <default>75.0</default>
80+ <default>40.0</default>
81 <min>0.0</min>
82 <max>100.0</max>
83 <precision>0.1</precision>
84@@ -200,18 +213,28 @@
85 <option name="vp_saturation" type="float">
86 <_short>Saturation</_short>
87 <_long>Inactive viewport saturation.</_long>
88- <default>100.0</default>
89+ <default>40.0</default>
90 <min>0.0</min>
91 <max>100.0</max>
92 <precision>0.1</precision>
93 </option>
94+ <option name="selected_color" type="color">
95+ <_short>Selected Color</_short>
96+ <_long>Color to use when highlighting the selected viewport</_long>
97+ <default>
98+ <red>0xfbfb</red>
99+ <green>0x8b8b</green>
100+ <blue>0x0</blue>
101+ <alpha>0xffff</alpha>
102+ </default>
103+ </option>
104 </subgroup>
105 <subgroup>
106 <short>Reflection</short>
107 <option name="reflection" type="bool">
108 <_short>Reflection</_short>
109 <_long>Show a reflection of the viewports on the ground</_long>
110- <default>true</default>
111+ <default>false</default>
112 </option>
113 <option name="ground_color1" type="color">
114 <_short>Ground color(near)</_short>
115@@ -244,7 +267,7 @@
116 <option name="scale_factor" type="float">
117 <_short>Reflection Scale</_short>
118 <_long>Scale factor of the expo wall reflection</_long>
119- <default>0.75</default>
120+ <default>1.0</default>
121 <min>0.0</min>
122 <max>2.0</max>
123 <precision>0.01</precision>
124Index: ubuntu/plugins/expo/src/expo.cpp
125===================================================================
126--- ubuntu.orig/plugins/expo/src/expo.cpp 2012-09-12 22:09:32.323735000 +0800
127+++ ubuntu/plugins/expo/src/expo.cpp 2012-09-12 22:29:50.643474721 +0800
128@@ -27,6 +27,8 @@
129
130 #include "expo.h"
131 #include "click-threshold.h"
132+#include "wall-offset.h"
133+#include "windows-on-viewport.h"
134 #include <math.h>
135 #ifndef USE_GLES
136 #include <GL/glu.h>
137@@ -73,11 +75,10 @@
138
139 if (dndState == DnDDuring || dndState == DnDStart)
140 {
141- if (dndWindow)
142+ if (dndWindows.size ())
143 finishWindowMovement ();
144
145 dndState = DnDNone;
146- dndWindow = NULL;
147
148 action->setState (action->state () & CompAction::StateInitButton);
149 cScreen->damageScreen ();
150@@ -113,7 +114,6 @@
151 clickTime = 0;
152
153 dndState = DnDNone;
154- dndWindow = NULL;
155
156 selectedVp = screen->vp ();
157 lastSelectedVp = screen->vp ();
158@@ -156,8 +156,8 @@
159 else
160 vpUpdateMode = VPUpdateMouseOver;
161
162- dndState = DnDNone;
163- dndWindow = NULL;
164+ dndState = DnDNone;
165+ dndWindows.clear ();
166
167 screen->removeAction (&optionGetDndButton ());
168 screen->removeAction (&optionGetExitButton ());
169@@ -202,6 +202,8 @@
170 if (!expoMode)
171 return false;
172
173+ lastSelectedVp = selectedVp;
174+
175 newX = selectedVp.x () + 1;
176 newY = selectedVp.y ();
177
178@@ -225,7 +227,7 @@
179 CompAction::State state,
180 CompOption::Vector& options)
181 {
182- int newX, newY;
183+ unsigned int newX, newY;
184 Window xid = CompOption::getIntOptionNamed (options, "root", 0);
185 if (xid != screen->root ())
186 return false;
187@@ -272,53 +274,39 @@
188 void
189 ExpoScreen::finishWindowMovement ()
190 {
191- dndWindow->syncPosition ();
192- dndWindow->ungrabNotify ();
193-
194- screen->moveViewport (screen->vp ().x () - selectedVp.x (),
195- screen->vp ().y () - selectedVp.y (), true);
196-
197- /* update saved window attributes in case we moved the
198- window to a new viewport */
199- if (dndWindow->saveMask () & CWX)
200- {
201- dndWindow->saveWc ().x = dndWindow->saveWc ().x % screen->width ();
202- if (dndWindow->saveWc ().x < 0)
203- dndWindow->saveWc ().x += screen->width ();
204- }
205- if (dndWindow->saveMask () & CWY)
206+ foreach (CompWindow *dndWindow, dndWindows)
207 {
208- dndWindow->saveWc ().y = dndWindow->saveWc ().y % screen->height ();
209- if (dndWindow->saveWc ().y < 0)
210- dndWindow->saveWc ().y += screen->height ();
211- }
212-
213- /* update window attibutes to make sure a moved maximized window
214- is properly snapped to the work area */
215- if (dndWindow->state () & MAXIMIZE_STATE)
216- dndWindow->updateAttributes (CompStackingUpdateModeNone);
217-
218-#if 0 /* FIXME: obsolete in the meantime? */
219- {
220- int lastOutput;
221- int centerX, centerY;
222+ if (dndWindow->grabbed ())
223+ {
224+ dndWindow->syncPosition ();
225+ dndWindow->ungrabNotify ();
226
227- /* make sure we snap to the correct output */
228- lastOutput = s->currentOutputDev;
229- centerX = (WIN_X (w) + WIN_W (w) / 2) % s->width;
230- if (centerX < 0)
231- centerX += s->width;
232- centerY = (WIN_Y (w) + WIN_H (w) / 2) % s->height;
233- if (centerY < 0)
234- centerY += s->height;
235+ screen->updateGrab (grabIndex, None);
236
237- s->currentOutputDev = outputDeviceForPoint (s, centerX, centerY);
238+ screen->moveViewport (screen->vp ().x () - selectedVp.x (),
239+ screen->vp ().y () - selectedVp.y (), true);
240
241- updateWindowAttributes (w, CompStackingUpdateModeNone);
242+ /* update saved window attributes in case we moved the
243+ window to a new viewport */
244+ if (dndWindow->saveMask () & CWX)
245+ {
246+ dndWindow->saveWc ().x = dndWindow->saveWc ().x % screen->width ();
247+ if (dndWindow->saveWc ().x < 0)
248+ dndWindow->saveWc ().x += screen->width ();
249+ }
250+ if (dndWindow->saveMask () & CWY)
251+ {
252+ dndWindow->saveWc ().y = dndWindow->saveWc ().y % screen->height ();
253+ if (dndWindow->saveWc ().y < 0)
254+ dndWindow->saveWc ().y += screen->height ();
255+ }
256
257- s->currentOutputDev = lastOutput;
258+ /* update window attibutes to make sure a moved maximized window
259+ is properly snapped to the work area */
260+ if (dndWindow->state () & MAXIMIZE_STATE)
261+ dndWindow->updateAttributes (CompStackingUpdateModeNone);
262+ }
263 }
264-#endif
265 }
266
267 void
268@@ -402,6 +390,80 @@
269 screen->handleEvent (event);
270 }
271
272+bool
273+ExpoWindow::dragged () const
274+{
275+ ExpoScreen *es = ExpoScreen::get (screen);
276+
277+ return std::find (es->dndWindows.begin (), es->dndWindows.end (), window) != es->dndWindows.end ();
278+}
279+
280+const compiz::window::Geometry &
281+ExpoWindow::absoluteGeometry () const
282+{
283+ const compiz::window::Geometry &relativeGeometry (window->geometry ());
284+ mAbsoluteGeometry.set ((screen->vp ().x () * screen->width ()) + relativeGeometry.x (),
285+ (screen->vp ().y () * screen->height ()) + relativeGeometry.y (),
286+ relativeGeometry.width (),
287+ relativeGeometry.height (),
288+ relativeGeometry.border ());
289+
290+ return mAbsoluteGeometry;
291+}
292+
293+bool
294+ExpoWindow::isDesktopOrDock () const
295+{
296+ return window->type () == CompWindowTypeDesktopMask ||
297+ window->type () == CompWindowTypeDockMask;
298+}
299+
300+namespace cei = compiz::expo::impl;
301+
302+cei::CompizClientListGenerator::CompizClientListGenerator (CompScreen *screen) :
303+ mScreen (screen),
304+ mClientList (&mScreen->clientList (true)),
305+ mClientListIterator (mClientList->begin ())
306+{
307+}
308+
309+compiz::expo::ViewportMemberWindow *
310+cei::CompizClientListGenerator::nextClient ()
311+{
312+ if (mClientListIterator == mClientList->end ())
313+ return NULL;
314+
315+ compiz::expo::ViewportMemberWindow *vpMemberWindow = ExpoWindow::get (*mClientListIterator);
316+
317+ ++mClientListIterator;
318+
319+ return vpMemberWindow;
320+}
321+
322+bool
323+ExpoScreen::windowsOnVp (compiz::expo::ClientListGenerator &clientList,
324+ CompPoint &p,
325+ const CompPoint &unprojectedCursor,
326+ const CompSize &screenSize,
327+ CompScreen *screen)
328+{
329+ return false;
330+}
331+
332+namespace
333+{
334+ void fillInNewViewportActivityData (unsigned int vpCount,
335+ std::vector <float> &vpActivity)
336+ {
337+ if (vpActivity.size () < vpCount)
338+ {
339+ vpActivity.resize (vpCount);
340+ foreach (float& activity, vpActivity)
341+ activity = 1.0f;
342+ }
343+ }
344+}
345+
346 void
347 ExpoScreen::preparePaint (int msSinceLastPaint)
348 {
349@@ -412,33 +474,43 @@
350 else
351 expoCam = MAX (0.0, expoCam - val);
352
353- if (expoCam)
354+ if (dndState == DnDDuring)
355 {
356- unsigned int i, j, vp;
357- unsigned int vpCount = screen->vpSize ().width () *
358- screen->vpSize ().height ();
359+ foreach (CompWindow *w, dndWindows)
360+ ExpoWindow::get (w)->dndOpacity = MIN (1.0, ExpoWindow::get (w)->dndOpacity + val);
361+ }
362+ else if (dndState == DnDNone)
363+ {
364+ CompWindowList::iterator it = dndWindows.begin ();
365
366- if (vpActivity.size () < vpCount)
367+ while (it != dndWindows.end ())
368 {
369- vpActivity.resize (vpCount);
370- foreach (float& activity, vpActivity)
371- activity = 1.0f;
372- }
373+ ExpoWindow::get ((*it))->dndOpacity = MAX (0.0, ExpoWindow::get ((*it))->dndOpacity - val);
374
375- for (i = 0; i < (unsigned int) screen->vpSize ().width (); i++)
376- {
377- for (j = 0; j < (unsigned int) screen->vpSize ().height (); j++)
378+ if (ExpoWindow::get ((*it))->dndOpacity <= 0.0f)
379 {
380- vp = (j * screen->vpSize ().width ()) + i;
381-
382- if (CompPoint (i, j) == selectedVp)
383- vpActivity[vp] = MIN (1.0, vpActivity[vp] + val);
384- else
385- vpActivity[vp] = MAX (0.0, vpActivity[vp] - val);
386+ dndWindows.erase (it);
387+ it = dndWindows.begin ();
388 }
389+ else
390+ it++;
391 }
392+ }
393
394- for (i = 0; i < 360; i++)
395+ if (expoCam)
396+ {
397+ unsigned int vpCount = compiz::expo::countViewports (screen->vpSize ());
398+
399+ fillInNewViewportActivityData (vpCount, vpActivity);
400+ compiz::expo::fillInNewViewportActiveData (vpCount, vpActive);
401+
402+ for (unsigned int i = 0; i < vpCount; i++)
403+ if (vpActive[i])
404+ vpActivity[i] = MIN (1.0, vpActivity[i] + val);
405+ else
406+ vpActivity[i] = MAX (0.0, vpActivity[i] - val);
407+
408+ for (int i = 0; i < 360; i++)
409 {
410 float fi = (float) i;
411
412@@ -509,6 +581,31 @@
413 cScreen->paint (outputs, mask);
414 }
415
416+namespace
417+{
418+ void updateViewportActiveStates (CompScreen *screen)
419+ {
420+ ExpoScreen *es = ExpoScreen::get (screen);
421+
422+ unsigned int vpCount = compiz::expo::countViewports (screen->vpSize ());
423+ fillInNewViewportActivityData (vpCount, es->vpActivity);
424+
425+ for (int i = 0; i < screen->vpSize ().width (); i++)
426+ {
427+ for (int j = 0; j < screen->vpSize ().height (); j++)
428+ {
429+ compiz::expo::impl::CompizClientListGenerator clientList (screen);
430+
431+ compiz::expo::activeViewportsForMembers (clientList,
432+ es->newCursor,
433+ screen->vpSize (),
434+ *screen,
435+ es->vpActive);
436+ }
437+ }
438+ }
439+}
440+
441 void
442 ExpoScreen::donePaint ()
443 {
444@@ -539,6 +636,11 @@
445 foreach (float& vp, vpActivity)
446 if (vp != 0.0 && vp != 1.0)
447 cScreen->damageScreen ();
448+
449+ foreach (CompWindow *w, dndWindows)
450+ if (ExpoWindow::get (w)->dndOpacity != 0.0f &&
451+ ExpoWindow::get (w)->dndOpacity != 1.0f)
452+ cScreen->damageScreen ();
453 }
454
455 if (grabIndex && expoCam <= 0.0f && !expoMode)
456@@ -553,10 +655,25 @@
457 switch (dndState) {
458 case DnDDuring:
459 {
460- if (dndWindow)
461- dndWindow->move (newCursor.x () - prevCursor.x (),
462- newCursor.y () - prevCursor.y (),
463- optionGetExpoImmediateMove ());
464+ if (dndWindows.size ())
465+ {
466+ foreach (CompWindow *dndWindow, dndWindows)
467+ {
468+ if (dndWindow->grabbed ())
469+ {
470+ ExpoWindow *ew = ExpoWindow::get (dndWindow);
471+
472+ /* No need to update twice */
473+ dndWindow->moveNotifySetEnabled (ew, false);
474+ dndWindow->move (newCursor.x () - prevCursor.x (),
475+ newCursor.y () - prevCursor.y (),
476+ optionGetExpoImmediateMove ());
477+ dndWindow->moveNotifySetEnabled (ew, true);
478+
479+ updateViewportActiveStates (screen);
480+ }
481+ }
482+ }
483
484 prevCursor = newCursor;
485 cScreen->damageScreen ();
486@@ -621,13 +738,13 @@
487 break;
488
489 dndState = DnDDuring;
490- dndWindow = w;
491+ dndWindows.push_back (w);
492
493 w->grabNotify (nx, ny, 0,
494 CompWindowGrabMoveMask |
495 CompWindowGrabButtonMask);
496
497- screen->updateGrab (grabIndex, dragCursor);
498+ screen->updateGrab (grabIndex, mMoveCursor);
499
500 w->raise ();
501 w->moveInputFocusTo ();
502@@ -762,6 +879,124 @@
503 }
504
505 void
506+ExpoScreen::paintViewport (const GLScreenPaintAttrib& attrib,
507+ const GLMatrix& transform,
508+ const CompRegion& region,
509+ CompOutput *output,
510+ unsigned int mask,
511+ CompPoint vpPos,
512+ GLVector &vpCamPos,
513+ bool reflection)
514+{
515+ GLMatrix sTransform (transform);
516+ GLMatrix sTransform2, sTransform3;
517+ float sx = (float) screen->width () / output->width ();
518+ float sy = (float) screen->height () / output->height ();
519+ float vpp;
520+ float progress = sigmoidProgress (expoCam);
521+ unsigned int vp;
522+ CompPoint vpSize (screen->vpSize ().width (), screen->vpSize ().height ());
523+
524+ const float gapY = optionGetVpDistance () * 0.1f * expoCam;
525+ const float gapX = optionGetVpDistance () * 0.1f * screen->height () /
526+ screen->width () * expoCam;
527+
528+ /* not sure this will work with different resolutions */
529+ sTransform.translate (0.0, MAX (0, vpPos.y ()) * -(sy + gapY), 0.0f);
530+
531+ sTransform2 = sTransform;
532+
533+ /* not sure this will work with different resolutions */
534+ if (optionGetDeform () != DeformCurve)
535+ sTransform2.translate (MAX (0, vpPos.x ()) * (sx + gapX), 0.0f, 0.0);
536+
537+
538+ if (optionGetExpoAnimation () == ExpoAnimationVortex)
539+ sTransform2.rotate (360 * expoCam,
540+ 0.0f, 1.0f, 2.0f * expoCam);
541+
542+ sTransform3 = sTransform2;
543+
544+ sTransform3.translate (output->x () / output->width (),
545+ -output->y () / output->height (), 0.0);
546+
547+ cScreen->setWindowPaintOffset ((screen->vp ().x () - vpPos.x ()) *
548+ screen->width (),
549+ (screen->vp ().y () - vpPos.y ()) *
550+ screen->height ());
551+
552+ vp = (vpPos.y () * vpSize.x ()) + vpPos.x ();
553+
554+ vpp = (expoCam * vpActivity[vp]) + (1 - expoCam);
555+ vpp = sigmoidProgress (vpp);
556+
557+ vpBrightness = vpp + ((1.0 - vpp) *
558+ optionGetVpBrightness () / 100.0);
559+ vpSaturation = vpp + ((1.0 - vpp) *
560+ optionGetVpSaturation () / 100.0);
561+
562+ paintingVp = vpPos;
563+
564+ if (optionGetDeform () == DeformCurve)
565+ {
566+ float rotateX;
567+
568+ sTransform3.translate (-vpCamPos[GLVector::x], 0.0f,
569+ curveDistance - DEFAULT_Z_CAMERA);
570+
571+ rotateX = -vpPos.x () + interpolate (((float) vpSize.x () / 2.0) - 0.5,
572+ screen->vp ().x (), progress);
573+
574+ sTransform3.rotate (curveAngle * rotateX, 0.0, 1.0, 0.0);
575+
576+ sTransform3.translate (vpCamPos[GLVector::x], 0.0f,
577+ DEFAULT_Z_CAMERA - curveDistance);
578+ }
579+
580+ if (paintingDndWindow)
581+ cScreen->getWindowPaintListSetEnabled (this, true);
582+ gScreen->glPaintTransformedOutput (attrib, sTransform3,
583+ screen->region (), output,
584+ mask);
585+
586+ if (paintingDndWindow)
587+ cScreen->getWindowPaintListSetEnabled (this, false);
588+
589+ if (!reflection && !paintingDndWindow)
590+ {
591+ int cursor[2] = { pointerX, pointerY };
592+
593+ invertTransformedVertex (attrib, sTransform3,
594+ output, cursor);
595+
596+ if ((cursor[0] > 0) && (cursor[0] < (int) screen->width ()) &&
597+ (cursor[1] > 0) && (cursor[1] < (int) screen->height ()))
598+ {
599+ newCursor.setX (vpPos.x () * screen->width () + cursor[0]);
600+ newCursor.setY (vpPos.y () * screen->height () + cursor[1]);
601+
602+ if (anyClick || dndState != DnDNone)
603+ {
604+ /* Used to save last viewport interaction was in */
605+ selectedVp = vpPos;
606+ anyClick = false;
607+ }
608+ }
609+ }
610+
611+ /* Calculate the current viewport size */
612+ int tl[2] = { 0, 0 };
613+ int br[2] = { screen->width (), screen->height () };
614+
615+ invertTransformedVertex (attrib, sTransform3, output, tl);
616+ invertTransformedVertex (attrib, sTransform3, output, br);
617+
618+ viewport_size = CompSize (br[0] - tl[0], br[1] - tl[1]);
619+
620+ cScreen->setWindowPaintOffset (0, 0);
621+}
622+
623+void
624 ExpoScreen::paintWall (const GLScreenPaintAttrib& attrib,
625 const GLMatrix& transform,
626 const CompRegion& region,
627@@ -772,13 +1007,11 @@
628 GLfloat vertexData[12];
629 GLushort colorData[16];
630 GLMatrix sTransformW, sTransform (transform);
631- int i, j, vp;
632 GLenum oldFilter = gScreen->textureFilter ();
633-
634- float sx = (float) screen->width () / output->width ();
635- float sy = (float) screen->height () / output->height ();
636+ float sx = (float) screen->width () / output->width ();
637+ float sy = (float) screen->height () / output->height ();
638 float biasZ;
639- float oScale, rotation = 0.0f, progress, vpp;
640+ float oScale, rotation = 0.0f, progress;
641 float aspectX = 1.0f, aspectY = 1.0f;
642 GLVector cam;
643 CompPoint vpSize (screen->vpSize ().width (), screen->vpSize ().height ());
644@@ -910,9 +1143,24 @@
645 sTransform.rotate (rotation, 0.0f, 1.0f, 0.0f);
646 sTransform.scale (aspectX, aspectY, 1.0);
647
648+ CompPoint offsetInScreenCoords (optionGetXOffset (),
649+ optionGetYOffset ());
650+ float offsetInWorldCoordX, offsetInWorldCoordY, worldScaleFactorX, worldScaleFactorY;
651+
652+ compiz::expo::calculateWallOffset (*output,
653+ offsetInScreenCoords,
654+ vpSize,
655+ *screen,
656+ offsetInWorldCoordX,
657+ offsetInWorldCoordY,
658+ worldScaleFactorX,
659+ worldScaleFactorY,
660+ sigmoidProgress (expoCam));
661+
662 /* translate expo to center */
663- sTransform.translate (vpSize.x () * sx * -0.5,
664- vpSize.y () * sy * 0.5, 0.0f);
665+ sTransform.translate (vpSize.x () * sx * -0.5 + offsetInWorldCoordX,
666+ vpSize.y () * sy * 0.5 - offsetInWorldCoordY, 0.0f);
667+ sTransform.scale (worldScaleFactorX, worldScaleFactorY, 1.0f);
668
669 if (optionGetDeform () == DeformCurve)
670 sTransform.translate ((vpSize.x () - 1) * sx * 0.5, 0.0, 0.0);
671@@ -936,90 +1184,29 @@
672
673 expoActive = true;
674
675- for (j = 0; j < vpSize.y (); j++)
676- {
677- GLMatrix sTransform2 (sTransform), sTransform3;
678-
679- for (i = 0; i < vpSize.x (); i++)
680- {
681- if (optionGetExpoAnimation () == ExpoAnimationVortex)
682- sTransform2.rotate (360 * expoCam,
683- 0.0f, 1.0f, 2.0f * expoCam);
684-
685- sTransform3 = sTransform2;
686-
687- sTransform3.translate (output->x () / output->width (),
688- -output->y () / output->height (), 0.0);
689-
690- cScreen->setWindowPaintOffset ((screen->vp ().x () - i) *
691- screen->width (),
692- (screen->vp ().y () - j) *
693- screen->height ());
694-
695- vp = (j * vpSize.x ()) + i;
696-
697- vpp = (expoCam * vpActivity[vp]) + (1 - expoCam);
698- vpp = sigmoidProgress (vpp);
699-
700- vpBrightness = vpp + ((1.0 - vpp) *
701- optionGetVpBrightness () / 100.0);
702- vpSaturation = vpp + ((1.0 - vpp) *
703- optionGetVpSaturation () / 100.0);
704+ for (int j = 0; j < screen->vpSize ().height (); j++)
705+ for (int i = 0; i < screen->vpSize().width (); i++)
706+ paintViewport (attrib, sTransform, region, output, mask, CompPoint (i, j), vpCamPos, reflection);
707
708- paintingVp.set (i, j);
709+ paintingDndWindow = true;
710
711- if (optionGetDeform () == DeformCurve)
712- {
713- float rotateX;
714-
715- sTransform3.translate (-vpCamPos[GLVector::x], 0.0f,
716- curveDistance - DEFAULT_Z_CAMERA);
717-
718- rotateX = -i + interpolate (((float) vpSize.x () / 2.0) - 0.5,
719- screen->vp ().x (), progress);
720-
721- sTransform3.rotate (curveAngle * rotateX, 0.0, 1.0, 0.0);
722-
723- sTransform3.translate (vpCamPos[GLVector::x], 0.0f,
724- DEFAULT_Z_CAMERA - curveDistance);
725- }
726-
727- gScreen->glPaintTransformedOutput (attrib, sTransform3,
728- screen->region (), output,
729- mask);
730-
731- if (!reflection)
732- {
733- int cursor[2] = { pointerX, pointerY };
734+ foreach (CompWindow *dndWindow, dndWindows)
735+ {
736+ CompPoint vp;
737
738- invertTransformedVertex (attrib, sTransform3,
739- output, cursor);
740+ screen->viewportForGeometry (dndWindow->geometry (), vp);
741
742- if ((cursor[0] > 0) && (cursor[0] < (int) screen->width ()) &&
743- (cursor[1] > 0) && (cursor[1] < (int) screen->height ()))
744- {
745- newCursor.setX (i * screen->width () + cursor[0]);
746- newCursor.setY (j * screen->height () + cursor[1]);
747+ while (vp.x () < 0)
748+ vp.setX (screen->vpSize ().width () + vp.x ());
749
750- if (anyClick || dndState != DnDNone)
751- {
752- /* Used to save last viewport interaction was in */
753- lastSelectedVp = selectedVp;
754- selectedVp.set (i, j);
755- anyClick = false;
756- }
757- }
758- }
759+ while (vp.y () < 0)
760+ vp.setY (screen->vpSize ().height () + vp.y ());
761
762- /* not sure this will work with different resolutions */
763- if (optionGetDeform () != DeformCurve)
764- sTransform2.translate (sx + gapX, 0.0f, 0.0);
765- }
766-
767- /* not sure this will work with different resolutions */
768- sTransform.translate (0.0, -(sy + gapY), 0.0f);
769+ paintViewport (attrib, sTransform, infiniteRegion, output, mask, vp, vpCamPos, reflection);
770 }
771
772+ paintingDndWindow = false;
773+
774 // glNormal3f (0.0, 0.0, -1.0);
775
776 if (reflection)
777@@ -1187,12 +1374,16 @@
778
779 expoActive = false;
780
781- cScreen->setWindowPaintOffset (0, 0);
782-
783 gScreen->glPaintTransformedOutputSetCurrentIndex (glPaintTransformedOutputIndex);
784 gScreen->setTextureFilter (oldFilter);
785 }
786
787+const CompWindowList &
788+ExpoScreen::getWindowPaintList ()
789+{
790+ return dndWindows;
791+}
792+
793 bool
794 ExpoScreen::glPaintOutput (const GLScreenPaintAttrib& attrib,
795 const GLMatrix& transform,
796@@ -1243,10 +1434,15 @@
797
798 bool
799 ExpoWindow::glDraw (const GLMatrix& transform,
800- const GLWindowPaintAttrib &attrib,
801+ const GLWindowPaintAttrib &attrib,
802 const CompRegion& region,
803 unsigned int mask)
804 {
805+ GLMatrix wTransform (transform);
806+ CompPoint vp;
807+
808+ screen->viewportForGeometry (window->geometry (), vp);
809+
810 if (eScreen->expoCam == 0.0f)
811 return gWindow->glDraw (transform, attrib, region, mask);
812
813@@ -1275,8 +1471,11 @@
814 }
815 }
816
817- eAttrib.brightness = attrib.brightness * eScreen->vpBrightness;
818- eAttrib.saturation = attrib.saturation * eScreen->vpSaturation;
819+ if ((vp == eScreen->paintingVp || window->onAllViewports ()) && !eScreen->paintingDndWindow)
820+ {
821+ eAttrib.brightness = attrib.brightness * eScreen->vpBrightness;
822+ eAttrib.saturation = attrib.saturation * eScreen->vpSaturation;
823+ }
824 }
825 else
826 {
827@@ -1287,7 +1486,79 @@
828 (1 - sigmoidProgress (eScreen->expoCam));
829 }
830
831- return gWindow->glDraw (transform, eAttrib, region, mask);
832+ bool status = gWindow->glDraw (transform, eAttrib, region, mask);
833+
834+ if (window->type () & CompWindowTypeDesktopMask)
835+ {
836+ /* We want to set the geometry of the polka dots to the window
837+ * region */
838+ CompRegion reg = CompRegion (0, 0, window->width (), window->height ());
839+
840+ foreach(GLTexture * tex, eScreen->polkadots_texture)
841+ {
842+ GLTexture::MatrixList matl;
843+ GLTexture::Matrix mat = tex->matrix();
844+ CompRegion paintRegion(region);
845+
846+ float xScale = screen->width () / (float) eScreen->viewport_size.width ();
847+ float yScale = screen->height () / (float) eScreen->viewport_size.height ();
848+
849+ mat.xx *= xScale;
850+ mat.yy *= yScale;
851+
852+ /* Not sure what this does, but it is necessary
853+ * (adjusts for scale?) */
854+ mat.x0 -= mat.xx * reg.boundingRect().x1();
855+ mat.y0 -= mat.yy * reg.boundingRect().y1();
856+
857+ matl.push_back(mat);
858+
859+ if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
860+ paintRegion = infiniteRegion;
861+
862+ /* Now allow plugins to mess with the geometry of our
863+ * dim (so we get a nice render for things like
864+ * wobbly etc etc */
865+ gWindow->vertexBuffer ()->begin ();
866+ gWindow->glAddGeometry (matl, reg, paintRegion);
867+ if (gWindow->vertexBuffer ()->end ())
868+ {
869+ unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex ();
870+ eAttrib.opacity = attrib.opacity * (((1.0 - eScreen->vpBrightness) + (1.0 - eScreen->vpSaturation) / 2.0));
871+ /* Texture rendering set-up */
872+ //eScreen->gScreen->setTexEnvMode(GL_MODULATE);
873+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
874+ /* Draw the dim texture with all of it's modified
875+ * geometry glory */
876+ gWindow->glDrawTextureSetCurrentIndex (MAXSHORT);
877+ gWindow->glDrawTexture (tex, transform, eAttrib, mask |
878+ PAINT_WINDOW_BLEND_MASK |
879+ PAINT_WINDOW_TRANSLUCENT_MASK |
880+ PAINT_WINDOW_TRANSFORMED_MASK);
881+ gWindow->glDrawTextureSetCurrentIndex (glDrawTextureIndex);
882+ /* Texture rendering tear-down */
883+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
884+ eScreen->gScreen->setTexEnvMode (GL_REPLACE);
885+ }
886+ }
887+
888+ /* Paint the outline */
889+ if (mGlowQuads && eScreen->paintingVp == eScreen->selectedVp)
890+ {
891+ if (region.numRects ())
892+ {
893+ /* reset geometry and paint */
894+ gWindow->vertexBuffer ()->begin ();
895+ gWindow->vertexBuffer ()->end ();
896+
897+ paintGlow (transform, attrib, infiniteRegion, mask);
898+ }
899+ }
900+
901+ }
902+
903+ return status;
904+
905 }
906
907 #define EXPO_GRID_SIZE 100
908@@ -1425,11 +1696,17 @@
909 const CompRegion& region,
910 unsigned int mask)
911 {
912+ GLMatrix wTransform (transform);
913+ GLWindowPaintAttrib wAttrib (attrib);
914+ CompRegion clip (region);
915+
916 if (eScreen->expoActive)
917 {
918 float opacity = 1.0;
919 bool hide;
920 bool zoomAnim;
921+ CompPoint vp;
922+ screen->viewportForGeometry (window->geometry (), vp);
923
924 zoomAnim = eScreen->optionGetExpoAnimation () ==
925 ExpoScreen::ExpoAnimationZoom;
926@@ -1458,9 +1735,47 @@
927
928 if (opacity <= 0)
929 mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
930+ else
931+ wAttrib.opacity = wAttrib.opacity * opacity;
932+
933+ /* Stretch maximized windows a little so that you don't
934+ * have an awkward gap */
935+
936+ if (window->state () & MAXIMIZE_STATE &&
937+ !window->border ().top)
938+ {
939+ CompOutput *o = &screen->outputDevs ()[screen->outputDeviceForGeometry(window->geometry())];
940+ float yS = 1.0 + ((o->height () / (float) window->height ()) - 1.0f) * sigmoidProgress (eScreen->expoCam);
941+ float xS = 1.0 + ((o->width () / (float) window->width ()) - 1.0f) * sigmoidProgress (eScreen->expoCam);
942+ wTransform.translate (window->x () + window->width (),
943+ window->y () + window->height (),
944+ 0.0f);
945+ wTransform.scale (xS, yS, 1.0f);
946+ wTransform.translate (-(window->x () + window->width ()),
947+ -(window->y () + window->height ()),
948+ 0.0f);
949+
950+ if (eScreen->paintingVp != vp)
951+ mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
952+
953+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
954+ }
955+
956+ if (std::find (eScreen->dndWindows.begin(), eScreen->dndWindows.end (), window) != eScreen->dndWindows.end ())
957+ {
958+ if (!eScreen->paintingDndWindow)
959+ {
960+ mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
961+ }
962+ else
963+ {
964+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
965+ clip = infiniteRegion;
966+ }
967+ }
968 }
969
970- return gWindow->glPaint (attrib, transform, region, mask);
971+ return gWindow->glPaint (wAttrib, wTransform, clip, mask);
972 }
973
974 bool
975@@ -1489,7 +1804,7 @@
976 expoActive (false),
977 expoMode (false),
978 dndState (DnDNone),
979- dndWindow (NULL),
980+ dndWindows (0),
981 origVp (s->vp ()),
982 selectedVp (s->vp ()),
983 lastSelectedVp (s->vp ()),
984@@ -1497,14 +1812,21 @@
985 clickTime (0),
986 doubleClick (false),
987 vpNormals (360 * 3),
988- grabIndex (0)
989-{
990+ grabIndex (0),
991+ paintingDndWindow (false),
992+ mGlowTextureProperties (&glowTextureProperties)
993+{
994+ CompString fname;
995+ CompString pname = "expo";
996+ CompSize size;
997+
998+
999 leftKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Left"));
1000 rightKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Right"));
1001 upKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Up"));
1002 downKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Down"));
1003
1004- dragCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
1005+ mMoveCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
1006
1007 EXPOINITBIND (ExpoKey, doExpo);
1008 EXPOTERMBIND (ExpoKey, termExpo);
1009@@ -1522,12 +1844,58 @@
1010 ScreenInterface::setHandler (screen, false);
1011 CompositeScreenInterface::setHandler (cScreen, false);
1012 GLScreenInterface::setHandler (gScreen, false);
1013+
1014+ outline_texture = GLTexture::imageDataToTexture (mGlowTextureProperties->textureData,
1015+ CompSize (mGlowTextureProperties->textureSize,
1016+ mGlowTextureProperties->textureSize),
1017+ GL_RGBA, GL_UNSIGNED_BYTE);
1018+ fname = "texture_tile.png";
1019+ polkadots_texture = GLTexture::readImageToTexture (fname, pname, polkadots_texture_size);
1020+
1021+ if (polkadots_texture.empty ())
1022+ compLogMessage ("expo", CompLogLevelWarn, "failed to bind image to texture");
1023+ else
1024+ {
1025+ foreach (GLTexture *tex, polkadots_texture)
1026+ {
1027+ tex->enable (GLTexture::Good);
1028+ glTexParameteri (tex->target (), GL_TEXTURE_WRAP_S, GL_REPEAT);
1029+ glTexParameteri (tex->target (), GL_TEXTURE_WRAP_T, GL_REPEAT);
1030+ tex->disable ();
1031+ }
1032+ }
1033 }
1034
1035 ExpoScreen::~ExpoScreen ()
1036 {
1037- if (dragCursor != None)
1038- XFreeCursor (screen->dpy (), dragCursor);
1039+ if (mMoveCursor)
1040+ XFreeCursor (screen->dpy (), mMoveCursor);
1041+}
1042+
1043+void
1044+ExpoWindow::moveNotify (int dx, int dy, bool immediate)
1045+{
1046+ window->moveNotify (dx, dy, immediate);
1047+
1048+ if (!ExpoScreen::get (screen)->expoActive)
1049+ return;
1050+
1051+ updateViewportActiveStates (screen);
1052+}
1053+
1054+void
1055+ExpoWindow::resizeNotify(int dx, int dy, int dw, int dh)
1056+{
1057+ window->resizeNotify (dx, dy, dw, dh);
1058+
1059+ /* mGlowQuads contains positional info, so we need to recalc that */
1060+ if (mGlowQuads)
1061+ {
1062+ /* FIXME: we need to find a more multitexture friendly way
1063+ * of doing this */
1064+ GLTexture::Matrix tMat = eScreen->outline_texture.at (0)->matrix ();
1065+ computeGlowQuads (&tMat);
1066+ }
1067 }
1068
1069 ExpoWindow::ExpoWindow (CompWindow *w) :
1070@@ -1535,10 +1903,28 @@
1071 window (w),
1072 cWindow (CompositeWindow::get (w)),
1073 gWindow (GLWindow::get (w)),
1074- eScreen (ExpoScreen::get (screen))
1075+ eScreen (ExpoScreen::get (screen)),
1076+ dndOpacity (0.0f),
1077+ mGlowQuads (NULL)
1078 {
1079 CompositeWindowInterface::setHandler (cWindow, false);
1080 GLWindowInterface::setHandler (gWindow, false);
1081+ WindowInterface::setHandler (window, true);
1082+
1083+ if (window->type () & CompWindowTypeDesktopMask)
1084+ {
1085+ foreach (GLTexture *tex, eScreen->outline_texture)
1086+ {
1087+ GLTexture::Matrix mat = tex->matrix ();
1088+ computeGlowQuads (&mat);
1089+ }
1090+ }
1091+}
1092+
1093+ExpoWindow::~ExpoWindow ()
1094+{
1095+ eScreen->dndWindows.remove (window);
1096+ computeGlowQuads (NULL);
1097 }
1098
1099 bool
1100Index: ubuntu/plugins/expo/src/expo.h
1101===================================================================
1102--- ubuntu.orig/plugins/expo/src/expo.h 2012-09-08 17:26:40.599035911 +0800
1103+++ ubuntu/plugins/expo/src/expo.h 2012-09-12 22:20:43.276760475 +0800
1104@@ -30,6 +30,44 @@
1105 #include <opengl/opengl.h>
1106
1107 #include "expo_options.h"
1108+#include "glow.h"
1109+#include "viewport-member-window.h"
1110+#include "client-list-generator.h"
1111+
1112+#define WIN_REAL_X(w) (w->x () - w->border ().left)
1113+#define WIN_REAL_Y(w) (w->y () - w->border ().top)
1114+#define WIN_REAL_WIDTH(w) (w->width () + 2 * w->geometry ().border () + \
1115+ w->border ().left + w->border ().right)
1116+#define WIN_REAL_HEIGHT(w) (w->height () + 2 * w->geometry ().border () + \
1117+ w->border ().top + w->border ().bottom)
1118+
1119+namespace compiz
1120+{
1121+ namespace expo
1122+ {
1123+ namespace impl
1124+ {
1125+ namespace ce = compiz::expo;
1126+
1127+ class CompizClientListGenerator :
1128+ public ce::ClientListGenerator
1129+ {
1130+ public:
1131+
1132+ CompizClientListGenerator (CompScreen *screen);
1133+
1134+ void refreshClientList ();
1135+ ViewportMemberWindow * nextClient ();
1136+
1137+ private:
1138+
1139+ CompScreen *mScreen;
1140+ const CompWindowVector *mClientList;
1141+ CompWindowVector::const_iterator mClientListIterator;
1142+ };
1143+ }
1144+ }
1145+}
1146
1147 class ExpoScreen :
1148 public ScreenInterface,
1149@@ -51,8 +89,10 @@
1150 bool glPaintOutput (const GLScreenPaintAttrib&, const GLMatrix&,
1151 const CompRegion&, CompOutput *, unsigned int);
1152 void glPaintTransformedOutput (const GLScreenPaintAttrib&,
1153- const GLMatrix&, const CompRegion&,
1154- CompOutput *, unsigned int);
1155+ const GLMatrix&, const CompRegion&,
1156+ CompOutput*, unsigned int);
1157+
1158+ const CompWindowList & getWindowPaintList ();
1159
1160 bool dndInit (CompAction *, CompAction::State, CompOption::Vector&);
1161 bool dndFini (CompAction *, CompAction::State, CompOption::Vector&);
1162@@ -62,6 +102,8 @@
1163 bool nextVp (CompAction *, CompAction::State, CompOption::Vector&);
1164 bool prevVp (CompAction *, CompAction::State, CompOption::Vector&);
1165
1166+ CompPoint currentViewport ();
1167+
1168 typedef enum {
1169 DnDNone,
1170 DnDDuring,
1171@@ -82,7 +124,7 @@
1172 bool expoMode;
1173
1174 DnDState dndState;
1175- CompWindow *dndWindow;
1176+ CompWindowList dndWindows;
1177
1178 CompPoint prevCursor;
1179 CompPoint newCursor;
1180@@ -94,6 +136,7 @@
1181 CompPoint paintingVp;
1182
1183 std::vector<float> vpActivity;
1184+ std::vector<bool> vpActive;
1185 float vpBrightness;
1186 float vpSaturation;
1187
1188@@ -113,6 +156,17 @@
1189
1190 CompScreen::GrabHandle grabIndex;
1191
1192+ GLTexture::List polkadots_texture;
1193+ CompSize polkadots_texture_size;
1194+ CompSize viewport_size;
1195+
1196+ GLTexture::List outline_texture;
1197+ CompSize outline_texture_size;
1198+
1199+ bool paintingDndWindow;
1200+
1201+ const GlowTextureProperties *mGlowTextureProperties;
1202+
1203 private:
1204 void moveFocusViewport (int, int);
1205 void finishWindowMovement ();
1206@@ -123,24 +177,45 @@
1207 void paintWall (const GLScreenPaintAttrib&, const GLMatrix&,
1208 const CompRegion&, CompOutput *, unsigned int, bool);
1209
1210+ void paintViewport (const GLScreenPaintAttrib& attrib,
1211+ const GLMatrix& transform,
1212+ const CompRegion& region,
1213+ CompOutput *output,
1214+ unsigned int mask,
1215+ CompPoint vpPos,
1216+ GLVector &vpCamPos,
1217+ bool reflection);
1218+
1219+ bool windowsOnVp (compiz::expo::ClientListGenerator &clientList,
1220+ CompPoint &p,
1221+ const CompPoint &unprojectedCursor,
1222+ const CompSize &screenSize,
1223+ CompScreen *screen);
1224+
1225 KeyCode leftKey;
1226 KeyCode rightKey;
1227 KeyCode upKey;
1228 KeyCode downKey;
1229
1230- Cursor dragCursor;
1231+ Cursor mMoveCursor;
1232 };
1233
1234 class ExpoWindow :
1235+ public compiz::expo::ViewportMemberWindow,
1236 public CompositeWindowInterface,
1237 public GLWindowInterface,
1238+ public WindowInterface,
1239 public PluginClassHandler<ExpoWindow, CompWindow>
1240 {
1241 public:
1242 ExpoWindow (CompWindow *);
1243+ ~ExpoWindow ();
1244
1245 bool damageRect (bool, const CompRect&);
1246
1247+ void resizeNotify (int dx, int dy, int dw, int dh);
1248+ void moveNotify (int dx, int dy, bool immediate);
1249+
1250 bool glDraw (const GLMatrix&, const GLWindowPaintAttrib&,
1251 const CompRegion&, unsigned int);
1252 bool glPaint (const GLWindowPaintAttrib&, const GLMatrix&,
1253@@ -150,11 +225,31 @@
1254 unsigned int, unsigned int);
1255 void glDrawTexture (GLTexture*, const GLMatrix&,
1256 const GLWindowPaintAttrib&, unsigned int);
1257+ void
1258+ paintGlow (const GLMatrix &transform,
1259+ const GLWindowPaintAttrib &attrib,
1260+ const CompRegion &paintRegion,
1261+ unsigned int mask);
1262+
1263+ void
1264+ computeGlowQuads (GLTexture::Matrix *matrix);
1265
1266 CompWindow *window;
1267 CompositeWindow *cWindow;
1268 GLWindow *gWindow;
1269 ExpoScreen *eScreen;
1270+
1271+ float dndOpacity;
1272+
1273+ GlowQuad *mGlowQuads;
1274+
1275+ private:
1276+
1277+ bool isDesktopOrDock () const;
1278+ bool dragged () const;
1279+ const compiz::window::Geometry & absoluteGeometry () const;
1280+
1281+ mutable compiz::window::Geometry mAbsoluteGeometry;
1282 };
1283
1284 class ExpoPluginVTable :
1285Index: ubuntu/plugins/expo/src/glow.cpp
1286===================================================================
1287--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1288+++ ubuntu/plugins/expo/src/glow.cpp 2012-09-12 22:20:43.280760497 +0800
1289@@ -0,0 +1,429 @@
1290+/**
1291+ *
1292+ * Compiz group plugin
1293+ *
1294+ * glow.cpp
1295+ *
1296+ * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen,
1297+ * Danny Baumann, Sam Spilsbury
1298+ * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com>
1299+ * Roi Cohen <roico.beryl@gmail.com>
1300+ * Danny Baumann <maniac@opencompositing.org>
1301+ * Sam Spilsbury <smspillaz@gmail.com>
1302+ *
1303+ *
1304+ * This program is free software; you can redistribute it and/or
1305+ * modify it under the terms of the GNU General Public License
1306+ * as published by the Free Software Foundation; either version 2
1307+ * of the License, or (at your option) any later version.
1308+ *
1309+ * This program is distributed in the hope that it will be useful,
1310+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1311+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1312+ * GNU General Public License for more details.
1313+ *
1314+ **/
1315+
1316+#include "expo.h"
1317+#include "group_glow.h"
1318+
1319+const GlowTextureProperties glowTextureProperties = {
1320+ /* GlowTextureRectangular */
1321+ glowTexRect, 32, 21
1322+};
1323+
1324+/*
1325+ * GroupWindow::paintGlow
1326+ *
1327+ * Takes our glow texture, stretches the appropriate positions in the glow texture,
1328+ * adds those geometries (so plugins like wobby and deform this texture correctly)
1329+ * and then draws the glow texture with this geometry (plugins like wobbly and friends
1330+ * will automatically deform the texture based on our set geometry)
1331+ */
1332+
1333+void
1334+ExpoWindow::paintGlow (const GLMatrix &transform,
1335+ const GLWindowPaintAttrib &attrib,
1336+ const CompRegion &paintRegion,
1337+ unsigned int mask)
1338+{
1339+ CompRegion reg;
1340+ int i;
1341+ GLushort colorData[4];
1342+ const GLushort *selColorData = ExpoScreen::get (screen)->optionGetSelectedColor ();
1343+ float alpha = (float) selColorData[3] / 65535.0f;
1344+
1345+ /* Premultiply color */
1346+ colorData[0] = selColorData[0] * alpha;
1347+ colorData[1] = selColorData[1] * alpha;
1348+ colorData[2] = selColorData[2] * alpha;
1349+ colorData[3] = selColorData[3];
1350+
1351+ gWindow->vertexBuffer ()->begin ();
1352+
1353+ /* There are 8 glow parts of the glow texture which we wish to paint
1354+ * separately with different transformations
1355+ */
1356+ for (i = 0; i < NUM_GLOWQUADS; i++)
1357+ {
1358+ /* Using precalculated quads here */
1359+ reg = CompRegion (mGlowQuads[i].mBox);
1360+
1361+ if (reg.boundingRect ().x1 () < reg.boundingRect ().x2 () &&
1362+ reg.boundingRect ().y1 () < reg.boundingRect ().y2 ())
1363+ {
1364+ GLTexture::MatrixList matl;
1365+ reg = CompRegion (reg.boundingRect ().x1 (),
1366+ reg.boundingRect ().y1 (),
1367+ reg.boundingRect ().width (),
1368+ reg.boundingRect ().height ());
1369+
1370+ matl.push_back (mGlowQuads[i].mMatrix);
1371+ /* Add color data for all 6 vertices of the quad */
1372+ for (int n = 0; n < 6; n++)
1373+ gWindow->vertexBuffer ()->addColors (1, colorData);
1374+ gWindow->glAddGeometry (matl, reg, paintRegion);
1375+ }
1376+ }
1377+
1378+ if (gWindow->vertexBuffer ()->end ())
1379+ {
1380+ //GLScreen::get (screen)->setTexEnvMode (GL_MODULATE);
1381+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1382+
1383+ /* we use PAINT_WINDOW_TRANSFORMED_MASK here to force
1384+ the usage of a good texture filter */
1385+ foreach (GLTexture *tex, ExpoScreen::get (screen)->outline_texture)
1386+ {
1387+ gWindow->glDrawTexture (tex, transform, attrib, mask |
1388+ PAINT_WINDOW_BLEND_MASK |
1389+ PAINT_WINDOW_TRANSLUCENT_MASK |
1390+ PAINT_WINDOW_TRANSFORMED_MASK);
1391+ }
1392+
1393+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1394+ GLScreen::get (screen)->setTexEnvMode (GL_REPLACE);
1395+ }
1396+}
1397+
1398+/*
1399+ * ExpoWindow::computeGlowQuads
1400+ *
1401+ * This function computures the matrix transformation required for each
1402+ * part of the glow texture which we wish to stretch to some rectangular
1403+ * dimentions
1404+ *
1405+ * There are eight quads different parts of the texture which we wish to
1406+ * paint here, the 4 sides and four corners, eg:
1407+ *
1408+ * ------------------
1409+ * | 1 | 4 | 6 |
1410+ * ------------- ------------------
1411+ * | 1 | 4 | 6 | | | | |
1412+ * ------------- | | | |
1413+ * | 2 | n | 7 | -> | 2 | n | 7 |
1414+ * ------------- | | | |
1415+ * | 3 | 5 | 8 | | | | |
1416+ * ------------- ------------------
1417+ * | 3 | 5 | 8 |
1418+ * ------------------
1419+ *
1420+ * In this example here, 2, 4, 5 and 7 are stretched, and the matrices for
1421+ * each quad rect adjusted accordingly for it's size compared to the original
1422+ * texture size.
1423+ *
1424+ * When we are adjusting the matrices here, the initial size of each corner has
1425+ * a size of of "1.0f", so according to 2x2 matrix rules,
1426+ * the scale factor is the inverse of the size of the glow (which explains
1427+ * while you will see here that matrix->xx is (1 / glowSize)
1428+ * where glowSize is the size the user specifies they want their glow to extend.
1429+ * (likewise, matrix->yy is adjusted similarly for corners and for top/bottom)
1430+ *
1431+ * matrix->x0 and matrix->y0 here are set to be the top left edge of the rect
1432+ * adjusted by the matrix scale factor (matrix->xx and matrix->yy)
1433+ *
1434+ */
1435+void
1436+ExpoWindow::computeGlowQuads (GLTexture::Matrix *matrix)
1437+{
1438+ CompRect *box;
1439+ int x1, x2, y1, y2;
1440+ GLTexture::Matrix *quadMatrix;
1441+ int glowSize, glowOffset;
1442+ CompWindow *w = window;
1443+
1444+ /* Passing NULL to this function frees the glow quads
1445+ * (so the window is not painted with glow) */
1446+
1447+ if (matrix)
1448+ {
1449+ if (!mGlowQuads)
1450+ mGlowQuads = new GlowQuad[NUM_GLOWQUADS];
1451+ if (!mGlowQuads)
1452+ return;
1453+ }
1454+ else
1455+ {
1456+ if (mGlowQuads)
1457+ {
1458+ delete[] mGlowQuads;
1459+ mGlowQuads = NULL;
1460+ }
1461+ return;
1462+ }
1463+
1464+ glowSize = 48;
1465+ glowOffset = (glowSize * ExpoScreen::get (screen)->mGlowTextureProperties->glowOffset /
1466+ ExpoScreen::get (screen)->mGlowTextureProperties->textureSize) + 1;
1467+
1468+ /* Top left corner */
1469+ box = &mGlowQuads[GLOWQUAD_TOPLEFT].mBox;
1470+ mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix = *matrix;
1471+ quadMatrix = &mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix;
1472+
1473+ /* Set the desired rect dimentions
1474+ * for the part of the glow we are painting */
1475+
1476+ x1 = WIN_REAL_X (w) - glowSize + glowOffset;
1477+ y1 = WIN_REAL_Y (w) - glowSize + glowOffset;
1478+
1479+ /* 2x2 Matrix here, adjust both x and y scale factors
1480+ * and the x and y position
1481+ *
1482+ * Scaling both parts of the texture in a positive direction
1483+ * here (left to right top to bottom)
1484+ *
1485+ * The base position (x0 and y0) here requires us to move backwards
1486+ * on the x and y dimentions by the calculated rect dimentions
1487+ * multiplied by the scale factors
1488+ */
1489+
1490+ quadMatrix->xx = 1.0f / glowSize;
1491+ quadMatrix->yy = 1.0f / (glowSize);
1492+ quadMatrix->x0 = -(x1 * quadMatrix->xx);
1493+ quadMatrix->y0 = -(y1 * quadMatrix->yy);
1494+
1495+ x2 = MIN (WIN_REAL_X (w) + glowOffset,
1496+ WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
1497+ y2 = MIN (WIN_REAL_Y (w) + glowOffset,
1498+ WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
1499+
1500+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1501+
1502+ /* Top right corner */
1503+ box = &mGlowQuads[GLOWQUAD_TOPRIGHT].mBox;
1504+ mGlowQuads[GLOWQUAD_TOPRIGHT].mMatrix = *matrix;
1505+ quadMatrix = &mGlowQuads[GLOWQUAD_TOPRIGHT].mMatrix;
1506+
1507+ /* Set the desired rect dimentions
1508+ * for the part of the glow we are painting */
1509+
1510+ x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
1511+ y1 = WIN_REAL_Y (w) - glowSize + glowOffset;
1512+ x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;
1513+
1514+ /* 2x2 Matrix here, adjust both x and y scale factors
1515+ * and the x and y position
1516+ *
1517+ * Scaling the y part of the texture in a positive direction
1518+ * and the x part in a negative direction here
1519+ * (right to left top to bottom)
1520+ *
1521+ * The base position (x0 and y0) here requires us to move backwards
1522+ * on the y dimention and forwards on x by the calculated rect dimentions
1523+ * multiplied by the scale factors (since we are moving forward on x we
1524+ * need the inverse of that which is 1 - x1 * xx
1525+ */
1526+
1527+ quadMatrix->xx = -1.0f / glowSize;
1528+ quadMatrix->yy = 1.0f / glowSize;
1529+ quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
1530+ quadMatrix->y0 = -(y1 * quadMatrix->yy);
1531+
1532+ x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset,
1533+ WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
1534+ y2 = MIN (WIN_REAL_Y (w) + glowOffset,
1535+ WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
1536+
1537+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1538+
1539+ /* Bottom left corner */
1540+ box = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mBox;
1541+ mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix = *matrix;
1542+ quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix;
1543+
1544+ x1 = WIN_REAL_X (w) - glowSize + glowOffset;
1545+ y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
1546+ x2 = WIN_REAL_X (w) + glowOffset;
1547+ y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;
1548+
1549+ /* 2x2 Matrix here, adjust both x and y scale factors
1550+ * and the x and y position
1551+ *
1552+ * Scaling the x part of the texture in a positive direction
1553+ * and the y part in a negative direction here
1554+ * (left to right bottom to top)
1555+ *
1556+ * The base position (x0 and y0) here requires us to move backwards
1557+ * on the x dimention and forwards on y by the calculated rect dimentions
1558+ * multiplied by the scale factors (since we are moving forward on x we
1559+ * need the inverse of that which is 1 - y1 * yy
1560+ */
1561+
1562+ quadMatrix->xx = 1.0f / glowSize;
1563+ quadMatrix->yy = -1.0f / glowSize;
1564+ quadMatrix->x0 = -(x1 * quadMatrix->xx);
1565+ quadMatrix->y0 = 1.0f - (y1 * quadMatrix->yy);
1566+
1567+ y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset,
1568+ WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
1569+ x2 = MIN (WIN_REAL_X (w) + glowOffset,
1570+ WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
1571+
1572+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1573+
1574+ /* Bottom right corner */
1575+ box = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mBox;
1576+ mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix = *matrix;
1577+ quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix;
1578+
1579+ x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
1580+ y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
1581+ x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;
1582+ y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;
1583+
1584+ /* 2x2 Matrix here, adjust both x and y scale factors
1585+ * and the x and y position
1586+ *
1587+ * Scaling the both parts of the texture in a negative direction
1588+ * (right to left bottom to top)
1589+ *
1590+ * The base position (x0 and y0) here requires us to move forwards
1591+ * on both dimentions by the calculated rect dimentions
1592+ * multiplied by the scale factors
1593+ */
1594+
1595+ quadMatrix->xx = -1.0f / glowSize;
1596+ quadMatrix->yy = -1.0f / glowSize;
1597+ quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
1598+ quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy);
1599+
1600+ x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset,
1601+ WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
1602+ y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset,
1603+ WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
1604+
1605+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1606+
1607+ /* Top edge */
1608+ box = &mGlowQuads[GLOWQUAD_TOP].mBox;
1609+ mGlowQuads[GLOWQUAD_TOP].mMatrix = *matrix;
1610+ quadMatrix = &mGlowQuads[GLOWQUAD_TOP].mMatrix;
1611+
1612+ x1 = WIN_REAL_X (w) + glowOffset;
1613+ y1 = WIN_REAL_Y (w) - glowSize + glowOffset;
1614+ x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
1615+ y2 = WIN_REAL_Y (w) + glowOffset;
1616+
1617+ /* 2x2 Matrix here, adjust both x and y scale factors
1618+ * and the x and y position
1619+ *
1620+ * No need to scale the x part of the texture here, but we
1621+ * are scaling on the y part in a positive direciton
1622+ *
1623+ * The base position (y0) here requires us to move backwards
1624+ * on the x dimention and forwards on y by the calculated rect dimentions
1625+ * multiplied by the scale factors
1626+ */
1627+
1628+ quadMatrix->xx = 0.0f;
1629+ quadMatrix->yy = 1.0f / glowSize;
1630+ quadMatrix->x0 = 1.0;
1631+ quadMatrix->y0 = -(y1 * quadMatrix->yy);
1632+
1633+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1634+
1635+ /* Bottom edge */
1636+ box = &mGlowQuads[GLOWQUAD_BOTTOM].mBox;
1637+ mGlowQuads[GLOWQUAD_BOTTOM].mMatrix = *matrix;
1638+ quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOM].mMatrix;
1639+
1640+ x1 = WIN_REAL_X (w) + glowOffset;
1641+ y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
1642+ x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
1643+ y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;
1644+
1645+ /* 2x2 Matrix here, adjust both x and y scale factors
1646+ * and the x and y position
1647+ *
1648+ * No need to scale the x part of the texture here, but we
1649+ * are scaling on the y part in a negative direciton
1650+ *
1651+ * The base position (y0) here requires us to move forwards
1652+ * on y by the calculated rect dimentions
1653+ * multiplied by the scale factors
1654+ */
1655+
1656+ quadMatrix->xx = 0.0f;
1657+ quadMatrix->yy = -1.0f / glowSize;
1658+ quadMatrix->x0 = 1.0;
1659+ quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy);
1660+
1661+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1662+
1663+ /* Left edge */
1664+ box = &mGlowQuads[GLOWQUAD_LEFT].mBox;
1665+ mGlowQuads[GLOWQUAD_LEFT].mMatrix = *matrix;
1666+ quadMatrix = &mGlowQuads[GLOWQUAD_LEFT].mMatrix;
1667+
1668+ x1 = WIN_REAL_X (w) - glowSize + glowOffset;
1669+ y1 = WIN_REAL_Y (w) + glowOffset;
1670+ x2 = WIN_REAL_X (w) + glowOffset;
1671+ y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
1672+
1673+ /* 2x2 Matrix here, adjust both x and y scale factors
1674+ * and the x and y position
1675+ *
1676+ * No need to scale the y part of the texture here, but we
1677+ * are scaling on the x part in a positive direciton
1678+ *
1679+ * The base position (x0) here requires us to move backwards
1680+ * on x by the calculated rect dimentions
1681+ * multiplied by the scale factors
1682+ */
1683+
1684+ quadMatrix->xx = 1.0f / glowSize;
1685+ quadMatrix->yy = 0.0f;
1686+ quadMatrix->x0 = -(x1 * quadMatrix->xx);
1687+ quadMatrix->y0 = 1.0;
1688+
1689+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1690+
1691+ /* Right edge */
1692+ box = &mGlowQuads[GLOWQUAD_RIGHT].mBox;
1693+ mGlowQuads[GLOWQUAD_RIGHT].mMatrix = *matrix;
1694+ quadMatrix = &mGlowQuads[GLOWQUAD_RIGHT].mMatrix;
1695+
1696+ x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
1697+ y1 = WIN_REAL_Y (w) + glowOffset;
1698+ x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;
1699+ y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
1700+
1701+ /* 2x2 Matrix here, adjust both x and y scale factors
1702+ * and the x and y position
1703+ *
1704+ * No need to scale the y part of the texture here, but we
1705+ * are scaling on the x part in a negative direciton
1706+ *
1707+ * The base position (x0) here requires us to move forwards
1708+ * on x by the calculated rect dimentions
1709+ * multiplied by the scale factors
1710+ */
1711+
1712+ quadMatrix->xx = -1.0f / glowSize;
1713+ quadMatrix->yy = 0.0f;
1714+ quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
1715+ quadMatrix->y0 = 1.0;
1716+
1717+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1718+}
1719Index: ubuntu/plugins/expo/src/glow.h
1720===================================================================
1721--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1722+++ ubuntu/plugins/expo/src/glow.h 2012-09-12 22:20:43.280760497 +0800
1723@@ -0,0 +1,66 @@
1724+/**
1725+ *
1726+ * Compiz group plugin
1727+ *
1728+ * glow.h
1729+ *
1730+ * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen,
1731+ * Danny Baumann, Sam Spilsbury
1732+ * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com>
1733+ * Roi Cohen <roico.beryl@gmail.com>
1734+ * Danny Baumann <maniac@opencompositing.org>
1735+ * Sam Spilsbury <smspillaz@gmail.com>
1736+ *
1737+ *
1738+ * This program is free software; you can redistribute it and/or
1739+ * modify it under the terms of the GNU General Public License
1740+ * as published by the Free Software Foundation; either version 2
1741+ * of the License, or (at your option) any later version.
1742+ *
1743+ * This program is distributed in the hope that it will be useful,
1744+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1745+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1746+ * GNU General Public License for more details.
1747+ *
1748+ **/
1749+
1750+#ifndef _EXPO_GLOW_H
1751+#define _EXPO_GLOW_H
1752+
1753+#define GLOWQUAD_TOPLEFT 0
1754+#define GLOWQUAD_TOPRIGHT 1
1755+#define GLOWQUAD_BOTTOMLEFT 2
1756+#define GLOWQUAD_BOTTOMRIGHT 3
1757+#define GLOWQUAD_TOP 4
1758+#define GLOWQUAD_BOTTOM 5
1759+#define GLOWQUAD_LEFT 6
1760+#define GLOWQUAD_RIGHT 7
1761+#define NUM_GLOWQUADS 8
1762+
1763+/* Represents a particular glow texture, so here
1764+ * we have hardcoded in the texture data, the offset
1765+ * and the size of the texture
1766+ */
1767+
1768+typedef struct _GlowTextureProperties {
1769+ char *textureData;
1770+ int textureSize;
1771+ int glowOffset;
1772+} GlowTextureProperties;
1773+
1774+/* Each glow quad contains a 2x2 scale + positional matrix
1775+ * (the 3rd column is not used since that is for matrix skew
1776+ * operations which we do not care about)
1777+ * and also a CompRect which describes the size and position of
1778+ * the quad on the glow
1779+ */
1780+
1781+class GlowQuad {
1782+ public:
1783+ CompRect mBox;
1784+ GLTexture::Matrix mMatrix;
1785+};
1786+
1787+extern const GlowTextureProperties glowTextureProperties;
1788+
1789+#endif
1790Index: ubuntu/plugins/expo/src/group_glow.h
1791===================================================================
1792--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1793+++ ubuntu/plugins/expo/src/group_glow.h 2012-09-12 22:20:43.280760497 +0800
1794@@ -0,0 +1,197 @@
1795+#ifndef _GROUP_GLOWTEX_H
1796+#define _GROUP_GLOWTEX_H
1797+
1798+/**
1799+ *
1800+ * Compiz group plugin
1801+ *
1802+ * group_glow.h
1803+ *
1804+ * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen,
1805+ * Danny Baumann, Sam Spilsbury
1806+ * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com>
1807+ * Roi Cohen <roico.beryl@gmail.com>
1808+ * Danny Baumann <maniac@opencompositing.org>
1809+ * Sam Spilsbury <smspillaz@gmail.com>
1810+ *
1811+ *
1812+ * This program is free software; you can redistribute it and/or
1813+ * modify it under the terms of the GNU General Public License
1814+ * as published by the Free Software Foundation; either version 2
1815+ * of the License, or (at your option) any later version.
1816+ *
1817+ * This program is distributed in the hope that it will be useful,
1818+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1819+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1820+ * GNU General Public License for more details.
1821+ *
1822+ **/
1823+
1824+/*
1825+ * glowTex
1826+ */
1827+
1828+static char glowTexRect[4097] = {
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"
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"
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"
1832+ "\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377"
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"
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"
1835+ "\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377"
1836+ "\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6"
1837+ "\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377"
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"
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"
1840+ "\377\377\377\14\377\377\377\22\377\377\377\22\377\377\377\22\377\377\377"
1841+ "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377"
1842+ "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377"
1843+ "\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377"
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"
1845+ "\377\6\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377\27\377\377"
1846+ "\377\27\377\377\377\35\377\377\377#\377\377\377'\377\377\377'\377\377\377"
1847+ "+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377"
1848+ "\377+\377\377\377+\377\377\377+\377\377\3771\377\377\3771\377\377\3771\377"
1849+ "\377\3771\377\377\3771\377\377\3771\377\377\3771\0\0\0\0\0\0\0\0\0\0\0\0"
1850+ "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377"
1851+ "\27\377\377\377\35\377\377\377#\377\377\377+\377\377\3771\377\377\3776\377"
1852+ "\377\377<\377\377\377>\377\377\377C\377\377\377I\377\377\377I\377\377\377"
1853+ "I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377"
1854+ "\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377"
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"
1856+ "\377\377\22\377\377\377\27\377\377\377#\377\377\377+\377\377\3776\377\377"
1857+ "\377C\377\377\377L\377\377\377U\377\377\377]\377\377\377`\377\377\377d\377"
1858+ "\377\377h\377\377\377k\377\377\377k\377\377\377k\377\377\377k\377\377\377"
1859+ "k\377\377\377k\377\377\377k\377\377\377p\377\377\377p\377\377\377p\377\377"
1860+ "\377p\377\377\377p\377\377\377p\377\377\377p\0\0\0\0\0\0\0\0\0\0\0\0\377"
1861+ "\377\377\6\377\377\377\14\377\377\377\22\314\314\314\35\377\377\377'\377"
1862+ "\377\3771\377\377\377>\357\357\357P\377\377\377]\363\363\363k\365\365\365"
1863+ "v\365\365\365|\377\377\377\202\367\367\367\210\367\367\367\214\367\367\367"
1864+ "\216\367\367\367\221\367\367\367\221\367\367\367\221\367\367\367\221\367"
1865+ "\367\367\221\367\367\367\221\367\367\367\224\367\367\367\224\367\367\367"
1866+ "\224\367\367\367\224\367\367\367\224\367\367\367\224\367\367\367\224\0\0"
1867+ "\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\27\377"
1868+ "\377\377'\377\377\3776\377\377\377I\377\377\377Y\377\377\377k\376\376\376"
1869+ "y\377\377\377\210\377\377\377\224\377\377\377\235\377\377\377\245\377\377"
1870+ "\377\253\377\377\377\255\377\377\377\262\377\377\377\262\377\377\377\263"
1871+ "\377\377\377\263\377\377\377\263\377\377\377\263\377\377\377\263\377\377"
1872+ "\377\266\377\377\377\266\377\377\377\266\377\377\377\266\377\377\377\266"
1873+ "\377\377\377\266\377\377\377\266\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377"
1874+ "\14\377\377\377\27\377\377\377#\377\377\3771\377\377\377I\377\377\377]\377"
1875+ "\377\377r\377\377\377\205\377\377\377\231\377\377\377\247\377\377\377\263"
1876+ "\377\377\377\275\377\377\377\304\377\377\377\310\377\377\377\313\377\377"
1877+ "\377\316\377\377\377\320\377\377\377\320\377\377\377\320\377\377\377\320"
1878+ "\377\377\377\320\377\377\377\320\377\377\377\322\377\377\377\322\377\377"
1879+ "\377\322\377\377\377\322\377\377\377\322\377\377\377\322\377\377\377\322"
1880+ "\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\35\377\377"
1881+ "\377+\377\377\377>\377\377\377Y\377\377\377r\377\377\377\210\376\376\376"
1882+ "\237\377\377\377\262\377\377\377\302\377\377\377\313\377\377\377\324\377"
1883+ "\377\377\332\376\376\376\336\377\377\377\341\377\377\377\342\377\377\377"
1884+ "\344\377\377\377\344\377\377\377\344\377\377\377\344\377\377\377\344\377"
1885+ "\377\377\344\377\377\377\345\377\377\377\345\377\377\377\345\377\377\377"
1886+ "\345\377\377\377\345\377\377\377\345\377\377\377\345\0\0\0\0\377\377\377"
1887+ "\6\377\377\377\14\377\377\377\27\377\377\377#\377\377\3776\377\377\377P\377"
1888+ "\377\377k\377\377\377\205\376\376\376\237\372\372\372\266\377\377\377\307"
1889+ "\373\373\373\325\373\373\373\337\374\374\374\345\374\374\374\352\374\374"
1890+ "\374\355\374\374\374\357\374\374\374\360\374\374\374\361\374\374\374\361"
1891+ "\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374"
1892+ "\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362"
1893+ "\374\374\374\362\374\374\374\362\0\0\0\0\377\377\377\6\377\377\377\14\377"
1894+ "\377\377\35\377\377\377+\377\377\377C\377\377\377]\377\377\377|\377\377\377"
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"
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"
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"
1898+ "\377\377\6\377\377\377\22\324\324\324#\377\377\3771\377\377\377L\363\363"
1899+ "\363k\377\377\377\210\377\377\377\247\377\377\377\302\377\377\377\325\0\0"
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"
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"
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"
1903+ "\377#\377\377\377<\377\377\377U\377\377\377v\377\377\377\226\377\377\377"
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"
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"
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"
1907+ "\6\377\377\377\14\377\377\377\27\377\377\377'\377\377\377>\377\377\377]\377"
1908+ "\377\377|\370\370\370\237\377\377\377\275\373\373\373\325\377\377\377\345"
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"
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"
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"
1912+ "\377\377+\377\377\377C\377\377\377`\377\377\377\202\377\377\377\247\377\377"
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"
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"
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"
1916+ "\377\6\377\377\377\14\377\377\377\27\377\377\377+\377\377\377C\377\377\377"
1917+ "d\377\377\377\210\377\377\377\253\377\377\377\310\376\376\376\336\374\374"
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"
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"
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"
1921+ "\35\377\377\377+\377\377\377I\377\377\377h\377\377\377\214\377\377\377\260"
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"
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"
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"
1925+ "\377\377\377\6\377\377\377\14\377\377\377\35\342\342\3421\377\377\377I\377"
1926+ "\377\377k\377\377\377\216\377\377\377\262\377\377\377\316\374\374\374\344"
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"
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"
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"
1930+ "\377\377\35\377\377\3771\377\377\377L\377\377\377k\377\377\377\221\377\377"
1931+ "\377\263\377\377\377\320\377\377\377\344\377\377\377\361\0\0\0\0\0\0\0\0"
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"
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"
1934+ "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377"
1935+ "\377L\377\377\377k\377\377\377\221\377\377\377\263\377\377\377\320\377\377"
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"
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"
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"
1939+ "\14\377\377\377\35\377\377\3771\377\377\377L\364\364\364p\377\377\377\221"
1940+ "\372\372\372\266\377\377\377\320\374\374\374\345\377\377\377\362\0\0\0\0"
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"
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"
1943+ "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377"
1944+ "1\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373\373\322"
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"
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"
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"
1948+ "\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\377\377"
1949+ "\377\221\377\377\377\266\373\373\373\322\377\377\377\345\377\377\377\362"
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"
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"
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"
1953+ "\377\3771\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373"
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"
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"
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"
1957+ "\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377"
1958+ "p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345\374\374"
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"
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"
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"
1962+ "\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266"
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"
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"
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"
1966+ "\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377"
1967+ "\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345"
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"
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"
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"
1971+ "\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377"
1972+ "\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0"
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"
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"
1975+ "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377"
1976+ "\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377"
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"
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"
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"
1980+ "\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224"
1981+ "\377\377\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0"
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"
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"
1984+ "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377"
1985+ "1\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322"
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"
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"
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",
1989+};
1990+
1991+#endif
1992Index: ubuntu/plugins/expo/src/wall_offset/CMakeLists.txt
1993===================================================================
1994--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1995+++ ubuntu/plugins/expo/src/wall_offset/CMakeLists.txt 2012-09-12 22:20:43.280760497 +0800
1996@@ -0,0 +1,33 @@
1997+include_directories (
1998+ ${CMAKE_CURRENT_SOURCE_DIR}/include
1999+ ${CMAKE_CURRENT_SOURCE_DIR}/src
2000+ ${Boost_INCLUDE_DIRS}
2001+ ${GLIBMM_INCLUDE_DIRS}
2002+)
2003+
2004+link_directories (${GLIBMM_LIBRARY_DIRS} ${COMPIZ_LIBRARY_DIRS})
2005+
2006+set (
2007+ PRIVATE_HEADERS
2008+ ${CMAKE_CURRENT_SOURCE_DIR}/include/wall-offset.h
2009+)
2010+
2011+set (
2012+ SRCS
2013+ ${CMAKE_CURRENT_SOURCE_DIR}/src/wall-offset.cpp
2014+)
2015+
2016+add_library (
2017+ compiz_expo_wall_offset STATIC
2018+ ${SRCS}
2019+ ${PRIVATE_HEADERS}
2020+)
2021+
2022+if (COMPIZ_BUILD_TESTING)
2023+ add_subdirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/tests )
2024+endif (COMPIZ_BUILD_TESTING)
2025+
2026+target_link_libraries (
2027+ compiz_expo_wall_offset
2028+ compiz_core
2029+)
2030Index: ubuntu/plugins/expo/src/wall_offset/include/wall-offset.h
2031===================================================================
2032--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2033+++ ubuntu/plugins/expo/src/wall_offset/include/wall-offset.h 2012-09-12 22:20:43.280760497 +0800
2034@@ -0,0 +1,43 @@
2035+/**
2036+ * Copyright © 2012 Canonical Ltd.
2037+ *
2038+ * Authors:
2039+ * Sam Spilsbury <sam.spilsbury@canonical.com>
2040+ *
2041+ * This program is free software; you can redistribute it and/or
2042+ * modify it under the terms of the GNU General Public License
2043+ * as published by the Free Software Foundation; either version 2
2044+ * of the License, or (at your option) any later version.
2045+ *
2046+ * This program is distributed in the hope that it will be useful,
2047+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2048+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2049+ * GNU General Public License for more details.
2050+ *
2051+ **/
2052+
2053+#ifndef _COMPIZ_EXPO_WALL_OFFSET_H
2054+#define _COMPIZ_EXPO_WALL_OFFSET_H
2055+
2056+#include <core/point.h>
2057+#include <core/size.h>
2058+#include <core/rect.h>
2059+
2060+namespace compiz
2061+{
2062+ namespace expo
2063+ {
2064+ void
2065+ calculateWallOffset (const CompRect &output,
2066+ const CompPoint &offsetInScreenCoords,
2067+ const CompPoint &vpSize,
2068+ const CompSize &screenSize,
2069+ float &offsetInWorldX,
2070+ float &offsetInWorldY,
2071+ float &worldScaleFactorX,
2072+ float &worldScaleFactorY,
2073+ float animationProgress);
2074+ }
2075+}
2076+
2077+#endif
2078Index: ubuntu/plugins/expo/src/wall_offset/src/wall-offset.cpp
2079===================================================================
2080--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2081+++ ubuntu/plugins/expo/src/wall_offset/src/wall-offset.cpp 2012-09-12 22:20:43.280760497 +0800
2082@@ -0,0 +1,55 @@
2083+/**
2084+ * Copyright © 2012 Canonical Ltd.
2085+ *
2086+ * Authors:
2087+ * Sam Spilsbury <sam.spilsbury@canonical.com>
2088+ *
2089+ * This program is free software; you can redistribute it and/or
2090+ * modify it under the terms of the GNU General Public License
2091+ * as published by the Free Software Foundation; either version 2
2092+ * of the License, or (at your option) any later version.
2093+ *
2094+ * This program is distributed in the hope that it will be useful,
2095+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2096+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2097+ * GNU General Public License for more details.
2098+ *
2099+ **/
2100+#include "wall-offset.h"
2101+
2102+namespace compiz
2103+{
2104+ namespace expo
2105+ {
2106+ void
2107+ calculateWallOffset (const CompRect &output,
2108+ const CompPoint &offsetInScreenCoords,
2109+ const CompPoint &vpSize,
2110+ const CompSize &screenSize,
2111+ float &offsetInWorldX,
2112+ float &offsetInWorldY,
2113+ float &worldScaleFactorX,
2114+ float &worldScaleFactorY,
2115+ float animationProgress)
2116+ {
2117+ const float sx = screenSize.width () / static_cast <float> (output.width ());
2118+ const float sy = screenSize.height () / static_cast <float> (output.height ());
2119+ offsetInWorldX = 0.0;
2120+ offsetInWorldY = 0.0;
2121+ worldScaleFactorX = 1.0f;
2122+ worldScaleFactorY = 1.0f;
2123+
2124+ if (output.left () == 0)
2125+ {
2126+ offsetInWorldX = ((vpSize.x () * sx) / ((float) output.width ()) * (offsetInScreenCoords.x ()) * animationProgress);
2127+ worldScaleFactorX = 1.0f - ((float) (offsetInScreenCoords.x ()) / (float) (output.width ())) * animationProgress;
2128+ }
2129+
2130+ if (output.top () == 0)
2131+ {
2132+ offsetInWorldY = ((vpSize.y () * sy) / ((float) output.height ()) * (offsetInScreenCoords.y ()) * animationProgress);
2133+ worldScaleFactorY = 1.0f - ((float) (offsetInScreenCoords.y ()) / (float) output.height ()) * animationProgress;
2134+ }
2135+ }
2136+ }
2137+}
2138Index: ubuntu/plugins/expo/src/wall_offset/tests/CMakeLists.txt
2139===================================================================
2140--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2141+++ ubuntu/plugins/expo/src/wall_offset/tests/CMakeLists.txt 2012-09-12 22:20:43.280760497 +0800
2142@@ -0,0 +1,19 @@
2143+if (NOT GTEST_FOUND)
2144+ message ("Google Test not found - cannot build tests!")
2145+ set (COMPIZ_BUILD_TESTING OFF)
2146+endif (NOT GTEST_FOUND)
2147+
2148+include_directories (${GTEST_INCLUDE_DIRS})
2149+
2150+link_directories (${COMPIZ_LIBRARY_DIRS})
2151+
2152+add_executable (compiz_test_expo_wall_offset
2153+ ${CMAKE_CURRENT_SOURCE_DIR}/test-expo-wall-offset.cpp)
2154+
2155+target_link_libraries (compiz_test_expo_wall_offset
2156+ compiz_expo_wall_offset
2157+ ${GTEST_BOTH_LIBRARIES}
2158+ ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
2159+ )
2160+
2161+compiz_discover_tests (compiz_test_expo_wall_offset COVERAGE compiz_expo_wall_offset)
2162Index: ubuntu/plugins/expo/src/wall_offset/tests/test-expo-wall-offset.cpp
2163===================================================================
2164--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2165+++ ubuntu/plugins/expo/src/wall_offset/tests/test-expo-wall-offset.cpp 2012-09-12 22:20:43.280760497 +0800
2166@@ -0,0 +1,263 @@
2167+/*
2168+ * Copyright © 2012 Canonical Ltd.
2169+ *
2170+ * Permission to use, copy, modify, distribute, and sell this software
2171+ * and its documentation for any purpose is hereby granted without
2172+ * fee, provided that the above copyright notice appear in all copies
2173+ * and that both that copyright notice and this permission notice
2174+ * appear in supporting documentation, and that the name of
2175+ * Canonical Ltd. not be used in advertising or publicity pertaining to
2176+ * distribution of the software without specific, written prior permission.
2177+ * Canonical Ltd. makes no representations about the suitability of this
2178+ * software for any purpose. It is provided "as is" without express or
2179+ * implied warranty.
2180+ *
2181+ * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
2182+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
2183+ * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
2184+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
2185+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
2186+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
2187+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2188+ *
2189+ * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
2190+ */
2191+#include <tr1/tuple>
2192+#include <gtest/gtest.h>
2193+#include "wall-offset.h"
2194+
2195+using ::testing::WithParamInterface;
2196+using ::testing::ValuesIn;
2197+using ::testing::Combine;
2198+using ::testing::Range;
2199+
2200+class ExpoWallOffsetTest :
2201+ public ::testing::Test
2202+{
2203+ protected:
2204+
2205+ float offsetInWorldX;
2206+ float offsetInWorldY;
2207+ float worldScaleFactorX;
2208+ float worldScaleFactorY;
2209+};
2210+
2211+namespace
2212+{
2213+ const unsigned int nAnimationsBegin = 0;
2214+ const unsigned int nAnimationSteps = 20;
2215+
2216+ struct OffsetAnimationParameters
2217+ {
2218+ float offsetInWorldX;
2219+ float offsetInWorldY;
2220+ float worldScaleFactorX;
2221+ float worldScaleFactorY;
2222+ };
2223+
2224+ struct OffsetParameters
2225+ {
2226+ float offsetX;
2227+ float offsetY;
2228+ int vpSizeWidth;
2229+ int vpSizeHeight;
2230+ int screenWidth;
2231+ int screenHeight;
2232+ int outputWidth;
2233+ int outputHeight;
2234+ OffsetAnimationParameters animationParameters[20];
2235+ };
2236+
2237+ const OffsetParameters testingOffsetParameters[] =
2238+ {
2239+ {
2240+ 0,
2241+ 0,
2242+ 1,
2243+ 1,
2244+ 100,
2245+ 100,
2246+ 100,
2247+ 100,
2248+ {
2249+ { 0, 0, 1.0, 1.0 },
2250+ { 0, 0, 1.0, 1.0 },
2251+ { 0, 0, 1.0, 1.0 },
2252+ { 0, 0, 1.0, 1.0 },
2253+ { 0, 0, 1.0, 1.0 },
2254+ { 0, 0, 1.0, 1.0 },
2255+ { 0, 0, 1.0, 1.0 },
2256+ { 0, 0, 1.0, 1.0 },
2257+ { 0, 0, 1.0, 1.0 },
2258+ { 0, 0, 1.0, 1.0 },
2259+ { 0, 0, 1.0, 1.0 },
2260+ { 0, 0, 1.0, 1.0 },
2261+ { 0, 0, 1.0, 1.0 },
2262+ { 0, 0, 1.0, 1.0 },
2263+ { 0, 0, 1.0, 1.0 },
2264+ { 0, 0, 1.0, 1.0 },
2265+ { 0, 0, 1.0, 1.0 },
2266+ { 0, 0, 1.0, 1.0 },
2267+ { 0, 0, 1.0, 1.0 },
2268+ { 0, 0, 1.0, 1.0 }
2269+ }
2270+ },
2271+ /* Monitor 1280x800, Screen: 1280x800, Viewport Layout: 2x2, Offset: 32, 24 */
2272+ {
2273+ 32,
2274+ 24,
2275+ 2,
2276+ 2,
2277+ 1280,
2278+ 800,
2279+ 1280,
2280+ 800,
2281+ {
2282+ { 0, 0, 1, 1 },
2283+ { 0.0025000001769512892, 0.0011718750465661287, 0.99874997138977051, 0.99906247854232788 },
2284+ { 0.0050000003539025784, 0.0023437500931322575, 0.99750000238418579, 0.99812501668930054 },
2285+ { 0.0075000002980232239, 0.0035156251396983862, 0.9962499737739563, 0.99718749523162842 },
2286+ { 0.010000000707805157, 0.0046875001862645149, 0.99500000476837158, 0.9962499737739563 },
2287+ { 0.012500000186264515, 0.005859375, 0.99374997615814209, 0.99531251192092896 },
2288+ { 0.015000000596046448, 0.0070312502793967724, 0.99250000715255737, 0.99437499046325684 },
2289+ { 0.017500000074505806, 0.0082031246274709702, 0.99124997854232788, 0.99343752861022949 },
2290+ { 0.020000001415610313, 0.0093750003725290298, 0.99000000953674316, 0.99250000715255737 },
2291+ { 0.022499999031424522, 0.01054687425494194, 0.98874998092651367, 0.99156248569488525 },
2292+ { 0.02500000037252903, 0.01171875, 0.98750001192092896, 0.99062502384185791 },
2293+ { 0.027500001713633537, 0.01289062574505806, 0.98624998331069946, 0.98968750238418579 },
2294+ { 0.030000001192092896, 0.014062500558793545, 0.98500001430511475, 0.98874998092651367 },
2295+ { 0.032499998807907104, 0.015234374441206455, 0.98374998569488525, 0.98781251907348633 },
2296+ { 0.035000000149011612, 0.01640624925494194, 0.98250001668930054, 0.98687499761581421 },
2297+ { 0.037500001490116119, 0.017578125, 0.98124998807907104, 0.98593747615814209 },
2298+ { 0.040000002831220627, 0.01875000074505806, 0.98000001907348633, 0.98500001430511475 },
2299+ { 0.042500000447034836, 0.019921876490116119, 0.97874999046325684, 0.98406249284744263 },
2300+ { 0.044999998062849045, 0.021093748509883881, 0.97750002145767212, 0.98312497138977051 },
2301+ { 0.047499999403953552, 0.02226562425494194, 0.97624999284744263, 0.98218750953674316 }
2302+ }
2303+ },
2304+ /* Monitor 1280x1024, Screen: 2560x1024, Viewport Layout: 2x2, Offset: 32, 24 */
2305+ {
2306+ 32,
2307+ 24,
2308+ 2,
2309+ 2,
2310+ 2560,
2311+ 1024,
2312+ 1280,
2313+ 1024,
2314+ {
2315+ { 0, 0, 1, 1 },
2316+ { 0.0050000003539025784, 0.001500000013038516, 0.99874997138977051, 0.99906247854232788 },
2317+ { 0.010000000707805157, 0.0030000000260770321, 0.99750000238418579, 0.99812501668930054 },
2318+ { 0.015000000596046448, 0.0045000002719461918, 0.9962499737739563, 0.99718749523162842 },
2319+ { 0.020000001415610313, 0.0060000000521540642, 0.99500000476837158, 0.9962499737739563 },
2320+ { 0.02500000037252903, 0.0074999998323619366, 0.99374997615814209, 0.99531251192092896 },
2321+ { 0.030000001192092896, 0.0090000005438923836, 0.99250000715255737, 0.99437499046325684 },
2322+ { 0.035000000149011612, 0.010499999858438969, 0.99124997854232788, 0.99343752861022949 },
2323+ { 0.040000002831220627, 0.012000000104308128, 0.99000000953674316, 0.99250000715255737 },
2324+ { 0.044999998062849045, 0.013499999418854713, 0.98874998092651367, 0.99156248569488525 },
2325+ { 0.05000000074505806, 0.014999999664723873, 0.98750001192092896, 0.99062502384185791 },
2326+ { 0.055000003427267075, 0.016499999910593033, 0.98624998331069946, 0.98968750238418579 },
2327+ { 0.060000002384185791, 0.018000001087784767, 0.98500001430511475, 0.98874998092651367 },
2328+ { 0.064999997615814209, 0.019499998539686203, 0.98374998569488525, 0.98781251907348633 },
2329+ { 0.070000000298023224, 0.020999999716877937, 0.98250001668930054, 0.98687499761581421 },
2330+ { 0.075000002980232239, 0.022499999031424522, 0.98124998807907104, 0.98593747615814209 },
2331+ { 0.080000005662441254, 0.024000000208616257, 0.98000001907348633, 0.98500001430511475 },
2332+ { 0.085000000894069672, 0.025499999523162842, 0.97874999046325684, 0.98406249284744263 },
2333+ { 0.08999999612569809, 0.026999998837709427, 0.97750002145767212, 0.98312497138977051 },
2334+ { 0.094999998807907104, 0.028499998152256012, 0.97624999284744263, 0.98218750953674316 }
2335+ }
2336+ },
2337+ };
2338+
2339+ typedef std::tr1::tuple <OffsetParameters, unsigned int> AnimParam;
2340+}
2341+
2342+class ExpoWallOffsetTestAnimations :
2343+ public ExpoWallOffsetTest,
2344+ public ::testing::WithParamInterface <AnimParam>
2345+{
2346+ public:
2347+
2348+ void
2349+ RecordProperty (const char *name, float value)
2350+ {
2351+ ::testing::Message message;
2352+ message << value;
2353+ Test::RecordProperty (name, message.GetString ().c_str ());
2354+ }
2355+};
2356+
2357+TEST_P (ExpoWallOffsetTestAnimations, TestAnimationValues)
2358+{
2359+ const OffsetParameters &offset (std::tr1::get <0> (GetParam ()));
2360+ const unsigned int &index (std::tr1::get <1> (GetParam ()));
2361+
2362+ RecordProperty ("outputWidth", offset.outputWidth);
2363+ RecordProperty ("outputHeight", offset.outputHeight);
2364+ RecordProperty ("screenWidth", offset.screenWidth);
2365+ RecordProperty ("screenHeight", offset.screenHeight);
2366+ RecordProperty ("offsetX", offset.offsetX);
2367+ RecordProperty ("offsetY", offset.offsetY);
2368+
2369+ RecordProperty ("expected.offsetInWorldX", offset.animationParameters[index].offsetInWorldX);
2370+ RecordProperty ("expected.offsetInWorldY", offset.animationParameters[index].offsetInWorldY);
2371+ RecordProperty ("expected.worldScaleFactorX", offset.animationParameters[index].worldScaleFactorX);
2372+ RecordProperty ("expected.worldScaleFactorY", offset.animationParameters[index].worldScaleFactorY);
2373+
2374+ compiz::expo::calculateWallOffset (CompRect (0,
2375+ 0,
2376+ offset.outputWidth,
2377+ offset.outputWidth),
2378+ CompPoint (offset.offsetX,
2379+ offset.offsetY),
2380+ CompPoint (offset.vpSizeWidth,
2381+ offset.vpSizeHeight),
2382+ CompSize (offset.screenWidth,
2383+ offset.screenHeight),
2384+ offsetInWorldX,
2385+ offsetInWorldY,
2386+ worldScaleFactorX,
2387+ worldScaleFactorY,
2388+ index / static_cast <float> (nAnimationSteps));
2389+
2390+ RecordProperty ("offsetInWorldX", offsetInWorldX);
2391+ RecordProperty ("offsetInWorldY", offsetInWorldY);
2392+ RecordProperty ("worldScaleFactorX", worldScaleFactorX);
2393+ RecordProperty ("worldScaleFactorY", worldScaleFactorY);
2394+
2395+ EXPECT_EQ (offsetInWorldX, offset.animationParameters[index].offsetInWorldX);
2396+ EXPECT_EQ (offsetInWorldY, offset.animationParameters[index].offsetInWorldY);
2397+ EXPECT_EQ (worldScaleFactorX, offset.animationParameters[index].worldScaleFactorX);
2398+ EXPECT_EQ (worldScaleFactorY, offset.animationParameters[index].worldScaleFactorY);
2399+}
2400+
2401+TEST_F (ExpoWallOffsetTest, TestNoOffsetIfOutputIsNotOrigin)
2402+{
2403+ compiz::expo::calculateWallOffset (CompRect (1,
2404+ 1,
2405+ 100,
2406+ 100),
2407+ CompPoint (100,
2408+ 100),
2409+ CompPoint (1,
2410+ 1),
2411+ CompSize (100,
2412+ 100),
2413+ offsetInWorldX,
2414+ offsetInWorldY,
2415+ worldScaleFactorX,
2416+ worldScaleFactorY,
2417+ 1.0);
2418+
2419+ EXPECT_EQ (offsetInWorldX, 0.0f);
2420+ EXPECT_EQ (offsetInWorldY, 0.0f);
2421+ EXPECT_EQ (worldScaleFactorX, 1.0f);
2422+ EXPECT_EQ (worldScaleFactorY, 1.0f);
2423+}
2424+
2425+INSTANTIATE_TEST_CASE_P (ExpoAnimationOffsetTest,
2426+ ExpoWallOffsetTestAnimations,
2427+ Combine (ValuesIn (testingOffsetParameters),
2428+ Range (nAnimationsBegin,
2429+ nAnimationSteps)));
2430Index: ubuntu/plugins/expo/CMakeLists.txt
2431===================================================================
2432--- ubuntu.orig/plugins/expo/CMakeLists.txt 2012-09-08 17:26:40.599035911 +0800
2433+++ ubuntu/plugins/expo/CMakeLists.txt 2012-09-12 22:20:43.300760590 +0800
2434@@ -1,7 +1,16 @@
2435 find_package (Compiz REQUIRED)
2436 include (CompizPlugin)
2437
2438+set (COMPIZ_EXPO_PLUGIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
2439+
2440 add_subdirectory (src/click_threshold)
2441 include_directories (src/click_threshold/include)
2442+add_subdirectory (src/wall_offset)
2443+include_directories (src/wall_offset/include)
2444+add_subdirectory (src/windows_on_viewport)
2445+include_directories (src/windows_on_viewport/include)
2446
2447-compiz_plugin (expo PLUGINDEPS composite opengl LIBRARIES compiz_expo_click_threshold)
2448+compiz_plugin (expo PLUGINDEPS composite opengl LIBRARIES
2449+ compiz_expo_click_threshold
2450+ compiz_expo_wall_offset
2451+ compiz_expo_windows_on_viewport)
2452Index: ubuntu/plugins/expo/src/windows_on_viewport/CMakeLists.txt
2453===================================================================
2454--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2455+++ ubuntu/plugins/expo/src/windows_on_viewport/CMakeLists.txt 2012-09-12 22:20:43.300760590 +0800
2456@@ -0,0 +1,36 @@
2457+include_directories (
2458+ ${CMAKE_CURRENT_SOURCE_DIR}/include
2459+ ${CMAKE_CURRENT_SOURCE_DIR}/src
2460+ ${COMPIZ_INCLUDE_DIRS}
2461+ ${COMPIZ_EXPO_PLUGIN_SOURCE_DIR}
2462+ ${Boost_INCLUDE_DIRS}
2463+ ${GLIBMM_INCLUDE_DIRS}
2464+)
2465+
2466+link_directories (${GLIBMM_LIBRARY_DIRS} ${COMPIZ_LIBRARY_DIRS})
2467+
2468+set (
2469+ PRIVATE_HEADERS
2470+ ${CMAKE_CURRENT_SOURCE_DIR}/include/windows-on-viewport.h
2471+)
2472+
2473+set (
2474+ SRCS
2475+ ${CMAKE_CURRENT_SOURCE_DIR}/src/windows-on-viewport.cpp
2476+)
2477+
2478+add_library (
2479+ compiz_expo_windows_on_viewport STATIC
2480+ ${SRCS}
2481+ ${PRIVATE_HEADERS}
2482+)
2483+
2484+if (COMPIZ_BUILD_TESTING)
2485+ add_subdirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/tests )
2486+endif (COMPIZ_BUILD_TESTING)
2487+
2488+target_link_libraries (
2489+ compiz_expo_windows_on_viewport
2490+ compiz_window_geometry
2491+ compiz_core
2492+)
2493Index: ubuntu/plugins/expo/src/windows_on_viewport/include/windows-on-viewport.h
2494===================================================================
2495--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2496+++ ubuntu/plugins/expo/src/windows_on_viewport/include/windows-on-viewport.h 2012-09-12 22:31:06.807852402 +0800
2497@@ -0,0 +1,43 @@
2498+/**
2499+ * Copyright © 2012 Canonical Ltd.
2500+ *
2501+ * Authors:
2502+ * Sam Spilsbury <sam.spilsbury@canonical.com>
2503+ *
2504+ * This program is free software; you can redistribute it and/or
2505+ * modify it under the terms of the GNU General Public License
2506+ * as published by the Free Software Foundation; either version 2
2507+ * of the License, or (at your option) any later version.
2508+ *
2509+ * This program is distributed in the hope that it will be useful,
2510+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2511+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2512+ * GNU General Public License for more details.
2513+ *
2514+ **/
2515+#ifndef _COMPIZ_EXPO_WINDOWS_ON_VIEWPORT_H
2516+#define _COMPIZ_EXPO_WINDOWS_ON_VIEWPORT_H
2517+
2518+#include <core/point.h>
2519+#include <core/size.h>
2520+#include <core/rect.h>
2521+#include "client-list-generator.h"
2522+
2523+namespace compiz
2524+{
2525+ namespace expo
2526+ {
2527+ unsigned int countViewports (const CompSize &vpSize);
2528+
2529+ void fillInNewViewportActiveData (unsigned int vpCount,
2530+ std::vector <bool> &vpActive);
2531+
2532+ void activeViewportsForMembers (compiz::expo::ClientListGenerator &clientList,
2533+ const CompPoint &cursor,
2534+ const CompSize &vpSize,
2535+ const CompSize &screenSize,
2536+ std::vector <bool> &viewportActiveStates);
2537+ }
2538+}
2539+
2540+#endif
2541Index: ubuntu/plugins/expo/src/windows_on_viewport/src/windows-on-viewport.cpp
2542===================================================================
2543--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2544+++ ubuntu/plugins/expo/src/windows_on_viewport/src/windows-on-viewport.cpp 2012-09-12 22:20:43.300760590 +0800
2545@@ -0,0 +1,80 @@
2546+/**
2547+ * Copyright © 2012 Canonical Ltd.
2548+ *
2549+ * Authors:
2550+ * Sam Spilsbury <sam.spilsbury@canonical.com>
2551+ *
2552+ * This program is free software; you can redistribute it and/or
2553+ * modify it under the terms of the GNU General Public License
2554+ * as published by the Free Software Foundation; either version 2
2555+ * of the License, or (at your option) any later version.
2556+ *
2557+ * This program is distributed in the hope that it will be useful,
2558+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2559+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2560+ * GNU General Public License for more details.
2561+ *
2562+ **/
2563+#include <cstdio>
2564+#include <algorithm>
2565+#include "windows-on-viewport.h"
2566+#include "viewport-member-window.h"
2567+
2568+namespace compiz
2569+{
2570+ namespace expo
2571+ {
2572+ unsigned int countViewports (const CompSize &vpSize)
2573+ {
2574+ return vpSize.width () * vpSize.height ();
2575+ }
2576+
2577+ void fillInNewViewportActiveData (unsigned int vpCount,
2578+ std::vector <bool> &vpActive)
2579+ {
2580+ if (vpActive.size () < vpCount)
2581+ {
2582+ unsigned int last = vpActive.size () - 1;
2583+ vpActive.resize (vpCount);
2584+ for (unsigned int i = last; i < vpActive.size (); i++)
2585+ vpActive[i] = false;
2586+ }
2587+ }
2588+
2589+ void activeViewportsForMembers (compiz::expo::ClientListGenerator &clientList,
2590+ const CompPoint &cursor,
2591+ const CompSize &vpSize,
2592+ const CompSize &screenSize,
2593+ std::vector <bool> &viewportActiveStates)
2594+ {
2595+ compiz::expo::ViewportMemberWindow *vpMemberWindow = clientList.nextClient ();
2596+
2597+ fillInNewViewportActiveData (countViewports (vpSize), viewportActiveStates);
2598+ std::fill_n (viewportActiveStates.begin (), viewportActiveStates.size (), false);
2599+
2600+ while (vpMemberWindow)
2601+ {
2602+ if (!vpMemberWindow->isDesktopOrDock ())
2603+ {
2604+ CompPoint viewport;
2605+
2606+ /* If this is a dragged window, use the cursor position */
2607+ if (vpMemberWindow->dragged ())
2608+ viewport.set (cursor.x () / screenSize.width (),
2609+ cursor.y () / screenSize.height ());
2610+ else
2611+ {
2612+ const compiz::window::Geometry &geom = vpMemberWindow->absoluteGeometry ();
2613+ viewport.set (geom.centerX () / screenSize.width (),
2614+ geom.centerY () / screenSize.height ());
2615+ }
2616+
2617+ unsigned int vpIndex = vpSize.width () * viewport.y () + viewport.x ();
2618+ viewportActiveStates[vpIndex] = true;
2619+ }
2620+
2621+ vpMemberWindow = clientList.nextClient ();
2622+ }
2623+ }
2624+ }
2625+}
2626Index: ubuntu/plugins/expo/src/windows_on_viewport/tests/CMakeLists.txt
2627===================================================================
2628--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2629+++ ubuntu/plugins/expo/src/windows_on_viewport/tests/CMakeLists.txt 2012-09-12 22:20:43.300760590 +0800
2630@@ -0,0 +1,22 @@
2631+if (NOT GTEST_FOUND)
2632+ message ("Google Test not found - cannot build tests!")
2633+ set (COMPIZ_BUILD_TESTING OFF)
2634+endif (NOT GTEST_FOUND)
2635+
2636+include_directories (${GTEST_INCLUDE_DIRS})
2637+include_directories (${CMAKE_EXPO_PLUGIN_SOURCE_DIR})
2638+
2639+link_directories (${COMPIZ_LIBRARY_DIRS})
2640+
2641+add_executable (compiz_test_expo_windows_on_viewport
2642+ ${CMAKE_CURRENT_SOURCE_DIR}/test-windows-on-viewport.cpp)
2643+
2644+target_link_libraries (compiz_test_expo_windows_on_viewport
2645+ compiz_expo_windows_on_viewport
2646+ ${GTEST_BOTH_LIBRARIES}
2647+ ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
2648+ ${GMOCK_LIBRARY}
2649+ ${GMOCK_MAIN_LIBRARY}
2650+ )
2651+
2652+compiz_discover_tests (compiz_test_expo_windows_on_viewport COVERAGE compiz_expo_windows_on_viewport)
2653Index: ubuntu/plugins/expo/src/windows_on_viewport/tests/test-windows-on-viewport.cpp
2654===================================================================
2655--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2656+++ ubuntu/plugins/expo/src/windows_on_viewport/tests/test-windows-on-viewport.cpp 2012-09-12 22:20:43.304760606 +0800
2657@@ -0,0 +1,149 @@
2658+/*
2659+ * Copyright © 2012 Canonical Ltd.
2660+ *
2661+ * Permission to use, copy, modify, distribute, and sell this software
2662+ * and its documentation for any purpose is hereby granted without
2663+ * fee, provided that the above copyright notice appear in all copies
2664+ * and that both that copyright notice and this permission notice
2665+ * appear in supporting documentation, and that the name of
2666+ * Canonical Ltd. not be used in advertising or publicity pertaining to
2667+ * distribution of the software without specific, written prior permission.
2668+ * Canonical Ltd. makes no representations about the suitability of this
2669+ * software for any purpose. It is provided "as is" without express or
2670+ * implied warranty.
2671+ *
2672+ * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
2673+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
2674+ * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
2675+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
2676+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
2677+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
2678+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2679+ *
2680+ * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
2681+ */
2682+#include <gtest/gtest.h>
2683+#include <gmock/gmock.h>
2684+#include "windows-on-viewport.h"
2685+#include "client-list-generator.h"
2686+#include "viewport-member-window.h"
2687+
2688+using ::testing::InSequence;
2689+using ::testing::Return;
2690+using ::testing::ReturnNull;
2691+using ::testing::ReturnRef;
2692+
2693+namespace
2694+{
2695+ namespace ce = compiz::expo;
2696+
2697+ class MockViewportMemberWindow :
2698+ public ce::ViewportMemberWindow
2699+ {
2700+ public:
2701+
2702+ MOCK_CONST_METHOD0 (absoluteGeometry, const compiz::window::Geometry & ());
2703+ MOCK_CONST_METHOD0 (isDesktopOrDock, bool ());
2704+ MOCK_CONST_METHOD0 (dragged, bool ());
2705+ };
2706+
2707+ class MockClientListGenerator :
2708+ public ce::ClientListGenerator
2709+ {
2710+ public:
2711+
2712+ MOCK_METHOD0 (nextClient, ce::ViewportMemberWindow * ());
2713+ };
2714+}
2715+
2716+class ExpoWindowsOnViewportTest :
2717+ public ::testing::Test
2718+{
2719+ protected:
2720+
2721+ MockClientListGenerator mockClientListGenerator;
2722+ std::vector <bool> activeStates;
2723+};
2724+
2725+namespace
2726+{
2727+ const CompSize vpSize (2, 2);
2728+ const CompSize screenSize (1000, 1000);
2729+}
2730+
2731+TEST_F (ExpoWindowsOnViewportTest, TestNoDocksMakeViewportsActive)
2732+{
2733+ MockViewportMemberWindow mockViewportMembers[1];
2734+ InSequence s;
2735+
2736+ EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (Return (&mockViewportMembers[0]));
2737+ EXPECT_CALL (mockViewportMembers[0], isDesktopOrDock ()).WillOnce (Return (true));
2738+ EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (ReturnNull ());
2739+
2740+ compiz::expo::activeViewportsForMembers (mockClientListGenerator,
2741+ CompPoint (1, 1),
2742+ vpSize,
2743+ screenSize,
2744+ activeStates);
2745+
2746+ ASSERT_EQ (activeStates.size (), vpSize.width () * vpSize.height ());
2747+ EXPECT_EQ (activeStates[0], false);
2748+ EXPECT_EQ (activeStates[1], false);
2749+ EXPECT_EQ (activeStates[2], false);
2750+ EXPECT_EQ (activeStates[3], false);
2751+}
2752+
2753+TEST_F (ExpoWindowsOnViewportTest, TestGrabbedWindowUsesCursorPosition)
2754+{
2755+ MockViewportMemberWindow mockViewportMembers[1];
2756+ InSequence s;
2757+
2758+ EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (Return (&mockViewportMembers[0]));
2759+ EXPECT_CALL (mockViewportMembers[0], isDesktopOrDock ()).WillOnce (Return (false));
2760+ EXPECT_CALL (mockViewportMembers[0], dragged ()).WillOnce (Return (true));
2761+ EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (ReturnNull ());
2762+
2763+ compiz::expo::activeViewportsForMembers (mockClientListGenerator,
2764+ CompPoint (screenSize.width () * 1.5,
2765+ screenSize.height () * 1.5),
2766+ vpSize,
2767+ screenSize,
2768+ activeStates);
2769+
2770+ ASSERT_EQ (activeStates.size (), vpSize.width () * vpSize.height ());
2771+ EXPECT_EQ (activeStates[0], false);
2772+ EXPECT_EQ (activeStates[1], false);
2773+ EXPECT_EQ (activeStates[2], false);
2774+ EXPECT_EQ (activeStates[3], true); // 2,2 has the cursor of a dragged window
2775+}
2776+
2777+TEST_F (ExpoWindowsOnViewportTest, TestUngrabbedWindowUsesGeometry)
2778+{
2779+ MockViewportMemberWindow mockViewportMembers[1];
2780+ InSequence s;
2781+
2782+ compiz::window::Geometry vpMemberGeometry1 (screenSize.width () * 1.1,
2783+ screenSize.height () * 1.1,
2784+ screenSize.width () / 2,
2785+ screenSize.height () / 2,
2786+ 0);
2787+
2788+ EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (Return (&mockViewportMembers[0]));
2789+ EXPECT_CALL (mockViewportMembers[0], isDesktopOrDock ()).WillOnce (Return (false));
2790+ EXPECT_CALL (mockViewportMembers[0], dragged ()).WillOnce (Return (false));
2791+ EXPECT_CALL (mockViewportMembers[0], absoluteGeometry ()).WillOnce (ReturnRef (vpMemberGeometry1));
2792+ EXPECT_CALL (mockClientListGenerator, nextClient ()).WillOnce (ReturnNull ());
2793+
2794+ compiz::expo::activeViewportsForMembers (mockClientListGenerator,
2795+ CompPoint (screenSize.width () * 1.5,
2796+ screenSize.height () * 1.5),
2797+ vpSize,
2798+ screenSize,
2799+ activeStates);
2800+
2801+ ASSERT_EQ (activeStates.size (), vpSize.width () * vpSize.height ());
2802+ EXPECT_EQ (activeStates[0], false);
2803+ EXPECT_EQ (activeStates[1], false);
2804+ EXPECT_EQ (activeStates[2], false);
2805+ EXPECT_EQ (activeStates[3], true); // 2,2 has a window on it
2806+}
2807Index: ubuntu/plugins/expo/src/client-list-generator.h
2808===================================================================
2809--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2810+++ ubuntu/plugins/expo/src/client-list-generator.h 2012-09-12 22:20:43.304760606 +0800
2811@@ -0,0 +1,45 @@
2812+/*
2813+ * Copyright © 2012 Canonical Ltd.
2814+ *
2815+ * Permission to use, copy, modify, distribute, and sell this software
2816+ * and its documentation for any purpose is hereby granted without
2817+ * fee, provided that the above copyright notice appear in all copies
2818+ * and that both that copyright notice and this permission notice
2819+ * appear in supporting documentation, and that the name of
2820+ * Canonical Ltd. not be used in advertising or publicity pertaining to
2821+ * distribution of the software without specific, written prior permission.
2822+ * Canonical Ltd. makes no representations about the suitability of this
2823+ * software for any purpose. It is provided "as is" without express or
2824+ * implied warranty.
2825+ *
2826+ * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
2827+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
2828+ * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
2829+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
2830+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
2831+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
2832+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2833+ *
2834+ * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
2835+ */
2836+#ifndef _COMPIZ_EXPO_CLIENT_LIST_GENERATOR_H
2837+#define _COMPIZ_EXPO_CLIENT_LIST_GENERATOR_H
2838+
2839+namespace compiz
2840+{
2841+ namespace expo
2842+ {
2843+ class ViewportMemberWindow;
2844+
2845+ class ClientListGenerator
2846+ {
2847+ public:
2848+
2849+ virtual ~ClientListGenerator () {};
2850+ virtual ViewportMemberWindow * nextClient () = 0;
2851+ };
2852+ }
2853+}
2854+#endif
2855+
2856+
2857Index: ubuntu/plugins/expo/src/viewport-member-window.h
2858===================================================================
2859--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2860+++ ubuntu/plugins/expo/src/viewport-member-window.h 2012-09-12 22:20:43.304760606 +0800
2861@@ -0,0 +1,46 @@
2862+/*
2863+ * Copyright © 2012 Canonical Ltd.
2864+ *
2865+ * Permission to use, copy, modify, distribute, and sell this software
2866+ * and its documentation for any purpose is hereby granted without
2867+ * fee, provided that the above copyright notice appear in all copies
2868+ * and that both that copyright notice and this permission notice
2869+ * appear in supporting documentation, and that the name of
2870+ * Canonical Ltd. not be used in advertising or publicity pertaining to
2871+ * distribution of the software without specific, written prior permission.
2872+ * Canonical Ltd. makes no representations about the suitability of this
2873+ * software for any purpose. It is provided "as is" without express or
2874+ * implied warranty.
2875+ *
2876+ * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
2877+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
2878+ * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
2879+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
2880+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
2881+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
2882+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2883+ *
2884+ * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
2885+ */
2886+#ifndef _COMPIZ_EXPO_VIEWPORT_MEMBER_WINDOW_H
2887+#define _COMPIZ_EXPO_VIEWPORT_MEMBER_WINDOW_H
2888+
2889+#include <core/windowgeometry.h>
2890+
2891+namespace compiz
2892+{
2893+ namespace expo
2894+ {
2895+ class ViewportMemberWindow
2896+ {
2897+ public:
2898+
2899+ virtual ~ViewportMemberWindow () {};
2900+ virtual const compiz::window::Geometry & absoluteGeometry () const = 0;
2901+ virtual bool dragged () const = 0;
2902+ virtual bool isDesktopOrDock () const = 0;
2903+ };
2904+ }
2905+}
2906+
2907+#endif
02908
=== removed file 'debian/patches/100_expo_layout.patch'
--- debian/patches/100_expo_layout.patch 2012-09-10 13:50:30 +0000
+++ debian/patches/100_expo_layout.patch 1970-01-01 00:00:00 +0000
@@ -1,2903 +0,0 @@
1Index: ubuntu/plugins/expo/expo.xml.in
2===================================================================
3--- ubuntu.orig/plugins/expo/expo.xml.in 2012-09-08 11:51:32.971327571 +0800
4+++ ubuntu/plugins/expo/expo.xml.in 2012-09-08 11:51:33.103328227 +0800
5@@ -17,6 +17,7 @@
6 <plugin>wobbly</plugin>
7 <plugin>animation</plugin>
8 <plugin>wallpaper</plugin>
9+ <plugin>imgpng</plugin>
10 </relation>
11 </deps>
12 <options>
13@@ -25,7 +26,7 @@
14 <option name="expo_key" type="key">
15 <_short>Expo key</_short>
16 <_long>Engage wall expo mode key binding</_long>
17- <default>&lt;Super&gt;e</default>
18+ <default>&lt;Super&gt;s</default>
19 </option>
20 <option name="expo_button" type="button">
21 <_short>Expo button</_short>
22@@ -35,8 +36,6 @@
23 <option name="expo_edge" type="edge">
24 <_short>Expo edge</_short>
25 <_long>Engage wall expo mode edge binding</_long>
26- <default>
27- </default>
28 </option>
29 <option name="double_click_time" type="int">
30 <_short>Double click time</_short>
31@@ -79,7 +78,7 @@
32 <option name="zoom_time" type="float">
33 <_short>Zoom time</_short>
34 <_long>Duration of the zoomout animation</_long>
35- <default>0.5</default>
36+ <default>0.3</default>
37 <min>0.1</min>
38 <max>5.0</max>
39 <precision>0.1</precision>
40@@ -130,10 +129,24 @@
41 <_name>Curve</_name>
42 </desc>
43 </option>
44+ <option name="x_offset" type="int">
45+ <_short>X Space</_short>
46+ <_long> Left Side screen space of expo in pixels</_long>
47+ <min>-1680</min>
48+ <max>1680</max>
49+ <default>64</default>
50+ </option>
51+ <option name="y_offset" type="int">
52+ <_short>Y Space</_short>
53+ <_long> Top Side screen space of expo in pixels</_long>
54+ <min>-100</min>
55+ <max>100</max>
56+ <default>24</default>
57+ </option>
58 <option name="distance" type="float">
59 <_short>Distance</_short>
60 <_long>Distance of the expo wall</_long>
61- <default>0.0</default>
62+ <default>0.005</default>
63 <min>0.0</min>
64 <max>1.0</max>
65 <precision>0.01</precision>
66@@ -141,7 +154,7 @@
67 <option name="vp_distance" type="float">
68 <_short>Viewport distance</_short>
69 <_long>Distance between viewports</_long>
70- <default>0.10</default>
71+ <default>0.2</default>
72 <min>0.0</min>
73 <max>1.0</max>
74 <precision>0.01</precision>
75@@ -192,7 +205,7 @@
76 <option name="vp_brightness" type="float">
77 <_short>Brightness</_short>
78 <_long>Inactive viewport brightness.</_long>
79- <default>75.0</default>
80+ <default>40.0</default>
81 <min>0.0</min>
82 <max>100.0</max>
83 <precision>0.1</precision>
84@@ -200,18 +213,28 @@
85 <option name="vp_saturation" type="float">
86 <_short>Saturation</_short>
87 <_long>Inactive viewport saturation.</_long>
88- <default>100.0</default>
89+ <default>40.0</default>
90 <min>0.0</min>
91 <max>100.0</max>
92 <precision>0.1</precision>
93 </option>
94+ <option name="selected_color" type="color">
95+ <_short>Selected Color</_short>
96+ <_long>Color to use when highlighting the selected viewport</_long>
97+ <default>
98+ <red>0xfbfb</red>
99+ <green>0x8b8b</green>
100+ <blue>0x0</blue>
101+ <alpha>0xffff</alpha>
102+ </default>
103+ </option>
104 </subgroup>
105 <subgroup>
106 <short>Reflection</short>
107 <option name="reflection" type="bool">
108 <_short>Reflection</_short>
109 <_long>Show a reflection of the viewports on the ground</_long>
110- <default>true</default>
111+ <default>false</default>
112 </option>
113 <option name="ground_color1" type="color">
114 <_short>Ground color(near)</_short>
115@@ -244,7 +267,7 @@
116 <option name="scale_factor" type="float">
117 <_short>Reflection Scale</_short>
118 <_long>Scale factor of the expo wall reflection</_long>
119- <default>0.75</default>
120+ <default>1.0</default>
121 <min>0.0</min>
122 <max>2.0</max>
123 <precision>0.01</precision>
124Index: ubuntu/plugins/expo/src/expo.cpp
125===================================================================
126--- ubuntu.orig/plugins/expo/src/expo.cpp 2012-09-08 11:51:02.279175377 +0800
127+++ ubuntu/plugins/expo/src/expo.cpp 2012-09-08 15:18:15.744829608 +0800
128@@ -27,6 +27,8 @@
129
130 #include "expo.h"
131 #include "click-threshold.h"
132+#include "wall-offset.h"
133+#include "windows-on-viewport.h"
134 #include <math.h>
135 #ifndef USE_GLES
136 #include <GL/glu.h>
137@@ -73,11 +75,10 @@
138
139 if (dndState == DnDDuring || dndState == DnDStart)
140 {
141- if (dndWindow)
142+ if (dndWindows.size ())
143 finishWindowMovement ();
144
145 dndState = DnDNone;
146- dndWindow = NULL;
147
148 action->setState (action->state () & CompAction::StateInitButton);
149 cScreen->damageScreen ();
150@@ -113,7 +114,6 @@
151 clickTime = 0;
152
153 dndState = DnDNone;
154- dndWindow = NULL;
155
156 selectedVp = screen->vp ();
157 lastSelectedVp = screen->vp ();
158@@ -156,8 +156,8 @@
159 else
160 vpUpdateMode = VPUpdateMouseOver;
161
162- dndState = DnDNone;
163- dndWindow = NULL;
164+ dndState = DnDNone;
165+ dndWindows.clear ();
166
167 screen->removeAction (&optionGetDndButton ());
168 screen->removeAction (&optionGetExitButton ());
169@@ -202,6 +202,8 @@
170 if (!expoMode)
171 return false;
172
173+ lastSelectedVp = selectedVp;
174+
175 newX = selectedVp.x () + 1;
176 newY = selectedVp.y ();
177
178@@ -225,7 +227,7 @@
179 CompAction::State state,
180 CompOption::Vector& options)
181 {
182- int newX, newY;
183+ unsigned int newX, newY;
184 Window xid = CompOption::getIntOptionNamed (options, "root", 0);
185 if (xid != screen->root ())
186 return false;
187@@ -272,53 +274,39 @@
188 void
189 ExpoScreen::finishWindowMovement ()
190 {
191- dndWindow->syncPosition ();
192- dndWindow->ungrabNotify ();
193-
194- screen->moveViewport (screen->vp ().x () - selectedVp.x (),
195- screen->vp ().y () - selectedVp.y (), true);
196-
197- /* update saved window attributes in case we moved the
198- window to a new viewport */
199- if (dndWindow->saveMask () & CWX)
200- {
201- dndWindow->saveWc ().x = dndWindow->saveWc ().x % screen->width ();
202- if (dndWindow->saveWc ().x < 0)
203- dndWindow->saveWc ().x += screen->width ();
204- }
205- if (dndWindow->saveMask () & CWY)
206+ foreach (CompWindow *dndWindow, dndWindows)
207 {
208- dndWindow->saveWc ().y = dndWindow->saveWc ().y % screen->height ();
209- if (dndWindow->saveWc ().y < 0)
210- dndWindow->saveWc ().y += screen->height ();
211- }
212-
213- /* update window attibutes to make sure a moved maximized window
214- is properly snapped to the work area */
215- if (dndWindow->state () & MAXIMIZE_STATE)
216- dndWindow->updateAttributes (CompStackingUpdateModeNone);
217-
218-#if 0 /* FIXME: obsolete in the meantime? */
219- {
220- int lastOutput;
221- int centerX, centerY;
222+ if (dndWindow->grabbed ())
223+ {
224+ dndWindow->syncPosition ();
225+ dndWindow->ungrabNotify ();
226
227- /* make sure we snap to the correct output */
228- lastOutput = s->currentOutputDev;
229- centerX = (WIN_X (w) + WIN_W (w) / 2) % s->width;
230- if (centerX < 0)
231- centerX += s->width;
232- centerY = (WIN_Y (w) + WIN_H (w) / 2) % s->height;
233- if (centerY < 0)
234- centerY += s->height;
235+ screen->updateGrab (grabIndex, None);
236
237- s->currentOutputDev = outputDeviceForPoint (s, centerX, centerY);
238+ screen->moveViewport (screen->vp ().x () - selectedVp.x (),
239+ screen->vp ().y () - selectedVp.y (), true);
240
241- updateWindowAttributes (w, CompStackingUpdateModeNone);
242+ /* update saved window attributes in case we moved the
243+ window to a new viewport */
244+ if (dndWindow->saveMask () & CWX)
245+ {
246+ dndWindow->saveWc ().x = dndWindow->saveWc ().x % screen->width ();
247+ if (dndWindow->saveWc ().x < 0)
248+ dndWindow->saveWc ().x += screen->width ();
249+ }
250+ if (dndWindow->saveMask () & CWY)
251+ {
252+ dndWindow->saveWc ().y = dndWindow->saveWc ().y % screen->height ();
253+ if (dndWindow->saveWc ().y < 0)
254+ dndWindow->saveWc ().y += screen->height ();
255+ }
256
257- s->currentOutputDev = lastOutput;
258+ /* update window attibutes to make sure a moved maximized window
259+ is properly snapped to the work area */
260+ if (dndWindow->state () & MAXIMIZE_STATE)
261+ dndWindow->updateAttributes (CompStackingUpdateModeNone);
262+ }
263 }
264-#endif
265 }
266
267 void
268@@ -402,6 +390,80 @@
269 screen->handleEvent (event);
270 }
271
272+bool
273+ExpoWindow::dragged () const
274+{
275+ ExpoScreen *es = ExpoScreen::get (screen);
276+
277+ return std::find (es->dndWindows.begin (), es->dndWindows.end (), window) != es->dndWindows.end ();
278+}
279+
280+const compiz::window::Geometry &
281+ExpoWindow::absoluteGeometry () const
282+{
283+ const compiz::window::Geometry &relativeGeometry (window->geometry ());
284+ mAbsoluteGeometry.set ((screen->vp ().x () * screen->width ()) + relativeGeometry.x (),
285+ (screen->vp ().y () * screen->height ()) + relativeGeometry.y (),
286+ relativeGeometry.width (),
287+ relativeGeometry.height (),
288+ relativeGeometry.border ());
289+
290+ return mAbsoluteGeometry;
291+}
292+
293+bool
294+ExpoWindow::isDesktopOrDock () const
295+{
296+ return window->type () == CompWindowTypeDesktopMask ||
297+ window->type () == CompWindowTypeDockMask;
298+}
299+
300+namespace cei = compiz::expo::impl;
301+
302+cei::CompizClientListGenerator::CompizClientListGenerator (CompScreen *screen) :
303+ mScreen (screen),
304+ mClientList (&mScreen->clientList (true)),
305+ mClientListIterator (mClientList->begin ())
306+{
307+}
308+
309+compiz::expo::ViewportMemberWindow *
310+cei::CompizClientListGenerator::nextClient ()
311+{
312+ if (mClientListIterator == mClientList->end ())
313+ return NULL;
314+
315+ compiz::expo::ViewportMemberWindow *vpMemberWindow = ExpoWindow::get (*mClientListIterator);
316+
317+ ++mClientListIterator;
318+
319+ return vpMemberWindow;
320+}
321+
322+bool
323+ExpoScreen::windowsOnVp (compiz::expo::ClientListGenerator &clientList,
324+ CompPoint &p,
325+ const CompPoint &unprojectedCursor,
326+ const CompSize &screenSize,
327+ CompScreen *screen)
328+{
329+ return false;
330+}
331+
332+namespace
333+{
334+ void fillInNewViewportActivityData (unsigned int vpCount,
335+ std::vector <float> &vpActivity)
336+ {
337+ if (vpActivity.size () < vpCount)
338+ {
339+ vpActivity.resize (vpCount);
340+ foreach (float& activity, vpActivity)
341+ activity = 1.0f;
342+ }
343+ }
344+}
345+
346 void
347 ExpoScreen::preparePaint (int msSinceLastPaint)
348 {
349@@ -412,33 +474,42 @@
350 else
351 expoCam = MAX (0.0, expoCam - val);
352
353- if (expoCam)
354+ if (dndState == DnDDuring)
355 {
356- unsigned int i, j, vp;
357- unsigned int vpCount = screen->vpSize ().width () *
358- screen->vpSize ().height ();
359+ foreach (CompWindow *w, dndWindows)
360+ ExpoWindow::get (w)->dndOpacity = MIN (1.0, ExpoWindow::get (w)->dndOpacity + val);
361+ }
362+ else if (dndState == DnDNone)
363+ {
364+ CompWindowList::iterator it = dndWindows.begin ();
365
366- if (vpActivity.size () < vpCount)
367+ while (it != dndWindows.end ())
368 {
369- vpActivity.resize (vpCount);
370- foreach (float& activity, vpActivity)
371- activity = 1.0f;
372- }
373+ ExpoWindow::get ((*it))->dndOpacity = MAX (0.0, ExpoWindow::get ((*it))->dndOpacity - val);
374
375- for (i = 0; i < (unsigned int) screen->vpSize ().width (); i++)
376- {
377- for (j = 0; j < (unsigned int) screen->vpSize ().height (); j++)
378+ if (ExpoWindow::get ((*it))->dndOpacity <= 0.0f)
379 {
380- vp = (j * screen->vpSize ().width ()) + i;
381-
382- if (CompPoint (i, j) == selectedVp)
383- vpActivity[vp] = MIN (1.0, vpActivity[vp] + val);
384- else
385- vpActivity[vp] = MAX (0.0, vpActivity[vp] - val);
386+ dndWindows.erase (it);
387+ it = dndWindows.begin ();
388 }
389+ else
390+ it++;
391 }
392+ }
393
394- for (i = 0; i < 360; i++)
395+ if (expoCam)
396+ {
397+ unsigned int vpCount = compiz::expo::countViewports (screen->vpSize ());
398+
399+ fillInNewViewportActivityData (vpCount, vpActivity);
400+
401+ for (unsigned int i = 0; i < vpCount; i++)
402+ if (vpActive[i])
403+ vpActivity[i] = MIN (1.0, vpActivity[i] + val);
404+ else
405+ vpActivity[i] = MAX (0.0, vpActivity[i] - val);
406+
407+ for (int i = 0; i < 360; i++)
408 {
409 float fi = (float) i;
410
411@@ -509,6 +580,31 @@
412 cScreen->paint (outputs, mask);
413 }
414
415+namespace
416+{
417+ void updateViewportActiveStates (CompScreen *screen)
418+ {
419+ ExpoScreen *es = ExpoScreen::get (screen);
420+
421+ unsigned int vpCount = compiz::expo::countViewports (screen->vpSize ());
422+ fillInNewViewportActivityData (vpCount, es->vpActivity);
423+
424+ for (int i = 0; i < screen->vpSize ().width (); i++)
425+ {
426+ for (int j = 0; j < screen->vpSize ().height (); j++)
427+ {
428+ compiz::expo::impl::CompizClientListGenerator clientList (screen);
429+
430+ compiz::expo::activeViewportsForMembers (clientList,
431+ es->newCursor,
432+ screen->vpSize (),
433+ *screen,
434+ es->vpActive);
435+ }
436+ }
437+ }
438+}
439+
440 void
441 ExpoScreen::donePaint ()
442 {
443@@ -539,6 +635,11 @@
444 foreach (float& vp, vpActivity)
445 if (vp != 0.0 && vp != 1.0)
446 cScreen->damageScreen ();
447+
448+ foreach (CompWindow *w, dndWindows)
449+ if (ExpoWindow::get (w)->dndOpacity != 0.0f &&
450+ ExpoWindow::get (w)->dndOpacity != 1.0f)
451+ cScreen->damageScreen ();
452 }
453
454 if (grabIndex && expoCam <= 0.0f && !expoMode)
455@@ -553,10 +654,25 @@
456 switch (dndState) {
457 case DnDDuring:
458 {
459- if (dndWindow)
460- dndWindow->move (newCursor.x () - prevCursor.x (),
461- newCursor.y () - prevCursor.y (),
462- optionGetExpoImmediateMove ());
463+ if (dndWindows.size ())
464+ {
465+ foreach (CompWindow *dndWindow, dndWindows)
466+ {
467+ if (dndWindow->grabbed ())
468+ {
469+ ExpoWindow *ew = ExpoWindow::get (dndWindow);
470+
471+ /* No need to update twice */
472+ dndWindow->moveNotifySetEnabled (ew, false);
473+ dndWindow->move (newCursor.x () - prevCursor.x (),
474+ newCursor.y () - prevCursor.y (),
475+ optionGetExpoImmediateMove ());
476+ dndWindow->moveNotifySetEnabled (ew, true);
477+
478+ updateViewportActiveStates (screen);
479+ }
480+ }
481+ }
482
483 prevCursor = newCursor;
484 cScreen->damageScreen ();
485@@ -621,13 +737,13 @@
486 break;
487
488 dndState = DnDDuring;
489- dndWindow = w;
490+ dndWindows.push_back (w);
491
492 w->grabNotify (nx, ny, 0,
493 CompWindowGrabMoveMask |
494 CompWindowGrabButtonMask);
495
496- screen->updateGrab (grabIndex, dragCursor);
497+ screen->updateGrab (grabIndex, mMoveCursor);
498
499 w->raise ();
500 w->moveInputFocusTo ();
501@@ -762,6 +878,124 @@
502 }
503
504 void
505+ExpoScreen::paintViewport (const GLScreenPaintAttrib& attrib,
506+ const GLMatrix& transform,
507+ const CompRegion& region,
508+ CompOutput *output,
509+ unsigned int mask,
510+ CompPoint vpPos,
511+ GLVector &vpCamPos,
512+ bool reflection)
513+{
514+ GLMatrix sTransform (transform);
515+ GLMatrix sTransform2, sTransform3;
516+ float sx = (float) screen->width () / output->width ();
517+ float sy = (float) screen->height () / output->height ();
518+ float vpp;
519+ float progress = sigmoidProgress (expoCam);
520+ unsigned int vp;
521+ CompPoint vpSize (screen->vpSize ().width (), screen->vpSize ().height ());
522+
523+ const float gapY = optionGetVpDistance () * 0.1f * expoCam;
524+ const float gapX = optionGetVpDistance () * 0.1f * screen->height () /
525+ screen->width () * expoCam;
526+
527+ /* not sure this will work with different resolutions */
528+ sTransform.translate (0.0, MAX (0, vpPos.y ()) * -(sy + gapY), 0.0f);
529+
530+ sTransform2 = sTransform;
531+
532+ /* not sure this will work with different resolutions */
533+ if (optionGetDeform () != DeformCurve)
534+ sTransform2.translate (MAX (0, vpPos.x ()) * (sx + gapX), 0.0f, 0.0);
535+
536+
537+ if (optionGetExpoAnimation () == ExpoAnimationVortex)
538+ sTransform2.rotate (360 * expoCam,
539+ 0.0f, 1.0f, 2.0f * expoCam);
540+
541+ sTransform3 = sTransform2;
542+
543+ sTransform3.translate (output->x () / output->width (),
544+ -output->y () / output->height (), 0.0);
545+
546+ cScreen->setWindowPaintOffset ((screen->vp ().x () - vpPos.x ()) *
547+ screen->width (),
548+ (screen->vp ().y () - vpPos.y ()) *
549+ screen->height ());
550+
551+ vp = (vpPos.y () * vpSize.x ()) + vpPos.x ();
552+
553+ vpp = (expoCam * vpActivity[vp]) + (1 - expoCam);
554+ vpp = sigmoidProgress (vpp);
555+
556+ vpBrightness = vpp + ((1.0 - vpp) *
557+ optionGetVpBrightness () / 100.0);
558+ vpSaturation = vpp + ((1.0 - vpp) *
559+ optionGetVpSaturation () / 100.0);
560+
561+ paintingVp = vpPos;
562+
563+ if (optionGetDeform () == DeformCurve)
564+ {
565+ float rotateX;
566+
567+ sTransform3.translate (-vpCamPos[GLVector::x], 0.0f,
568+ curveDistance - DEFAULT_Z_CAMERA);
569+
570+ rotateX = -vpPos.x () + interpolate (((float) vpSize.x () / 2.0) - 0.5,
571+ screen->vp ().x (), progress);
572+
573+ sTransform3.rotate (curveAngle * rotateX, 0.0, 1.0, 0.0);
574+
575+ sTransform3.translate (vpCamPos[GLVector::x], 0.0f,
576+ DEFAULT_Z_CAMERA - curveDistance);
577+ }
578+
579+ if (paintingDndWindow)
580+ cScreen->getWindowPaintListSetEnabled (this, true);
581+ gScreen->glPaintTransformedOutput (attrib, sTransform3,
582+ screen->region (), output,
583+ mask);
584+
585+ if (paintingDndWindow)
586+ cScreen->getWindowPaintListSetEnabled (this, false);
587+
588+ if (!reflection && !paintingDndWindow)
589+ {
590+ int cursor[2] = { pointerX, pointerY };
591+
592+ invertTransformedVertex (attrib, sTransform3,
593+ output, cursor);
594+
595+ if ((cursor[0] > 0) && (cursor[0] < (int) screen->width ()) &&
596+ (cursor[1] > 0) && (cursor[1] < (int) screen->height ()))
597+ {
598+ newCursor.setX (vpPos.x () * screen->width () + cursor[0]);
599+ newCursor.setY (vpPos.y () * screen->height () + cursor[1]);
600+
601+ if (anyClick || dndState != DnDNone)
602+ {
603+ /* Used to save last viewport interaction was in */
604+ selectedVp = vpPos;
605+ anyClick = false;
606+ }
607+ }
608+ }
609+
610+ /* Calculate the current viewport size */
611+ int tl[2] = { 0, 0 };
612+ int br[2] = { screen->width (), screen->height () };
613+
614+ invertTransformedVertex (attrib, sTransform3, output, tl);
615+ invertTransformedVertex (attrib, sTransform3, output, br);
616+
617+ viewport_size = CompSize (br[0] - tl[0], br[1] - tl[1]);
618+
619+ cScreen->setWindowPaintOffset (0, 0);
620+}
621+
622+void
623 ExpoScreen::paintWall (const GLScreenPaintAttrib& attrib,
624 const GLMatrix& transform,
625 const CompRegion& region,
626@@ -772,13 +1006,11 @@
627 GLfloat vertexData[12];
628 GLushort colorData[16];
629 GLMatrix sTransformW, sTransform (transform);
630- int i, j, vp;
631 GLenum oldFilter = gScreen->textureFilter ();
632-
633- float sx = (float) screen->width () / output->width ();
634- float sy = (float) screen->height () / output->height ();
635+ float sx = (float) screen->width () / output->width ();
636+ float sy = (float) screen->height () / output->height ();
637 float biasZ;
638- float oScale, rotation = 0.0f, progress, vpp;
639+ float oScale, rotation = 0.0f, progress;
640 float aspectX = 1.0f, aspectY = 1.0f;
641 GLVector cam;
642 CompPoint vpSize (screen->vpSize ().width (), screen->vpSize ().height ());
643@@ -910,9 +1142,24 @@
644 sTransform.rotate (rotation, 0.0f, 1.0f, 0.0f);
645 sTransform.scale (aspectX, aspectY, 1.0);
646
647+ CompPoint offsetInScreenCoords (optionGetXOffset (),
648+ optionGetYOffset ());
649+ float offsetInWorldCoordX, offsetInWorldCoordY, worldScaleFactorX, worldScaleFactorY;
650+
651+ compiz::expo::calculateWallOffset (*output,
652+ offsetInScreenCoords,
653+ vpSize,
654+ *screen,
655+ offsetInWorldCoordX,
656+ offsetInWorldCoordY,
657+ worldScaleFactorX,
658+ worldScaleFactorY,
659+ sigmoidProgress (expoCam));
660+
661 /* translate expo to center */
662- sTransform.translate (vpSize.x () * sx * -0.5,
663- vpSize.y () * sy * 0.5, 0.0f);
664+ sTransform.translate (vpSize.x () * sx * -0.5 + offsetInWorldCoordX,
665+ vpSize.y () * sy * 0.5 - offsetInWorldCoordY, 0.0f);
666+ sTransform.scale (worldScaleFactorX, worldScaleFactorY, 1.0f);
667
668 if (optionGetDeform () == DeformCurve)
669 sTransform.translate ((vpSize.x () - 1) * sx * 0.5, 0.0, 0.0);
670@@ -936,90 +1183,29 @@
671
672 expoActive = true;
673
674- for (j = 0; j < vpSize.y (); j++)
675- {
676- GLMatrix sTransform2 (sTransform), sTransform3;
677-
678- for (i = 0; i < vpSize.x (); i++)
679- {
680- if (optionGetExpoAnimation () == ExpoAnimationVortex)
681- sTransform2.rotate (360 * expoCam,
682- 0.0f, 1.0f, 2.0f * expoCam);
683-
684- sTransform3 = sTransform2;
685-
686- sTransform3.translate (output->x () / output->width (),
687- -output->y () / output->height (), 0.0);
688-
689- cScreen->setWindowPaintOffset ((screen->vp ().x () - i) *
690- screen->width (),
691- (screen->vp ().y () - j) *
692- screen->height ());
693-
694- vp = (j * vpSize.x ()) + i;
695-
696- vpp = (expoCam * vpActivity[vp]) + (1 - expoCam);
697- vpp = sigmoidProgress (vpp);
698-
699- vpBrightness = vpp + ((1.0 - vpp) *
700- optionGetVpBrightness () / 100.0);
701- vpSaturation = vpp + ((1.0 - vpp) *
702- optionGetVpSaturation () / 100.0);
703+ for (int j = 0; j < screen->vpSize ().height (); j++)
704+ for (int i = 0; i < screen->vpSize().width (); i++)
705+ paintViewport (attrib, sTransform, region, output, mask, CompPoint (i, j), vpCamPos, reflection);
706
707- paintingVp.set (i, j);
708+ paintingDndWindow = true;
709
710- if (optionGetDeform () == DeformCurve)
711- {
712- float rotateX;
713-
714- sTransform3.translate (-vpCamPos[GLVector::x], 0.0f,
715- curveDistance - DEFAULT_Z_CAMERA);
716-
717- rotateX = -i + interpolate (((float) vpSize.x () / 2.0) - 0.5,
718- screen->vp ().x (), progress);
719-
720- sTransform3.rotate (curveAngle * rotateX, 0.0, 1.0, 0.0);
721-
722- sTransform3.translate (vpCamPos[GLVector::x], 0.0f,
723- DEFAULT_Z_CAMERA - curveDistance);
724- }
725-
726- gScreen->glPaintTransformedOutput (attrib, sTransform3,
727- screen->region (), output,
728- mask);
729-
730- if (!reflection)
731- {
732- int cursor[2] = { pointerX, pointerY };
733+ foreach (CompWindow *dndWindow, dndWindows)
734+ {
735+ CompPoint vp;
736
737- invertTransformedVertex (attrib, sTransform3,
738- output, cursor);
739+ screen->viewportForGeometry (dndWindow->geometry (), vp);
740
741- if ((cursor[0] > 0) && (cursor[0] < (int) screen->width ()) &&
742- (cursor[1] > 0) && (cursor[1] < (int) screen->height ()))
743- {
744- newCursor.setX (i * screen->width () + cursor[0]);
745- newCursor.setY (j * screen->height () + cursor[1]);
746+ while (vp.x () < 0)
747+ vp.setX (screen->vpSize ().width () + vp.x ());
748
749- if (anyClick || dndState != DnDNone)
750- {
751- /* Used to save last viewport interaction was in */
752- lastSelectedVp = selectedVp;
753- selectedVp.set (i, j);
754- anyClick = false;
755- }
756- }
757- }
758+ while (vp.y () < 0)
759+ vp.setY (screen->vpSize ().height () + vp.y ());
760
761- /* not sure this will work with different resolutions */
762- if (optionGetDeform () != DeformCurve)
763- sTransform2.translate (sx + gapX, 0.0f, 0.0);
764- }
765-
766- /* not sure this will work with different resolutions */
767- sTransform.translate (0.0, -(sy + gapY), 0.0f);
768+ paintViewport (attrib, sTransform, infiniteRegion, output, mask, vp, vpCamPos, reflection);
769 }
770
771+ paintingDndWindow = false;
772+
773 // glNormal3f (0.0, 0.0, -1.0);
774
775 if (reflection)
776@@ -1187,12 +1373,16 @@
777
778 expoActive = false;
779
780- cScreen->setWindowPaintOffset (0, 0);
781-
782 gScreen->glPaintTransformedOutputSetCurrentIndex (glPaintTransformedOutputIndex);
783 gScreen->setTextureFilter (oldFilter);
784 }
785
786+const CompWindowList &
787+ExpoScreen::getWindowPaintList ()
788+{
789+ return dndWindows;
790+}
791+
792 bool
793 ExpoScreen::glPaintOutput (const GLScreenPaintAttrib& attrib,
794 const GLMatrix& transform,
795@@ -1243,10 +1433,15 @@
796
797 bool
798 ExpoWindow::glDraw (const GLMatrix& transform,
799- const GLWindowPaintAttrib &attrib,
800+ const GLWindowPaintAttrib &attrib,
801 const CompRegion& region,
802 unsigned int mask)
803 {
804+ GLMatrix wTransform (transform);
805+ CompPoint vp;
806+
807+ screen->viewportForGeometry (window->geometry (), vp);
808+
809 if (eScreen->expoCam == 0.0f)
810 return gWindow->glDraw (transform, attrib, region, mask);
811
812@@ -1275,8 +1470,11 @@
813 }
814 }
815
816- eAttrib.brightness = attrib.brightness * eScreen->vpBrightness;
817- eAttrib.saturation = attrib.saturation * eScreen->vpSaturation;
818+ if ((vp == eScreen->paintingVp || window->onAllViewports ()) && !eScreen->paintingDndWindow)
819+ {
820+ eAttrib.brightness = attrib.brightness * eScreen->vpBrightness;
821+ eAttrib.saturation = attrib.saturation * eScreen->vpSaturation;
822+ }
823 }
824 else
825 {
826@@ -1287,7 +1485,79 @@
827 (1 - sigmoidProgress (eScreen->expoCam));
828 }
829
830- return gWindow->glDraw (transform, eAttrib, region, mask);
831+ bool status = gWindow->glDraw (transform, eAttrib, region, mask);
832+
833+ if (window->type () & CompWindowTypeDesktopMask)
834+ {
835+ /* We want to set the geometry of the polka dots to the window
836+ * region */
837+ CompRegion reg = CompRegion (0, 0, window->width (), window->height ());
838+
839+ foreach(GLTexture * tex, eScreen->polkadots_texture)
840+ {
841+ GLTexture::MatrixList matl;
842+ GLTexture::Matrix mat = tex->matrix();
843+ CompRegion paintRegion(region);
844+
845+ float xScale = screen->width () / (float) eScreen->viewport_size.width ();
846+ float yScale = screen->height () / (float) eScreen->viewport_size.height ();
847+
848+ mat.xx *= xScale;
849+ mat.yy *= yScale;
850+
851+ /* Not sure what this does, but it is necessary
852+ * (adjusts for scale?) */
853+ mat.x0 -= mat.xx * reg.boundingRect().x1();
854+ mat.y0 -= mat.yy * reg.boundingRect().y1();
855+
856+ matl.push_back(mat);
857+
858+ if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
859+ paintRegion = infiniteRegion;
860+
861+ /* Now allow plugins to mess with the geometry of our
862+ * dim (so we get a nice render for things like
863+ * wobbly etc etc */
864+ gWindow->vertexBuffer ()->begin ();
865+ gWindow->glAddGeometry (matl, reg, paintRegion);
866+ if (gWindow->vertexBuffer ()->end ())
867+ {
868+ unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex ();
869+ eAttrib.opacity = attrib.opacity * (((1.0 - eScreen->vpBrightness) + (1.0 - eScreen->vpSaturation) / 2.0));
870+ /* Texture rendering set-up */
871+ //eScreen->gScreen->setTexEnvMode(GL_MODULATE);
872+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
873+ /* Draw the dim texture with all of it's modified
874+ * geometry glory */
875+ gWindow->glDrawTextureSetCurrentIndex (MAXSHORT);
876+ gWindow->glDrawTexture (tex, transform, eAttrib, mask |
877+ PAINT_WINDOW_BLEND_MASK |
878+ PAINT_WINDOW_TRANSLUCENT_MASK |
879+ PAINT_WINDOW_TRANSFORMED_MASK);
880+ gWindow->glDrawTextureSetCurrentIndex (glDrawTextureIndex);
881+ /* Texture rendering tear-down */
882+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
883+ eScreen->gScreen->setTexEnvMode (GL_REPLACE);
884+ }
885+ }
886+
887+ /* Paint the outline */
888+ if (mGlowQuads && eScreen->paintingVp == eScreen->selectedVp)
889+ {
890+ if (region.numRects ())
891+ {
892+ /* reset geometry and paint */
893+ gWindow->vertexBuffer ()->begin ();
894+ gWindow->vertexBuffer ()->end ();
895+
896+ paintGlow (transform, attrib, infiniteRegion, mask);
897+ }
898+ }
899+
900+ }
901+
902+ return status;
903+
904 }
905
906 #define EXPO_GRID_SIZE 100
907@@ -1425,11 +1695,17 @@
908 const CompRegion& region,
909 unsigned int mask)
910 {
911+ GLMatrix wTransform (transform);
912+ GLWindowPaintAttrib wAttrib (attrib);
913+ CompRegion clip (region);
914+
915 if (eScreen->expoActive)
916 {
917 float opacity = 1.0;
918 bool hide;
919 bool zoomAnim;
920+ CompPoint vp;
921+ screen->viewportForGeometry (window->geometry (), vp);
922
923 zoomAnim = eScreen->optionGetExpoAnimation () ==
924 ExpoScreen::ExpoAnimationZoom;
925@@ -1458,9 +1734,47 @@
926
927 if (opacity <= 0)
928 mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
929+ else
930+ wAttrib.opacity = wAttrib.opacity * opacity;
931+
932+ /* Stretch maximized windows a little so that you don't
933+ * have an awkward gap */
934+
935+ if (window->state () & MAXIMIZE_STATE &&
936+ !window->border ().top)
937+ {
938+ CompOutput *o = &screen->outputDevs ()[screen->outputDeviceForGeometry(window->geometry())];
939+ float yS = 1.0 + ((o->height () / (float) window->height ()) - 1.0f) * sigmoidProgress (eScreen->expoCam);
940+ float xS = 1.0 + ((o->width () / (float) window->width ()) - 1.0f) * sigmoidProgress (eScreen->expoCam);
941+ wTransform.translate (window->x () + window->width (),
942+ window->y () + window->height (),
943+ 0.0f);
944+ wTransform.scale (xS, yS, 1.0f);
945+ wTransform.translate (-(window->x () + window->width ()),
946+ -(window->y () + window->height ()),
947+ 0.0f);
948+
949+ if (eScreen->paintingVp != vp)
950+ mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
951+
952+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
953+ }
954+
955+ if (std::find (eScreen->dndWindows.begin(), eScreen->dndWindows.end (), window) != eScreen->dndWindows.end ())
956+ {
957+ if (!eScreen->paintingDndWindow)
958+ {
959+ mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
960+ }
961+ else
962+ {
963+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
964+ clip = infiniteRegion;
965+ }
966+ }
967 }
968
969- return gWindow->glPaint (attrib, transform, region, mask);
970+ return gWindow->glPaint (wAttrib, wTransform, clip, mask);
971 }
972
973 bool
974@@ -1489,7 +1803,7 @@
975 expoActive (false),
976 expoMode (false),
977 dndState (DnDNone),
978- dndWindow (NULL),
979+ dndWindows (0),
980 origVp (s->vp ()),
981 selectedVp (s->vp ()),
982 lastSelectedVp (s->vp ()),
983@@ -1497,14 +1811,21 @@
984 clickTime (0),
985 doubleClick (false),
986 vpNormals (360 * 3),
987- grabIndex (0)
988-{
989+ grabIndex (0),
990+ paintingDndWindow (false),
991+ mGlowTextureProperties (&glowTextureProperties)
992+{
993+ CompString fname;
994+ CompString pname = "expo";
995+ CompSize size;
996+
997+
998 leftKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Left"));
999 rightKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Right"));
1000 upKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Up"));
1001 downKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Down"));
1002
1003- dragCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
1004+ mMoveCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
1005
1006 EXPOINITBIND (ExpoKey, doExpo);
1007 EXPOTERMBIND (ExpoKey, termExpo);
1008@@ -1522,12 +1843,58 @@
1009 ScreenInterface::setHandler (screen, false);
1010 CompositeScreenInterface::setHandler (cScreen, false);
1011 GLScreenInterface::setHandler (gScreen, false);
1012+
1013+ outline_texture = GLTexture::imageDataToTexture (mGlowTextureProperties->textureData,
1014+ CompSize (mGlowTextureProperties->textureSize,
1015+ mGlowTextureProperties->textureSize),
1016+ GL_RGBA, GL_UNSIGNED_BYTE);
1017+ fname = "texture_tile.png";
1018+ polkadots_texture = GLTexture::readImageToTexture (fname, pname, polkadots_texture_size);
1019+
1020+ if (polkadots_texture.empty ())
1021+ compLogMessage ("expo", CompLogLevelWarn, "failed to bind image to texture");
1022+ else
1023+ {
1024+ foreach (GLTexture *tex, polkadots_texture)
1025+ {
1026+ tex->enable (GLTexture::Good);
1027+ glTexParameteri (tex->target (), GL_TEXTURE_WRAP_S, GL_REPEAT);
1028+ glTexParameteri (tex->target (), GL_TEXTURE_WRAP_T, GL_REPEAT);
1029+ tex->disable ();
1030+ }
1031+ }
1032 }
1033
1034 ExpoScreen::~ExpoScreen ()
1035 {
1036- if (dragCursor != None)
1037- XFreeCursor (screen->dpy (), dragCursor);
1038+ if (mMoveCursor)
1039+ XFreeCursor (screen->dpy (), mMoveCursor);
1040+}
1041+
1042+void
1043+ExpoWindow::moveNotify (int dx, int dy, bool immediate)
1044+{
1045+ window->moveNotify (dx, dy, immediate);
1046+
1047+ if (!ExpoScreen::get (screen)->expoActive)
1048+ return;
1049+
1050+ updateViewportActiveStates (screen);
1051+}
1052+
1053+void
1054+ExpoWindow::resizeNotify(int dx, int dy, int dw, int dh)
1055+{
1056+ window->resizeNotify (dx, dy, dw, dh);
1057+
1058+ /* mGlowQuads contains positional info, so we need to recalc that */
1059+ if (mGlowQuads)
1060+ {
1061+ /* FIXME: we need to find a more multitexture friendly way
1062+ * of doing this */
1063+ GLTexture::Matrix tMat = eScreen->outline_texture.at (0)->matrix ();
1064+ computeGlowQuads (&tMat);
1065+ }
1066 }
1067
1068 ExpoWindow::ExpoWindow (CompWindow *w) :
1069@@ -1535,10 +1902,28 @@
1070 window (w),
1071 cWindow (CompositeWindow::get (w)),
1072 gWindow (GLWindow::get (w)),
1073- eScreen (ExpoScreen::get (screen))
1074+ eScreen (ExpoScreen::get (screen)),
1075+ dndOpacity (0.0f),
1076+ mGlowQuads (NULL)
1077 {
1078 CompositeWindowInterface::setHandler (cWindow, false);
1079 GLWindowInterface::setHandler (gWindow, false);
1080+ WindowInterface::setHandler (window, true);
1081+
1082+ if (window->type () & CompWindowTypeDesktopMask)
1083+ {
1084+ foreach (GLTexture *tex, eScreen->outline_texture)
1085+ {
1086+ GLTexture::Matrix mat = tex->matrix ();
1087+ computeGlowQuads (&mat);
1088+ }
1089+ }
1090+}
1091+
1092+ExpoWindow::~ExpoWindow ()
1093+{
1094+ eScreen->dndWindows.remove (window);
1095+ computeGlowQuads (NULL);
1096 }
1097
1098 bool
1099Index: ubuntu/plugins/expo/src/expo.h
1100===================================================================
1101--- ubuntu.orig/plugins/expo/src/expo.h 2012-09-08 11:51:02.279175377 +0800
1102+++ ubuntu/plugins/expo/src/expo.h 2012-09-08 14:07:47.219861486 +0800
1103@@ -30,6 +30,44 @@
1104 #include <opengl/opengl.h>
1105
1106 #include "expo_options.h"
1107+#include "glow.h"
1108+#include "viewport-member-window.h"
1109+#include "client-list-generator.h"
1110+
1111+#define WIN_REAL_X(w) (w->x () - w->border ().left)
1112+#define WIN_REAL_Y(w) (w->y () - w->border ().top)
1113+#define WIN_REAL_WIDTH(w) (w->width () + 2 * w->geometry ().border () + \
1114+ w->border ().left + w->border ().right)
1115+#define WIN_REAL_HEIGHT(w) (w->height () + 2 * w->geometry ().border () + \
1116+ w->border ().top + w->border ().bottom)
1117+
1118+namespace compiz
1119+{
1120+ namespace expo
1121+ {
1122+ namespace impl
1123+ {
1124+ namespace ce = compiz::expo;
1125+
1126+ class CompizClientListGenerator :
1127+ public ce::ClientListGenerator
1128+ {
1129+ public:
1130+
1131+ CompizClientListGenerator (CompScreen *screen);
1132+
1133+ void refreshClientList ();
1134+ ViewportMemberWindow * nextClient ();
1135+
1136+ private:
1137+
1138+ CompScreen *mScreen;
1139+ const CompWindowVector *mClientList;
1140+ CompWindowVector::const_iterator mClientListIterator;
1141+ };
1142+ }
1143+ }
1144+}
1145
1146 class ExpoScreen :
1147 public ScreenInterface,
1148@@ -51,8 +89,10 @@
1149 bool glPaintOutput (const GLScreenPaintAttrib&, const GLMatrix&,
1150 const CompRegion&, CompOutput *, unsigned int);
1151 void glPaintTransformedOutput (const GLScreenPaintAttrib&,
1152- const GLMatrix&, const CompRegion&,
1153- CompOutput *, unsigned int);
1154+ const GLMatrix&, const CompRegion&,
1155+ CompOutput*, unsigned int);
1156+
1157+ const CompWindowList & getWindowPaintList ();
1158
1159 bool dndInit (CompAction *, CompAction::State, CompOption::Vector&);
1160 bool dndFini (CompAction *, CompAction::State, CompOption::Vector&);
1161@@ -62,6 +102,8 @@
1162 bool nextVp (CompAction *, CompAction::State, CompOption::Vector&);
1163 bool prevVp (CompAction *, CompAction::State, CompOption::Vector&);
1164
1165+ CompPoint currentViewport ();
1166+
1167 typedef enum {
1168 DnDNone,
1169 DnDDuring,
1170@@ -82,7 +124,7 @@
1171 bool expoMode;
1172
1173 DnDState dndState;
1174- CompWindow *dndWindow;
1175+ CompWindowList dndWindows;
1176
1177 CompPoint prevCursor;
1178 CompPoint newCursor;
1179@@ -94,6 +136,7 @@
1180 CompPoint paintingVp;
1181
1182 std::vector<float> vpActivity;
1183+ std::vector<bool> vpActive;
1184 float vpBrightness;
1185 float vpSaturation;
1186
1187@@ -113,6 +156,17 @@
1188
1189 CompScreen::GrabHandle grabIndex;
1190
1191+ GLTexture::List polkadots_texture;
1192+ CompSize polkadots_texture_size;
1193+ CompSize viewport_size;
1194+
1195+ GLTexture::List outline_texture;
1196+ CompSize outline_texture_size;
1197+
1198+ bool paintingDndWindow;
1199+
1200+ const GlowTextureProperties *mGlowTextureProperties;
1201+
1202 private:
1203 void moveFocusViewport (int, int);
1204 void finishWindowMovement ();
1205@@ -123,24 +177,45 @@
1206 void paintWall (const GLScreenPaintAttrib&, const GLMatrix&,
1207 const CompRegion&, CompOutput *, unsigned int, bool);
1208
1209+ void paintViewport (const GLScreenPaintAttrib& attrib,
1210+ const GLMatrix& transform,
1211+ const CompRegion& region,
1212+ CompOutput *output,
1213+ unsigned int mask,
1214+ CompPoint vpPos,
1215+ GLVector &vpCamPos,
1216+ bool reflection);
1217+
1218+ bool windowsOnVp (compiz::expo::ClientListGenerator &clientList,
1219+ CompPoint &p,
1220+ const CompPoint &unprojectedCursor,
1221+ const CompSize &screenSize,
1222+ CompScreen *screen);
1223+
1224 KeyCode leftKey;
1225 KeyCode rightKey;
1226 KeyCode upKey;
1227 KeyCode downKey;
1228
1229- Cursor dragCursor;
1230+ Cursor mMoveCursor;
1231 };
1232
1233 class ExpoWindow :
1234+ public compiz::expo::ViewportMemberWindow,
1235 public CompositeWindowInterface,
1236 public GLWindowInterface,
1237+ public WindowInterface,
1238 public PluginClassHandler<ExpoWindow, CompWindow>
1239 {
1240 public:
1241 ExpoWindow (CompWindow *);
1242+ ~ExpoWindow ();
1243
1244 bool damageRect (bool, const CompRect&);
1245
1246+ void resizeNotify (int dx, int dy, int dw, int dh);
1247+ void moveNotify (int dx, int dy, bool immediate);
1248+
1249 bool glDraw (const GLMatrix&, const GLWindowPaintAttrib&,
1250 const CompRegion&, unsigned int);
1251 bool glPaint (const GLWindowPaintAttrib&, const GLMatrix&,
1252@@ -150,11 +225,31 @@
1253 unsigned int, unsigned int);
1254 void glDrawTexture (GLTexture*, const GLMatrix&,
1255 const GLWindowPaintAttrib&, unsigned int);
1256+ void
1257+ paintGlow (const GLMatrix &transform,
1258+ const GLWindowPaintAttrib &attrib,
1259+ const CompRegion &paintRegion,
1260+ unsigned int mask);
1261+
1262+ void
1263+ computeGlowQuads (GLTexture::Matrix *matrix);
1264
1265 CompWindow *window;
1266 CompositeWindow *cWindow;
1267 GLWindow *gWindow;
1268 ExpoScreen *eScreen;
1269+
1270+ float dndOpacity;
1271+
1272+ GlowQuad *mGlowQuads;
1273+
1274+ private:
1275+
1276+ bool isDesktopOrDock () const;
1277+ bool dragged () const;
1278+ const compiz::window::Geometry & absoluteGeometry () const;
1279+
1280+ mutable compiz::window::Geometry mAbsoluteGeometry;
1281 };
1282
1283 class ExpoPluginVTable :
1284Index: ubuntu/plugins/expo/src/glow.cpp
1285===================================================================
1286--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1287+++ ubuntu/plugins/expo/src/glow.cpp 2012-09-08 11:51:33.107328243 +0800
1288@@ -0,0 +1,429 @@
1289+/**
1290+ *
1291+ * Compiz group plugin
1292+ *
1293+ * glow.cpp
1294+ *
1295+ * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen,
1296+ * Danny Baumann, Sam Spilsbury
1297+ * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com>
1298+ * Roi Cohen <roico.beryl@gmail.com>
1299+ * Danny Baumann <maniac@opencompositing.org>
1300+ * Sam Spilsbury <smspillaz@gmail.com>
1301+ *
1302+ *
1303+ * This program is free software; you can redistribute it and/or
1304+ * modify it under the terms of the GNU General Public License
1305+ * as published by the Free Software Foundation; either version 2
1306+ * of the License, or (at your option) any later version.
1307+ *
1308+ * This program is distributed in the hope that it will be useful,
1309+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1310+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1311+ * GNU General Public License for more details.
1312+ *
1313+ **/
1314+
1315+#include "expo.h"
1316+#include "group_glow.h"
1317+
1318+const GlowTextureProperties glowTextureProperties = {
1319+ /* GlowTextureRectangular */
1320+ glowTexRect, 32, 21
1321+};
1322+
1323+/*
1324+ * GroupWindow::paintGlow
1325+ *
1326+ * Takes our glow texture, stretches the appropriate positions in the glow texture,
1327+ * adds those geometries (so plugins like wobby and deform this texture correctly)
1328+ * and then draws the glow texture with this geometry (plugins like wobbly and friends
1329+ * will automatically deform the texture based on our set geometry)
1330+ */
1331+
1332+void
1333+ExpoWindow::paintGlow (const GLMatrix &transform,
1334+ const GLWindowPaintAttrib &attrib,
1335+ const CompRegion &paintRegion,
1336+ unsigned int mask)
1337+{
1338+ CompRegion reg;
1339+ int i;
1340+ GLushort colorData[4];
1341+ const GLushort *selColorData = ExpoScreen::get (screen)->optionGetSelectedColor ();
1342+ float alpha = (float) selColorData[3] / 65535.0f;
1343+
1344+ /* Premultiply color */
1345+ colorData[0] = selColorData[0] * alpha;
1346+ colorData[1] = selColorData[1] * alpha;
1347+ colorData[2] = selColorData[2] * alpha;
1348+ colorData[3] = selColorData[3];
1349+
1350+ gWindow->vertexBuffer ()->begin ();
1351+
1352+ /* There are 8 glow parts of the glow texture which we wish to paint
1353+ * separately with different transformations
1354+ */
1355+ for (i = 0; i < NUM_GLOWQUADS; i++)
1356+ {
1357+ /* Using precalculated quads here */
1358+ reg = CompRegion (mGlowQuads[i].mBox);
1359+
1360+ if (reg.boundingRect ().x1 () < reg.boundingRect ().x2 () &&
1361+ reg.boundingRect ().y1 () < reg.boundingRect ().y2 ())
1362+ {
1363+ GLTexture::MatrixList matl;
1364+ reg = CompRegion (reg.boundingRect ().x1 (),
1365+ reg.boundingRect ().y1 (),
1366+ reg.boundingRect ().width (),
1367+ reg.boundingRect ().height ());
1368+
1369+ matl.push_back (mGlowQuads[i].mMatrix);
1370+ /* Add color data for all 6 vertices of the quad */
1371+ for (int n = 0; n < 6; n++)
1372+ gWindow->vertexBuffer ()->addColors (1, colorData);
1373+ gWindow->glAddGeometry (matl, reg, paintRegion);
1374+ }
1375+ }
1376+
1377+ if (gWindow->vertexBuffer ()->end ())
1378+ {
1379+ //GLScreen::get (screen)->setTexEnvMode (GL_MODULATE);
1380+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1381+
1382+ /* we use PAINT_WINDOW_TRANSFORMED_MASK here to force
1383+ the usage of a good texture filter */
1384+ foreach (GLTexture *tex, ExpoScreen::get (screen)->outline_texture)
1385+ {
1386+ gWindow->glDrawTexture (tex, transform, attrib, mask |
1387+ PAINT_WINDOW_BLEND_MASK |
1388+ PAINT_WINDOW_TRANSLUCENT_MASK |
1389+ PAINT_WINDOW_TRANSFORMED_MASK);
1390+ }
1391+
1392+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1393+ GLScreen::get (screen)->setTexEnvMode (GL_REPLACE);
1394+ }
1395+}
1396+
1397+/*
1398+ * ExpoWindow::computeGlowQuads
1399+ *
1400+ * This function computures the matrix transformation required for each
1401+ * part of the glow texture which we wish to stretch to some rectangular
1402+ * dimentions
1403+ *
1404+ * There are eight quads different parts of the texture which we wish to
1405+ * paint here, the 4 sides and four corners, eg:
1406+ *
1407+ * ------------------
1408+ * | 1 | 4 | 6 |
1409+ * ------------- ------------------
1410+ * | 1 | 4 | 6 | | | | |
1411+ * ------------- | | | |
1412+ * | 2 | n | 7 | -> | 2 | n | 7 |
1413+ * ------------- | | | |
1414+ * | 3 | 5 | 8 | | | | |
1415+ * ------------- ------------------
1416+ * | 3 | 5 | 8 |
1417+ * ------------------
1418+ *
1419+ * In this example here, 2, 4, 5 and 7 are stretched, and the matrices for
1420+ * each quad rect adjusted accordingly for it's size compared to the original
1421+ * texture size.
1422+ *
1423+ * When we are adjusting the matrices here, the initial size of each corner has
1424+ * a size of of "1.0f", so according to 2x2 matrix rules,
1425+ * the scale factor is the inverse of the size of the glow (which explains
1426+ * while you will see here that matrix->xx is (1 / glowSize)
1427+ * where glowSize is the size the user specifies they want their glow to extend.
1428+ * (likewise, matrix->yy is adjusted similarly for corners and for top/bottom)
1429+ *
1430+ * matrix->x0 and matrix->y0 here are set to be the top left edge of the rect
1431+ * adjusted by the matrix scale factor (matrix->xx and matrix->yy)
1432+ *
1433+ */
1434+void
1435+ExpoWindow::computeGlowQuads (GLTexture::Matrix *matrix)
1436+{
1437+ CompRect *box;
1438+ int x1, x2, y1, y2;
1439+ GLTexture::Matrix *quadMatrix;
1440+ int glowSize, glowOffset;
1441+ CompWindow *w = window;
1442+
1443+ /* Passing NULL to this function frees the glow quads
1444+ * (so the window is not painted with glow) */
1445+
1446+ if (matrix)
1447+ {
1448+ if (!mGlowQuads)
1449+ mGlowQuads = new GlowQuad[NUM_GLOWQUADS];
1450+ if (!mGlowQuads)
1451+ return;
1452+ }
1453+ else
1454+ {
1455+ if (mGlowQuads)
1456+ {
1457+ delete[] mGlowQuads;
1458+ mGlowQuads = NULL;
1459+ }
1460+ return;
1461+ }
1462+
1463+ glowSize = 48;
1464+ glowOffset = (glowSize * ExpoScreen::get (screen)->mGlowTextureProperties->glowOffset /
1465+ ExpoScreen::get (screen)->mGlowTextureProperties->textureSize) + 1;
1466+
1467+ /* Top left corner */
1468+ box = &mGlowQuads[GLOWQUAD_TOPLEFT].mBox;
1469+ mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix = *matrix;
1470+ quadMatrix = &mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix;
1471+
1472+ /* Set the desired rect dimentions
1473+ * for the part of the glow we are painting */
1474+
1475+ x1 = WIN_REAL_X (w) - glowSize + glowOffset;
1476+ y1 = WIN_REAL_Y (w) - glowSize + glowOffset;
1477+
1478+ /* 2x2 Matrix here, adjust both x and y scale factors
1479+ * and the x and y position
1480+ *
1481+ * Scaling both parts of the texture in a positive direction
1482+ * here (left to right top to bottom)
1483+ *
1484+ * The base position (x0 and y0) here requires us to move backwards
1485+ * on the x and y dimentions by the calculated rect dimentions
1486+ * multiplied by the scale factors
1487+ */
1488+
1489+ quadMatrix->xx = 1.0f / glowSize;
1490+ quadMatrix->yy = 1.0f / (glowSize);
1491+ quadMatrix->x0 = -(x1 * quadMatrix->xx);
1492+ quadMatrix->y0 = -(y1 * quadMatrix->yy);
1493+
1494+ x2 = MIN (WIN_REAL_X (w) + glowOffset,
1495+ WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
1496+ y2 = MIN (WIN_REAL_Y (w) + glowOffset,
1497+ WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
1498+
1499+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1500+
1501+ /* Top right corner */
1502+ box = &mGlowQuads[GLOWQUAD_TOPRIGHT].mBox;
1503+ mGlowQuads[GLOWQUAD_TOPRIGHT].mMatrix = *matrix;
1504+ quadMatrix = &mGlowQuads[GLOWQUAD_TOPRIGHT].mMatrix;
1505+
1506+ /* Set the desired rect dimentions
1507+ * for the part of the glow we are painting */
1508+
1509+ x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
1510+ y1 = WIN_REAL_Y (w) - glowSize + glowOffset;
1511+ x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;
1512+
1513+ /* 2x2 Matrix here, adjust both x and y scale factors
1514+ * and the x and y position
1515+ *
1516+ * Scaling the y part of the texture in a positive direction
1517+ * and the x part in a negative direction here
1518+ * (right to left top to bottom)
1519+ *
1520+ * The base position (x0 and y0) here requires us to move backwards
1521+ * on the y dimention and forwards on x by the calculated rect dimentions
1522+ * multiplied by the scale factors (since we are moving forward on x we
1523+ * need the inverse of that which is 1 - x1 * xx
1524+ */
1525+
1526+ quadMatrix->xx = -1.0f / glowSize;
1527+ quadMatrix->yy = 1.0f / glowSize;
1528+ quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
1529+ quadMatrix->y0 = -(y1 * quadMatrix->yy);
1530+
1531+ x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset,
1532+ WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
1533+ y2 = MIN (WIN_REAL_Y (w) + glowOffset,
1534+ WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
1535+
1536+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1537+
1538+ /* Bottom left corner */
1539+ box = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mBox;
1540+ mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix = *matrix;
1541+ quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix;
1542+
1543+ x1 = WIN_REAL_X (w) - glowSize + glowOffset;
1544+ y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
1545+ x2 = WIN_REAL_X (w) + glowOffset;
1546+ y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;
1547+
1548+ /* 2x2 Matrix here, adjust both x and y scale factors
1549+ * and the x and y position
1550+ *
1551+ * Scaling the x part of the texture in a positive direction
1552+ * and the y part in a negative direction here
1553+ * (left to right bottom to top)
1554+ *
1555+ * The base position (x0 and y0) here requires us to move backwards
1556+ * on the x dimention and forwards on y by the calculated rect dimentions
1557+ * multiplied by the scale factors (since we are moving forward on x we
1558+ * need the inverse of that which is 1 - y1 * yy
1559+ */
1560+
1561+ quadMatrix->xx = 1.0f / glowSize;
1562+ quadMatrix->yy = -1.0f / glowSize;
1563+ quadMatrix->x0 = -(x1 * quadMatrix->xx);
1564+ quadMatrix->y0 = 1.0f - (y1 * quadMatrix->yy);
1565+
1566+ y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset,
1567+ WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
1568+ x2 = MIN (WIN_REAL_X (w) + glowOffset,
1569+ WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
1570+
1571+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1572+
1573+ /* Bottom right corner */
1574+ box = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mBox;
1575+ mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix = *matrix;
1576+ quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix;
1577+
1578+ x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
1579+ y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
1580+ x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;
1581+ y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;
1582+
1583+ /* 2x2 Matrix here, adjust both x and y scale factors
1584+ * and the x and y position
1585+ *
1586+ * Scaling the both parts of the texture in a negative direction
1587+ * (right to left bottom to top)
1588+ *
1589+ * The base position (x0 and y0) here requires us to move forwards
1590+ * on both dimentions by the calculated rect dimentions
1591+ * multiplied by the scale factors
1592+ */
1593+
1594+ quadMatrix->xx = -1.0f / glowSize;
1595+ quadMatrix->yy = -1.0f / glowSize;
1596+ quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
1597+ quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy);
1598+
1599+ x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset,
1600+ WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
1601+ y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset,
1602+ WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
1603+
1604+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1605+
1606+ /* Top edge */
1607+ box = &mGlowQuads[GLOWQUAD_TOP].mBox;
1608+ mGlowQuads[GLOWQUAD_TOP].mMatrix = *matrix;
1609+ quadMatrix = &mGlowQuads[GLOWQUAD_TOP].mMatrix;
1610+
1611+ x1 = WIN_REAL_X (w) + glowOffset;
1612+ y1 = WIN_REAL_Y (w) - glowSize + glowOffset;
1613+ x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
1614+ y2 = WIN_REAL_Y (w) + glowOffset;
1615+
1616+ /* 2x2 Matrix here, adjust both x and y scale factors
1617+ * and the x and y position
1618+ *
1619+ * No need to scale the x part of the texture here, but we
1620+ * are scaling on the y part in a positive direciton
1621+ *
1622+ * The base position (y0) here requires us to move backwards
1623+ * on the x dimention and forwards on y by the calculated rect dimentions
1624+ * multiplied by the scale factors
1625+ */
1626+
1627+ quadMatrix->xx = 0.0f;
1628+ quadMatrix->yy = 1.0f / glowSize;
1629+ quadMatrix->x0 = 1.0;
1630+ quadMatrix->y0 = -(y1 * quadMatrix->yy);
1631+
1632+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1633+
1634+ /* Bottom edge */
1635+ box = &mGlowQuads[GLOWQUAD_BOTTOM].mBox;
1636+ mGlowQuads[GLOWQUAD_BOTTOM].mMatrix = *matrix;
1637+ quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOM].mMatrix;
1638+
1639+ x1 = WIN_REAL_X (w) + glowOffset;
1640+ y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
1641+ x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
1642+ y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;
1643+
1644+ /* 2x2 Matrix here, adjust both x and y scale factors
1645+ * and the x and y position
1646+ *
1647+ * No need to scale the x part of the texture here, but we
1648+ * are scaling on the y part in a negative direciton
1649+ *
1650+ * The base position (y0) here requires us to move forwards
1651+ * on y by the calculated rect dimentions
1652+ * multiplied by the scale factors
1653+ */
1654+
1655+ quadMatrix->xx = 0.0f;
1656+ quadMatrix->yy = -1.0f / glowSize;
1657+ quadMatrix->x0 = 1.0;
1658+ quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy);
1659+
1660+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1661+
1662+ /* Left edge */
1663+ box = &mGlowQuads[GLOWQUAD_LEFT].mBox;
1664+ mGlowQuads[GLOWQUAD_LEFT].mMatrix = *matrix;
1665+ quadMatrix = &mGlowQuads[GLOWQUAD_LEFT].mMatrix;
1666+
1667+ x1 = WIN_REAL_X (w) - glowSize + glowOffset;
1668+ y1 = WIN_REAL_Y (w) + glowOffset;
1669+ x2 = WIN_REAL_X (w) + glowOffset;
1670+ y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
1671+
1672+ /* 2x2 Matrix here, adjust both x and y scale factors
1673+ * and the x and y position
1674+ *
1675+ * No need to scale the y part of the texture here, but we
1676+ * are scaling on the x part in a positive direciton
1677+ *
1678+ * The base position (x0) here requires us to move backwards
1679+ * on x by the calculated rect dimentions
1680+ * multiplied by the scale factors
1681+ */
1682+
1683+ quadMatrix->xx = 1.0f / glowSize;
1684+ quadMatrix->yy = 0.0f;
1685+ quadMatrix->x0 = -(x1 * quadMatrix->xx);
1686+ quadMatrix->y0 = 1.0;
1687+
1688+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1689+
1690+ /* Right edge */
1691+ box = &mGlowQuads[GLOWQUAD_RIGHT].mBox;
1692+ mGlowQuads[GLOWQUAD_RIGHT].mMatrix = *matrix;
1693+ quadMatrix = &mGlowQuads[GLOWQUAD_RIGHT].mMatrix;
1694+
1695+ x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
1696+ y1 = WIN_REAL_Y (w) + glowOffset;
1697+ x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;
1698+ y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
1699+
1700+ /* 2x2 Matrix here, adjust both x and y scale factors
1701+ * and the x and y position
1702+ *
1703+ * No need to scale the y part of the texture here, but we
1704+ * are scaling on the x part in a negative direciton
1705+ *
1706+ * The base position (x0) here requires us to move forwards
1707+ * on x by the calculated rect dimentions
1708+ * multiplied by the scale factors
1709+ */
1710+
1711+ quadMatrix->xx = -1.0f / glowSize;
1712+ quadMatrix->yy = 0.0f;
1713+ quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
1714+ quadMatrix->y0 = 1.0;
1715+
1716+ *box = CompRect (x1, y1, x2 - x1, y2 - y1);
1717+}
1718Index: ubuntu/plugins/expo/src/glow.h
1719===================================================================
1720--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1721+++ ubuntu/plugins/expo/src/glow.h 2012-09-08 11:51:33.107328243 +0800
1722@@ -0,0 +1,66 @@
1723+/**
1724+ *
1725+ * Compiz group plugin
1726+ *
1727+ * glow.h
1728+ *
1729+ * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen,
1730+ * Danny Baumann, Sam Spilsbury
1731+ * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com>
1732+ * Roi Cohen <roico.beryl@gmail.com>
1733+ * Danny Baumann <maniac@opencompositing.org>
1734+ * Sam Spilsbury <smspillaz@gmail.com>
1735+ *
1736+ *
1737+ * This program is free software; you can redistribute it and/or
1738+ * modify it under the terms of the GNU General Public License
1739+ * as published by the Free Software Foundation; either version 2
1740+ * of the License, or (at your option) any later version.
1741+ *
1742+ * This program is distributed in the hope that it will be useful,
1743+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1744+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1745+ * GNU General Public License for more details.
1746+ *
1747+ **/
1748+
1749+#ifndef _EXPO_GLOW_H
1750+#define _EXPO_GLOW_H
1751+
1752+#define GLOWQUAD_TOPLEFT 0
1753+#define GLOWQUAD_TOPRIGHT 1
1754+#define GLOWQUAD_BOTTOMLEFT 2
1755+#define GLOWQUAD_BOTTOMRIGHT 3
1756+#define GLOWQUAD_TOP 4
1757+#define GLOWQUAD_BOTTOM 5
1758+#define GLOWQUAD_LEFT 6
1759+#define GLOWQUAD_RIGHT 7
1760+#define NUM_GLOWQUADS 8
1761+
1762+/* Represents a particular glow texture, so here
1763+ * we have hardcoded in the texture data, the offset
1764+ * and the size of the texture
1765+ */
1766+
1767+typedef struct _GlowTextureProperties {
1768+ char *textureData;
1769+ int textureSize;
1770+ int glowOffset;
1771+} GlowTextureProperties;
1772+
1773+/* Each glow quad contains a 2x2 scale + positional matrix
1774+ * (the 3rd column is not used since that is for matrix skew
1775+ * operations which we do not care about)
1776+ * and also a CompRect which describes the size and position of
1777+ * the quad on the glow
1778+ */
1779+
1780+class GlowQuad {
1781+ public:
1782+ CompRect mBox;
1783+ GLTexture::Matrix mMatrix;
1784+};
1785+
1786+extern const GlowTextureProperties glowTextureProperties;
1787+
1788+#endif
1789Index: ubuntu/plugins/expo/src/group_glow.h
1790===================================================================
1791--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1792+++ ubuntu/plugins/expo/src/group_glow.h 2012-09-08 11:51:33.107328243 +0800
1793@@ -0,0 +1,197 @@
1794+#ifndef _GROUP_GLOWTEX_H
1795+#define _GROUP_GLOWTEX_H
1796+
1797+/**
1798+ *
1799+ * Compiz group plugin
1800+ *
1801+ * group_glow.h
1802+ *
1803+ * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen,
1804+ * Danny Baumann, Sam Spilsbury
1805+ * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com>
1806+ * Roi Cohen <roico.beryl@gmail.com>
1807+ * Danny Baumann <maniac@opencompositing.org>
1808+ * Sam Spilsbury <smspillaz@gmail.com>
1809+ *
1810+ *
1811+ * This program is free software; you can redistribute it and/or
1812+ * modify it under the terms of the GNU General Public License
1813+ * as published by the Free Software Foundation; either version 2
1814+ * of the License, or (at your option) any later version.
1815+ *
1816+ * This program is distributed in the hope that it will be useful,
1817+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1818+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1819+ * GNU General Public License for more details.
1820+ *
1821+ **/
1822+
1823+/*
1824+ * glowTex
1825+ */
1826+
1827+static char glowTexRect[4097] = {
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"
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"
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"
1831+ "\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377"
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"
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"
1834+ "\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377"
1835+ "\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6"
1836+ "\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377"
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"
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"
1839+ "\377\377\377\14\377\377\377\22\377\377\377\22\377\377\377\22\377\377\377"
1840+ "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377"
1841+ "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377"
1842+ "\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377"
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"
1844+ "\377\6\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377\27\377\377"
1845+ "\377\27\377\377\377\35\377\377\377#\377\377\377'\377\377\377'\377\377\377"
1846+ "+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377"
1847+ "\377+\377\377\377+\377\377\377+\377\377\3771\377\377\3771\377\377\3771\377"
1848+ "\377\3771\377\377\3771\377\377\3771\377\377\3771\0\0\0\0\0\0\0\0\0\0\0\0"
1849+ "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377"
1850+ "\27\377\377\377\35\377\377\377#\377\377\377+\377\377\3771\377\377\3776\377"
1851+ "\377\377<\377\377\377>\377\377\377C\377\377\377I\377\377\377I\377\377\377"
1852+ "I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377"
1853+ "\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377"
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"
1855+ "\377\377\22\377\377\377\27\377\377\377#\377\377\377+\377\377\3776\377\377"
1856+ "\377C\377\377\377L\377\377\377U\377\377\377]\377\377\377`\377\377\377d\377"
1857+ "\377\377h\377\377\377k\377\377\377k\377\377\377k\377\377\377k\377\377\377"
1858+ "k\377\377\377k\377\377\377k\377\377\377p\377\377\377p\377\377\377p\377\377"
1859+ "\377p\377\377\377p\377\377\377p\377\377\377p\0\0\0\0\0\0\0\0\0\0\0\0\377"
1860+ "\377\377\6\377\377\377\14\377\377\377\22\314\314\314\35\377\377\377'\377"
1861+ "\377\3771\377\377\377>\357\357\357P\377\377\377]\363\363\363k\365\365\365"
1862+ "v\365\365\365|\377\377\377\202\367\367\367\210\367\367\367\214\367\367\367"
1863+ "\216\367\367\367\221\367\367\367\221\367\367\367\221\367\367\367\221\367"
1864+ "\367\367\221\367\367\367\221\367\367\367\224\367\367\367\224\367\367\367"
1865+ "\224\367\367\367\224\367\367\367\224\367\367\367\224\367\367\367\224\0\0"
1866+ "\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\27\377"
1867+ "\377\377'\377\377\3776\377\377\377I\377\377\377Y\377\377\377k\376\376\376"
1868+ "y\377\377\377\210\377\377\377\224\377\377\377\235\377\377\377\245\377\377"
1869+ "\377\253\377\377\377\255\377\377\377\262\377\377\377\262\377\377\377\263"
1870+ "\377\377\377\263\377\377\377\263\377\377\377\263\377\377\377\263\377\377"
1871+ "\377\266\377\377\377\266\377\377\377\266\377\377\377\266\377\377\377\266"
1872+ "\377\377\377\266\377\377\377\266\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377"
1873+ "\14\377\377\377\27\377\377\377#\377\377\3771\377\377\377I\377\377\377]\377"
1874+ "\377\377r\377\377\377\205\377\377\377\231\377\377\377\247\377\377\377\263"
1875+ "\377\377\377\275\377\377\377\304\377\377\377\310\377\377\377\313\377\377"
1876+ "\377\316\377\377\377\320\377\377\377\320\377\377\377\320\377\377\377\320"
1877+ "\377\377\377\320\377\377\377\320\377\377\377\322\377\377\377\322\377\377"
1878+ "\377\322\377\377\377\322\377\377\377\322\377\377\377\322\377\377\377\322"
1879+ "\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\35\377\377"
1880+ "\377+\377\377\377>\377\377\377Y\377\377\377r\377\377\377\210\376\376\376"
1881+ "\237\377\377\377\262\377\377\377\302\377\377\377\313\377\377\377\324\377"
1882+ "\377\377\332\376\376\376\336\377\377\377\341\377\377\377\342\377\377\377"
1883+ "\344\377\377\377\344\377\377\377\344\377\377\377\344\377\377\377\344\377"
1884+ "\377\377\344\377\377\377\345\377\377\377\345\377\377\377\345\377\377\377"
1885+ "\345\377\377\377\345\377\377\377\345\377\377\377\345\0\0\0\0\377\377\377"
1886+ "\6\377\377\377\14\377\377\377\27\377\377\377#\377\377\3776\377\377\377P\377"
1887+ "\377\377k\377\377\377\205\376\376\376\237\372\372\372\266\377\377\377\307"
1888+ "\373\373\373\325\373\373\373\337\374\374\374\345\374\374\374\352\374\374"
1889+ "\374\355\374\374\374\357\374\374\374\360\374\374\374\361\374\374\374\361"
1890+ "\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374"
1891+ "\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362"
1892+ "\374\374\374\362\374\374\374\362\0\0\0\0\377\377\377\6\377\377\377\14\377"
1893+ "\377\377\35\377\377\377+\377\377\377C\377\377\377]\377\377\377|\377\377\377"
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"
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"
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"
1897+ "\377\377\6\377\377\377\22\324\324\324#\377\377\3771\377\377\377L\363\363"
1898+ "\363k\377\377\377\210\377\377\377\247\377\377\377\302\377\377\377\325\0\0"
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"
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"
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"
1902+ "\377#\377\377\377<\377\377\377U\377\377\377v\377\377\377\226\377\377\377"
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"
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"
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"
1906+ "\6\377\377\377\14\377\377\377\27\377\377\377'\377\377\377>\377\377\377]\377"
1907+ "\377\377|\370\370\370\237\377\377\377\275\373\373\373\325\377\377\377\345"
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"
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"
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"
1911+ "\377\377+\377\377\377C\377\377\377`\377\377\377\202\377\377\377\247\377\377"
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"
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"
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"
1915+ "\377\6\377\377\377\14\377\377\377\27\377\377\377+\377\377\377C\377\377\377"
1916+ "d\377\377\377\210\377\377\377\253\377\377\377\310\376\376\376\336\374\374"
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"
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"
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"
1920+ "\35\377\377\377+\377\377\377I\377\377\377h\377\377\377\214\377\377\377\260"
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"
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"
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"
1924+ "\377\377\377\6\377\377\377\14\377\377\377\35\342\342\3421\377\377\377I\377"
1925+ "\377\377k\377\377\377\216\377\377\377\262\377\377\377\316\374\374\374\344"
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"
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"
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"
1929+ "\377\377\35\377\377\3771\377\377\377L\377\377\377k\377\377\377\221\377\377"
1930+ "\377\263\377\377\377\320\377\377\377\344\377\377\377\361\0\0\0\0\0\0\0\0"
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"
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"
1933+ "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377"
1934+ "\377L\377\377\377k\377\377\377\221\377\377\377\263\377\377\377\320\377\377"
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"
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"
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"
1938+ "\14\377\377\377\35\377\377\3771\377\377\377L\364\364\364p\377\377\377\221"
1939+ "\372\372\372\266\377\377\377\320\374\374\374\345\377\377\377\362\0\0\0\0"
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"
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"
1942+ "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377"
1943+ "1\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373\373\322"
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"
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"
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"
1947+ "\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\377\377"
1948+ "\377\221\377\377\377\266\373\373\373\322\377\377\377\345\377\377\377\362"
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"
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"
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"
1952+ "\377\3771\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373"
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"
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"
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"
1956+ "\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377"
1957+ "p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345\374\374"
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"
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"
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"
1961+ "\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266"
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"
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"
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"
1965+ "\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377"
1966+ "\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345"
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"
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"
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"
1970+ "\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377"
1971+ "\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0"
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"
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"
1974+ "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377"
1975+ "\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377"
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"
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"
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"
1979+ "\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224"
1980+ "\377\377\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0"
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"
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"
1983+ "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377"
1984+ "1\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322"
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"
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"
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",
1988+};
1989+
1990+#endif
1991Index: ubuntu/plugins/expo/src/wall_offset/CMakeLists.txt
1992===================================================================
1993--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1994+++ ubuntu/plugins/expo/src/wall_offset/CMakeLists.txt 2012-09-08 14:56:23.698323512 +0800
1995@@ -0,0 +1,33 @@
1996+include_directories (
1997+ ${CMAKE_CURRENT_SOURCE_DIR}/include
1998+ ${CMAKE_CURRENT_SOURCE_DIR}/src
1999+ ${Boost_INCLUDE_DIRS}
2000+ ${GLIBMM_INCLUDE_DIRS}
2001+)
2002+
2003+link_directories (${GLIBMM_LIBRARY_DIRS} ${COMPIZ_LIBRARY_DIRS})
2004+
2005+set (
2006+ PRIVATE_HEADERS
2007+ ${CMAKE_CURRENT_SOURCE_DIR}/include/wall-offset.h
2008+)
2009+
2010+set (
2011+ SRCS
2012+ ${CMAKE_CURRENT_SOURCE_DIR}/src/wall-offset.cpp
2013+)
2014+
2015+add_library (
2016+ compiz_expo_wall_offset STATIC
2017+ ${SRCS}
2018+ ${PRIVATE_HEADERS}
2019+)
2020+
2021+if (COMPIZ_BUILD_TESTING)
2022+ add_subdirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/tests )
2023+endif (COMPIZ_BUILD_TESTING)
2024+
2025+target_link_libraries (
2026+ compiz_expo_wall_offset
2027+ compiz_core
2028+)
2029Index: ubuntu/plugins/expo/src/wall_offset/include/wall-offset.h
2030===================================================================
2031--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2032+++ ubuntu/plugins/expo/src/wall_offset/include/wall-offset.h 2012-09-08 11:51:33.107328243 +0800
2033@@ -0,0 +1,43 @@
2034+/**
2035+ * Copyright © 2012 Canonical Ltd.
2036+ *
2037+ * Authors:
2038+ * Sam Spilsbury <sam.spilsbury@canonical.com>
2039+ *
2040+ * This program is free software; you can redistribute it and/or
2041+ * modify it under the terms of the GNU General Public License
2042+ * as published by the Free Software Foundation; either version 2
2043+ * of the License, or (at your option) any later version.
2044+ *
2045+ * This program is distributed in the hope that it will be useful,
2046+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2047+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2048+ * GNU General Public License for more details.
2049+ *
2050+ **/
2051+
2052+#ifndef _COMPIZ_EXPO_WALL_OFFSET_H
2053+#define _COMPIZ_EXPO_WALL_OFFSET_H
2054+
2055+#include <core/point.h>
2056+#include <core/size.h>
2057+#include <core/rect.h>
2058+
2059+namespace compiz
2060+{
2061+ namespace expo
2062+ {
2063+ void
2064+ calculateWallOffset (const CompRect &output,
2065+ const CompPoint &offsetInScreenCoords,
2066+ const CompPoint &vpSize,
2067+ const CompSize &screenSize,
2068+ float &offsetInWorldX,
2069+ float &offsetInWorldY,
2070+ float &worldScaleFactorX,
2071+ float &worldScaleFactorY,
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: