Merge lp:~mc-return/compiz/compiz.merge-expo-code-cleanup into lp:compiz/0.9.10

Proposed by MC Return
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3717
Merged at revision: 3740
Proposed branch: lp:~mc-return/compiz/compiz.merge-expo-code-cleanup
Merge into: lp:compiz/0.9.10
Diff against target: 2153 lines (+653/-578)
7 files modified
plugins/expo/src/click_threshold/include/click-threshold.h (+4/-2)
plugins/expo/src/click_threshold/src/click-threshold.cpp (+5/-3)
plugins/expo/src/expo.cpp (+429/-410)
plugins/expo/src/expo.h (+105/-70)
plugins/expo/src/glow.cpp (+100/-86)
plugins/expo/src/glow.h (+6/-3)
plugins/expo/src/wall_offset/src/wall-offset.cpp (+4/-4)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-expo-code-cleanup
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Sam Spilsbury Approve
Sami Jaktholm (community) Approve
MC Return Needs Resubmitting
Review via email: mp+163721@code.launchpad.net

Commit message

Expo, code cleanup:

Declaration of local variables outside of loops.
Use prefix instead of postfix increments.
Declaration and assignment of local variables in one line, if possible.
Reduced the scope of some variables.
Removed redundant brackets.
Used static_cast <> (type) instead of (type) cast.
Added and removed newlines if appropriate.
Fixed indentation.
Added TODOs.

Expo, speed improvements:

Do not calculate screen->vpSize ().width () and screen->vpSize ().height ()
multiple times, instead save them in the unsigned ints vpCountHorz and
vpCountVert and use those variables instead.
Speed up the curve calculations by using additional variables to save results
to not have to re-calculate those all the time. The new variables introduced
are degToRad, screenWidth, screenWidthSquared, curveDistSquaredPlusQuarter,
pOne2MinusCurveDist, v0Squared and v2Squared.
Also introduced const float halfGapX = gapX / 2.0 and used this variable in the
calculations of curveDistance and curveRadius.
Simplified calculations of this type:
(M_PI / 180.0f) * curveAngle / 2.0, which is equal to: (M_PI / 360.0f) * curveAngle
Do not call optionGetGroundSize (); twice, instead save the value in the float
groundSize and use that variable in the following calculations.
Removed the creation of the redundant bool hide, which is just used once in an
if-condition check. It does not help to have this bool.
Try to avoid redundant GL_BLEND state changes, they are expensive - only enable
GL_BLEND if it is disabled and just disable it, if it was disabled before, otherwise
do nothing.
Try to avoid redundant GL filter changes - just query the filter state if the mipmap
option in CCSM is enabled. Also just set back the filter to the previous state if
we actually changed it, otherwise do nothing.
-5.5f * 2 = -11.0f.
No need to calculate M_PI / 180.0f 720 times:
Calculate this value once instead and save it in the const float mpi, use mpi
in the following looped calculations.
Use const int scw in the same loop instead of calling screen->width () 360 times.

glow.cpp:
Massively increased calculation speed of the glow texture:
No need for any macros here -> removed them and replaced them with local variables.
Precalculate values, store them in local variables and use those in the following
calculations (new variables are the ints winRealX, winRealY, winRealWidth, winRealHeight,
halfWinRealWidth, halfWinRealHeight, xPlusHalfWidth, yPlusHalfHeight, xPlusGlowOff,
yPlusGlowOff, xMinusGlowOff, yMinusGlowOff and the float glowPart).
Used w->geometry ().widthIncBorders () and w->geometry ().heightIncBorders ()
to determine winRealWidth and winRealHeight.

Expo, fixes:

Do not force "One wall per output" on the user, if his displays use different
resolutions.
"One big wall" makes a lot of sense for many multi-screen configs, where not
all of the screens have exactly the same resolution, so if the user explicitely
chooses this mode, Compiz should respect the user's choice.

(LP: #1009592)

Description of the change

See a dual-screen screenshot (1920x1200 + 1280x1024) of Expo here: https://bugs.launchpad.net/compiz/+bug/1009592/+attachment/3687163/+files/Expo-2screens-different-resolution-very-usable_scaled_down.png

Note:
This also helps users hitting bug #1041822 (video: https://bugs.launchpad.net/compiz/+bug/1041822/+attachment/3370316/+files/Expo2ndDisplayBlack.mp4 ), because this bug won't occur in "One big wall" mode.

Also it resolves bug #1024373 - Expo Zoom Animation uses wrong path on second screen in multimonitor configurations (video:
https://bugs.launchpad.net/compiz/+bug/1024373/+attachment/3370329/+files/ExpoWrongPath.mp4 )

So forcing the user to use "One wall per output" is a very bad idea and leads to additional troubles, which do not occur with "One big wall"...

Another reason why a large wall spanning over multiple screens is important is the size of the miniature viewports itself, which in a typical horizontal monitor configuration logically have a high x to y ratio: 3.2 : 1.2 in my case for example, so in a 4:1 viewport
configuration (needed for the cube for example) this means a ratio of 12.8 : 1.2 (!).
Of course this fits much better onto 3200x1200 than 1280x1024, which would be the small monitor... hard to identify the correct window, everything is that small...

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :
Download full text (3.9 KiB)

506 - int width = outputs.front ()->width ();
507 - int height = outputs.front ()->height ();
508 - bool sizeDiff = false;
509 -
510 - /* "One big wall" does not make sense where outputs are different
511 - * sizes, so force multiple walls in this case
512 - *
513 - * TODO: Is it possible to re-create "one big wall" using
514 - * independent output painting in this case? */
515 -
516 - foreach (CompOutput *o, outputs)
517 - {
518 - if (o->width () != width || o->height () != height)
519 - {
520 - sizeDiff = true;
521 - break;
522 - }
523 - }
524 -
525 - if (expoCam > 0.0 && outputs.size () > 1 &&
526 - optionGetMultioutputMode () == MultioutputModeOneBigWall &&
527 - !sizeDiff)

> Do not force "One wall per output" on the user, if his displays use different
> resolutions.
> "One big wall" makes a lot of sense for many multi-screen configs, where not
> all of the screens have exactly the same resolution, so if the user explicitely
> chooses this mode, Compiz should respect the user's choice.

"One big wall" is currently the default behavior which makes some sense so long as the screens have exactly the same resolution. Its *completely* broken for multimonitor configurations with different resolutions. There's just no sane way to line the views up so that they look correctly when the wall is only rendered in one pass. This change should be reverted.

I even have misgivings about the way that it works on multimonitor configurations where you have the same resolution and a number of viewports that is not evenly divisible amongst the monitors. It results in confusing situations where viewports end up partially on one monitor and partially on another and does not make for a good user experience.

328 + if (event->xkey.keycode == leftKey)
329 + moveFocusViewport (-1, 0);
330 + else if (event->xkey.keycode == rightKey)
331 + moveFocusViewport (1, 0);

This is alignment-formatting taken to its extreme. Alignment can sometimes aid readability but it should be used judiciously and not inflexibly. This just makes the code unreadable. There is no reason why there should be that much whitespace between an if and brackets.

358 + (unsigned int)optionGetDoubleClickTime ()

There should be a space between the cast or better yet a static_cast <unsigned int> ()

368 + prevClickPoint = CompPoint(event->xbutton.x, event->xbutton.y);

Extra whitespace required.

395 + /* TODO: What action to take if expo_key is not defined ? */

An action is always bound to it. That's different from whether or not a keybinding is assigned. This todo is inaccurate.

449 + const int scw = screen->width ();

That variable should be renamed to "screenWidth" - "scw" is ambiguous.

448 + const float mpi = M_PI / 180.0f;

This should be renamed degreesToRadians

475 + screen->handleEventSetEnabled (this, enable);
476 + cScreen->preparePaintSetEnabled (this, enable);
477 + cScreen->paintSetEnabled (this, enable);
478 + cScreen->donePaintSetEnabled (this, enable);
479 + gScreen->glPaintOutputSetEnabled (this, enable);
480 ...

Read more...

review: Needs Fixing
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

848 + float sx = (float) screen->width () / output->width ();
849 + float sy = (float) screen->height () / output->height ();

The denominator should be casted and not the numerator.

948 - gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
949 + {
950 + /* check the actual filtering */
951 + oldFilter = gScreen->textureFilter ();
952 +
953 + /* just change the global filter if necessary */
954 + if (oldFilter != GL_LINEAR_MIPMAP_LINEAR)
955 + {
956 + gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
957 + filterChanged = true;
958 + }
959 + }

This change has no effect - setTextureFilter only changes the *next* texture filter any textures will be configured with the next time that they are bound to a texture unit, so checking if the filter is already GL_LINEAR_MIPMAP_LINEAR will not save any calls into OpenGL, as setTextureFilter doesn't make any.

1393 - zoomAnim = eScreen->optionGetExpoAnimation () ==
1394 - ExpoScreen::ExpoAnimationZoom;
1395 - hide = eScreen->optionGetHideDocks () &&
1396 - (window->wmType () & CompWindowTypeDockMask);
1397 -
1398 if (eScreen->expoCam > 0.0)
1399 mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
1400
1401 + float opacity = 1.0;
1402 + bool zoomAnim = eScreen->optionGetExpoAnimation () == ExpoScreen::ExpoAnimationZoom;

1412 - opacity = attrib.opacity *
1413 - (1 - sigmoidProgress (eScreen->expoCam));
1414 + opacity = attrib.opacity * (1 - sigmoidProgress (eScreen->expoCam));

1861 + int winRealWidth = w->width () + 2 * w->geometry ().border () + w->border ().left + w->border ().right;
1862 + int winRealHeight = w->height () + 2 * w->geometry ().border () + w->border ().top + w->border ().bottom;
1863 +

The preference for compiz is to where possible keep line lengths under 80 characters.

It is a somewhat artificially small limit, but it assists those who are working on the code in text-based editors.

1407 - if (hide)
1408 + if (eScreen->optionGetHideDocks () &&
1409 + (window->wmType () & CompWindowTypeDockMask))

Prefer to keep temporary booleans where they are there for the purpose of aiding readability. The compiler gets rid of them at the optimization phase.

1834 + /* TODO: Make glowSize configurable via CCSM */
1835 + int glowSize = 48;

There is no good reason to make this configurable, especially where the texture itself is hardcoded and scales poorly.

1861 + int winRealWidth = w->width () + 2 * w->geometry ().border ()

compiz::window::Geometry has a helper function widthIncBorders () which does exactly this with less error prone typing.

The other changes seem fine so far. Keep in mind that that size of this review means that I might have missed things and that I might need to go through it again later.

Revision history for this message
MC Return (mc-return) wrote :
Download full text (4.2 KiB)

Sam, first I want to say thanks for finding the time for reviewing this. +1

> 848 + float sx = (float) screen->width () / output->width ();
> 849 + float sy = (float) screen->height () / output->height ();
>
> The denominator should be casted and not the numerator.
>
AFAIR I kept what was there already, see:

825 - float sx = (float) screen->width () / output->width ();
826 - float sy = (float) screen->height () / output->height ();

...but I can change that -> no problem.

> 948 - gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
> 949 + {
> 950 + /* check the actual filtering */
> 951 + oldFilter = gScreen->textureFilter ();
> 952 +
> 953 + /* just change the global filter if necessary */
> 954 + if (oldFilter != GL_LINEAR_MIPMAP_LINEAR)
> 955 + {
> 956 + gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
> 957 + filterChanged = true;
> 958 + }
> 959 + }
>
> This change has no effect - setTextureFilter only changes the *next* texture
> filter any textures will be configured with the next time that they are bound
> to a texture unit, so checking if the filter is already
> GL_LINEAR_MIPMAP_LINEAR will not save any calls into OpenGL, as
> setTextureFilter doesn't make any.
>
Ah -> good to know, thanks for the info. I did not dive that deep into that
part of the code yet...
So setTextureFilter won't make any changes if the filter we want to set is
already set ?

> 1393 - zoomAnim = eScreen->optionGetExpoAnimation () ==
> 1394 - ExpoScreen::ExpoAnimationZoom;
> 1395 - hide = eScreen->optionGetHideDocks () &&
> 1396 - (window->wmType () & CompWindowTypeDockMask);
> 1397 -
> 1398 if (eScreen->expoCam > 0.0)
> 1399 mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
> 1400
> 1401 + float opacity = 1.0;
> 1402 + bool zoomAnim = eScreen->optionGetExpoAnimation () ==
> ExpoScreen::ExpoAnimationZoom;
>
> 1412 - opacity = attrib.opacity *
> 1413 - (1 - sigmoidProgress (eScreen->expoCam));
> 1414 + opacity = attrib.opacity * (1 - sigmoidProgress
> (eScreen->expoCam));
>
> 1861 + int winRealWidth = w->width () + 2 * w->geometry
> ().border () + w->border ().left + w->border ().right;
> 1862 + int winRealHeight = w->height () + 2 * w->geometry
> ().border () + w->border ().top + w->border ().bottom;
> 1863 +
>
> The preference for compiz is to where possible keep line lengths under 80
> characters.
>
Yes, I know that of course ;)
Normally I use the rule to just extend over 80 characters, if it massively
improves readability.
Maybe I messed up here -> I'll investigate.

> It is a somewhat artificially small limit, but it assists those who are
> working on the code in text-based editors.
>
> 1407 - if (hide)
> 1408 + if (eScreen->optionGetHideDocks () &&
> 1409 + (window->wmType () & CompWindowTypeDockMask))
>
> Prefer to keep temporary booleans where they are there for the purpose of...

Read more...

Revision history for this message
MC Return (mc-return) wrote :
Download full text (4.5 KiB)

>
> "One big wall" is currently the default behavior which makes some sense so
> long as the screens have exactly the same resolution. Its *completely* broken
> for multimonitor configurations with different resolutions.

This is not true, just look at this screenshot, which is 3200x1200 downscaled.
It shows Expo in dual-screen mode with 1920x1200 and 1280x1024 screens:
https://bugs.launchpad.net/compiz/+bug/1009592/+attachment/3687163/+files/Expo-2screens-different-resolution-very-usable_scaled_down.png

> There's just no
> sane way to line the views up so that they look correctly when the wall is
> only rendered in one pass. This change should be reverted.
>
Well, here everything lines up fine, while otherwise since r3320 I am hitting
bug #1041822 (video: https://bugs.launchpad.net/compiz/+bug/1041822/+attachment/3370316/+files/Expo2ndDisplayBlack.mp4 ),
which makes Expo completely unusable in "One wall per output" mode.

> I even have misgivings about the way that it works on multimonitor
> configurations where you have the same resolution and a number of viewports
> that is not evenly divisible amongst the monitors. It results in confusing
> situations where viewports end up partially on one monitor and partially on
> another and does not make for a good user experience.
>
Well, this is no problem here at all, see the screenshot here again:
https://bugs.launchpad.net/compiz/+bug/1009592/+attachment/3687163/+files/Expo-2screens-different-resolution-very-usable_scaled_down.png
I am not promoting to remove the "one wall per output" mode, but letting
the user choose the prefered method. Here this is "One big wall".

> 328 + if (event->xkey.keycode == leftKey)
> 329 + moveFocusViewport (-1, 0);
> 330 + else if (event->xkey.keycode == rightKey)
> 331 + moveFocusViewport (1, 0);
>
> This is alignment-formatting taken to its extreme. Alignment can sometimes aid
> readability but it should be used judiciously and not inflexibly. This just
> makes the code unreadable. There is no reason why there should be that much
> whitespace between an if and brackets.
>
Ok, no problem to remove the few spaces...

> 358 + (unsigned int)optionGetDoubleClickTime ()
>
> There should be a space between the cast or better yet a static_cast <unsigned
> int> ()
>
Ok, I'll convert all the casts to static_casts.

> 368 + prevClickPoint = CompPoint(event->xbutton.x,
> event->xbutton.y);
>
> Extra whitespace required.
>
Eagle-eye ;)

> 395 + /* TODO: What action to take if expo_key is not
> defined ? */
>
> An action is always bound to it. That's different from whether or not a
> keybinding is assigned. This todo is inaccurate.
>
I am not sure here -> but I'll re-investigate.
AFAIR removing the Expo Initiate key results in not being able to exit Expo...

> 449 + const int scw = screen->width ();
>
> That variable should be renamed to "screenWidth" - "scw" is ambiguous.
>
ok.

> 448 + const float mpi = M_PI / 180.0f;
>
> This should be renamed degreesToRadians
>
ok.

> 475 + scr...

Read more...

Revision history for this message
MC Return (mc-return) wrote :
review: Needs Resubmitting
3717. By MC Return

Used static_cast <> (type) instead of (type) cast for all casts.

Revision history for this message
MC Return (mc-return) wrote :

>
> "One big wall" is currently the default behavior which makes some sense so
> long as the screens have exactly the same resolution.

We can argue about the best default of course. (have not even looked up what
it is set to in upstream/ubuntu)

> Its *completely* broken
> for multimonitor configurations with different resolutions. There's just no
> sane way to line the views up so that they look correctly when the wall is
> only rendered in one pass. This change should be reverted.
>
> I even have misgivings about the way that it works on multimonitor
> configurations where you have the same resolution and a number of viewports
> that is not evenly divisible amongst the monitors. It results in confusing
> situations where viewports end up partially on one monitor and partially on
> another and does not make for a good user experience.
>
Another response, especially regarding this change:

This change also helps users hitting bug #1041822 (video: https://bugs.launchpad.net/compiz/+bug/1041822/+attachment/3370316/+files/Expo2ndDisplayBlack.mp4 ), because this bug won't occur in "One big wall" mode.

Also it resolves bug #1024373 - Expo Zoom Animation uses wrong path on second screen in multimonitor configurations (video:
https://bugs.launchpad.net/compiz/+bug/1024373/+attachment/3370329/+files/ExpoWrongPath.mp4 )

So forcing the user to use "One wall per output" is a very bad idea and leads to additional troubles, which do not occur with "One big wall"...

Another reason why a large wall spanning over multiple screens is important is the size of the miniature viewports itself, which in a typical horizontal monitor configuration logically have a high x to y ratio: 3.2 : 1.2 in my case for example, so in a 4:1 viewport
configuration (needed for the cube for example) this means a ratio of 12.8 : 1.2 (!).
Of course this fits much better onto 3200x1200 than 1280x1024, which would be the small monitor... hard to identify the correct window, everything is that small...

Muuuch better that way:

It shows Expo in dual-screen mode with 1920x1200 and 1280x1024 screens (3200x1200 4x downscaled):
https://bugs.launchpad.net/compiz/+bug/1009592/+attachment/3687163/+files/Expo-2screens-different-resolution-very-usable_scaled_down.png

Revision history for this message
Sam Spilsbury (smspillaz) wrote :
Download full text (3.4 KiB)

> >
> > "One big wall" is currently the default behavior which makes some sense so
> > long as the screens have exactly the same resolution.
>
> We can argue about the best default of course. (have not even looked up what
> it is set to in upstream/ubuntu)
>
> > Its *completely* broken
> > for multimonitor configurations with different resolutions. There's just no
> > sane way to line the views up so that they look correctly when the wall is
> > only rendered in one pass. This change should be reverted.
> >
> > I even have misgivings about the way that it works on multimonitor
> > configurations where you have the same resolution and a number of viewports
> > that is not evenly divisible amongst the monitors. It results in confusing
> > situations where viewports end up partially on one monitor and partially on
> > another and does not make for a good user experience.
> >
> Another response, especially regarding this change:
>
> This change also helps users hitting bug #1041822 (video: https://bugs.launchp
> ad.net/compiz/+bug/1041822/+attachment/3370316/+files/Expo2ndDisplayBlack.mp4
> ), because this bug won't occur in "One big wall" mode.
>
> Also it resolves bug #1024373 - Expo Zoom Animation uses wrong path on second
> screen in multimonitor configurations (video:
> https://bugs.launchpad.net/compiz/+bug/1024373/+attachment/3370329/+files/Expo
> WrongPath.mp4 )
>
> So forcing the user to use "One wall per output" is a very bad idea and leads
> to additional troubles, which do not occur with "One big wall"...
>
> Another reason why a large wall spanning over multiple screens is important is
> the size of the miniature viewports itself, which in a typical horizontal
> monitor configuration logically have a high x to y ratio: 3.2 : 1.2 in my case
> for example, so in a 4:1 viewport
> configuration (needed for the cube for example) this means a ratio of 12.8 :
> 1.2 (!).
> Of course this fits much better onto 3200x1200 than 1280x1024, which would be
> the small monitor... hard to identify the correct window, everything is that
> small...
>
> Muuuch better that way:
>
> It shows Expo in dual-screen mode with 1920x1200 and 1280x1024 screens
> (3200x1200 4x downscaled):
> https://bugs.launchpad.net/compiz/+bug/1009592/+attachment/3687163/+files
> /Expo-2screens-different-resolution-very-usable_scaled_down.png

It does appear from the screenshots to be a lot better from what I remember, however screenshots can be misleading. One needs to consider how monitors are positioned in reality. Then again, I can see the argument for allowing it to work so long as the user asked for it - it might just be that the user's monitors are positioned correctly so that it doesn't look misaligned. But there's no way to verify this programatically

What I might suggest is that - how about changing the default in the .xml file to be "one wall per output" and I'll look into any bugs to do with the second output being black (I'm sure its quite simple). Then the user can pick "one big wall" if it would make sense on their particular configuration, as I think it tends to work better in fewer configurations than the former does. Doing it that way, incidentally, h...

Read more...

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Yep, those changes are looking good now, thanks. What are your thoughts on my solution above ?

Revision history for this message
MC Return (mc-return) wrote :

>
> It does appear from the screenshots to be a lot better from what I remember,
> however screenshots can be misleading. One needs to consider how monitors are
> positioned in reality. Then again, I can see the argument for allowing it to
> work so long as the user asked for it - it might just be that the user's
> monitors are positioned correctly so that it doesn't look misaligned. But
> there's no way to verify this programatically
>
Believe me, I would not use this mode if it would not be better ;)

> What I might suggest is that - how about changing the default in the .xml file
> to be "one wall per output" and I'll look into any bugs to do with the second
> output being black (I'm sure its quite simple). Then the user can pick "one
> big wall" if it would make sense on their particular configuration, as I think
> it tends to work better in fewer configurations than the former does. Doing it
> that way, incidentally, helps to get around some complicated alignment issues
> that happen with unity, and I believe that the workspaces design specification
> mandated independent workspace picking per output.
>
That sounds like a great solution. +1
Thanks for looking into the related bugs, that sounds very good also :)

I will look into the defaults later, but would really prefer to do that in a
follow-up proposal as this sounds like having to do some quilting again and when
doing that I would also fix some other related expo.xml.in bugs, which also need
some quilt magic...

Revision history for this message
Sami Jaktholm (sjakthol) wrote :

Did not see any errors in the diff and expo seems to work fine.

review: Approve
Revision history for this message
MC Return (mc-return) wrote :

> Did not see any errors in the diff and expo seems to work fine.

Thanks a lot for your review, Sami. +1

Revision history for this message
MC Return (mc-return) wrote :

I am happy we have so much support from Canonical.
I do not know what the Compiz project would do without all those coders and reviewers.
I am so happy they promised to continue this excellent support of Compiz until 2017 on Precise...

Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/expo/src/click_threshold/include/click-threshold.h'
--- plugins/expo/src/click_threshold/include/click-threshold.h 2012-08-10 12:14:07 +0000
+++ plugins/expo/src/click_threshold/include/click-threshold.h 2013-06-16 12:25:34 +0000
@@ -30,8 +30,10 @@
30{30{
31 namespace expo31 namespace expo
32 {32 {
33 bool clickMovementInThreshold(int previousX, int previousY,33 bool clickMovementInThreshold (int previousX,
34 int currentX, int currentY);34 int previousY,
35 int currentX,
36 int currentY);
35 }37 }
36}38}
3739
3840
=== modified file 'plugins/expo/src/click_threshold/src/click-threshold.cpp'
--- plugins/expo/src/click_threshold/src/click-threshold.cpp 2012-08-10 12:14:07 +0000
+++ plugins/expo/src/click_threshold/src/click-threshold.cpp 2013-06-16 12:25:34 +0000
@@ -25,11 +25,13 @@
25#include "click-threshold.h"25#include "click-threshold.h"
26#include <stdlib.h>26#include <stdlib.h>
2727
28static const int DND_THRESHOLD = 5;28static const unsigned short DND_THRESHOLD = 5;
2929
30bool30bool
31compiz::expo::clickMovementInThreshold(int previousX, int previousY,31compiz::expo::clickMovementInThreshold (int previousX,
32 int currentX, int currentY)32 int previousY,
33 int currentX,
34 int currentY)
33{35{
34 if ((abs (previousX - currentX) <= DND_THRESHOLD) &&36 if ((abs (previousX - currentX) <= DND_THRESHOLD) &&
35 (abs (previousY - currentY) <= DND_THRESHOLD))37 (abs (previousY - currentY) <= DND_THRESHOLD))
3638
=== modified file 'plugins/expo/src/expo.cpp'
--- plugins/expo/src/expo.cpp 2013-05-13 18:08:52 +0000
+++ plugins/expo/src/expo.cpp 2013-06-16 12:25:34 +0000
@@ -36,16 +36,16 @@
3636
37COMPIZ_PLUGIN_20090315 (expo, ExpoPluginVTable);37COMPIZ_PLUGIN_20090315 (expo, ExpoPluginVTable);
3838
39#define sigmoid(x) (1.0f / (1.0f + exp (-5.5f * 2 * ((x) - 0.5))))39#define sigmoid(x) (1.0f / (1.0f + exp (-11.0f * ((x) - 0.5f))))
40#define sigmoidProgress(x) ((sigmoid (x) - sigmoid (0)) / \40#define sigmoidProgress(x) ((sigmoid (x) - sigmoid (0)) / \
41 (sigmoid (1) - sigmoid (0)))41 (sigmoid (1) - sigmoid (0)))
4242
43#define interpolate(a, b, val) (((val) * (a)) + ((1 - (val)) * (b)))43#define interpolate(a, b, val) (((val) * (a)) + ((1 - (val)) * (b)))
4444
45bool45bool
46ExpoScreen::dndInit (CompAction *action,46ExpoScreen::dndInit (CompAction *action,
47 CompAction::State state,47 CompAction::State state,
48 CompOption::Vector& options)48 CompOption::Vector &options)
49{49{
50 if (expoMode)50 if (expoMode)
51 {51 {
@@ -60,9 +60,9 @@
60}60}
6161
62bool62bool
63ExpoScreen::dndFini (CompAction *action,63ExpoScreen::dndFini (CompAction *action,
64 CompAction::State state,64 CompAction::State state,
65 CompOption::Vector& options)65 CompOption::Vector &options)
66{66{
67 if (dndState == DnDDuring || dndState == DnDStart)67 if (dndState == DnDDuring || dndState == DnDStart)
68 {68 {
@@ -82,9 +82,9 @@
82}82}
8383
84bool84bool
85ExpoScreen::doExpo (CompAction *action,85ExpoScreen::doExpo (CompAction *action,
86 CompAction::State state,86 CompAction::State state,
87 CompOption::Vector& options)87 CompOption::Vector &options)
88{88{
89 if (screen->otherGrabExist ("expo", NULL))89 if (screen->otherGrabExist ("expo", NULL))
90 return false;90 return false;
@@ -104,9 +104,9 @@
104 dndState = DnDNone;104 dndState = DnDNone;
105 dndWindow = NULL;105 dndWindow = NULL;
106106
107 selectedVp = screen->vp ();107 selectedVp = screen->vp ();
108 lastSelectedVp = screen->vp ();108 lastSelectedVp = selectedVp;
109 origVp = screen->vp ();109 origVp = selectedVp;
110110
111 screen->addAction (&optionGetDndButton ());111 screen->addAction (&optionGetDndButton ());
112 screen->addAction (&optionGetExitButton ());112 screen->addAction (&optionGetExitButton ());
@@ -116,17 +116,15 @@
116 cScreen->damageScreen ();116 cScreen->damageScreen ();
117 }117 }
118 else118 else
119 {
120 termExpo (action, state, options);119 termExpo (action, state, options);
121 }
122120
123 return true;121 return true;
124}122}
125123
126bool124bool
127ExpoScreen::termExpo (CompAction *action,125ExpoScreen::termExpo (CompAction *action,
128 CompAction::State state,126 CompAction::State state,
129 CompOption::Vector& options)127 CompOption::Vector &options)
130{128{
131 if (!expoMode)129 if (!expoMode)
132 return true;130 return true;
@@ -156,9 +154,9 @@
156}154}
157155
158bool156bool
159ExpoScreen::exitExpo (CompAction *action,157ExpoScreen::exitExpo (CompAction *action,
160 CompAction::State state,158 CompAction::State state,
161 CompOption::Vector& options)159 CompOption::Vector &options)
162{160{
163 if (!expoMode)161 if (!expoMode)
164 return false;162 return false;
@@ -171,22 +169,21 @@
171}169}
172170
173bool171bool
174ExpoScreen::nextVp (CompAction *action,172ExpoScreen::nextVp (CompAction *action,
175 CompAction::State state,173 CompAction::State state,
176 CompOption::Vector& options)174 CompOption::Vector &options)
177{175{
178 unsigned int newX, newY;
179
180 if (!expoMode)176 if (!expoMode)
181 return false;177 return false;
182178
183 newX = selectedVp.x () + 1;179 unsigned int newX = selectedVp.x () + 1;
184 newY = selectedVp.y ();180 unsigned int newY = selectedVp.y ();
185181
186 if (newX >= (unsigned int) screen->vpSize ().width ())182 if (newX >= (unsigned int) screen->vpSize ().width ())
187 {183 {
188 newX = 0;184 newX = 0;
189 newY = newY + 1;185 newY = newY + 1;
186
190 if (newY >= (unsigned int) screen->vpSize ().height ())187 if (newY >= (unsigned int) screen->vpSize ().height ())
191 newY = 0;188 newY = 0;
192 }189 }
@@ -199,22 +196,21 @@
199}196}
200197
201bool198bool
202ExpoScreen::prevVp (CompAction *action,199ExpoScreen::prevVp (CompAction *action,
203 CompAction::State state,200 CompAction::State state,
204 CompOption::Vector& options)201 CompOption::Vector &options)
205{202{
206 int newX, newY;
207
208 if (!expoMode)203 if (!expoMode)
209 return false;204 return false;
210205
211 newX = selectedVp.x () - 1;206 int newX = selectedVp.x () - 1;
212 newY = selectedVp.y ();207 int newY = selectedVp.y ();
213208
214 if (newX < 0)209 if (newX < 0)
215 {210 {
216 newX = screen->vpSize ().width () - 1;211 newX = screen->vpSize ().width () - 1;
217 newY = newY - 1;212 newY = newY - 1;
213
218 if (newY < 0)214 if (newY < 0)
219 newY = screen->vpSize ().height () - 1;215 newY = screen->vpSize ().height () - 1;
220 }216 }
@@ -230,15 +226,13 @@
230ExpoScreen::moveFocusViewport (int dx,226ExpoScreen::moveFocusViewport (int dx,
231 int dy)227 int dy)
232{228{
233 int newX, newY;
234
235 lastSelectedVp = selectedVp;229 lastSelectedVp = selectedVp;
236230
237 newX = selectedVp.x () + dx;231 int newX = selectedVp.x () + dx;
238 newY = selectedVp.y () + dy;232 int newY = selectedVp.y () + dy;
239233
240 newX = MAX (0, MIN ((int) screen->vpSize ().width () - 1, newX));234 newX = MAX (0, MIN (static_cast <int> (screen->vpSize ().width ()) - 1, newX));
241 newY = MAX (0, MIN ((int) screen->vpSize ().height () - 1, newY));235 newY = MAX (0, MIN (static_cast <int> (screen->vpSize ().height ()) - 1, newY));
242236
243 selectedVp.set (newX, newY);237 selectedVp.set (newX, newY);
244 cScreen->damageScreen ();238 cScreen->damageScreen ();
@@ -260,12 +254,15 @@
260 if (dndWindow->saveMask () & CWX)254 if (dndWindow->saveMask () & CWX)
261 {255 {
262 dndWindow->saveWc ().x = dndWindow->saveWc ().x % screen->width ();256 dndWindow->saveWc ().x = dndWindow->saveWc ().x % screen->width ();
257
263 if (dndWindow->saveWc ().x < 0)258 if (dndWindow->saveWc ().x < 0)
264 dndWindow->saveWc ().x += screen->width ();259 dndWindow->saveWc ().x += screen->width ();
265 }260 }
261
266 if (dndWindow->saveMask () & CWY)262 if (dndWindow->saveMask () & CWY)
267 {263 {
268 dndWindow->saveWc ().y = dndWindow->saveWc ().y % screen->height ();264 dndWindow->saveWc ().y = dndWindow->saveWc ().y % screen->height ();
265
269 if (dndWindow->saveWc ().y < 0)266 if (dndWindow->saveWc ().y < 0)
270 dndWindow->saveWc ().y += screen->height ();267 dndWindow->saveWc ().y += screen->height ();
271 }268 }
@@ -277,15 +274,15 @@
277274
278#if 0 /* FIXME: obsolete in the meantime? */275#if 0 /* FIXME: obsolete in the meantime? */
279 {276 {
280 int lastOutput;
281 int centerX, centerY;
282
283 /* make sure we snap to the correct output */277 /* make sure we snap to the correct output */
284 lastOutput = s->currentOutputDev;278 int lastOutput = s->currentOutputDev;
285 centerX = (WIN_X (w) + WIN_W (w) / 2) % s->width;279 int centerX = (WIN_X (w) + WIN_W (w) / 2) % s->width;
280
286 if (centerX < 0)281 if (centerX < 0)
287 centerX += s->width;282 centerX += s->width;
288 centerY = (WIN_Y (w) + WIN_H (w) / 2) % s->height;283
284 int centerY = (WIN_Y (w) + WIN_H (w) / 2) % s->height;
285
289 if (centerY < 0)286 if (centerY < 0)
290 centerY += s->height;287 centerY += s->height;
291288
@@ -301,79 +298,90 @@
301void298void
302ExpoScreen::handleEvent (XEvent *event)299ExpoScreen::handleEvent (XEvent *event)
303{300{
304 switch (event->type) {301 switch (event->type)
305 case KeyPress:302 {
306 if (expoMode && event->xkey.root == screen->root ())303 case KeyPress:
307 {304 if (expoMode && event->xkey.root == screen->root ())
308 if (event->xkey.keycode == leftKey)305 {
309 moveFocusViewport (-1, 0);306 if (event->xkey.keycode == leftKey)
310 else if (event->xkey.keycode == rightKey)307 moveFocusViewport (-1, 0);
311 moveFocusViewport (1, 0);308 else if (event->xkey.keycode == rightKey)
312 else if (event->xkey.keycode == upKey)309 moveFocusViewport (1, 0);
313 moveFocusViewport (0, -1);310 else if (event->xkey.keycode == upKey)
314 else if (event->xkey.keycode == downKey)311 moveFocusViewport (0, -1);
315 moveFocusViewport (0, 1);312 else if (event->xkey.keycode == downKey)
316 }313 moveFocusViewport (0, 1);
317 break;314 }
318315
319 case ButtonPress:316 break;
320 if (expoMode && event->xbutton.button == Button1 &&317
321 event->xbutton.root == screen->root ())318 case ButtonPress:
322 {319 if (expoMode &&
323 CompPoint pointer (event->xbutton.x_root, event->xbutton.y_root);320 event->xbutton.button == Button1 &&
324 if (!screen->workArea().contains (pointer))321 event->xbutton.root == screen->root ())
325 break;322 {
326323 CompPoint pointer (event->xbutton.x_root, event->xbutton.y_root);
327 anyClick = true;324
328 if (clickTime == 0)325 if (!screen->workArea ().contains (pointer))
329 {326 break;
330 clickTime = event->xbutton.time;327
331 }
332 else if (event->xbutton.time - clickTime <=
333 (unsigned int) optionGetDoubleClickTime () && lastSelectedVp == selectedVp)
334 {
335 doubleClick = true;
336 }
337 else
338 {
339 clickTime = event->xbutton.time;
340 doubleClick = false;
341 }
342 cScreen->damageScreen ();
343 prevClickPoint = CompPoint(event->xbutton.x, event->xbutton.y);
344 }
345 break;
346
347 case ButtonRelease:
348 if (expoMode && event->xbutton.button == Button1 &&
349 event->xbutton.root == screen->root ())
350 {
351 CompPoint pointer (event->xbutton.x_root, event->xbutton.y_root);
352 if (!screen->workArea().contains (pointer))
353 break;
354
355 if (event->xbutton.time - clickTime >
356 (unsigned int) optionGetDoubleClickTime ())
357 {
358 clickTime = 0;
359 doubleClick = false;
360 }
361 else if (doubleClick ||
362 compiz::expo::clickMovementInThreshold(prevClickPoint.x (),
363 prevClickPoint.y (),
364 event->xbutton.x,
365 event->xbutton.y))
366 {
367 CompAction& action = optionGetExpoKey ();
368
369 clickTime = 0;
370 doubleClick = false;
371
372 termExpo (&action, 0, noOptions ());
373 anyClick = true;328 anyClick = true;
374 }329
375 }330 if (clickTime == 0)
376 break;331 clickTime = event->xbutton.time;
332 else if (event->xbutton.time - clickTime <=
333 static_cast <unsigned int> (optionGetDoubleClickTime ()) &&
334 lastSelectedVp == selectedVp)
335 doubleClick = true;
336 else
337 {
338 clickTime = event->xbutton.time;
339 doubleClick = false;
340 }
341
342 cScreen->damageScreen ();
343 prevClickPoint = CompPoint (event->xbutton.x, event->xbutton.y);
344 }
345
346 break;
347
348 case ButtonRelease:
349 if (expoMode &&
350 event->xbutton.button == Button1 &&
351 event->xbutton.root == screen->root ())
352 {
353 CompPoint pointer (event->xbutton.x_root, event->xbutton.y_root);
354
355 if (!screen->workArea ().contains (pointer))
356 break;
357
358 if (event->xbutton.time - clickTime >
359 (unsigned int)optionGetDoubleClickTime ())
360 {
361 clickTime = 0;
362 doubleClick = false;
363 }
364 else if (doubleClick ||
365 compiz::expo::clickMovementInThreshold(prevClickPoint.x (),
366 prevClickPoint.y (),
367 event->xbutton.x,
368 event->xbutton.y))
369 {
370 /* TODO: What action to take if expo_key is not defined ? */
371 CompAction &action = optionGetExpoKey ();
372
373 clickTime = 0;
374 doubleClick = false;
375
376 termExpo (&action, 0, noOptions ());
377 anyClick = true;
378 }
379 }
380
381 break;
382
383 default:
384 break;
377 }385 }
378386
379 screen->handleEvent (event);387 screen->handleEvent (event);
@@ -382,7 +390,8 @@
382void390void
383ExpoScreen::preparePaint (int msSinceLastPaint)391ExpoScreen::preparePaint (int msSinceLastPaint)
384{392{
385 float val = ((float) msSinceLastPaint / 1000.0) / optionGetZoomTime ();393 float val = (static_cast <float> (msSinceLastPaint) / 1000.0f) /
394 optionGetZoomTime ();
386395
387 if (expoMode)396 if (expoMode)
388 expoCam = MIN (1.0, expoCam + val);397 expoCam = MIN (1.0, expoCam + val);
@@ -392,21 +401,23 @@
392 if (expoCam)401 if (expoCam)
393 {402 {
394 unsigned int i, j, vp;403 unsigned int i, j, vp;
395 unsigned int vpCount = screen->vpSize ().width () *404 unsigned int vpCountHorz = screen->vpSize ().width ();
396 screen->vpSize ().height ();405 unsigned int vpCountVert = screen->vpSize ().height ();
406 unsigned int vpCount = vpCountHorz * vpCountVert;
397407
398 if (vpActivity.size () < vpCount)408 if (vpActivity.size () < vpCount)
399 {409 {
400 vpActivity.resize (vpCount);410 vpActivity.resize (vpCount);
401 foreach (float& activity, vpActivity)411
412 foreach (float &activity, vpActivity)
402 activity = 1.0f;413 activity = 1.0f;
403 }414 }
404415
405 for (i = 0; i < (unsigned int) screen->vpSize ().width (); i++)416 for (i = 0; i < vpCountHorz; ++i)
406 {417 {
407 for (j = 0; j < (unsigned int) screen->vpSize ().height (); j++)418 for (j = 0; j < vpCountVert; ++j)
408 {419 {
409 vp = (j * screen->vpSize ().width ()) + i;420 vp = j * vpCountHorz + i;
410421
411 if (CompPoint (i, j) == selectedVp)422 if (CompPoint (i, j) == selectedVp)
412 vpActivity[vp] = MIN (1.0, vpActivity[vp] + val);423 vpActivity[vp] = MIN (1.0, vpActivity[vp] + val);
@@ -415,15 +426,14 @@
415 }426 }
416 }427 }
417428
418 for (i = 0; i < 360; i++)429 const float degToRad = M_PI / 180.0f;
430 const int screenWidth = screen->width ();
431
432 for (i = 0; i < 360; ++i)
419 {433 {
420 float fi = (float) i;434 vpNormals[i * 3] = (-sin (i * degToRad) / screenWidth) * expoCam;
421435 vpNormals[i * 3 + 1] = 0.0;
422 vpNormals[i * 3] = (-sin (fi * (M_PI / 180.0f)) / screen->width ()) *436 vpNormals[i * 3 + 2] = (-cos (i * degToRad) * expoCam) - (1 - expoCam);
423 expoCam;
424 vpNormals[(i * 3) + 1] = 0.0;
425 vpNormals[(i * 3) + 2] = (-cos (fi * (M_PI / 180.0f)) * expoCam) -
426 (1 - expoCam);
427 }437 }
428 }438 }
429439
@@ -440,44 +450,27 @@
440 gScreen->glPaintOutputSetEnabled (this, enable);450 gScreen->glPaintOutputSetEnabled (this, enable);
441 gScreen->glPaintTransformedOutputSetEnabled (this, enable);451 gScreen->glPaintTransformedOutputSetEnabled (this, enable);
442452
453 ExpoWindow *ew;
454
443 foreach (CompWindow *w, screen->windows ())455 foreach (CompWindow *w, screen->windows ())
444 {456 {
445 ExpoWindow *ew = ExpoWindow::get (w);457 ew = ExpoWindow::get (w);
446458
447 ew->cWindow->damageRectSetEnabled (ew, enable);459 ew->cWindow->damageRectSetEnabled (ew, enable);
448 ew->gWindow->glPaintSetEnabled (ew, enable);460 ew->gWindow->glPaintSetEnabled (ew, enable);
449 ew->gWindow->glDrawSetEnabled (ew, enable);461 ew->gWindow->glDrawSetEnabled (ew, enable);
450 ew->gWindow->glAddGeometrySetEnabled (ew, enable);462 ew->gWindow->glAddGeometrySetEnabled (ew, enable);
451 ew->gWindow->glDrawTextureSetEnabled (ew, enable);463 ew->gWindow->glDrawTextureSetEnabled (ew, enable);
452 }464 }
453}465}
454466
455void467void
456ExpoScreen::paint (CompOutput::ptrList& outputs,468ExpoScreen::paint (CompOutput::ptrList &outputs,
457 unsigned int mask)469 unsigned int mask)
458{470{
459 int width = outputs.front ()->width ();471 if (expoCam > 0.0 &&
460 int height = outputs.front ()->height ();472 outputs.size () > 1 &&
461 bool sizeDiff = false;473 optionGetMultioutputMode () == MultioutputModeOneBigWall)
462
463 /* "One big wall" does not make sense where outputs are different
464 * sizes, so force multiple walls in this case
465 *
466 * TODO: Is it possible to re-create "one big wall" using
467 * independent output painting in this case? */
468
469 foreach (CompOutput *o, outputs)
470 {
471 if (o->width () != width || o->height () != height)
472 {
473 sizeDiff = true;
474 break;
475 }
476 }
477
478 if (expoCam > 0.0 && outputs.size () > 1 &&
479 optionGetMultioutputMode () == MultioutputModeOneBigWall &&
480 !sizeDiff)
481 {474 {
482 outputs.clear ();475 outputs.clear ();
483 outputs.push_back (&screen->fullscreenOutput ());476 outputs.push_back (&screen->fullscreenOutput ());
@@ -491,24 +484,29 @@
491{484{
492 CompOption::Vector o(0);485 CompOption::Vector o(0);
493 screen->handleCompizEvent ("expo", "start_viewport_switch", o);486 screen->handleCompizEvent ("expo", "start_viewport_switch", o);
494 switch (vpUpdateMode) {487
495 case VPUpdateMouseOver:488 switch (vpUpdateMode)
496 screen->moveViewport (screen->vp ().x () - selectedVp.x (),489 {
497 screen->vp ().y () - selectedVp.y (), true);490 case VPUpdateMouseOver:
498 screen->focusDefaultWindow ();491 screen->moveViewport (screen->vp ().x () - selectedVp.x (),
499 vpUpdateMode = VPUpdateNone;492 screen->vp ().y () - selectedVp.y (), true);
500 break;493 screen->focusDefaultWindow ();
501 case VPUpdatePrevious:494 vpUpdateMode = VPUpdateNone;
502 screen->moveViewport (screen->vp ().x () - origVp.x (),495 break;
503 screen->vp ().y () - origVp.y (), true);496
504 lastSelectedVp = selectedVp;497 case VPUpdatePrevious:
505 selectedVp = origVp;498 screen->moveViewport (screen->vp ().x () - origVp.x (),
506 screen->focusDefaultWindow ();499 screen->vp ().y () - origVp.y (), true);
507 vpUpdateMode = VPUpdateNone;500 lastSelectedVp = selectedVp;
508 break;501 selectedVp = origVp;
509 default:502 screen->focusDefaultWindow ();
510 break;503 vpUpdateMode = VPUpdateNone;
504 break;
505
506 default:
507 break;
511 }508 }
509
512 screen->handleCompizEvent ("expo", "end_viewport_switch", o);510 screen->handleCompizEvent ("expo", "end_viewport_switch", o);
513511
514 if ((expoCam > 0.0f && expoCam < 1.0f) || dndState != DnDNone)512 if ((expoCam > 0.0f && expoCam < 1.0f) || dndState != DnDNone)
@@ -516,7 +514,7 @@
516514
517 if (expoCam == 1.0f)515 if (expoCam == 1.0f)
518 {516 {
519 foreach (float& vp, vpActivity)517 foreach (float &vp, vpActivity)
520 if (vp != 0.0 && vp != 1.0)518 if (vp != 0.0 && vp != 1.0)
521 cScreen->damageScreen ();519 cScreen->damageScreen ();
522 }520 }
@@ -530,8 +528,9 @@
530528
531 cScreen->donePaint ();529 cScreen->donePaint ();
532530
533 switch (dndState) {531 switch (dndState)
534 case DnDDuring:532 {
533 case DnDDuring:
535 {534 {
536 if (dndWindow)535 if (dndWindow)
537 dndWindow->move (newCursor.x () - prevCursor.x (),536 dndWindow->move (newCursor.x () - prevCursor.x (),
@@ -541,30 +540,27 @@
541 prevCursor = newCursor;540 prevCursor = newCursor;
542 cScreen->damageScreen ();541 cScreen->damageScreen ();
543 }542 }
544 break;543 break;
545544
546 case DnDStart:545 case DnDStart:
547 {546 {
548 int xOffset, yOffset;547 int xOffset = screen->vpSize ().width () * screen->width ();
549 CompWindowList::reverse_iterator iter;548 int yOffset = screen->vpSize ().height () * screen->height ();
550
551 xOffset = screen->vpSize ().width () * screen->width ();
552 yOffset = screen->vpSize ().height () * screen->height ();
553549
554 dndState = DnDNone;550 dndState = DnDNone;
555551
556 for (iter = screen->windows ().rbegin ();552 bool inWindow;
553 int nx, ny;
554 CompWindow *w;
555
556 for (CompWindowList::reverse_iterator iter = screen->windows ().rbegin ();
557 iter != screen->windows ().rend (); ++iter)557 iter != screen->windows ().rend (); ++iter)
558 {558 {
559 CompWindow *w = *iter;559 w = *iter;
560 CompRect input (w->inputRect ());560 CompRect input (w->inputRect ());
561 bool inWindow;561
562 int nx, ny;562 if (w->destroyed () ||
563563 (!w->shaded () && !w->isViewable ()))
564 if (w->destroyed ())
565 continue;
566
567 if (!w->shaded () && !w->isViewable ())
568 continue;564 continue;
569565
570 if (w->onAllViewports ())566 if (w->onAllViewports ())
@@ -574,18 +570,16 @@
574 }570 }
575 else571 else
576 {572 {
577 nx = newCursor.x () -573 nx = newCursor.x () - (screen->vp ().x () * screen->width ());
578 (screen->vp ().x () * screen->width ());574 ny = newCursor.y () - (screen->vp ().y () * screen->height ());
579 ny = newCursor.y () -
580 (screen->vp ().y () * screen->height ());
581 }575 }
582576
583 inWindow = (nx >= input.left () && nx <= input.right ()) ||577 inWindow = (nx >= input.left () && nx <= input.right ()) ||
584 (nx >= (input.left () + xOffset) &&578 (nx >= (input.left () + xOffset) &&
585 nx <= (input.right () + xOffset));579 nx <= (input.right () + xOffset));
586580
587 inWindow &= (ny >= input.top () && ny <= input.bottom ()) ||581 inWindow &= (ny >= input.top () && ny <= input.bottom ()) ||
588 (ny >= (input.top () + yOffset) &&582 (ny >= (input.top () + yOffset) &&
589 ny <= (input.bottom () + yOffset));583 ny <= (input.bottom () + yOffset));
590584
591 if (!inWindow)585 if (!inWindow)
@@ -616,21 +610,28 @@
616610
617 prevCursor = newCursor;611 prevCursor = newCursor;
618 }612 }
619 break;613
620 case DnDNone:614 break;
621 screen->updateGrab (grabIndex, screen->normalCursor ());615
622 break;616 case DnDNone:
623 default:617 screen->updateGrab (grabIndex, screen->normalCursor ());
624 break;618 break;
619
620 default:
621 break;
625 }622 }
626}623}
627624
628static bool625static bool
629unproject (float winx, float winy, float winz,626unproject (float winx,
630 const GLMatrix &modelview,627 float winy,
631 const GLMatrix &projection,628 float winz,
632 const GLint viewport[4],629 const GLMatrix &modelview,
633 float *objx, float *objy, float *objz)630 const GLMatrix &projection,
631 const GLint viewport[4],
632 float *objx,
633 float *objy,
634 float *objz)
634{635{
635 GLMatrix finalMatrix = projection * modelview;636 GLMatrix finalMatrix = projection * modelview;
636 float in[4], out[4];637 float in[4], out[4];
@@ -652,7 +653,7 @@
652 in[1] = in[1] * 2 - 1;653 in[1] = in[1] * 2 - 1;
653 in[2] = in[2] * 2 - 1;654 in[2] = in[2] * 2 - 1;
654655
655 for (int i = 0; i < 4; i++)656 for (int i = 0; i < 4; ++i)
656 {657 {
657 out[i] = in[0] * finalMatrix[i] +658 out[i] = in[0] * finalMatrix[i] +
658 in[1] * finalMatrix[4 + i] +659 in[1] * finalMatrix[4 + i] +
@@ -675,13 +676,13 @@
675}676}
676677
677void678void
678ExpoScreen::invertTransformedVertex (const GLScreenPaintAttrib& attrib,679ExpoScreen::invertTransformedVertex (const GLScreenPaintAttrib &attrib,
679 const GLMatrix& transform,680 const GLMatrix &transform,
680 CompOutput *output,681 CompOutput *output,
681 int vertex[2])682 int vertex[2])
682{683{
683 GLMatrix sTransform (transform);684 GLMatrix sTransform (transform);
684 float p1[3], p2[3], v[3], alpha;685 float p1[3], p2[3], v[3];
685 GLint viewport[4];686 GLint viewport[4];
686687
687 gScreen->glApplyTransform (attrib, output, &sTransform);688 gScreen->glApplyTransform (attrib, output, &sTransform);
@@ -690,33 +691,37 @@
690 glGetIntegerv (GL_VIEWPORT, viewport);691 glGetIntegerv (GL_VIEWPORT, viewport);
691692
692 unproject (vertex[0], screen->height () - vertex[1], 0,693 unproject (vertex[0], screen->height () - vertex[1], 0,
693 sTransform, *gScreen->projectionMatrix (), viewport,694 sTransform, *gScreen->projectionMatrix (), viewport,
694 &p1[0], &p1[1], &p1[2]);695 &p1[0], &p1[1], &p1[2]);
695 unproject (vertex[0], screen->height () - vertex[1], -1.0,696 unproject (vertex[0], screen->height () - vertex[1], -1.0,
696 sTransform, *gScreen->projectionMatrix (), viewport,697 sTransform, *gScreen->projectionMatrix (), viewport,
697 &p2[0], &p2[1], &p2[2]);698 &p2[0], &p2[1], &p2[2]);
698699
699 for (int i = 0; i < 3; i++)700 for (int i = 0; i < 3; ++i)
700 v[i] = p1[i] - p2[i];701 v[i] = p1[i] - p2[i];
701702
702 alpha = -p1[2] / v[2];703 float alpha = -p1[2] / v[2];
703704
704 if (optionGetDeform () == DeformCurve && screen->desktopWindowCount ())705 if (optionGetDeform () == DeformCurve && screen->desktopWindowCount ())
705 {706 {
706 const float sws = screen->width () * screen->width ();707 const float screenWidth = static_cast <float> (screen->width ());
707 const float rs = (curveDistance * curveDistance) + 0.25;708 const float screenWidthSquared = screenWidth * screenWidth;
708 const float p = ((2.0 * sws * (p1[2] - curveDistance) * v[2]) +709 const float curveDistSquaredPlusQuarter = curveDistance * curveDistance + 0.25;
709 (2.0 * p1[0] * v[0]) -710 const float pOne2MinusCurveDist = p1[2] - curveDistance;
710 (v[0] * (float) screen->width ())) /711 const float v0Squared = v[0] * v[0];
711 ((v[2] * v[2] * sws) + (v[0] * v[0]));712 const float v2Squared = v[2] * v[2];
712 const float q = (-(sws * rs) + (sws * (p1[2] - curveDistance) *713 const float vsv = v2Squared * screenWidthSquared +
713 (p1[2] - curveDistance)) +714 v0Squared;
714 (0.25 * sws) + (p1[0] * p1[0]) -715
715 (p1[0] * (float) screen->width ())) /716 const float p = (2.0 * screenWidthSquared * pOne2MinusCurveDist * v[2] +
716 ((v[2] * v[2] * sws) + (v[0] * v[0]));717 2.0 * p1[0] * v[0] - v[0] * screenWidth) / vsv;
717718 const float q = (-screenWidthSquared * curveDistSquaredPlusQuarter +
718 const float rq = (0.25 * p * p) - q;719 screenWidthSquared * pOne2MinusCurveDist * pOne2MinusCurveDist +
719 const float ph = -p * 0.5;720 0.25 * screenWidthSquared +
721 p1[0] * p1[0] - p1[0] * screenWidth) / vsv;
722
723 const float rq = 0.25 * p * p - q;
724 const float ph = -p * 0.5;
720725
721 if (rq < 0.0)726 if (rq < 0.0)
722 {727 {
@@ -727,6 +732,7 @@
727 else732 else
728 {733 {
729 alpha = ph + sqrt(rq);734 alpha = ph + sqrt(rq);
735
730 if (p1[2] + (alpha * v[2]) > 0.0)736 if (p1[2] + (alpha * v[2]) > 0.0)
731 {737 {
732 vertex[0] = -1000;738 vertex[0] = -1000;
@@ -741,25 +747,17 @@
741}747}
742748
743void749void
744ExpoScreen::paintWall (const GLScreenPaintAttrib& attrib,750ExpoScreen::paintWall (const GLScreenPaintAttrib &attrib,
745 const GLMatrix& transform,751 const GLMatrix& transform,
746 const CompRegion& region,752 const CompRegion& region,
747 CompOutput *output,753 CompOutput *output,
748 unsigned int mask,754 unsigned int mask,
749 bool reflection)755 bool reflection)
750{756{
751 GLfloat vertexData[12];757 GLfloat vertexData[12];
752 GLushort colorData[16];758 GLushort colorData[16];
753 GLMatrix sTransformW, sTransform (transform);759 GLMatrix sTransformW, sTransform (transform);
754 int i, j, vp;
755 GLenum oldFilter = gScreen->textureFilter ();
756760
757 float sx = (float) screen->width () / output->width ();
758 float sy = (float) screen->height () / output->height ();
759 float biasZ;
760 float oScale, rotation = 0.0f, progress, vpp;
761 float aspectX = 1.0f, aspectY = 1.0f;
762 GLVector cam;
763 CompPoint vpSize (screen->vpSize ().width (), screen->vpSize ().height ());761 CompPoint vpSize (screen->vpSize ().width (), screen->vpSize ().height ());
764762
765 /* amount of gap between viewports */763 /* amount of gap between viewports */
@@ -767,8 +765,7 @@
767 const float gapX = optionGetVpDistance () * 0.1f * screen->height () /765 const float gapX = optionGetVpDistance () * 0.1f * screen->height () /
768 screen->width () * expoCam;766 screen->width () * expoCam;
769767
770 int glPaintTransformedOutputIndex =768 int glPaintTransformedOutputIndex = gScreen->glPaintTransformedOutputGetCurrentIndex ();
771 gScreen->glPaintTransformedOutputGetCurrentIndex ();
772769
773 GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();770 GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
774771
@@ -782,52 +779,57 @@
782 /* camera position during expo mode */779 /* camera position during expo mode */
783 GLVector expoCamPos (0, 0, 0, 0);780 GLVector expoCamPos (0, 0, 0, 0);
784781
782 float sx = screen->width () / static_cast <float> (output->width ());
783 float sy = screen->height () / static_cast <float> (output->height ());
784
785 if (optionGetDeform () == DeformCurve)785 if (optionGetDeform () == DeformCurve)
786 {786 vpCamPos[GLVector::x] = -sx * (0.5 - ((static_cast <float> (output->x ()) +
787 vpCamPos[GLVector::x] = -sx * (0.5 - (((float) output->x () +787 output->width () / 2.0) /
788 (output->width () / 2.0)) /788 static_cast <float> (screen->width ())));
789 (float) screen->width ()));
790 }
791 else789 else
792 {790 vpCamPos[GLVector::x] = screen->vp ().x () * sx + 0.5 +
793 vpCamPos[GLVector::x] = (screen->vp ().x () * sx) + 0.5 +791 output->x () / output->width () -
794 (output->x () / output->width ()) -792 vpSize.x () * 0.5 * sx +
795 (vpSize.x () * 0.5 * sx) +
796 gapX * screen->vp ().x ();793 gapX * screen->vp ().x ();
797 }794
798 vpCamPos[GLVector::y] = -((screen->vp ().y () * sy) + 0.5 +795 vpCamPos[GLVector::y] = -(screen->vp ().y () * sy + 0.5 +
799 (output->y () / output->height ())) +796 output->y () / output->height ()) +
800 (vpSize.y () * 0.5 * sy) -797 vpSize.y () * 0.5 * sy -
801 gapY * screen->vp ().y ();798 gapY * screen->vp ().y ();
802799
803 biasZ = MAX (vpSize.x () * sx, vpSize.y () * sy);800 float biasZ = MAX (vpSize.x () * sx, vpSize.y () * sy);
801
804 if (optionGetDeform () == DeformTilt || optionGetReflection ())802 if (optionGetDeform () == DeformTilt || optionGetReflection ())
805 biasZ *= (0.15 + optionGetDistance ());803 biasZ *= (0.15 + optionGetDistance ());
806 else804 else
807 biasZ *= optionGetDistance ();805 biasZ *= optionGetDistance ();
808806
809 progress = sigmoidProgress (expoCam);807 float progress = sigmoidProgress (expoCam);
810808
811 if (optionGetDeform () != DeformCurve)809 if (optionGetDeform () != DeformCurve)
812 expoCamPos[GLVector::x] = gapX * (vpSize.x () - 1) * 0.5;810 expoCamPos[GLVector::x] = gapX * (vpSize.x () - 1) * 0.5;
813811
814 expoCamPos[GLVector::y] = -gapY * (vpSize.y () - 1) * 0.5;812 expoCamPos[GLVector::y] = -gapY * (vpSize.y () - 1) * 0.5;
815 expoCamPos[GLVector::z] = -DEFAULT_Z_CAMERA + DEFAULT_Z_CAMERA *813 expoCamPos[GLVector::z] = -DEFAULT_Z_CAMERA + DEFAULT_Z_CAMERA *
816 (MAX (vpSize.x () + (vpSize.x () - 1) * gapX,814 (MAX (vpSize.x () + (vpSize.x () - 1) * gapX,
817 vpSize.y () + (vpSize.y () - 1) * gapY) +815 vpSize.y () + (vpSize.y () - 1) * gapY) +
818 biasZ);816 biasZ);
819817
820 /* interpolate between vpCamPos and expoCamPos */818 /* interpolate between vpCamPos and expoCamPos */
819 GLVector cam;
820
821 cam[GLVector::x] = vpCamPos[GLVector::x] * (1 - progress) +821 cam[GLVector::x] = vpCamPos[GLVector::x] * (1 - progress) +
822 expoCamPos[GLVector::x] * progress;822 expoCamPos[GLVector::x] * progress;
823 cam[GLVector::y] = vpCamPos[GLVector::y] * (1 - progress) +823 cam[GLVector::y] = vpCamPos[GLVector::y] * (1 - progress) +
824 expoCamPos[GLVector::y] * progress;824 expoCamPos[GLVector::y] * progress;
825 cam[GLVector::z] = vpCamPos[GLVector::z] * (1 - progress) +825 cam[GLVector::z] = vpCamPos[GLVector::z] * (1 - progress) +
826 expoCamPos[GLVector::z] * progress;826 expoCamPos[GLVector::z] * progress;
827
828 float aspectX = 1.0f, aspectY = 1.0f;
827829
828 if (vpSize.x () > vpSize.y ())830 if (vpSize.x () > vpSize.y ())
829 {831 {
830 aspectY = (float) vpSize.x () / (float) vpSize.y ();832 aspectY = vpSize.x () / static_cast <float> (vpSize.y ());
831 aspectY -= 1.0;833 aspectY -= 1.0;
832 aspectY *= -optionGetAspectRatio () + 1.0;834 aspectY *= -optionGetAspectRatio () + 1.0;
833 aspectY *= progress;835 aspectY *= progress;
@@ -835,7 +837,7 @@
835 }837 }
836 else838 else
837 {839 {
838 aspectX = (float) vpSize.y () / (float) vpSize.x ();840 aspectX = vpSize.y () / static_cast <float> (vpSize.x ());
839 aspectX -= 1.0;841 aspectX -= 1.0;
840 aspectX *= -optionGetAspectRatio () + 1.0;842 aspectX *= -optionGetAspectRatio () + 1.0;
841 aspectX *= progress;843 aspectX *= progress;
@@ -844,6 +846,8 @@
844846
845 /* End of Zoom animation stuff */847 /* End of Zoom animation stuff */
846848
849 float rotation = 0.0f;
850
847 if (optionGetDeform () == DeformTilt)851 if (optionGetDeform () == DeformTilt)
848 {852 {
849 if (optionGetExpoAnimation () == ExpoAnimationZoom)853 if (optionGetExpoAnimation () == ExpoAnimationZoom)
@@ -852,12 +856,21 @@
852 rotation = 10.0 * expoCam;856 rotation = 10.0 * expoCam;
853 }857 }
854858
859 bool filterChanged = false;
860 GLenum oldFilter;
861
855 if (optionGetMipmaps ())862 if (optionGetMipmaps ())
863 {
864 /* check the actual filtering */
865 oldFilter = gScreen->textureFilter ();
866
856 gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);867 gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
868 filterChanged = true;
869 }
857870
858 /* ALL TRANSFORMATION ARE EXECUTED FROM BOTTOM TO TOP */871 /* ALL TRANSFORMATION ARE EXECUTED FROM BOTTOM TO TOP */
859872
860 oScale = 1 / (1 + ((MAX (sx, sy) - 1) * progress));873 float oScale = 1 / (1 + ((MAX (sx, sy) - 1) * progress));
861874
862 sTransform.scale (oScale, oScale, 1.0);875 sTransform.scale (oScale, oScale, 1.0);
863876
@@ -891,7 +904,7 @@
891904
892 CompPoint offsetInScreenCoords (optionGetXOffset (),905 CompPoint offsetInScreenCoords (optionGetXOffset (),
893 optionGetYOffset ());906 optionGetYOffset ());
894 float offsetInWorldCoordX, offsetInWorldCoordY, worldScaleFactorX, worldScaleFactorY;907 float offsetInWorldCoordX, offsetInWorldCoordY, worldScaleFactorX, worldScaleFactorY;
895908
896 compiz::expo::calculateWallOffset (*output,909 compiz::expo::calculateWallOffset (*output,
897 offsetInScreenCoords,910 offsetInScreenCoords,
@@ -905,7 +918,7 @@
905918
906 /* translate expo to center */919 /* translate expo to center */
907 sTransform.translate (vpSize.x () * sx * -0.5 + offsetInWorldCoordX,920 sTransform.translate (vpSize.x () * sx * -0.5 + offsetInWorldCoordX,
908 vpSize.y () * sy * 0.5 - offsetInWorldCoordY, 0.0f);921 vpSize.y () * sy * 0.5 - offsetInWorldCoordY, 0.0f);
909 sTransform.scale (worldScaleFactorX, worldScaleFactorY, 1.0f);922 sTransform.scale (worldScaleFactorX, worldScaleFactorY, 1.0f);
910923
911924
@@ -924,18 +937,23 @@
924 else937 else
925 curveAngle = interpolate (180 / vpSize.x (), 1, optionGetCurve ());938 curveAngle = interpolate (180 / vpSize.x (), 1, optionGetCurve ());
926939
927 curveDistance = ((0.5f * sx) + (gapX / 2.0)) /940 const float halfGapX = gapX / 2.0;
928 tanf ((M_PI / 180.0f) * curveAngle / 2.0);941
929 curveRadius = ((0.5f * sx) + (gapX / 2.0)) /942 curveDistance = ((0.5f * sx) + halfGapX) /
930 sinf ((M_PI / 180.0f) * curveAngle / 2.0);943 tanf ((M_PI / 360.0f) * curveAngle);
944 curveRadius = ((0.5f * sx) + halfGapX) /
945 sinf ((M_PI / 360.0f) * curveAngle);
931946
932 expoActive = true;947 expoActive = true;
933948
934 for (j = 0; j < vpSize.y (); j++)949 float rotateX, vpp;
950 int vp;
951
952 for (int j = 0; j < vpSize.y (); ++j)
935 {953 {
936 GLMatrix sTransform2 (sTransform), sTransform3;954 GLMatrix sTransform2 (sTransform), sTransform3;
937955
938 for (i = 0; i < vpSize.x (); i++)956 for (int i = 0; i < vpSize.x (); ++i)
939 {957 {
940 if (optionGetExpoAnimation () == ExpoAnimationVortex)958 if (optionGetExpoAnimation () == ExpoAnimationVortex)
941 sTransform2.rotate (360 * expoCam,959 sTransform2.rotate (360 * expoCam,
@@ -943,7 +961,7 @@
943961
944 sTransform3 = sTransform2;962 sTransform3 = sTransform2;
945963
946 sTransform3.translate (output->x () / output->width (),964 sTransform3.translate ( output->x () / output->width (),
947 -output->y () / output->height (), 0.0);965 -output->y () / output->height (), 0.0);
948966
949 cScreen->setWindowPaintOffset ((screen->vp ().x () - i) *967 cScreen->setWindowPaintOffset ((screen->vp ().x () - i) *
@@ -965,12 +983,11 @@
965983
966 if (optionGetDeform () == DeformCurve)984 if (optionGetDeform () == DeformCurve)
967 {985 {
968 float rotateX;
969
970 sTransform3.translate (-vpCamPos[GLVector::x], 0.0f,986 sTransform3.translate (-vpCamPos[GLVector::x], 0.0f,
971 curveDistance - DEFAULT_Z_CAMERA);987 curveDistance - DEFAULT_Z_CAMERA);
972988
973 rotateX = -i + interpolate (((float) vpSize.x () / 2.0) - 0.5,989 rotateX = -i + interpolate ((static_cast <float> (vpSize.x ()) / 2.0) -
990 0.5,
974 screen->vp ().x (), progress);991 screen->vp ().x (), progress);
975992
976 sTransform3.rotate (curveAngle * rotateX, 0.0, 1.0, 0.0);993 sTransform3.rotate (curveAngle * rotateX, 0.0, 1.0, 0.0);
@@ -990,10 +1007,12 @@
990 invertTransformedVertex (attrib, sTransform3,1007 invertTransformedVertex (attrib, sTransform3,
991 output, cursor);1008 output, cursor);
9921009
993 if ((cursor[0] > 0) && (cursor[0] < (int) screen->width ()) &&1010 if (cursor[0] > 0 &&
994 (cursor[1] > 0) && (cursor[1] < (int) screen->height ()))1011 cursor[0] < static_cast <int> (screen->width ()) &&
1012 cursor[1] > 0 &&
1013 cursor[1] < static_cast <int> (screen->height ()))
995 {1014 {
996 newCursor.setX (i * screen->width () + cursor[0]);1015 newCursor.setX (i * screen->width () + cursor[0]);
997 newCursor.setY (j * screen->height () + cursor[1]);1016 newCursor.setY (j * screen->height () + cursor[1]);
9981017
999 if (anyClick || dndState != DnDNone)1018 if (anyClick || dndState != DnDNone)
@@ -1001,7 +1020,7 @@
1001 /* Used to save last viewport interaction was in */1020 /* Used to save last viewport interaction was in */
1002 lastSelectedVp = selectedVp;1021 lastSelectedVp = selectedVp;
1003 selectedVp.set (i, j);1022 selectedVp.set (i, j);
1004 anyClick = false;1023 anyClick = false;
1005 }1024 }
1006 }1025 }
1007 }1026 }
@@ -1019,7 +1038,12 @@
10191038
1020 if (reflection)1039 if (reflection)
1021 {1040 {
1022 glEnable (GL_BLEND);1041 GLboolean glBlendEnabled = glIsEnabled (GL_BLEND);
1042
1043 /* just enable blending if it is disabled */
1044 if (!glBlendEnabled)
1045 glEnable (GL_BLEND);
1046
1023 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);1047 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
10241048
1025 if (optionGetDeform () != DeformCurve)1049 if (optionGetDeform () != DeformCurve)
@@ -1145,10 +1169,12 @@
1145 streamingBuffer->end ();1169 streamingBuffer->end ();
1146 streamingBuffer->render (cTransform);1170 streamingBuffer->render (cTransform);
1147 }1171 }
1172
1148 glCullFace (GL_BACK);1173 glCullFace (GL_BACK);
11491174
1150 if (optionGetGroundSize () > 0.0)1175 if (optionGetGroundSize () > 0.0)
1151 {1176 {
1177 float groundSize = optionGetGroundSize ();
1152 GLMatrix gTransform;1178 GLMatrix gTransform;
1153 gTransform.translate (0.0, 0.0, -DEFAULT_Z_CAMERA);1179 gTransform.translate (0.0, 0.0, -DEFAULT_Z_CAMERA);
11541180
@@ -1161,10 +1187,10 @@
1161 vertexData[4] = -0.5;1187 vertexData[4] = -0.5;
1162 vertexData[5] = 0;1188 vertexData[5] = 0;
1163 vertexData[6] = -0.5;1189 vertexData[6] = -0.5;
1164 vertexData[7] = -0.5 + optionGetGroundSize ();1190 vertexData[7] = -0.5 + groundSize;
1165 vertexData[8] = 0;1191 vertexData[8] = 0;
1166 vertexData[9] = 0.5;1192 vertexData[9] = 0.5;
1167 vertexData[10] = -0.5 + optionGetGroundSize ();1193 vertexData[10] = -0.5 + groundSize;
1168 vertexData[11] = 0;1194 vertexData[11] = 0;
11691195
1170 streamingBuffer->addColors (1, optionGetGroundColor1 ());1196 streamingBuffer->addColors (1, optionGetGroundColor1 ());
@@ -1176,8 +1202,12 @@
1176 streamingBuffer->end ();1202 streamingBuffer->end ();
1177 streamingBuffer->render (gTransform);1203 streamingBuffer->render (gTransform);
1178 }1204 }
1205
1179 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);1206 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1180 glDisable (GL_BLEND);1207
1208 /* just disable blending if it was disabled before */
1209 if (!glBlendEnabled)
1210 glDisable (GL_BLEND);
1181 }1211 }
11821212
1183 expoActive = false;1213 expoActive = false;
@@ -1185,15 +1215,18 @@
1185 cScreen->setWindowPaintOffset (0, 0);1215 cScreen->setWindowPaintOffset (0, 0);
11861216
1187 gScreen->glPaintTransformedOutputSetCurrentIndex (glPaintTransformedOutputIndex);1217 gScreen->glPaintTransformedOutputSetCurrentIndex (glPaintTransformedOutputIndex);
1188 gScreen->setTextureFilter (oldFilter);1218
1219 /* we just need to change the global filter state if we manipulated it before */
1220 if (filterChanged)
1221 gScreen->setTextureFilter (oldFilter);
1189}1222}
11901223
1191bool1224bool
1192ExpoScreen::glPaintOutput (const GLScreenPaintAttrib& attrib,1225ExpoScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
1193 const GLMatrix& transform,1226 const GLMatrix &transform,
1194 const CompRegion& region,1227 const CompRegion &region,
1195 CompOutput *output,1228 CompOutput *output,
1196 unsigned int mask)1229 unsigned int mask)
1197{1230{
1198 if (expoCam > 0.0)1231 if (expoCam > 0.0)
1199 mask |= PAINT_SCREEN_TRANSFORMED_MASK | PAINT_SCREEN_CLEAR_MASK;1232 mask |= PAINT_SCREEN_TRANSFORMED_MASK | PAINT_SCREEN_CLEAR_MASK;
@@ -1202,11 +1235,11 @@
1202}1235}
12031236
1204void1237void
1205ExpoScreen::glPaintTransformedOutput (const GLScreenPaintAttrib& attrib,1238ExpoScreen::glPaintTransformedOutput (const GLScreenPaintAttrib &attrib,
1206 const GLMatrix& transform,1239 const GLMatrix &transform,
1207 const CompRegion& region,1240 const CompRegion &region,
1208 CompOutput *output,1241 CompOutput *output,
1209 unsigned int mask)1242 unsigned int mask)
1210{1243{
1211 expoActive = false;1244 expoActive = false;
12121245
@@ -1226,14 +1259,10 @@
12261259
1227 if (expoCam <= 0 || (expoCam > 0.0 && expoCam < 1.0 &&1260 if (expoCam <= 0 || (expoCam > 0.0 && expoCam < 1.0 &&
1228 optionGetExpoAnimation () != ExpoAnimationZoom))1261 optionGetExpoAnimation () != ExpoAnimationZoom))
1229 {
1230 gScreen->glPaintTransformedOutput (attrib, transform, region,1262 gScreen->glPaintTransformedOutput (attrib, transform, region,
1231 output, mask);1263 output, mask);
1232 }
1233 else1264 else
1234 {
1235 gScreen->clearOutput (output, GL_COLOR_BUFFER_BIT);1265 gScreen->clearOutput (output, GL_COLOR_BUFFER_BIT);
1236 }
12371266
1238 mask &= ~PAINT_SCREEN_CLEAR_MASK;1267 mask &= ~PAINT_SCREEN_CLEAR_MASK;
12391268
@@ -1248,20 +1277,18 @@
1248}1277}
12491278
1250bool1279bool
1251ExpoWindow::glDraw (const GLMatrix& transform,1280ExpoWindow::glDraw (const GLMatrix &transform,
1252 const GLWindowPaintAttrib &attrib,1281 const GLWindowPaintAttrib &attrib,
1253 const CompRegion& region,1282 const CompRegion &region,
1254 unsigned int mask)1283 unsigned int mask)
1255{1284{
1256 if (eScreen->expoCam == 0.0f)1285 if (eScreen->expoCam == 0.0f)
1257 return gWindow->glDraw (transform, attrib, region, mask);1286 return gWindow->glDraw (transform, attrib, region, mask);
12581287
1259 int expoAnimation;
1260
1261 // Scaling factors to be applied to attrib later in glDrawTexture1288 // Scaling factors to be applied to attrib later in glDrawTexture
1262 expoOpacity = 1.0f;1289 expoOpacity = 1.0f;
12631290
1264 expoAnimation = eScreen->optionGetExpoAnimation ();1291 int expoAnimation = eScreen->optionGetExpoAnimation ();
12651292
1266 if (eScreen->expoActive)1293 if (eScreen->expoActive)
1267 {1294 {
@@ -1273,23 +1300,19 @@
1273 {1300 {
1274 if (expoAnimation == ExpoScreen::ExpoAnimationZoom &&1301 if (expoAnimation == ExpoScreen::ExpoAnimationZoom &&
1275 eScreen->paintingVp == eScreen->selectedVp)1302 eScreen->paintingVp == eScreen->selectedVp)
1276 {
1277 expoOpacity = (1.0f - sigmoidProgress (eScreen->expoCam));1303 expoOpacity = (1.0f - sigmoidProgress (eScreen->expoCam));
1278 }
1279 else1304 else
1280 {
1281 expoOpacity = 0.0f;1305 expoOpacity = 0.0f;
1282 }
1283 }1306 }
1284 }1307 }
12851308
1286 bool status = gWindow->glDraw (transform, attrib, region, mask);1309 bool status = gWindow->glDraw (transform, attrib, region, mask);
12871310
1288 if (window->type () & CompWindowTypeDesktopMask &&1311 if (window->type () & CompWindowTypeDesktopMask &&
1289 eScreen->optionGetSelectedColor ()[3] && // colour is visible1312 eScreen->optionGetSelectedColor ()[3] && // colour is visible
1290 mGlowQuads &&1313 mGlowQuads &&
1291 eScreen->paintingVp == eScreen->selectedVp &&1314 eScreen->paintingVp == eScreen->selectedVp &&
1292 region.numRects ())1315 region.numRects ())
1293 {1316 {
1294 /* reset geometry and paint */1317 /* reset geometry and paint */
1295 gWindow->vertexBuffer ()->begin ();1318 gWindow->vertexBuffer ()->begin ();
@@ -1303,54 +1326,54 @@
1303static const unsigned short EXPO_GRID_SIZE = 100;1326static const unsigned short EXPO_GRID_SIZE = 100;
13041327
1305void1328void
1306ExpoWindow::glAddGeometry (const GLTexture::MatrixList& matrices,1329ExpoWindow::glAddGeometry (const GLTexture::MatrixList &matrices,
1307 const CompRegion& region,1330 const CompRegion &region,
1308 const CompRegion& clip,1331 const CompRegion &clip,
1309 unsigned int maxGridWidth,1332 unsigned int maxGridWidth,
1310 unsigned int maxGridHeight)1333 unsigned int maxGridHeight)
1311{1334{
1312 if (eScreen->expoCam > 0.0 &&1335 if (eScreen->expoCam > 0.0 &&
1313 screen->desktopWindowCount () &&1336 screen->desktopWindowCount () &&
1314 eScreen->optionGetDeform () == ExpoScreen::DeformCurve)1337 eScreen->optionGetDeform () == ExpoScreen::DeformCurve)
1315 {1338 {
1316 int i, oldVCount = gWindow->vertexBuffer ()->countVertices ();
1317 GLfloat *v;
1318 CompPoint offset;
1319 float lastX, lastZ = 0.0;
1320 const float radSquare = pow (eScreen->curveDistance, 2) + 0.25;
1321 float ang;
1322
1323 gWindow->glAddGeometry (matrices, region, clip,1339 gWindow->glAddGeometry (matrices, region, clip,
1324 MIN(maxGridWidth , EXPO_GRID_SIZE),1340 MIN (maxGridWidth, EXPO_GRID_SIZE),
1325 maxGridHeight);1341 maxGridHeight);
13261342
1327 int stride = gWindow->vertexBuffer ()->getVertexStride ();1343 int stride = gWindow->vertexBuffer ()->getVertexStride ();
1328 v = gWindow->vertexBuffer ()->getVertices ();1344 int oldVCount = gWindow->vertexBuffer ()->countVertices ();
1345 GLfloat *v = gWindow->vertexBuffer ()->getVertices ();
1346
1329 v += stride - 3;1347 v += stride - 3;
1330 v += stride * oldVCount;1348 v += stride * oldVCount;
13311349
1350 CompPoint offset;
1351
1332 if (!window->onAllViewports ())1352 if (!window->onAllViewports ())
1333 {1353 {
1334 offset = eScreen->cScreen->windowPaintOffset ();1354 offset = eScreen->cScreen->windowPaintOffset ();
1335 offset = window->getMovementForOffset (offset);1355 offset = window->getMovementForOffset (offset);
1336 }1356 }
13371357
1338 lastX = -1000000000.0;1358 float ang;
1359 float lastX = -1000000000.0f;
1360 float lastZ = 0.0f;
1361 const float radSquare = pow (eScreen->curveDistance, 2) + 0.25;
13391362
1340 for (i = oldVCount; i < gWindow->vertexBuffer ()->countVertices (); i++)1363 for (int i = oldVCount; i < gWindow->vertexBuffer ()->countVertices (); ++i)
1341 {1364 {
1342 if (v[0] == lastX)1365 if (v[0] == lastX)
1343 {
1344 v[2] = lastZ;1366 v[2] = lastZ;
1345 }
1346 else if (v[0] + offset.x () >= -EXPO_GRID_SIZE &&1367 else if (v[0] + offset.x () >= -EXPO_GRID_SIZE &&
1347 v[0] + offset.x () < screen->width () + EXPO_GRID_SIZE)1368 v[0] + offset.x () < screen->width () + EXPO_GRID_SIZE)
1348 {1369 {
1349 ang = (((v[0] + offset.x ()) / (float) screen->width ()) - 0.5);1370 ang = ((v[0] + offset.x ()) /
1371 static_cast <float> (screen->width ())) - 0.5;
1350 ang *= ang;1372 ang *= ang;
1373
1351 if (ang < radSquare)1374 if (ang < radSquare)
1352 {1375 {
1353 v[2] = eScreen->curveDistance - sqrt (radSquare - ang);1376 v[2] = eScreen->curveDistance - sqrt (radSquare - ang);
1354 v[2] *= sigmoidProgress (eScreen->expoCam);1377 v[2] *= sigmoidProgress (eScreen->expoCam);
1355 }1378 }
1356 }1379 }
@@ -1362,34 +1385,30 @@
1362 }1385 }
1363 }1386 }
1364 else1387 else
1365 {
1366 gWindow->glAddGeometry (matrices, region, clip, maxGridWidth, maxGridHeight);1388 gWindow->glAddGeometry (matrices, region, clip, maxGridWidth, maxGridHeight);
1367 }
1368}1389}
13691390
1370void1391void
1371ExpoWindow::glDrawTexture (GLTexture *texture,1392ExpoWindow::glDrawTexture (GLTexture *texture,
1372 const GLMatrix &transform,1393 const GLMatrix &transform,
1373 const GLWindowPaintAttrib &attrib,1394 const GLWindowPaintAttrib &attrib,
1374 unsigned int mask)1395 unsigned int mask)
1375{1396{
1376 GLWindowPaintAttrib wAttrib (attrib);1397 GLWindowPaintAttrib wAttrib (attrib);
13771398
1378 if (eScreen->expoCam > 0.0)1399 if (eScreen->expoCam > 0.0)
1379 {1400 {
1380 wAttrib.opacity *= expoOpacity;1401 wAttrib.opacity *= expoOpacity;
1381 wAttrib.brightness *= eScreen->vpBrightness;1402 wAttrib.brightness *= eScreen->vpBrightness;
1382 wAttrib.saturation *= eScreen->vpSaturation;1403 wAttrib.saturation *= eScreen->vpSaturation;
1383 }1404 }
13841405
1385 if (eScreen->expoCam > 0.0 &&1406 if (eScreen->expoCam > 0.0 &&
1386 eScreen->optionGetDeform () == ExpoScreen::DeformCurve &&1407 eScreen->optionGetDeform () == ExpoScreen::DeformCurve &&
1387 eScreen->gScreen->lighting () &&1408 eScreen->gScreen->lighting () &&
1388 screen->desktopWindowCount ())1409 screen->desktopWindowCount ())
1389 {1410 {
1390 CompPoint offset;1411 CompPoint offset;
1391 GLfloat *v;
1392 GLVertexBuffer *vb = gWindow->vertexBuffer ();
13931412
1394 if (!window->onAllViewports ())1413 if (!window->onAllViewports ())
1395 {1414 {
@@ -1397,20 +1416,23 @@
1397 offset = window->getMovementForOffset (offset);1416 offset = window->getMovementForOffset (offset);
1398 }1417 }
13991418
1400 int stride = vb->getVertexStride ();1419 GLVertexBuffer *vb = gWindow->vertexBuffer ();
1401 v = vb->getVertices () + stride - 3;1420 int stride = vb->getVertexStride ();
1421 GLfloat *v = vb->getVertices () + stride - 3;
1422 GLfloat normal[3];
1423 int idx;
1424 float x;
14021425
1403 for (int i = 0; i < vb->countVertices (); i++)1426 for (int i = 0; i < vb->countVertices (); ++i)
1404 {1427 {
1405 float x = (v[0] + offset.x () - screen->width () / 2) *1428 x = (v[0] + offset.x () - screen->width () / 2) *
1406 eScreen->curveAngle / screen->width ();1429 eScreen->curveAngle / screen->width ();
14071430
1408 while (x < 0)1431 while (x < 0)
1409 x += 360.0;1432 x += 360.0;
14101433
1411 int idx = floor (x);1434 idx = floor (x);
14121435
1413 GLfloat normal[3];
1414 normal[0] = -eScreen->vpNormals[idx * 3];1436 normal[0] = -eScreen->vpNormals[idx * 3];
1415 normal[1] = eScreen->vpNormals[(idx * 3) + 1];1437 normal[1] = eScreen->vpNormals[(idx * 3) + 1];
1416 normal[2] = eScreen->vpNormals[(idx * 3) + 2];1438 normal[2] = eScreen->vpNormals[(idx * 3) + 2];
@@ -1439,25 +1461,22 @@
1439}1461}
14401462
1441bool1463bool
1442ExpoWindow::glPaint (const GLWindowPaintAttrib& attrib,1464ExpoWindow::glPaint (const GLWindowPaintAttrib &attrib,
1443 const GLMatrix& transform,1465 const GLMatrix &transform,
1444 const CompRegion& region,1466 const CompRegion &region,
1445 unsigned int mask)1467 unsigned int mask)
1446{1468{
1447 if (eScreen->expoActive)1469 if (eScreen->expoActive)
1448 {1470 {
1449 float opacity = 1.0;
1450 bool hide;
1451 bool zoomAnim;
1452
1453 zoomAnim = eScreen->optionGetExpoAnimation () ==
1454 ExpoScreen::ExpoAnimationZoom;
1455 hide = eScreen->optionGetHideDocks () &&
1456 (window->wmType () & CompWindowTypeDockMask);
1457
1458 if (eScreen->expoCam > 0.0)1471 if (eScreen->expoCam > 0.0)
1459 mask |= PAINT_WINDOW_TRANSLUCENT_MASK;1472 mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
14601473
1474 float opacity = 1.0;
1475 bool zoomAnim = eScreen->optionGetExpoAnimation () ==
1476 ExpoScreen::ExpoAnimationZoom;
1477 bool hide = eScreen->optionGetHideDocks () &&
1478 (window->wmType () & CompWindowTypeDockMask);
1479
1461 if (!zoomAnim)1480 if (!zoomAnim)
1462 opacity = attrib.opacity * eScreen->expoCam;1481 opacity = attrib.opacity * eScreen->expoCam;
14631482
@@ -1479,7 +1498,7 @@
14791498
1480bool1499bool
1481ExpoWindow::damageRect (bool initial,1500ExpoWindow::damageRect (bool initial,
1482 const CompRect& rect)1501 const CompRect &rect)
1483{1502{
1484 if (eScreen->expoCam > 0.0f)1503 if (eScreen->expoCam > 0.0f)
1485 eScreen->cScreen->damageScreen ();1504 eScreen->cScreen->damageScreen ();
@@ -1497,21 +1516,21 @@
1497ExpoScreen::ExpoScreen (CompScreen *s) :1516ExpoScreen::ExpoScreen (CompScreen *s) :
1498 PluginClassHandler<ExpoScreen, CompScreen> (s),1517 PluginClassHandler<ExpoScreen, CompScreen> (s),
1499 ExpoOptions (),1518 ExpoOptions (),
1500 cScreen (CompositeScreen::get (s)),1519 cScreen (CompositeScreen::get (s)),
1501 gScreen (GLScreen::get (s)),1520 gScreen (GLScreen::get (s)),
1502 expoCam (0.0f),1521 expoCam (0.0f),
1503 expoActive (false),1522 expoActive (false),
1504 expoMode (false),1523 expoMode (false),
1505 dndState (DnDNone),1524 dndState (DnDNone),
1506 dndWindow (NULL),1525 dndWindow (NULL),
1507 origVp (s->vp ()),1526 origVp (s->vp ()),
1508 selectedVp (s->vp ()),1527 selectedVp (s->vp ()),
1509 lastSelectedVp (s->vp ()),1528 lastSelectedVp (s->vp ()),
1510 vpUpdateMode (VPUpdateNone),1529 vpUpdateMode (VPUpdateNone),
1511 clickTime (0),1530 clickTime (0),
1512 doubleClick (false),1531 doubleClick (false),
1513 vpNormals (360 * 3),1532 vpNormals (360 * 3),
1514 grabIndex (0),1533 grabIndex (0),
1515 mGlowTextureProperties (&glowTextureProperties)1534 mGlowTextureProperties (&glowTextureProperties)
1516{1535{
1517 leftKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Left"));1536 leftKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Left"));
@@ -1552,11 +1571,11 @@
15521571
1553ExpoWindow::ExpoWindow (CompWindow *w) :1572ExpoWindow::ExpoWindow (CompWindow *w) :
1554 PluginClassHandler<ExpoWindow, CompWindow> (w),1573 PluginClassHandler<ExpoWindow, CompWindow> (w),
1555 window (w),1574 window (w),
1556 cWindow (CompositeWindow::get (w)),1575 cWindow (CompositeWindow::get (w)),
1557 gWindow (GLWindow::get (w)),1576 gWindow (GLWindow::get (w)),
1558 eScreen (ExpoScreen::get (screen)),1577 eScreen (ExpoScreen::get (screen)),
1559 mGlowQuads (NULL),1578 mGlowQuads (NULL),
1560 expoOpacity (1.0f)1579 expoOpacity (1.0f)
1561{1580{
1562 CompositeWindowInterface::setHandler (cWindow, false);1581 CompositeWindowInterface::setHandler (cWindow, false);
15631582
=== modified file 'plugins/expo/src/expo.h'
--- plugins/expo/src/expo.h 2012-11-26 07:13:04 +0000
+++ plugins/expo/src/expo.h 2013-06-16 12:25:34 +0000
@@ -40,20 +40,30 @@
40 public ExpoOptions40 public ExpoOptions
41{41{
42 public:42 public:
43
43 ExpoScreen (CompScreen *);44 ExpoScreen (CompScreen *);
44 ~ExpoScreen ();45 ~ExpoScreen ();
4546
46 void handleEvent (XEvent *);47 void handleEvent (XEvent *);
4748
48 void preparePaint (int);49 void preparePaint (int);
49 void paint (CompOutput::ptrList&, unsigned int);50
51 void paint (CompOutput::ptrList &,
52 unsigned int );
53
50 void donePaint ();54 void donePaint ();
5155
52 bool glPaintOutput (const GLScreenPaintAttrib&, const GLMatrix&,56 bool glPaintOutput (const GLScreenPaintAttrib &,
53 const CompRegion&, CompOutput *, unsigned int);57 const GLMatrix &,
54 void glPaintTransformedOutput (const GLScreenPaintAttrib&,58 const CompRegion &,
55 const GLMatrix&, const CompRegion&,59 CompOutput *,
56 CompOutput *, unsigned int);60 unsigned int );
61
62 void glPaintTransformedOutput (const GLScreenPaintAttrib &,
63 const GLMatrix &,
64 const CompRegion &,
65 CompOutput *,
66 unsigned int );
5767
58 bool dndInit (CompAction *, CompAction::State, CompOption::Vector&);68 bool dndInit (CompAction *, CompAction::State, CompOption::Vector&);
59 bool dndFini (CompAction *, CompAction::State, CompOption::Vector&);69 bool dndFini (CompAction *, CompAction::State, CompOption::Vector&);
@@ -63,71 +73,81 @@
63 bool nextVp (CompAction *, CompAction::State, CompOption::Vector&);73 bool nextVp (CompAction *, CompAction::State, CompOption::Vector&);
64 bool prevVp (CompAction *, CompAction::State, CompOption::Vector&);74 bool prevVp (CompAction *, CompAction::State, CompOption::Vector&);
6575
66 typedef enum {76 typedef enum
77 {
67 DnDNone,78 DnDNone,
68 DnDDuring,79 DnDDuring,
69 DnDStart80 DnDStart
70 } DnDState;81 } DnDState;
7182
72 typedef enum {83 typedef enum
84 {
73 VPUpdateNone,85 VPUpdateNone,
74 VPUpdateMouseOver,86 VPUpdateMouseOver,
75 VPUpdatePrevious87 VPUpdatePrevious
76 } VPUpdateMode;88 } VPUpdateMode;
7789
78 CompositeScreen *cScreen;90 CompositeScreen *cScreen;
79 GLScreen *gScreen;91 GLScreen *gScreen;
8092
81 float expoCam;93 float expoCam;
82 bool expoActive;94 bool expoActive;
83 bool expoMode;95 bool expoMode;
8496
85 DnDState dndState;97 DnDState dndState;
86 CompWindow *dndWindow;98 CompWindow *dndWindow;
8799
88 CompPoint prevCursor;100 CompPoint prevCursor;
89 CompPoint newCursor;101 CompPoint newCursor;
90 CompPoint prevClickPoint;102 CompPoint prevClickPoint;
91103
92 CompPoint origVp;104 CompPoint origVp;
93 CompPoint selectedVp;105 CompPoint selectedVp;
94 CompPoint lastSelectedVp;106 CompPoint lastSelectedVp;
95 CompPoint paintingVp;107 CompPoint paintingVp;
96108
97 std::vector<float> vpActivity;109 std::vector<float> vpActivity;
98 float vpBrightness;110 float vpBrightness;
99 float vpSaturation;111 float vpSaturation;
100112
101 VPUpdateMode vpUpdateMode;113 VPUpdateMode vpUpdateMode;
102114
103 bool anyClick;115 bool anyClick;
104 unsigned int clickTime;116 unsigned int clickTime;
105 bool doubleClick;117 bool doubleClick;
106118
107 CompRegion tmpRegion;119 CompRegion tmpRegion;
108120
109 float curveAngle;121 float curveAngle;
110 float curveDistance;122 float curveDistance;
111 float curveRadius;123 float curveRadius;
112124
113 std::vector<GLfloat> vpNormals;125 std::vector<GLfloat> vpNormals;
114126
115 CompScreen::GrabHandle grabIndex;127 CompScreen::GrabHandle grabIndex;
116128
117 GLTexture::List outline_texture;129 GLTexture::List outline_texture;
118 CompSize outline_texture_size;130 CompSize outline_texture_size;
119131
120 const GlowTextureProperties *mGlowTextureProperties;132 const GlowTextureProperties *mGlowTextureProperties;
121133
122 private:134 private:
135
123 void moveFocusViewport (int, int);136 void moveFocusViewport (int, int);
124 void finishWindowMovement ();137 void finishWindowMovement ();
125 void updateWraps (bool);138 void updateWraps (bool);
126139
127 void invertTransformedVertex (const GLScreenPaintAttrib&,140 void invertTransformedVertex (const GLScreenPaintAttrib &,
128 const GLMatrix&, CompOutput *, int[2]);141 const GLMatrix &,
129 void paintWall (const GLScreenPaintAttrib&, const GLMatrix&,142 CompOutput *,
130 const CompRegion&, CompOutput *, unsigned int, bool);143 int[2] );
144
145 void paintWall (const GLScreenPaintAttrib &,
146 const GLMatrix &,
147 const CompRegion &,
148 CompOutput *,
149 unsigned int ,
150 bool );
131151
132 KeyCode leftKey;152 KeyCode leftKey;
133 KeyCode rightKey;153 KeyCode rightKey;
@@ -143,25 +163,39 @@
143 public PluginClassHandler<ExpoWindow, CompWindow>163 public PluginClassHandler<ExpoWindow, CompWindow>
144{164{
145 public:165 public:
166
146 ExpoWindow (CompWindow *);167 ExpoWindow (CompWindow *);
147 ~ExpoWindow ();168 ~ExpoWindow ();
148169
149 bool damageRect (bool, const CompRect&);170 bool damageRect (bool ,
150171 const CompRect &);
151 bool glDraw (const GLMatrix&, const GLWindowPaintAttrib&,172
152 const CompRegion&, unsigned int);173 bool glDraw (const GLMatrix &,
153 bool glPaint (const GLWindowPaintAttrib&, const GLMatrix&,174 const GLWindowPaintAttrib &,
154 const CompRegion&, unsigned int);175 const CompRegion &,
155 void glAddGeometry (const GLTexture::MatrixList&,176 unsigned int );
156 const CompRegion&, const CompRegion&,177
157 unsigned int, unsigned int);178 bool glPaint (const GLWindowPaintAttrib &,
158 void glDrawTexture (GLTexture*, const GLMatrix&,179 const GLMatrix &,
159 const GLWindowPaintAttrib&, unsigned int);180 const CompRegion &,
181 unsigned int );
182
183 void glAddGeometry (const GLTexture::MatrixList &,
184 const CompRegion &,
185 const CompRegion &,
186 unsigned int ,
187 unsigned int );
188
189 void glDrawTexture (GLTexture *,
190 const GLMatrix &,
191 const GLWindowPaintAttrib &,
192 unsigned int );
193
160 void194 void
161 paintGlow (const GLMatrix &transform,195 paintGlow (const GLMatrix &transform,
162 const GLWindowPaintAttrib &attrib,196 const GLWindowPaintAttrib &attrib,
163 const CompRegion &paintRegion,197 const CompRegion &paintRegion,
164 unsigned int mask);198 unsigned int mask);
165199
166 void200 void
167 computeGlowQuads (GLTexture::Matrix *matrix);201 computeGlowQuads (GLTexture::Matrix *matrix);
@@ -172,14 +206,15 @@
172 ExpoScreen *eScreen;206 ExpoScreen *eScreen;
173207
174 private:208 private:
175 GlowQuad *mGlowQuads;209
176 float expoOpacity;210 GlowQuad *mGlowQuads;
211 float expoOpacity;
177};212};
178213
179class ExpoPluginVTable :214class ExpoPluginVTable :
180 public CompPlugin::VTableForScreenAndWindow<ExpoScreen, ExpoWindow>215 public CompPlugin::VTableForScreenAndWindow<ExpoScreen, ExpoWindow>
181{216{
182 public:217 public:
218
183 bool init ();219 bool init ();
184};220};
185
186221
=== modified file 'plugins/expo/src/glow.cpp'
--- plugins/expo/src/glow.cpp 2013-02-03 18:19:21 +0000
+++ plugins/expo/src/glow.cpp 2013-06-16 12:25:34 +0000
@@ -27,14 +27,8 @@
27#include "expo.h"27#include "expo.h"
28#include "group_glow.h"28#include "group_glow.h"
2929
30#define WIN_REAL_X(w) (w->x () - w->border ().left)30const GlowTextureProperties glowTextureProperties =
31#define WIN_REAL_Y(w) (w->y () - w->border ().top)31{
32#define WIN_REAL_WIDTH(w) (w->width () + 2 * w->geometry ().border () + \
33 w->border ().left + w->border ().right)
34#define WIN_REAL_HEIGHT(w) (w->height () + 2 * w->geometry ().border () + \
35 w->border ().top + w->border ().bottom)
36
37const GlowTextureProperties glowTextureProperties = {
38 /* GlowTextureRectangular */32 /* GlowTextureRectangular */
39 glowTexRect, 32, 2133 glowTexRect, 32, 21
40};34};
@@ -43,22 +37,21 @@
43 * GroupWindow::paintGlow37 * GroupWindow::paintGlow
44 *38 *
45 * Takes our glow texture, stretches the appropriate positions in the glow texture,39 * Takes our glow texture, stretches the appropriate positions in the glow texture,
46 * adds those geometries (so plugins like wobby and deform this texture correctly)40 * adds those geometries (so plugins like wobby deform this texture correctly)
47 * and then draws the glow texture with this geometry (plugins like wobbly and friends41 * and then draws the glow texture with this geometry (plugins like wobbly and friends
48 * will automatically deform the texture based on our set geometry)42 * will automatically deform the texture based on our set geometry)
49 */43 */
5044
51void45void
52ExpoWindow::paintGlow (const GLMatrix &transform,46ExpoWindow::paintGlow (const GLMatrix &transform,
53 const GLWindowPaintAttrib &attrib,47 const GLWindowPaintAttrib &attrib,
54 const CompRegion &paintRegion,48 const CompRegion &paintRegion,
55 unsigned int mask)49 unsigned int mask)
56{50{
57 CompRegion reg;51 CompRegion reg;
58 int i;
59 GLushort colorData[4];52 GLushort colorData[4];
60 const GLushort *selColorData = ExpoScreen::get (screen)->optionGetSelectedColor ();53 const GLushort *selColorData = ExpoScreen::get (screen)->optionGetSelectedColor ();
61 float alpha = (float) selColorData[3] / 65535.0f;54 float alpha = static_cast <float> (selColorData[3] / 65535.0f);
6255
63 /* Premultiply color */56 /* Premultiply color */
64 colorData[0] = selColorData[0] * alpha;57 colorData[0] = selColorData[0] * alpha;
@@ -71,7 +64,7 @@
71 /* There are 8 glow parts of the glow texture which we wish to paint64 /* There are 8 glow parts of the glow texture which we wish to paint
72 * separately with different transformations65 * separately with different transformations
73 */66 */
74 for (i = 0; i < NUM_GLOWQUADS; i++)67 for (int i = 0; i < NUM_GLOWQUADS; ++i)
75 {68 {
76 /* Using precalculated quads here */69 /* Using precalculated quads here */
77 reg = CompRegion (mGlowQuads[i].mBox);70 reg = CompRegion (mGlowQuads[i].mBox);
@@ -87,8 +80,9 @@
8780
88 matl.push_back (mGlowQuads[i].mMatrix);81 matl.push_back (mGlowQuads[i].mMatrix);
89 /* Add color data for all 6 vertices of the quad */82 /* Add color data for all 6 vertices of the quad */
90 for (int n = 0; n < 6; n++)83 for (int n = 0; n < 6; ++n)
91 gWindow->vertexBuffer ()->addColors (1, colorData);84 gWindow->vertexBuffer ()->addColors (1, colorData);
85
92 gWindow->glAddGeometry (matl, reg, paintRegion);86 gWindow->glAddGeometry (matl, reg, paintRegion);
93 }87 }
94 }88 }
@@ -116,7 +110,7 @@
116/*110/*
117 * ExpoWindow::computeGlowQuads111 * ExpoWindow::computeGlowQuads
118 *112 *
119 * This function computures the matrix transformation required for each113 * This function computes the matrix transformation required for each
120 * part of the glow texture which we wish to stretch to some rectangular114 * part of the glow texture which we wish to stretch to some rectangular
121 * dimensions115 * dimensions
122 *116 *
@@ -153,12 +147,6 @@
153void147void
154ExpoWindow::computeGlowQuads (GLTexture::Matrix *matrix)148ExpoWindow::computeGlowQuads (GLTexture::Matrix *matrix)
155{149{
156 CompRect *box;
157 int x1, x2, y1, y2;
158 GLTexture::Matrix *quadMatrix;
159 int glowSize, glowOffset;
160 CompWindow *w = window;
161
162 /* Passing NULL to this function frees the glow quads150 /* Passing NULL to this function frees the glow quads
163 * (so the window is not painted with glow) */151 * (so the window is not painted with glow) */
164152
@@ -166,6 +154,7 @@
166 {154 {
167 if (!mGlowQuads)155 if (!mGlowQuads)
168 mGlowQuads = new GlowQuad[NUM_GLOWQUADS];156 mGlowQuads = new GlowQuad[NUM_GLOWQUADS];
157
169 if (!mGlowQuads)158 if (!mGlowQuads)
170 return;159 return;
171 }160 }
@@ -176,23 +165,49 @@
176 delete[] mGlowQuads;165 delete[] mGlowQuads;
177 mGlowQuads = NULL;166 mGlowQuads = NULL;
178 }167 }
168
179 return;169 return;
180 }170 }
181171
182 glowSize = 48;172 /* TODO: Make glowSize configurable via CCSM */
183 glowOffset = (glowSize * ExpoScreen::get (screen)->mGlowTextureProperties->glowOffset /173 int glowSize = 48;
184 ExpoScreen::get (screen)->mGlowTextureProperties->textureSize) + 1;174 int glowOffset = (glowSize * ExpoScreen::get (screen)->mGlowTextureProperties->glowOffset /
175 ExpoScreen::get (screen)->mGlowTextureProperties->textureSize) + 1;
185176
186 /* Top left corner */177 /* Top left corner */
187 box = &mGlowQuads[GLOWQUAD_TOPLEFT].mBox;178 CompRect *box = &mGlowQuads[GLOWQUAD_TOPLEFT].mBox;
188 mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix = *matrix;179 mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix = *matrix;
189 quadMatrix = &mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix;180 GLTexture::Matrix *quadMatrix = &mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix;
181
182 /* Precalculate some values we need multiple times */
183
184 CompWindow *w = window;
185
186 int winRealX = w->x () - w->border ().left;
187 int winRealY = w->y () - w->border ().top;
190188
191 /* Set the desired rect dimensions189 /* Set the desired rect dimensions
192 * for the part of the glow we are painting */190 * for the part of the glow we are painting */
193191
194 x1 = WIN_REAL_X (w) - glowSize + glowOffset;192 int x1 = winRealX - glowSize + glowOffset;
195 y1 = WIN_REAL_Y (w) - glowSize + glowOffset;193 int y1 = winRealY - glowSize + glowOffset;
194
195 int winRealWidth = w->geometry ().widthIncBorders ();
196 int winRealHeight = w->geometry ().heightIncBorders ();
197
198 int halfWinRealWidth = winRealWidth / 2;
199 int halfWinRealHeight = winRealHeight / 2;
200
201 int xPlusHalfWidth = winRealX + halfWinRealWidth;
202 int yPlusHalfHeight = winRealY + halfWinRealHeight;
203
204 int xPlusGlowOff = winRealX + glowOffset;
205 int yPlusGlowOff = winRealY + glowOffset;
206
207 int xMinusGlowOff = winRealX - glowOffset;
208 int yMinusGlowOff = winRealY - glowOffset;
209
210 float glowPart = 1.0f / glowSize;
196211
197 /* 2x2 Matrix here, adjust both x and y scale factors212 /* 2x2 Matrix here, adjust both x and y scale factors
198 * and the x and y position213 * and the x and y position
@@ -205,15 +220,14 @@
205 * multiplied by the scale factors220 * multiplied by the scale factors
206 */221 */
207222
208 quadMatrix->xx = 1.0f / glowSize;223 quadMatrix->xx = quadMatrix->yy = glowPart;
209 quadMatrix->yy = 1.0f / (glowSize);
210 quadMatrix->x0 = -(x1 * quadMatrix->xx);224 quadMatrix->x0 = -(x1 * quadMatrix->xx);
211 quadMatrix->y0 = -(y1 * quadMatrix->yy);225 quadMatrix->y0 = -(y1 * quadMatrix->yy);
212226
213 x2 = MIN (WIN_REAL_X (w) + glowOffset,227 int x2 = MIN (xPlusGlowOff,
214 WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));228 xPlusHalfWidth);
215 y2 = MIN (WIN_REAL_Y (w) + glowOffset,229 int y2 = MIN (yPlusGlowOff,
216 WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));230 yPlusHalfHeight);
217231
218 *box = CompRect (x1, y1, x2 - x1, y2 - y1);232 *box = CompRect (x1, y1, x2 - x1, y2 - y1);
219233
@@ -225,9 +239,9 @@
225 /* Set the desired rect dimensions239 /* Set the desired rect dimensions
226 * for the part of the glow we are painting */240 * for the part of the glow we are painting */
227241
228 x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;242 x1 = xMinusGlowOff + winRealWidth;
229 y1 = WIN_REAL_Y (w) - glowSize + glowOffset;243 y1 = yPlusGlowOff - glowSize;
230 x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;244 x2 = x1 + glowSize;
231245
232 /* 2x2 Matrix here, adjust both x and y scale factors246 /* 2x2 Matrix here, adjust both x and y scale factors
233 * and the x and y position247 * and the x and y position
@@ -242,15 +256,15 @@
242 * need the inverse of that which is 1 - x1 * xx256 * need the inverse of that which is 1 - x1 * xx
243 */257 */
244258
245 quadMatrix->xx = -1.0f / glowSize;259 quadMatrix->xx = -glowPart;
246 quadMatrix->yy = 1.0f / glowSize;260 quadMatrix->yy = glowPart;
247 quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);261 quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
248 quadMatrix->y0 = -(y1 * quadMatrix->yy);262 quadMatrix->y0 = -(y1 * quadMatrix->yy);
249263
250 x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset,264 x1 = MAX (xMinusGlowOff + winRealWidth,
251 WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));265 xPlusHalfWidth);
252 y2 = MIN (WIN_REAL_Y (w) + glowOffset,266 y2 = MIN (yPlusGlowOff,
253 WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));267 yPlusHalfHeight);
254268
255 *box = CompRect (x1, y1, x2 - x1, y2 - y1);269 *box = CompRect (x1, y1, x2 - x1, y2 - y1);
256270
@@ -259,10 +273,10 @@
259 mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix = *matrix;273 mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix = *matrix;
260 quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix;274 quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix;
261275
262 x1 = WIN_REAL_X (w) - glowSize + glowOffset;276 x1 = xPlusGlowOff - glowSize;
263 y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;277 y1 = yMinusGlowOff + winRealHeight;
264 /* x2 = WIN_REAL_X (w) + glowOffset; */278 /* x2 = xPlusGlowOff; */
265 y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;279 y2 = yMinusGlowOff + winRealHeight + glowSize;
266280
267 /* 2x2 Matrix here, adjust both x and y scale factors281 /* 2x2 Matrix here, adjust both x and y scale factors
268 * and the x and y position282 * and the x and y position
@@ -277,15 +291,15 @@
277 * need the inverse of that which is 1 - y1 * yy291 * need the inverse of that which is 1 - y1 * yy
278 */292 */
279293
280 quadMatrix->xx = 1.0f / glowSize;294 quadMatrix->xx = glowPart;
281 quadMatrix->yy = -1.0f / glowSize;295 quadMatrix->yy = -glowPart;
282 quadMatrix->x0 = -(x1 * quadMatrix->xx);296 quadMatrix->x0 = -(x1 * quadMatrix->xx);
283 quadMatrix->y0 = 1.0f - (y1 * quadMatrix->yy);297 quadMatrix->y0 = 1.0f - (y1 * quadMatrix->yy);
284298
285 y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset,299 y1 = MAX (winRealY + winRealHeight - glowOffset,
286 WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));300 yPlusHalfHeight);
287 x2 = MIN (WIN_REAL_X (w) + glowOffset,301 x2 = MIN (xPlusGlowOff,
288 WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));302 xPlusHalfWidth);
289303
290 *box = CompRect (x1, y1, x2 - x1, y2 - y1);304 *box = CompRect (x1, y1, x2 - x1, y2 - y1);
291305
@@ -294,10 +308,10 @@
294 mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix = *matrix;308 mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix = *matrix;
295 quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix;309 quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix;
296310
297 x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;311 x1 = xMinusGlowOff + winRealWidth;
298 y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;312 y1 = yMinusGlowOff + winRealHeight;
299 x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;313 x2 = x1 + glowSize;
300 y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;314 y2 = y1 + glowSize;
301315
302 /* 2x2 Matrix here, adjust both x and y scale factors316 /* 2x2 Matrix here, adjust both x and y scale factors
303 * and the x and y position317 * and the x and y position
@@ -310,15 +324,15 @@
310 * multiplied by the scale factors324 * multiplied by the scale factors
311 */325 */
312326
313 quadMatrix->xx = -1.0f / glowSize;327 quadMatrix->xx = -glowPart;
314 quadMatrix->yy = -1.0f / glowSize;328 quadMatrix->yy = -glowPart;
315 quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);329 quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
316 quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy);330 quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy);
317331
318 x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset,332 x1 = MAX (xMinusGlowOff + winRealWidth,
319 WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));333 xPlusHalfWidth);
320 y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset,334 y1 = MAX (yMinusGlowOff + winRealHeight,
321 WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));335 yPlusHalfHeight);
322336
323 *box = CompRect (x1, y1, x2 - x1, y2 - y1);337 *box = CompRect (x1, y1, x2 - x1, y2 - y1);
324338
@@ -327,10 +341,10 @@
327 mGlowQuads[GLOWQUAD_TOP].mMatrix = *matrix;341 mGlowQuads[GLOWQUAD_TOP].mMatrix = *matrix;
328 quadMatrix = &mGlowQuads[GLOWQUAD_TOP].mMatrix;342 quadMatrix = &mGlowQuads[GLOWQUAD_TOP].mMatrix;
329343
330 x1 = WIN_REAL_X (w) + glowOffset;344 x1 = xPlusGlowOff;
331 y1 = WIN_REAL_Y (w) - glowSize + glowOffset;345 y1 = yPlusGlowOff - glowSize;
332 x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;346 x2 = xMinusGlowOff + winRealWidth;
333 y2 = WIN_REAL_Y (w) + glowOffset;347 y2 = yPlusGlowOff;
334348
335 /* 2x2 Matrix here, adjust both x and y scale factors349 /* 2x2 Matrix here, adjust both x and y scale factors
336 * and the x and y position350 * and the x and y position
@@ -344,7 +358,7 @@
344 */358 */
345359
346 quadMatrix->xx = 0.0f;360 quadMatrix->xx = 0.0f;
347 quadMatrix->yy = 1.0f / glowSize;361 quadMatrix->yy = glowPart;
348 quadMatrix->x0 = 1.0;362 quadMatrix->x0 = 1.0;
349 quadMatrix->y0 = -(y1 * quadMatrix->yy);363 quadMatrix->y0 = -(y1 * quadMatrix->yy);
350364
@@ -355,10 +369,10 @@
355 mGlowQuads[GLOWQUAD_BOTTOM].mMatrix = *matrix;369 mGlowQuads[GLOWQUAD_BOTTOM].mMatrix = *matrix;
356 quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOM].mMatrix;370 quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOM].mMatrix;
357371
358 x1 = WIN_REAL_X (w) + glowOffset;372 x1 = xPlusGlowOff;
359 y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;373 y1 = yMinusGlowOff + winRealHeight;
360 x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;374 x2 = xMinusGlowOff + winRealWidth;
361 y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;375 y2 = y1 + glowSize;
362376
363 /* 2x2 Matrix here, adjust both x and y scale factors377 /* 2x2 Matrix here, adjust both x and y scale factors
364 * and the x and y position378 * and the x and y position
@@ -372,7 +386,7 @@
372 */386 */
373387
374 quadMatrix->xx = 0.0f;388 quadMatrix->xx = 0.0f;
375 quadMatrix->yy = -1.0f / glowSize;389 quadMatrix->yy = -glowPart;
376 quadMatrix->x0 = 1.0;390 quadMatrix->x0 = 1.0;
377 quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy);391 quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy);
378392
@@ -383,10 +397,10 @@
383 mGlowQuads[GLOWQUAD_LEFT].mMatrix = *matrix;397 mGlowQuads[GLOWQUAD_LEFT].mMatrix = *matrix;
384 quadMatrix = &mGlowQuads[GLOWQUAD_LEFT].mMatrix;398 quadMatrix = &mGlowQuads[GLOWQUAD_LEFT].mMatrix;
385399
386 x1 = WIN_REAL_X (w) - glowSize + glowOffset;400 x1 = xPlusGlowOff - glowSize;
387 y1 = WIN_REAL_Y (w) + glowOffset;401 y1 = yPlusGlowOff;
388 x2 = WIN_REAL_X (w) + glowOffset;402 x2 = xPlusGlowOff;
389 y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;403 y2 = yMinusGlowOff + winRealHeight;
390404
391 /* 2x2 Matrix here, adjust both x and y scale factors405 /* 2x2 Matrix here, adjust both x and y scale factors
392 * and the x and y position406 * and the x and y position
@@ -399,7 +413,7 @@
399 * multiplied by the scale factors413 * multiplied by the scale factors
400 */414 */
401415
402 quadMatrix->xx = 1.0f / glowSize;416 quadMatrix->xx = glowPart;
403 quadMatrix->yy = 0.0f;417 quadMatrix->yy = 0.0f;
404 quadMatrix->x0 = -(x1 * quadMatrix->xx);418 quadMatrix->x0 = -(x1 * quadMatrix->xx);
405 quadMatrix->y0 = 1.0;419 quadMatrix->y0 = 1.0;
@@ -411,10 +425,10 @@
411 mGlowQuads[GLOWQUAD_RIGHT].mMatrix = *matrix;425 mGlowQuads[GLOWQUAD_RIGHT].mMatrix = *matrix;
412 quadMatrix = &mGlowQuads[GLOWQUAD_RIGHT].mMatrix;426 quadMatrix = &mGlowQuads[GLOWQUAD_RIGHT].mMatrix;
413427
414 x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;428 x1 = xMinusGlowOff + winRealWidth;
415 y1 = WIN_REAL_Y (w) + glowOffset;429 y1 = yPlusGlowOff;
416 x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;430 x2 = xMinusGlowOff + winRealWidth + glowSize;
417 y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;431 y2 = yMinusGlowOff + winRealHeight;
418432
419 /* 2x2 Matrix here, adjust both x and y scale factors433 /* 2x2 Matrix here, adjust both x and y scale factors
420 * and the x and y position434 * and the x and y position
@@ -427,7 +441,7 @@
427 * multiplied by the scale factors441 * multiplied by the scale factors
428 */442 */
429443
430 quadMatrix->xx = -1.0f / glowSize;444 quadMatrix->xx = -glowPart;
431 quadMatrix->yy = 0.0f;445 quadMatrix->yy = 0.0f;
432 quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);446 quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
433 quadMatrix->y0 = 1.0;447 quadMatrix->y0 = 1.0;
434448
=== modified file 'plugins/expo/src/glow.h'
--- plugins/expo/src/glow.h 2012-11-23 08:20:42 +0000
+++ plugins/expo/src/glow.h 2013-06-16 12:25:34 +0000
@@ -42,7 +42,8 @@
42 * and the size of the texture42 * and the size of the texture
43 */43 */
4444
45typedef struct _GlowTextureProperties {45typedef struct _GlowTextureProperties
46{
46 char *textureData;47 char *textureData;
47 int textureSize;48 int textureSize;
48 int glowOffset;49 int glowOffset;
@@ -55,9 +56,11 @@
55 * the quad on the glow56 * the quad on the glow
56 */57 */
5758
58class GlowQuad {59class GlowQuad
60{
59 public:61 public:
60 CompRect mBox;62
63 CompRect mBox;
61 GLTexture::Matrix mMatrix;64 GLTexture::Matrix mMatrix;
62};65};
6366
6467
=== modified file 'plugins/expo/src/wall_offset/src/wall-offset.cpp'
--- plugins/expo/src/wall_offset/src/wall-offset.cpp 2012-11-23 09:07:48 +0000
+++ plugins/expo/src/wall_offset/src/wall-offset.cpp 2013-06-16 12:25:34 +0000
@@ -32,10 +32,10 @@
32 float &worldScaleFactorY,32 float &worldScaleFactorY,
33 float animationProgress)33 float animationProgress)
34 {34 {
35 const float sx = screenSize.width () / static_cast <float> (output.width ());35 const float sx = screenSize.width () / static_cast <float> (output.width ());
36 const float sy = screenSize.height () / static_cast <float> (output.height ());36 const float sy = screenSize.height () / static_cast <float> (output.height ());
37 offsetInWorldX = 0.0;37 offsetInWorldX = 0.0;
38 offsetInWorldY = 0.0;38 offsetInWorldY = 0.0;
39 worldScaleFactorX = 1.0f;39 worldScaleFactorX = 1.0f;
40 worldScaleFactorY = 1.0f;40 worldScaleFactorY = 1.0f;
4141

Subscribers

People subscribed via source and target branches

to all changes: