Merge lp:~mc-return/compiz/compiz.merge-thumbnail-improvements into lp:compiz/0.9.10

Proposed by MC Return
Status: Merged
Approved by: MC Return
Approved revision: 3749
Merged at revision: 3759
Proposed branch: lp:~mc-return/compiz/compiz.merge-thumbnail-improvements
Merge into: lp:compiz/0.9.10
Diff against target: 1602 lines (+538/-574)
2 files modified
plugins/thumbnail/src/thumbnail.cpp (+499/-527)
plugins/thumbnail/src/thumbnail.h (+39/-47)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-thumbnail-improvements
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
MC Return Approve
Sami Jaktholm (community) Approve
Sam Spilsbury Approve
Review via email: mp+170548@code.launchpad.net

Commit message

Thumbnail, cleanup:

Merged if condition checks.
Declaration of variables when they are needed (C++ style).
Removed redundant brackets.
Removed useless "/* Could someone please explain how this works */"
comment.
Removed extern const unsigned short TEXT_DISTANCE, because this
variable does not exist anymore (value is configurable already).
Changed if (something > 0.0) to if (something), 10 times.
Changed pointedWin = 0; to pointedWin = NULL;.
Used centerX () and centerY () abstractions from
compiz::window::Geometry to determine the icon center coordinates.
Added and removed newlines, if appropriate.
Fixed indentation.

Thumbnail, code speedup:

Return ASAP, do not calculate stuff you might not need.
No need for WIN_W (w) and WIN_H (w) macros, removed those and
replaced them with the local variables int winWidth, int winHeight,
int dockWidth and int dockHeight.
No need for WIN_X (w) and WIN_Y (w) macros, replaced those with
int dockX and int dockY.
Introduced int tHeight = thumb.height;, int tWidth = thumb.width;,
int halfTWidth = tWidth / 2; and int halfTHeight =
tHeight / 2; and used those variables in the following calculations.
Use igMidPoint[0] and igMidPoint[1] as arguments in the
screen->outputDeviceForPoint (arg1, arg2) function, instead of re-
calculating the arguments again.

Thumbnail, GL speedup:

Introduced
GLfloat wxPlusWidth = wx + width;,
GLfloat wyPlusHeight = wy + height;,
GLfloat wxPlusWPlusOff = wxPlusWidth + off;,
GLfloat wyPlusHPlusOff = wyPlusHeight + off;,
GLfloat wxMinusOff = wx - off; and
GLfloat wyMinusOff = wy - off;
and used those coordinates in the vertexData arrays. No need to re-
calculate those values multiple times.
Just query optionGetShowDelay () once and use int showDelay later.
We just enable blending if it is currently disabled and disable
blending only, if it was disabled before.

Description of the change

Note:
There is still minor flickering during fade in/out visible with some drivers, which is a regression from r3320 (no bug filed yet).

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

58 + int x = t->x - t->offset;
59 + int y = t->y - t->offset;
60 + int width = t->width + t->offset * 2;
61 + int height = t->height + t->offset * 2;
62 +
63 + CompRect rect (x, y, width, height);

As 63 does something very different with the data computed from 58 to 61, there is no need for horizontal alignment.

101 - tw->cWindow->damageRectSetEnabled (tw, false);
102 - tw->gWindow->glPaintSetEnabled (tw, false);
103 + tw->cWindow->damageRectSetEnabled (tw, false);
104 + tw->gWindow->glPaintSetEnabled (tw, false);
105 tw->window->resizeNotifySetEnabled (tw, false);

There is no need for horizontal whitespacing here. The variables on these lines are not related at all.

176 + igMidPoint[0] = w->iconGeometry ().x () + w->iconGeometry ().width () / 2;
177 + igMidPoint[1] = w->iconGeometry ().y () + w->iconGeometry ().height () / 2;

Prefer using the centerX () and centerY () abstractions in compiz::window::Geometry

244 + int dockX = dock->x () - dock->border ().left;
245 + int dockY = dock->y () - dock->border ().top;
246 +
247 + int dockWidth = dock->width () + dock->border ().left + dock->border ().right;
248 + int dockHeight = dock->height () + dock->border ().top + dock->border ().bottom;

Consider removing the vertical whitespace if these are related

1115 + GLushort color[4];
1116 + int addWindowGeometryIndex;
1117 + int wx = t->x;
1118 + int wy = t->y;
1119 +
1120 + GLWindowPaintAttrib sAttrib;
1121 + unsigned int mask = PAINT_WINDOW_TRANSFORMED_MASK |
1122 + PAINT_WINDOW_TRANSLUCENT_MASK;
1123 + GLWindow *gWindow = GLWindow::get (w);

A lot of these variables are not related, and so the alignemnt makes no sense. Suggestion:

GLWindow *gWindow = GLWindow::get (window);

GLushort color[4];

int wx = t->x;
int wy = t->y;

GLWindowPaintAttrib sAttrib;
unsigned int mask = PAINT_WINDOW_TRANSFORMED_MASK | PAINT_WINDOW_TRANSLUCENT_MASK
unsigned int addWindowGeometryIndex = gWindow->glAddGeometryGetCurrentIndex ();

1184 + GLenum filter = gScreen->textureFilter ();
1185 + bool filterChanged = false;
202 + /* only set back the global filter
1203 + * if we changed it before */
1204 + if (filterChanged)
1205 + gScreen->setTextureFilter (filter);

This isn't necessary anymore.

1357 + if (ts->thumb.win == window && ts->thumb.opacity > 0.0)

There's no need for all that whitespace between "ts->thumb.win" and "== window" and likewise for "> 0.0"

1373 + gScreen (GLScreen::get (screen)),
1374 + cScreen (CompositeScreen::get (screen)),
1375 + dock (NULL),
1376 + pointedWin (NULL),
1377 + showingThumb (false),
1378 + painted (false),
1379 + glowTexture (GLTexture::imageDataToTexture
1380 + (glowTex, CompSize (32, 32), GL_RGBA, GL_UNSIGNED_BYTE)),

See other comments about whitespace alignment in constructors and how it doesn't make sense.

1414 - WindowInterface::setHandler (window, false);
1415 + WindowInterface::setHandler (window, false);
141...

Read more...

review: Needs Fixing
Revision history for this message
MC Return (mc-return) wrote :
Download full text (5.1 KiB)

> 58 + int x = t->x - t->offset;
> 59 + int y = t->y - t->offset;
> 60 + int width = t->width + t->offset * 2;
> 61 + int height = t->height + t->offset * 2;
> 62 +
> 63 + CompRect rect (x, y, width, height);
>
> As 63 does something very different with the data computed from 58 to 61,
> there is no need for horizontal alignment.
>
Fixed in r3743.

> 101 - tw->cWindow->damageRectSetEnabled (tw, false);
> 102 - tw->gWindow->glPaintSetEnabled (tw, false);
> 103 + tw->cWindow->damageRectSetEnabled (tw, false);
> 104 + tw->gWindow->glPaintSetEnabled (tw, false);
> 105 tw->window->resizeNotifySetEnabled (tw, false);
>
> There is no need for horizontal whitespacing here. The variables on these
> lines are not related at all.
>
Fixed in r3743.

> 176 + igMidPoint[0] = w->iconGeometry ().x () + w->iconGeometry
> ().width () / 2;
> 177 + igMidPoint[1] = w->iconGeometry ().y () + w->iconGeometry
> ().height () / 2;
>
> Prefer using the centerX () and centerY () abstractions in
> compiz::window::Geometry
>
Not yet fixed. TODO.

> 244 + int dockX = dock->x () - dock->border ().left;
> 245 + int dockY = dock->y () - dock->border ().top;
> 246 +
> 247 + int dockWidth = dock->width () + dock->border ().left +
> dock->border ().right;
> 248 + int dockHeight = dock->height () + dock->border ().top +
> dock->border ().bottom;
>
> Consider removing the vertical whitespace if these are related
>
Fixed in r3743.

> 1115 + GLushort color[4];
> 1116 + int addWindowGeometryIndex;
> 1117 + int wx = t->x;
> 1118 + int wy = t->y;
> 1119 +
> 1120 + GLWindowPaintAttrib sAttrib;
> 1121 + unsigned int mask = PAINT_WINDOW_TRANSFORMED_MASK |
> 1122 + PAINT_WINDOW_TRANSLUCENT_MASK;
> 1123 + GLWindow *gWindow = GLWindow::get (w);
>
> A lot of these variables are not related, and so the alignemnt makes no sense.
> Suggestion:
>
> GLWindow *gWindow = GLWindow::get (window);
>
> GLushort color[4];
>
> int wx = t->x;
> int wy = t->y;
>
> GLWindowPaintAttrib sAttrib;
> unsigned int mask = PAINT_WINDOW_TRANSFORMED_MASK |
> PAINT_WINDOW_TRANSLUCENT_MASK
> unsigned int addWindowGeometryIndex =
> gWindow->glAddGeometryGetCurrentIndex ();
>
Fixed in r3743.

> 1184 + GLenum filter = gScreen->textureFilter ();
> 1185 + bool filterChanged = false;
> 202 + /* only set back the global filter
> 1203 + * if we changed it before */
> 1204 + if (filterChanged)
> 1205 + gScreen->setTextureFilter (filter);
>
> This isn't necessary anymore.
>
Question: Why ? How do we set back the GL_filter state if we changed it ?
I am sorry that I still don't fully get it, it seems...

> 1357 + if (ts->thumb.win == window && ts->thumb.opacity > 0.0)
>
> There's no need for all that whitespace between "ts->thumb.win" and "==
> window" and likewise for "> ...

Read more...

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

I'll try to further improve thumbnail as there is still some room for optimization...

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

> 1184 + GLenum filter = gScreen->textureFilter ();
> 1185 + bool filterChanged = false;
> 202 + /* only set back the global filter
> 1203 + * if we changed it before */
> 1204 + if (filterChanged)
> 1205 + gScreen->setTextureFilter (filter);
>
> This isn't necessary anymore.
>
Question: Why ? How do we set back the GL_filter state if we changed it ?
I am sorry that I still don't fully get it, it seems...

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

Sam, I think I got them all now (except the filter-change that still needs info)... ;)

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

Re: filter. As I mentioned earlier, the filter is only changed at the time a texture is bound. As such calling setTextureFilter does not result in any calls into opengl.

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

> Re: filter. As I mentioned earlier, the filter is only changed at the time a
> texture is bound. As such calling setTextureFilter does not result in any
> calls into opengl.

I guess I need some example code to understand. Even if the filter change will just get applied the next time a texture gets bound, we still need to set back the filter to its previous state, or otherwise we would mess with the user's OpenGL filter settings...
Btw, here you approved the same solution: http://bazaar.launchpad.net/~compiz-team/compiz/0.9.10/revision/3740

To me that makes sense, we cannot simply change the filter on a per-plugin basis, if we do not know what the global filter is set to... but maybe I still do not get it, maybe just those open bug reports about broken mipmapping are making me nervous, see:

bug #1020818 [regression][GLES] mipmapping doesn't work at all any more
bug #1016364 Mipmap support broken

or

bug #913521 After using mipmaps for effects, windows stop refreshing

At least I cannot reproduce the last one of them for sure, not sure about the former 2 though...

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

/offtopic on

Sam, another unrelated, but open quite important question I have is how to find out if a specific plugin is enabled/running, something like:

bool
isPluginRunning (name)

Do we have something like this ?

/offtopic off

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
MC Return (mc-return) wrote :

99% tests passed, 1 tests failed out of 1500

Total Test time (real) = 2562.04 sec

The following tests FAILED:
 1478 - CompizXorgSystemStackingTest.TestCreateWindowsAndRestackRelativeToEachOtherDockAlwaysOnTop (Failed)

This has nothing to do with this branch, Jenkins...

review: Needs Resubmitting
Revision history for this message
Sam Spilsbury (smspillaz) wrote :
Download full text (4.5 KiB)

As I've mentioned before, all these changes are fine. The only one that needs to be removed is the filter-save-restore as it is redundant.

1247 + GLenum filter = gScreen->textureFilter ();
1248 + bool filterChanged = false;
1249 +
1250 + /* we just need to change the texture filter, if
1251 + * thumbnail mipmapping is enabled */
1252 if (optionGetMipmap ())
1253 + {
1254 gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
1255 + filterChanged = true;
1256 + }
1257
1258 wTransform.translate (w->x (), w->y (), 0.0f);
1259 wTransform.scale (sAttrib.xScale, sAttrib.yScale, 1.0f);
1260 @@ -932,7 +914,10 @@
1261 gWindow->glAddGeometrySetCurrentIndex (MAXSHORT);
1262 gWindow->glDraw (wTransform, sAttrib, infiniteRegion, mask);
1263
1264 - gScreen->setTextureFilter (filter);
1265 + /* only set back the global filter
1266 + * if we changed it before */
1267 + if (filterChanged)
1268 + gScreen->setTextureFilter (filter);

Answering your other questions

> 99% tests passed, 1 tests failed out of 1500

> Total Test time (real) = 2562.04 sec

> The following tests FAILED:
> 1478 - CompizXorgSystemStackingTest.TestCreateWindowsAndRestackRelativeToEachOtherDockAlwaysOnTop (Failed)

> This has nothing to do with this branch, Jenkins...

Unfortunately there is a race condition in our jenkins infrastructure which makes sporadic failures of these tests possible. The tests are not sandboxed and instead run on the same worker in parallel. Our testing framework does the best it can to avoid this by selecting another X connection to run on if there is already a server running on the selected display - but it is not perfect as test runs 1 and 2 can pick the same display number if neither of them saw that the display was in use at the same time. This generally causes one of the servers to either crash, or causes both tests to interfere with each other.

Just resubmit if that happens and jenkins will run again.

> I guess I need some example code to understand. Even if the filter change will just get applied the next time a texture gets bound, we still need to set back the filter to its previous state, or otherwise we would mess with the user's OpenGL filter settings...

We already do that.

GLint filter = gScreen->textureFilter ();

...
gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
...
gScreen->setTextureFilter (filter);

The point I'm trying to make is this - you don't need to check if the filter has changed in order to change it back. Just change it back. setTextureFilter does not result in any calls to OpenGL. The call is delayed until the point at which a texture is bound. This means that the following:

gScreen->setTextureFilter (...)
texture->activate (); <-
gScreen->setTextureFilter (...)

Will only result in a single call to OpenGL, because the desired state is cached and applied only at the bind point.

> Btw, here you approved the same solution: http://bazaar.launchpad.net/~compiz-team/compiz/0.9.10/revision/3740

That was a mistake on my behalf. A mostly harmless mistake, but a mistake nonetheless.

> To me that makes sense, we cannot simply change the filter on a per-plugin basis, if we do not know what the ...

Read more...

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

Thanks a lot 4 taking the time and explaining the mipmap stuff in detail. Now this makes a lot more sense to me.

I will fix the mipmap stuff accordingly in this MP and will propose another MP fixing the wrong mipmap handling of Expo.

Revision history for this message
MC Return (mc-return) :
review: Needs Resubmitting
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Will merge this after 0.9.10

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

> Will merge this after 0.9.10

Now it seems to me that the release is not far away ?
Our blueprint for 0.9.10 says it is still a long and winding road to 0.9.10 (still a lot of bugs open there)...
My impression from my past involvement was that the release would happen around end of August or some time in September ?

/me is confused a bit now...

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

Note:
Sam, you reviewed this already up to r3747.
All I did afterwards was fixing the filter stuff according to my new understanding of things (thanks again 4 your explanations).
I do not think that Compiz really has time for delays...

Also (regarding the release):
I do not agree that we ship/release stuff that we know is broken, examples for this are: td, session, dbus.
We should exclude those from compilation, before we release. It makes no sense to release broken stuff.

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

No functional changes. Can't test this is action but the changes look good to me.

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

Thanks, Sami. Merging it.

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

No, I'll wait for Sam, because of his comment above...

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

Trunk is unblocked.

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/thumbnail/src/thumbnail.cpp'
--- plugins/thumbnail/src/thumbnail.cpp 2013-05-09 13:43:07 +0000
+++ plugins/thumbnail/src/thumbnail.cpp 2013-06-28 14:26:23 +0000
@@ -33,7 +33,7 @@
33COMPIZ_PLUGIN_20090315 (thumbnail, ThumbPluginVTable);33COMPIZ_PLUGIN_20090315 (thumbnail, ThumbPluginVTable);
3434
35void35void
36ThumbScreen::freeThumbText (Thumbnail *t)36ThumbScreen::freeThumbText (Thumbnail *t)
37{37{
38 if (!t->text)38 if (!t->text)
39 return;39 return;
@@ -43,20 +43,20 @@
43}43}
4444
45void45void
46ThumbScreen::renderThumbText (Thumbnail *t,46ThumbScreen::renderThumbText (Thumbnail *t,
47 bool freeThumb)47 bool freeThumb)
48{48{
49 if (!textPluginLoaded)49 if (!textPluginLoaded)
50 return;50 return;
5151
52 CompText::Attrib tA;
53
54 if (freeThumb || !t->text)52 if (freeThumb || !t->text)
55 {53 {
56 freeThumbText (t);54 freeThumbText (t);
57 t->text = new CompText ();55 t->text = new CompText ();
58 }56 }
5957
58 CompText::Attrib tA;
59
60 tA.maxWidth = t->width;60 tA.maxWidth = t->width;
61 tA.maxHeight = 100;61 tA.maxHeight = 100;
6262
@@ -74,8 +74,10 @@
74 tA.color[2] = optionGetFontColorBlue ();74 tA.color[2] = optionGetFontColorBlue ();
75 tA.color[3] = optionGetFontColorAlpha ();75 tA.color[3] = optionGetFontColorAlpha ();
76 tA.flags = CompText::WithBackground | CompText::Ellipsized;76 tA.flags = CompText::WithBackground | CompText::Ellipsized;
77
77 if (optionGetFontBold ())78 if (optionGetFontBold ())
78 tA.flags |= CompText::StyleBold;79 tA.flags |= CompText::StyleBold;
80
79 tA.family = "Sans";81 tA.family = "Sans";
8082
81 t->textValid = t->text->renderWindowTitle (t->win->id (), false, tA);83 t->textValid = t->text->renderWindowTitle (t->win->id (), false, tA);
@@ -84,11 +86,12 @@
84void86void
85ThumbScreen::damageThumbRegion (Thumbnail *t)87ThumbScreen::damageThumbRegion (Thumbnail *t)
86{88{
87 int x = t->x - t->offset;89 int x = t->x - t->offset;
88 int y = t->y - t->offset;90 int y = t->y - t->offset;
89 int width = t->width + (t->offset * 2);91 int width = t->width + t->offset * 2;
90 int height = t->height + (t->offset * 2);92 int height = t->height + t->offset * 2;
91 CompRect rect (x, y, width, height);93
94 CompRect rect (x, y, width, height);
9295
93 if (t->text)96 if (t->text)
94 rect.setHeight (rect.height () + t->text->getHeight () + optionGetTextDistance ());97 rect.setHeight (rect.height () + t->text->getHeight () + optionGetTextDistance ());
@@ -105,20 +108,8 @@
105void108void
106ThumbScreen::thumbUpdateThumbnail ()109ThumbScreen::thumbUpdateThumbnail ()
107{110{
108 int igMidPoint[2], tMidPoint[2];111 if (thumb.win == pointedWin ||
109 int tPos[2], tmpPos[2];112 (thumb.opacity && oldThumb.opacity))
110 float distance = 1000000;
111 int off, oDev, tHeight;
112 CompRect oGeom;
113 float maxSize = optionGetThumbSize ();
114 double scale = 1.0;
115 ThumbWindow *tw;
116 CompWindow *w;
117
118 if (thumb.win == pointedWin)
119 return;
120
121 if (thumb.opacity > 0.0 && oldThumb.opacity > 0.0)
122 return;113 return;
123114
124 if (thumb.win)115 if (thumb.win)
@@ -126,6 +117,8 @@
126117
127 freeThumbText (&oldThumb);118 freeThumbText (&oldThumb);
128119
120 ThumbWindow *tw;
121
129 if (oldThumb.win)122 if (oldThumb.win)
130 {123 {
131 tw = ThumbWindow::get (oldThumb.win);124 tw = ThumbWindow::get (oldThumb.win);
@@ -136,36 +129,42 @@
136 tw->window->resizeNotifySetEnabled (tw, false);129 tw->window->resizeNotifySetEnabled (tw, false);
137 }130 }
138131
139 oldThumb = thumb;132 oldThumb = thumb;
140 thumb.text = NULL;133 thumb.text = NULL;
141 thumb.win = pointedWin;134 thumb.win = pointedWin;
142 thumb.dock = dock;135 thumb.dock = dock;
143136
144 if (!thumb.win || !dock)137 if (!thumb.win || !dock)
145 {138 {
146 thumb.win = NULL;139 thumb.win = NULL;
147 thumb.dock = NULL;140 thumb.dock = NULL;
148 return;141 return;
149 }142 }
150143
151 w = thumb.win;144 CompWindow *w = thumb.win;
152 tw = ThumbWindow::get (w);145 tw = ThumbWindow::get (w);
153146
154 tw->cWindow->damageRectSetEnabled (tw, true);147 tw->cWindow->damageRectSetEnabled (tw, true);
155 tw->gWindow->glPaintSetEnabled (tw, true);148 tw->gWindow->glPaintSetEnabled (tw, true);
156 tw->window->resizeNotifySetEnabled (tw, true);149 tw->window->resizeNotifySetEnabled (tw, true);
157150
158 /* do we nee to scale the window down? */151 float maxSize = optionGetThumbSize ();
159 if (WIN_W (w) > maxSize || WIN_H (w) > maxSize)152 double scale = 1.0;
153
154 int winWidth = w->width () + w->border ().left + w->border ().right;
155 int winHeight = w->height () + w->border ().top + w->border ().bottom;
156
157 /* do we need to scale the window down? */
158 if (winWidth > maxSize || winHeight > maxSize)
160 {159 {
161 if (WIN_W (w) >= WIN_H (w))160 if (winWidth >= winHeight)
162 scale = maxSize / WIN_W (w);161 scale = maxSize / winWidth;
163 else162 else
164 scale = maxSize / WIN_H (w);163 scale = maxSize / winHeight;
165 }164 }
166165
167 thumb.width = WIN_W (w)* scale;166 thumb.width = winWidth * scale;
168 thumb.height = WIN_H (w) * scale;167 thumb.height = winHeight * scale;
169 thumb.scale = scale;168 thumb.scale = scale;
170169
171 if (optionGetTitleEnabled ())170 if (optionGetTitleEnabled ())
@@ -173,33 +172,35 @@
173 else172 else
174 freeThumbText (&thumb);173 freeThumbText (&thumb);
175174
176 igMidPoint[0] = w->iconGeometry ().x () + (w->iconGeometry ().width () / 2);175 int igMidPoint[2], tMidPoint[2];
177 igMidPoint[1] = w->iconGeometry ().y () + (w->iconGeometry ().height () / 2);176
178177 igMidPoint[0] = w->iconGeometry ().centerX ();
179 off = optionGetBorder ();178 igMidPoint[1] = w->iconGeometry ().centerY ();
180 oDev = screen->outputDeviceForPoint (w->iconGeometry ().x () +179
181 (w->iconGeometry ().width () / 2),180 int off = optionGetBorder ();
182 w->iconGeometry ().y () +181 int oDev = screen->outputDeviceForPoint (igMidPoint[0],
183 (w->iconGeometry ().height () / 2));182 igMidPoint[1]);
183
184 CompRect oGeom;
184185
185 if (screen->outputDevs ().size () == 1 ||186 if (screen->outputDevs ().size () == 1 ||
186 (unsigned int) oDev > screen->outputDevs ().size ())187 (unsigned int) oDev > screen->outputDevs ().size ())
187 {
188 oGeom.setGeometry (0, 0, screen->width (), screen->height ());188 oGeom.setGeometry (0, 0, screen->width (), screen->height ());
189 }
190 else189 else
191 {
192 oGeom = screen->outputDevs ()[oDev];190 oGeom = screen->outputDevs ()[oDev];
193 }191
194192 int tHeight = thumb.height;
195 tHeight = thumb.height;193 int tWidth = thumb.width;
194
196 if (thumb.text)195 if (thumb.text)
197 tHeight += thumb.text->getHeight () + optionGetTextDistance ();196 tHeight += thumb.text->getHeight () + optionGetTextDistance ();
198197
199 /* Could someone please explain how this works */198 int halfTWidth = tWidth / 2;
199 int halfTHeight = tHeight / 2;
200 int tPos[2], tmpPos[2];
200201
201 // failsave position202 // failsave position
202 tPos[0] = igMidPoint[0] - (thumb.width / 2.0);203 tPos[0] = igMidPoint[0] - halfTWidth;
203204
204 if (w->iconGeometry ().y () - tHeight >= 0)205 if (w->iconGeometry ().y () - tHeight >= 0)
205 tPos[1] = w->iconGeometry ().y () - tHeight;206 tPos[1] = w->iconGeometry ().y () - tHeight;
@@ -207,23 +208,30 @@
207 tPos[1] = w->iconGeometry ().y () + w->iconGeometry ().height ();208 tPos[1] = w->iconGeometry ().y () + w->iconGeometry ().height ();
208209
209 // above210 // above
210 tmpPos[0] = igMidPoint[0] - (thumb.width / 2.0);211 tmpPos[0] = igMidPoint[0] - halfTWidth;
211212
212 if (tmpPos[0] - off < oGeom.x1 ())213 if (tmpPos[0] - off < oGeom.x1 ())
213 tmpPos[0] = oGeom.x1 () + off;214 tmpPos[0] = oGeom.x1 () + off;
214215
215 if (tmpPos[0] + off + thumb.width > oGeom.x2 ())216 if (tmpPos[0] + off + tWidth > oGeom.x2 ())
216 {217 {
217 if (thumb.width + (2 * off) <= oGeom.width ())218 if (tWidth + (2 * off) <= oGeom.width ())
218 tmpPos[0] = oGeom.x2 () - thumb.width - off;219 tmpPos[0] = oGeom.x2 () - tWidth - off;
219 else220 else
220 tmpPos[0] = oGeom.x1 () + off;221 tmpPos[0] = oGeom.x1 () + off;
221 }222 }
222223
223 tMidPoint[0] = tmpPos[0] + (thumb.width / 2.0);224 tMidPoint[0] = tmpPos[0] + halfTWidth;
224225
225 tmpPos[1] = WIN_Y (dock) - tHeight - off;226 int dockX = dock->x () - dock->border ().left;
226 tMidPoint[1] = tmpPos[1] + (tHeight / 2.0);227 int dockY = dock->y () - dock->border ().top;
228 int dockWidth = dock->width () + dock->border ().left + dock->border ().right;
229 int dockHeight = dock->height () + dock->border ().top + dock->border ().bottom;
230
231 tmpPos[1] = dockY - tHeight - off;
232 tMidPoint[1] = tmpPos[1] + halfTHeight;
233
234 float distance = 1000000;
227235
228 if (tmpPos[1] > oGeom.y1 ())236 if (tmpPos[1] > oGeom.y1 ())
229 {237 {
@@ -233,9 +241,9 @@
233 }241 }
234242
235 // below243 // below
236 tmpPos[1] = WIN_Y (dock) + WIN_H (dock) + off;244 tmpPos[1] = dockY + dockHeight + off;
237245
238 tMidPoint[1] = tmpPos[1] + (tHeight / 2.0);246 tMidPoint[1] = tmpPos[1] + halfTHeight;
239247
240 if (tmpPos[1] + tHeight + off < oGeom.y2 () &&248 if (tmpPos[1] + tHeight + off < oGeom.y2 () &&
241 GET_DISTANCE (igMidPoint, tMidPoint) < distance)249 GET_DISTANCE (igMidPoint, tMidPoint) < distance)
@@ -246,7 +254,7 @@
246 }254 }
247255
248 // left256 // left
249 tmpPos[1] = igMidPoint[1] - (tHeight / 2.0);257 tmpPos[1] = igMidPoint[1] - halfTHeight;
250258
251 if (tmpPos[1] - off < oGeom.y1 ())259 if (tmpPos[1] - off < oGeom.y1 ())
252 tmpPos[1] = oGeom.y1 () + off;260 tmpPos[1] = oGeom.y1 () + off;
@@ -254,15 +262,14 @@
254 if (tmpPos[1] + off + tHeight > oGeom.y2 ())262 if (tmpPos[1] + off + tHeight > oGeom.y2 ())
255 {263 {
256 if (tHeight + (2 * off) <= oGeom.height ())264 if (tHeight + (2 * off) <= oGeom.height ())
257 tmpPos[1] = oGeom.y2 () - thumb.height - off;265 tmpPos[1] = oGeom.y2 () - tHeight - off;
258 else266 else
259 tmpPos[1] = oGeom.y1 () + off;267 tmpPos[1] = oGeom.y1 () + off;
260 }268 }
261269
262 tMidPoint[1] = tmpPos[1] + (tHeight / 2.0);270 tMidPoint[1] = tmpPos[1] + halfTHeight;
263271 tmpPos[0] = dockX - tWidth - off;
264 tmpPos[0] = WIN_X (dock) - thumb.width - off;272 tMidPoint[0] = tmpPos[0] + halfTWidth;
265 tMidPoint[0] = tmpPos[0] + (thumb.width / 2.0);
266273
267 if (tmpPos[0] > oGeom.x1 () && GET_DISTANCE (igMidPoint, tMidPoint) < distance)274 if (tmpPos[0] > oGeom.x1 () && GET_DISTANCE (igMidPoint, tMidPoint) < distance)
268 {275 {
@@ -272,11 +279,11 @@
272 }279 }
273280
274 // right281 // right
275 tmpPos[0] = WIN_X (dock) + WIN_W (dock) + off;282 tmpPos[0] = dockX + dockWidth + off;
276283
277 tMidPoint[0] = tmpPos[0] + (thumb.width / 2.0);284 tMidPoint[0] = tmpPos[0] + halfTWidth;
278285
279 if (tmpPos[0] + thumb.width + off < oGeom.x2 () &&286 if (tmpPos[0] + tWidth + off < oGeom.x2 () &&
280 GET_DISTANCE (igMidPoint, tMidPoint) < distance)287 GET_DISTANCE (igMidPoint, tMidPoint) < distance)
281 {288 {
282 tPos[0] = tmpPos[0];289 tPos[0] = tmpPos[0];
@@ -298,7 +305,7 @@
298bool305bool
299ThumbScreen::thumbShowThumbnail ()306ThumbScreen::thumbShowThumbnail ()
300{307{
301 showingThumb = true;308 showingThumb = true;
302309
303 thumbUpdateThumbnail ();310 thumbUpdateThumbnail ();
304 damageThumbRegion (&thumb);311 damageThumbRegion (&thumb);
@@ -310,15 +317,11 @@
310ThumbScreen::checkPosition (CompWindow *w)317ThumbScreen::checkPosition (CompWindow *w)
311{318{
312 if (optionGetCurrentViewport ())319 if (optionGetCurrentViewport ())
313 {320 if (w->serverX () >= screen->width () ||
314 if (w->serverX () >= screen->width () ||321 w->serverX () + w->serverWidth () <= 0 ||
315 w->serverX () + w->serverWidth () <= 0 ||322 w->serverY () >= screen->height () ||
316 w->serverY () >= screen->height () ||
317 w->serverY () + w->serverHeight () <= 0)323 w->serverY () + w->serverHeight () <= 0)
318 {
319 return false;324 return false;
320 }
321 }
322325
323 return true;326 return true;
324}327}
@@ -332,25 +335,13 @@
332 {335 {
333 THUMB_WINDOW (cw);336 THUMB_WINDOW (cw);
334337
335 if (cw->destroyed ())338 if (cw->destroyed () ||
336 continue;339 cw->iconGeometry ().isEmpty () ||
337340 !cw->isMapped () ||
338 if (cw->iconGeometry ().isEmpty ())341 cw->state () & CompWindowStateSkipTaskbarMask ||
339 continue;342 cw->state () & CompWindowStateSkipPagerMask ||
340343 !cw->managed () ||
341 if (!cw->isMapped ())344 !tw->cWindow->pixmap ())
342 continue;
343
344 if (cw->state () & CompWindowStateSkipTaskbarMask)
345 continue;
346
347 if (cw->state () & CompWindowStateSkipPagerMask)
348 continue;
349
350 if (!cw->managed ())
351 continue;
352
353 if (!tw->cWindow->pixmap ())
354 continue;345 continue;
355346
356 if (cw->iconGeometry ().contains (p) &&347 if (cw->iconGeometry ().contains (p) &&
@@ -363,41 +354,35 @@
363354
364 if (found)355 if (found)
365 {356 {
357 int showDelay = optionGetShowDelay ();
358
366 if (!showingThumb &&359 if (!showingThumb &&
367 !(thumb.opacity != 0.0 && thumb.win == found))360 !(thumb.opacity != 0.0 && thumb.win == found))
368 {361 {
369 if (displayTimeout.active ())362 if (displayTimeout.active ())
370
371 {363 {
372 if (pointedWin != found)364 if (pointedWin != found)
373 {365 {
374 displayTimeout.stop ();366 displayTimeout.stop ();
375 displayTimeout.start (boost::bind367 displayTimeout.start (boost::bind (&ThumbScreen::thumbShowThumbnail,
376 (&ThumbScreen::thumbShowThumbnail,368 this), showDelay, showDelay + 500);
377 this),
378 optionGetShowDelay (),
379 optionGetShowDelay () + 500);
380 }369 }
381 }370 }
382 else371 else
383 {372 {
384 displayTimeout.stop ();373 displayTimeout.stop ();
385 displayTimeout.start (boost::bind (&ThumbScreen::thumbShowThumbnail,374 displayTimeout.start (boost::bind (&ThumbScreen::thumbShowThumbnail,
386 this),375 this), showDelay, showDelay + 500);
387 optionGetShowDelay (),
388 optionGetShowDelay () + 500);
389 }376 }
390 }377 }
391378
392 pointedWin = found;379 pointedWin = found;
393 thumbUpdateThumbnail ();380 thumbUpdateThumbnail ();
394 }381 }
395 else382 else
396 {383 {
397 if (displayTimeout.active ())384 if (displayTimeout.active ())
398 {
399 displayTimeout.stop ();385 displayTimeout.stop ();
400 }
401386
402 pointedWin = NULL;387 pointedWin = NULL;
403 showingThumb = false;388 showingThumb = false;
@@ -407,12 +392,11 @@
407 }392 }
408}393}
409394
410
411void395void
412ThumbWindow::resizeNotify (int dx,396ThumbWindow::resizeNotify (int dx,
413 int dy,397 int dy,
414 int dwidth,398 int dwidth,
415 int dheight)399 int dheight)
416{400{
417 THUMB_SCREEN (screen);401 THUMB_SCREEN (screen);
418402
@@ -422,96 +406,82 @@
422}406}
423407
424void408void
425ThumbScreen::handleEvent (XEvent * event)409ThumbScreen::handleEvent (XEvent *event)
426{410{
427
428 screen->handleEvent (event);411 screen->handleEvent (event);
429412
430 CompWindow *w;413 CompWindow *w;
431414
432 switch (event->type)415 switch (event->type)
433 {416 {
434 case PropertyNotify:417 case PropertyNotify:
435 if (event->xproperty.atom == Atoms::wmName)418 if (event->xproperty.atom == Atoms::wmName)
436 {419 {
437 w = screen->findWindow (event->xproperty.window);420 w = screen->findWindow (event->xproperty.window);
438421
439 if (w)422 if (w && thumb.win == w && optionGetTitleEnabled ())
440 {
441 if (thumb.win == w && optionGetTitleEnabled ())
442 renderThumbText (&thumb, true);423 renderThumbText (&thumb, true);
443 }424 }
444 }425
445 break;426 break;
446427
447 case ButtonPress:428 case ButtonPress:
448 {429 {
449
450 if (displayTimeout.active ())430 if (displayTimeout.active ())
451 {
452 displayTimeout.stop ();431 displayTimeout.stop ();
453 }
454432
455 pointedWin = 0;433 pointedWin = NULL;
456 showingThumb = false;434 showingThumb = false;
457 }435 }
458 break;436 break;
459437
460 case EnterNotify:438 case EnterNotify:
461 w = screen->findWindow (event->xcrossing.window);439 w = screen->findWindow (event->xcrossing.window);
462 if (w)440
463 {441 if (w)
464 if (w->wmType () & CompWindowTypeDockMask)
465 {442 {
466 if (dock != w)443 if (w->wmType () & CompWindowTypeDockMask)
467 {444 {
468 dock = w;445 if (dock != w)
446 {
447 dock = w;
448
449 if (displayTimeout.active ())
450 displayTimeout.stop ();
451
452 pointedWin = NULL;
453 showingThumb = false;
454 }
455
456 if (!poller.active ())
457 poller.start ();
458 }
459 else
460 {
461 dock = NULL;
469462
470 if (displayTimeout.active ())463 if (displayTimeout.active ())
471 {
472 displayTimeout.stop ();464 displayTimeout.stop ();
473 }
474465
475 pointedWin = NULL;466 pointedWin = NULL;
476 showingThumb = false;467 showingThumb = false;
477 }468
478469 if (poller.active ())
479 if (!poller.active ())470 poller.stop ();
480 {471 }
481 poller.start ();472 }
482 }473
483 }474 break;
484 else475
485 {476 case LeaveNotify:
486 dock = NULL;477 w = screen->findWindow (event->xcrossing.window);
487478
488 if (displayTimeout.active ())479 if (w && (w->wmType () & CompWindowTypeDockMask))
489 {480 {
490 displayTimeout.stop ();481 dock = NULL;
491 }482
492483 if (displayTimeout.active ())
493 pointedWin = NULL;484 displayTimeout.stop ();
494 showingThumb = false;
495
496 if (poller.active ())
497 {
498 poller.stop ();
499 }
500 }
501 }
502 break;
503 case LeaveNotify:
504 w = screen->findWindow (event->xcrossing.window);
505 if (w)
506 {
507 if (w->wmType () & CompWindowTypeDockMask)
508 {
509 dock = NULL;
510
511 if (displayTimeout.active ())
512 {
513 displayTimeout.stop ();
514 }
515485
516 pointedWin = NULL;486 pointedWin = NULL;
517 showingThumb = false;487 showingThumb = false;
@@ -520,32 +490,35 @@
520 cScreen->donePaintSetEnabled (this, true);490 cScreen->donePaintSetEnabled (this, true);
521491
522 if (poller.active ())492 if (poller.active ())
523 {
524 poller.stop ();493 poller.stop ();
525 }
526
527
528 }494 }
529 }495
530 break;496 break;
531497
532 default:498 default:
533 break;499 break;
534 }500 }
535}501}
536502
537
538void503void
539ThumbScreen::paintTexture (const GLMatrix &transform,504ThumbScreen::paintTexture (const GLMatrix &transform,
540 GLushort *color,505 GLushort *color,
541 int wx,506 int wx,
542 int wy,507 int wy,
543 int width,508 int width,
544 int height,509 int height,
545 int off)510 int off)
546{511{
547 GLfloat textureData[8];512 GLfloat textureData[8];
548 GLfloat vertexData[12];513 GLfloat vertexData[12];
514
515 GLfloat wxPlusWidth = wx + width;
516 GLfloat wyPlusHeight = wy + height;
517 GLfloat wxPlusWPlusOff = wxPlusWidth + off;
518 GLfloat wyPlusHPlusOff = wyPlusHeight + off;
519 GLfloat wxMinusOff = wx - off;
520 GLfloat wyMinusOff = wy - off;
521
549 GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();522 GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
550523
551 streamingBuffer->begin (GL_TRIANGLE_STRIP);524 streamingBuffer->begin (GL_TRIANGLE_STRIP);
@@ -557,13 +530,13 @@
557 vertexData[1] = wy;530 vertexData[1] = wy;
558 vertexData[2] = 0;531 vertexData[2] = 0;
559 vertexData[3] = wx;532 vertexData[3] = wx;
560 vertexData[4] = wy + height;533 vertexData[4] = wyPlusHeight;
561 vertexData[5] = 0;534 vertexData[5] = 0;
562 vertexData[6] = wx + width;535 vertexData[6] = wxPlusWidth;
563 vertexData[7] = wy;536 vertexData[7] = wy;
564 vertexData[8] = 0;537 vertexData[8] = 0;
565 vertexData[9] = wx + width;538 vertexData[9] = wxPlusWidth;
566 vertexData[10] = wy + height;539 vertexData[10] = wyPlusHeight;
567 vertexData[11] = 0;540 vertexData[11] = 0;
568541
569 streamingBuffer->addTexCoords (0, 1, textureData);542 streamingBuffer->addTexCoords (0, 1, textureData);
@@ -573,253 +546,245 @@
573 streamingBuffer->end ();546 streamingBuffer->end ();
574 streamingBuffer->render (transform);547 streamingBuffer->render (transform);
575548
576549 streamingBuffer->begin (GL_TRIANGLE_STRIP);
577 streamingBuffer->begin (GL_TRIANGLE_STRIP);550
578551 textureData[0] = 0;
579 textureData[0] = 0;552 textureData[1] = 0;
580 textureData[1] = 0;553 textureData[2] = 0;
581 textureData[2] = 0;554 textureData[3] = 1;
582 textureData[3] = 1;555 textureData[4] = 1;
583 textureData[4] = 1;556 textureData[5] = 0;
584 textureData[5] = 0;557 textureData[6] = 1;
585 textureData[6] = 1;558 textureData[7] = 1;
586 textureData[7] = 1;559
587560 vertexData[0] = wxMinusOff;
588 vertexData[0] = wx - off;561 vertexData[1] = wyMinusOff;
589 vertexData[1] = wy - off;562 vertexData[2] = 0;
590 vertexData[2] = 0;563 vertexData[3] = wxMinusOff;
591 vertexData[3] = wx - off;564 vertexData[4] = wy;
592 vertexData[4] = wy;565 vertexData[5] = 0;
593 vertexData[5] = 0;566 vertexData[6] = wx;
594 vertexData[6] = wx;567 vertexData[7] = wyMinusOff;
595 vertexData[7] = wy - off;568 vertexData[8] = 0;
596 vertexData[8] = 0;569 vertexData[9] = wx;
597 vertexData[9] = wx;570 vertexData[10] = wy;
598 vertexData[10] = wy;571 vertexData[11] = 0;
599 vertexData[11] = 0;572
600573 streamingBuffer->addTexCoords (0, 4, textureData);
601 streamingBuffer->addTexCoords (0, 4, textureData);574 streamingBuffer->addVertices (4, vertexData);
602 streamingBuffer->addVertices (4, vertexData);575 streamingBuffer->addColors (1, color);
603 streamingBuffer->addColors (1, color);576
604577 streamingBuffer->end ();
605 streamingBuffer->end ();578 streamingBuffer->render (transform);
606 streamingBuffer->render (transform);579
607580 streamingBuffer->begin (GL_TRIANGLE_STRIP);
608581
609 streamingBuffer->begin (GL_TRIANGLE_STRIP);582 textureData[0] = 1;
610583 textureData[1] = 0;
611 textureData[0] = 1;584 textureData[2] = 1;
612 textureData[1] = 0;585 textureData[3] = 1;
613 textureData[2] = 1;586 textureData[4] = 0;
614 textureData[3] = 1;587 textureData[5] = 0;
615 textureData[4] = 0;588 textureData[6] = 0;
616 textureData[5] = 0;589 textureData[7] = 1;
617 textureData[6] = 0;590
618 textureData[7] = 1;591 vertexData[0] = wxPlusWidth;
619592 vertexData[1] = wyMinusOff;
620 vertexData[0] = wx + width;593 vertexData[2] = 0;
621 vertexData[1] = wy - off;594 vertexData[3] = wxPlusWidth;
622 vertexData[2] = 0;595 vertexData[4] = wy;
623 vertexData[3] = wx + width;596 vertexData[5] = 0;
624 vertexData[4] = wy;597 vertexData[6] = wxPlusWPlusOff;
625 vertexData[5] = 0;598 vertexData[7] = wyMinusOff;
626 vertexData[6] = wx + width + off;599 vertexData[8] = 0;
627 vertexData[7] = wy - off;600 vertexData[9] = wxPlusWPlusOff;
628 vertexData[8] = 0;601 vertexData[10] = wy;
629 vertexData[9] = wx + width + off;602 vertexData[11] = 0;
630 vertexData[10] = wy;603
631 vertexData[11] = 0;604 streamingBuffer->addTexCoords (0, 4, textureData);
632605 streamingBuffer->addVertices (4, vertexData);
633 streamingBuffer->addTexCoords (0, 4, textureData);606 streamingBuffer->addColors (1, color);
634 streamingBuffer->addVertices (4, vertexData);607
635 streamingBuffer->addColors (1, color);608 streamingBuffer->end ();
636609 streamingBuffer->render (transform);
637 streamingBuffer->end ();610
638 streamingBuffer->render (transform);611 streamingBuffer->begin (GL_TRIANGLE_STRIP);
639612
640613 textureData[0] = 0;
641 streamingBuffer->begin (GL_TRIANGLE_STRIP);614 textureData[1] = 1;
642615 textureData[2] = 0;
643 textureData[0] = 0;616 textureData[3] = 0;
644 textureData[1] = 1;617 textureData[4] = 1;
645 textureData[2] = 0;618 textureData[5] = 1;
646 textureData[3] = 0;619 textureData[6] = 1;
647 textureData[4] = 1;620 textureData[7] = 0;
648 textureData[5] = 1;621
649 textureData[6] = 1;622 vertexData[0] = wxMinusOff;
650 textureData[7] = 0;623 vertexData[1] = wyPlusHeight;
651624 vertexData[2] = 0;
652 vertexData[0] = wx - off;625 vertexData[3] = wxMinusOff;
653 vertexData[1] = wy + height;626 vertexData[4] = wyPlusHPlusOff;
654 vertexData[2] = 0;627 vertexData[5] = 0;
655 vertexData[3] = wx - off;628 vertexData[6] = wx;
656 vertexData[4] = wy + height + off;629 vertexData[7] = wyPlusHeight;
657 vertexData[5] = 0;630 vertexData[8] = 0;
658 vertexData[6] = wx;631 vertexData[9] = wx;
659 vertexData[7] = wy + height;632 vertexData[10] = wyPlusHPlusOff;
660 vertexData[8] = 0;633 vertexData[11] = 0;
661 vertexData[9] = wx;634
662 vertexData[10] = wy + height + off;635 streamingBuffer->addTexCoords (0, 4, textureData);
663 vertexData[11] = 0;636 streamingBuffer->addVertices (4, vertexData);
664637 streamingBuffer->addColors (1, color);
665 streamingBuffer->addTexCoords (0, 4, textureData);638
666 streamingBuffer->addVertices (4, vertexData);639 streamingBuffer->end ();
667 streamingBuffer->addColors (1, color);640 streamingBuffer->render (transform);
668641
669 streamingBuffer->end ();642 streamingBuffer->begin (GL_TRIANGLE_STRIP);
670 streamingBuffer->render (transform);643
671644 textureData[0] = 1;
672645 textureData[1] = 1;
673 streamingBuffer->begin (GL_TRIANGLE_STRIP);646 textureData[2] = 1;
674647 textureData[3] = 0;
675 textureData[0] = 1;648 textureData[4] = 0;
676 textureData[1] = 1;649 textureData[5] = 1;
677 textureData[2] = 1;650 textureData[6] = 0;
678 textureData[3] = 0;651 textureData[7] = 0;
679 textureData[4] = 0;652
680 textureData[5] = 1;653 vertexData[0] = wxPlusWidth;
681 textureData[6] = 0;654 vertexData[1] = wyPlusHeight;
682 textureData[7] = 0;655 vertexData[2] = 0;
683656 vertexData[3] = wxPlusWidth;
684 vertexData[0] = wx + width;657 vertexData[4] = wyPlusHPlusOff;
685 vertexData[1] = wy + height;658 vertexData[5] = 0;
686 vertexData[2] = 0;659 vertexData[6] = wxPlusWPlusOff;
687 vertexData[3] = wx + width;660 vertexData[7] = wyPlusHeight;
688 vertexData[4] = wy + height + off;661 vertexData[8] = 0;
689 vertexData[5] = 0;662 vertexData[9] = wxPlusWPlusOff;
690 vertexData[6] = wx + width + off;663 vertexData[10] = wyPlusHPlusOff;
691 vertexData[7] = wy + height;664 vertexData[11] = 0;
692 vertexData[8] = 0;665
693 vertexData[9] = wx + width + off;666 streamingBuffer->addTexCoords (0, 4, textureData);
694 vertexData[10] = wy + height + off;667 streamingBuffer->addVertices (4, vertexData);
695 vertexData[11] = 0;668 streamingBuffer->addColors (1, color);
696669
697 streamingBuffer->addTexCoords (0, 4, textureData);670 streamingBuffer->end ();
698 streamingBuffer->addVertices (4, vertexData);671 streamingBuffer->render (transform);
699 streamingBuffer->addColors (1, color);672
700673 streamingBuffer->begin (GL_TRIANGLE_STRIP);
701 streamingBuffer->end ();674
702 streamingBuffer->render (transform);675 textureData[0] = 1;
703676 textureData[1] = 0;
704677 textureData[2] = 1;
705 streamingBuffer->begin (GL_TRIANGLE_STRIP);678 textureData[3] = 1;
706679 textureData[4] = 1;
707 textureData[0] = 1;680 textureData[5] = 0;
708 textureData[1] = 0;681 textureData[6] = 1;
709 textureData[2] = 1;682 textureData[7] = 1;
710 textureData[3] = 1;683
711 textureData[4] = 1;684 vertexData[0] = wx;
712 textureData[5] = 0;685 vertexData[1] = wyMinusOff;
713 textureData[6] = 1;686 vertexData[2] = 0;
714 textureData[7] = 1;687 vertexData[3] = wx;
715688 vertexData[4] = wy;
716 vertexData[0] = wx;689 vertexData[5] = 0;
717 vertexData[1] = wy - off;690 vertexData[6] = wxPlusWidth;
718 vertexData[2] = 0;691 vertexData[7] = wyMinusOff;
719 vertexData[3] = wx;692 vertexData[8] = 0;
720 vertexData[4] = wy;693 vertexData[9] = wxPlusWidth;
721 vertexData[5] = 0;694 vertexData[10] = wy;
722 vertexData[6] = wx + width;695 vertexData[11] = 0;
723 vertexData[7] = wy - off;696
724 vertexData[8] = 0;697 streamingBuffer->addTexCoords (0, 4, textureData);
725 vertexData[9] = wx + width;698 streamingBuffer->addVertices (4, vertexData);
726 vertexData[10] = wy;699 streamingBuffer->addColors (1, color);
727 vertexData[11] = 0;700
728701 streamingBuffer->end ();
729 streamingBuffer->addTexCoords (0, 4, textureData);702 streamingBuffer->render (transform);
730 streamingBuffer->addVertices (4, vertexData);703
731 streamingBuffer->addColors (1, color);704 streamingBuffer->begin (GL_TRIANGLE_STRIP);
732705
733 streamingBuffer->end ();706 textureData[0] = 1;
734 streamingBuffer->render (transform);707 textureData[1] = 1;
735708 textureData[2] = 1;
736709 textureData[3] = 0;
737 streamingBuffer->begin (GL_TRIANGLE_STRIP);710 textureData[4] = 1;
738711 textureData[5] = 1;
739 textureData[0] = 1;712 textureData[6] = 1;
740 textureData[1] = 1;713 textureData[7] = 0;
741 textureData[2] = 1;714
742 textureData[3] = 0;715 vertexData[0] = wx;
743 textureData[4] = 1;716 vertexData[1] = wyPlusHeight;
744 textureData[5] = 1;717 vertexData[2] = 0;
745 textureData[6] = 1;718 vertexData[3] = wx;
746 textureData[7] = 0;719 vertexData[4] = wyPlusHPlusOff;
747720 vertexData[5] = 0;
748 vertexData[0] = wx;721 vertexData[6] = wxPlusWidth;
749 vertexData[1] = wy + height;722 vertexData[7] = wyPlusHeight;
750 vertexData[2] = 0;723 vertexData[8] = 0;
751 vertexData[3] = wx;724 vertexData[9] = wxPlusWidth;
752 vertexData[4] = wy + height + off;725 vertexData[10] = wyPlusHPlusOff;
753 vertexData[5] = 0;726 vertexData[11] = 0;
754 vertexData[6] = wx + width;727
755 vertexData[7] = wy + height;728 streamingBuffer->addTexCoords (0, 4, textureData);
756 vertexData[8] = 0;729 streamingBuffer->addVertices (4, vertexData);
757 vertexData[9] = wx + width;730 streamingBuffer->addColors (1, color);
758 vertexData[10] = wy + height + off;731
759 vertexData[11] = 0;732 streamingBuffer->end ();
760733 streamingBuffer->render (transform);
761 streamingBuffer->addTexCoords (0, 4, textureData);734
762 streamingBuffer->addVertices (4, vertexData);735 streamingBuffer->begin (GL_TRIANGLE_STRIP);
763 streamingBuffer->addColors (1, color);736
764737 textureData[0] = 0;
765 streamingBuffer->end ();738 textureData[1] = 1;
766 streamingBuffer->render (transform);739 textureData[2] = 0;
767740 textureData[3] = 1;
768741 textureData[4] = 1;
769 streamingBuffer->begin (GL_TRIANGLE_STRIP);742 textureData[5] = 1;
770743 textureData[6] = 1;
771 textureData[0] = 0;744 textureData[7] = 1;
772 textureData[1] = 1;745
773 textureData[2] = 0;746 vertexData[0] = wxMinusOff;
774 textureData[3] = 1;747 vertexData[1] = wy;
775 textureData[4] = 1;748 vertexData[2] = 0;
776 textureData[5] = 1;749 vertexData[3] = wxMinusOff;
777 textureData[6] = 1;750 vertexData[4] = wyPlusHeight;
778 textureData[7] = 1;751 vertexData[5] = 0;
779752 vertexData[6] = wx;
780 vertexData[0] = wx - off;753 vertexData[7] = wy;
781 vertexData[1] = wy;754 vertexData[8] = 0;
782 vertexData[2] = 0;755 vertexData[9] = wx;
783 vertexData[3] = wx - off;756 vertexData[10] = wyPlusHeight;
784 vertexData[4] = wy + height;757 vertexData[11] = 0;
785 vertexData[5] = 0;758
786 vertexData[6] = wx;759 streamingBuffer->addTexCoords (0, 4, textureData);
787 vertexData[7] = wy;760 streamingBuffer->addVertices (4, vertexData);
788 vertexData[8] = 0;761 streamingBuffer->addColors (1, color);
789 vertexData[9] = wx;762
790 vertexData[10] = wy + height;763 streamingBuffer->end ();
791 vertexData[11] = 0;764 streamingBuffer->render (transform);
792765
793 streamingBuffer->addTexCoords (0, 4, textureData);766 streamingBuffer->begin (GL_TRIANGLE_STRIP);
794 streamingBuffer->addVertices (4, vertexData);767
795 streamingBuffer->addColors (1, color);768 textureData[0] = 1;
796769 textureData[1] = 1;
797 streamingBuffer->end ();770 textureData[2] = 1;
798 streamingBuffer->render (transform);771 textureData[3] = 1;
799772 textureData[4] = 0;
800773 textureData[5] = 1;
801 streamingBuffer->begin (GL_TRIANGLE_STRIP);774 textureData[6] = 0;
802775 textureData[7] = 1;
803 textureData[0] = 1;776
804 textureData[1] = 1;777 vertexData[0] = wxPlusWidth;
805 textureData[2] = 1;778 vertexData[1] = wy;
806 textureData[3] = 1;779 vertexData[2] = 0;
807 textureData[4] = 0;780 vertexData[3] = wxPlusWidth;
808 textureData[5] = 1;781 vertexData[4] = wyPlusHeight;
809 textureData[6] = 0;782 vertexData[5] = 0;
810 textureData[7] = 1;783 vertexData[6] = wxPlusWPlusOff;
811784 vertexData[7] = wy;
812 vertexData[0] = wx + width;785 vertexData[8] = 0;
813 vertexData[1] = wy;786 vertexData[9] = wxPlusWPlusOff;
814 vertexData[2] = 0;787 vertexData[10] = wyPlusHeight;
815 vertexData[3] = wx + width;
816 vertexData[4] = wy + height;
817 vertexData[5] = 0;
818 vertexData[6] = wx + width + off;
819 vertexData[7] = wy;
820 vertexData[8] = 0;
821 vertexData[9] = wx + width + off;
822 vertexData[10] = wy + height;
823 vertexData[11] = 0;788 vertexData[11] = 0;
824789
825 streamingBuffer->addTexCoords (0, 4, textureData);790 streamingBuffer->addTexCoords (0, 4, textureData);
@@ -831,40 +796,46 @@
831}796}
832797
833void798void
834ThumbScreen::thumbPaintThumb (Thumbnail *t,799ThumbScreen::thumbPaintThumb (Thumbnail *t,
835 const GLMatrix *transform)800 const GLMatrix *transform)
836{801{
837 GLushort color[4];802 CompWindow *w = t->win;
838 int addWindowGeometryIndex;
839 CompWindow *w = t->win;
840 int wx = t->x;
841 int wy = t->y;
842 float width = t->width;
843 float backheight = t->height; // background/glow height
844 GLWindowPaintAttrib sAttrib;
845 unsigned int mask = PAINT_WINDOW_TRANSFORMED_MASK |
846 PAINT_WINDOW_TRANSLUCENT_MASK;
847 GLWindow *gWindow = GLWindow::get (w);
848803
849 if (!w)804 if (!w)
850 return;805 return;
851806
807 GLWindow *gWindow = GLWindow::get (w);
808
809 GLushort color[4];
810
811 int wx = t->x;
812 int wy = t->y;
813
814 GLWindowPaintAttrib sAttrib;
815 unsigned int mask = PAINT_WINDOW_TRANSFORMED_MASK |
816 PAINT_WINDOW_TRANSLUCENT_MASK;
817
852 sAttrib = gWindow->paintAttrib ();818 sAttrib = gWindow->paintAttrib ();
853819
854 /* Wrap drawWindowGeometry to make sure the general820 /* Wrap drawWindowGeometry to make sure the general
855 drawWindowGeometry function is used */821 drawWindowGeometry function is used */
856 addWindowGeometryIndex =822 unsigned int addWindowGeometryIndex = gWindow->glAddGeometryGetCurrentIndex ();
857 gWindow->glAddGeometryGetCurrentIndex ();
858823
859 if (!gWindow->textures ().empty ())824 if (!gWindow->textures ().empty ())
860 {825 {
861 int off = t->offset;826 GLMatrix wTransform (*transform);
862 GLenum filter = gScreen->textureFilter ();827 GLboolean glBlendEnabled = glIsEnabled (GL_BLEND);
863 GLMatrix wTransform (*transform);828
864829 /* just enable blending if it is currently disabled */
865 glEnable (GL_BLEND);830 if (!glBlendEnabled)
831 glEnable (GL_BLEND);
832
866 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);833 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
867834
835 int off = t->offset;
836 float backheight = t->height; // background/glow height
837 float width = t->width;
838
868 if (optionGetWindowLike ())839 if (optionGetWindowLike ())
869 {840 {
870 color[0] = 1;841 color[0] = 1;
@@ -895,11 +866,14 @@
895 }866 }
896867
897 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);868 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
898 glDisable (GL_BLEND);869
870 /* we disable blending only, if it was disabled before */
871 if (!glBlendEnabled)
872 glDisable (GL_BLEND);
899873
900 if (t->text)874 if (t->text)
901 {875 {
902 float ox = 0.0f;876 float ox = 0.0f;
903 float height = backheight + t->text->getHeight () + optionGetTextDistance ();877 float height = backheight + t->text->getHeight () + optionGetTextDistance ();
904878
905 if (t->text->getWidth () < width)879 if (t->text->getWidth () < width)
@@ -911,12 +885,16 @@
911 gScreen->setTexEnvMode (GL_REPLACE);885 gScreen->setTexEnvMode (GL_REPLACE);
912886
913 sAttrib.opacity *= t->opacity;887 sAttrib.opacity *= t->opacity;
914 sAttrib.yScale = t->scale;888 sAttrib.yScale = t->scale;
915 sAttrib.xScale = t->scale;889 sAttrib.xScale = t->scale;
916890
917 sAttrib.xTranslate = wx - w->x () + w->border ().left * sAttrib.xScale;891 sAttrib.xTranslate = wx - w->x () + w->border ().left * sAttrib.xScale;
918 sAttrib.yTranslate = wy - w->y () + w->border ().top * sAttrib.yScale;892 sAttrib.yTranslate = wy - w->y () + w->border ().top * sAttrib.yScale;
919893
894 GLenum filter = gScreen->textureFilter ();
895
896 /* we just need to change the texture filter, if
897 * thumbnail mipmapping is enabled */
920 if (optionGetMipmap ())898 if (optionGetMipmap ())
921 gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);899 gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
922900
@@ -962,13 +940,12 @@
962 }*/940 }*/
963941
964 if (showingThumb && thumb.win == pointedWin)942 if (showingThumb && thumb.win == pointedWin)
965 {
966 thumb.opacity = MIN (1.0, thumb.opacity + val);943 thumb.opacity = MIN (1.0, thumb.opacity + val);
967 }
968944
969 if (!showingThumb || thumb.win != pointedWin)945 if (!showingThumb || thumb.win != pointedWin)
970 {946 {
971 thumb.opacity = MAX (0.0, thumb.opacity - val);947 thumb.opacity = MAX (0.0, thumb.opacity - val);
948
972 if (thumb.opacity == 0.0)949 if (thumb.opacity == 0.0)
973 thumb.win = NULL;950 thumb.win = NULL;
974 }951 }
@@ -976,6 +953,7 @@
976 if (oldThumb.opacity > 0.0f)953 if (oldThumb.opacity > 0.0f)
977 {954 {
978 oldThumb.opacity = MAX (0.0, oldThumb.opacity - val);955 oldThumb.opacity = MAX (0.0, oldThumb.opacity - val);
956
979 if (oldThumb.opacity == 0.0)957 if (oldThumb.opacity == 0.0)
980 {958 {
981 damageThumbRegion (&oldThumb);959 damageThumbRegion (&oldThumb);
@@ -999,10 +977,10 @@
999{977{
1000 std::vector <Thumbnail *> damageThumbs;978 std::vector <Thumbnail *> damageThumbs;
1001979
1002 if (thumb.opacity > 0.0)980 if (thumb.opacity)
1003 damageThumbs.push_back (&thumb);981 damageThumbs.push_back (&thumb);
1004982
1005 if (oldThumb.opacity > 0.0)983 if (oldThumb.opacity)
1006 damageThumbs.push_back (&oldThumb);984 damageThumbs.push_back (&oldThumb);
1007985
1008 if (!damageThumbs.empty ())986 if (!damageThumbs.empty ())
@@ -1021,12 +999,11 @@
1021999
1022bool1000bool
1023ThumbScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,1001ThumbScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
1024 const GLMatrix &transform,1002 const GLMatrix &transform,
1025 const CompRegion &region,1003 const CompRegion &region,
1026 CompOutput *output,1004 CompOutput *output,
1027 unsigned int mask)1005 unsigned int mask)
1028{1006{
1029 bool status;
1030 unsigned int newMask = mask;1007 unsigned int newMask = mask;
10311008
1032 painted = false;1009 painted = false;
@@ -1035,12 +1012,10 @@
1035 y = screen->vp ().y ();1012 y = screen->vp ().y ();
10361013
1037 if ((oldThumb.opacity > 0.0 && oldThumb.win) ||1014 if ((oldThumb.opacity > 0.0 && oldThumb.win) ||
1038 (thumb.opacity > 0.0 && thumb.win))1015 (thumb.opacity > 0.0 && thumb.win))
1039 {
1040 newMask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;1016 newMask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
1041 }
10421017
1043 status = gScreen->glPaintOutput (attrib, transform, region, output, newMask);1018 bool status = gScreen->glPaintOutput (attrib, transform, region, output, newMask);
10441019
1045 if (optionGetAlwaysOnTop () && !painted)1020 if (optionGetAlwaysOnTop () && !painted)
1046 {1021 {
@@ -1066,12 +1041,11 @@
10661041
1067void1042void
1068ThumbScreen::glPaintTransformedOutput (const GLScreenPaintAttrib &attrib,1043ThumbScreen::glPaintTransformedOutput (const GLScreenPaintAttrib &attrib,
1069 const GLMatrix &transform,1044 const GLMatrix &transform,
1070 const CompRegion &region,1045 const CompRegion &region,
1071 CompOutput *output,1046 CompOutput *output,
1072 unsigned int mask)1047 unsigned int mask)
1073{1048{
1074
1075 gScreen->glPaintTransformedOutput (attrib, transform, region, output, mask);1049 gScreen->glPaintTransformedOutput (attrib, transform, region, output, mask);
10761050
1077 if (optionGetAlwaysOnTop () && x == screen->vp ().x () &&1051 if (optionGetAlwaysOnTop () && x == screen->vp ().x () &&
@@ -1079,7 +1053,7 @@
1079 {1053 {
1080 painted = true;1054 painted = true;
10811055
1082 if (oldThumb.opacity > 0.0 && oldThumb.win)1056 if (oldThumb.opacity && oldThumb.win)
1083 {1057 {
1084 GLMatrix sTransform = transform;1058 GLMatrix sTransform = transform;
10851059
@@ -1088,7 +1062,7 @@
1088 thumbPaintThumb (&oldThumb, &sTransform);1062 thumbPaintThumb (&oldThumb, &sTransform);
1089 }1063 }
10901064
1091 if (thumb.opacity > 0.0 && thumb.win)1065 if (thumb.opacity && thumb.win)
1092 {1066 {
1093 GLMatrix sTransform = transform;1067 GLMatrix sTransform = transform;
10941068
@@ -1101,45 +1075,44 @@
11011075
1102bool1076bool
1103ThumbWindow::glPaint (const GLWindowPaintAttrib &attrib,1077ThumbWindow::glPaint (const GLWindowPaintAttrib &attrib,
1104 const GLMatrix &transform,1078 const GLMatrix &transform,
1105 const CompRegion &region,1079 const CompRegion &region,
1106 unsigned int mask)1080 unsigned int mask)
1107{1081{
1108 bool status;
1109
1110 THUMB_SCREEN (screen);1082 THUMB_SCREEN (screen);
11111083
1112 status = gWindow->glPaint (attrib, transform, region, mask);1084 bool status = gWindow->glPaint (attrib, transform, region, mask);
11131085
1114 if (!ts->optionGetAlwaysOnTop () && ts->x == screen->vp ().x () &&1086 if (!ts->optionGetAlwaysOnTop () &&
1115 ts->y == screen->vp ().y ())1087 ts->x == screen->vp ().x () &&
1088 ts->y == screen->vp ().y ())
1116 {1089 {
1117 GLMatrix sTransform = transform;1090 GLMatrix sTransform = transform;
1118 if (ts->oldThumb.opacity > 0.0 && ts->oldThumb.win &&1091
1092 if (ts->oldThumb.opacity &&
1093 ts->oldThumb.win &&
1119 ts->oldThumb.dock == window)1094 ts->oldThumb.dock == window)
1120 {
1121 ts->thumbPaintThumb (&ts->oldThumb, &sTransform);1095 ts->thumbPaintThumb (&ts->oldThumb, &sTransform);
1122 }
11231096
1124 if (ts->thumb.opacity > 0.0 && ts->thumb.win && ts->thumb.dock == window)1097 if (ts->thumb.opacity &&
1125 {1098 ts->thumb.win &&
1099 ts->thumb.dock == window)
1126 ts->thumbPaintThumb (&ts->thumb, &sTransform);1100 ts->thumbPaintThumb (&ts->thumb, &sTransform);
1127 }
1128 }1101 }
11291102
1130 return status;1103 return status;
1131}1104}
11321105
1133bool1106bool
1134ThumbWindow::damageRect (bool initial,1107ThumbWindow::damageRect (bool initial,
1135 const CompRect &rect)1108 const CompRect &rect)
1136{1109{
1137 THUMB_SCREEN (screen);1110 THUMB_SCREEN (screen);
11381111
1139 if (ts->thumb.win == window && ts->thumb.opacity > 0.0)1112 if (ts->thumb.win == window && ts->thumb.opacity)
1140 ts->damageThumbRegion (&ts->thumb);1113 ts->damageThumbRegion (&ts->thumb);
11411114
1142 if (ts->oldThumb.win == window && ts->oldThumb.opacity > 0.0)1115 if (ts->oldThumb.win == window && ts->oldThumb.opacity)
1143 ts->damageThumbRegion (&ts->oldThumb);1116 ts->damageThumbRegion (&ts->oldThumb);
11441117
1145 return cWindow->damageRect (initial, rect);1118 return cWindow->damageRect (initial, rect);
@@ -1164,13 +1137,13 @@
1164 CompositeScreenInterface::setHandler (cScreen, false);1137 CompositeScreenInterface::setHandler (cScreen, false);
1165 GLScreenInterface::setHandler (gScreen, false);1138 GLScreenInterface::setHandler (gScreen, false);
11661139
1167 thumb.win = NULL;1140 thumb.win = NULL;
1168 oldThumb.win = NULL;1141 oldThumb.win = NULL;
11691142
1170 thumb.text = NULL;1143 thumb.text = NULL;
1171 oldThumb.text = NULL;1144 oldThumb.text = NULL;
11721145
1173 thumb.opacity = 0.0f;1146 thumb.opacity = 0.0f;
1174 oldThumb.opacity = 0.0f;1147 oldThumb.opacity = 0.0f;
11751148
1176 poller.setCallback (boost::bind (&ThumbScreen::positionUpdate, this, _1));1149 poller.setCallback (boost::bind (&ThumbScreen::positionUpdate, this, _1));
@@ -1196,7 +1169,6 @@
1196 GLWindowInterface::setHandler (gWindow, false);1169 GLWindowInterface::setHandler (gWindow, false);
1197}1170}
11981171
1199
1200ThumbWindow::~ThumbWindow ()1172ThumbWindow::~ThumbWindow ()
1201{1173{
1202 THUMB_SCREEN (screen);1174 THUMB_SCREEN (screen);
@@ -1204,14 +1176,14 @@
1204 if (ts->thumb.win == window)1176 if (ts->thumb.win == window)
1205 {1177 {
1206 ts->damageThumbRegion (&ts->thumb);1178 ts->damageThumbRegion (&ts->thumb);
1207 ts->thumb.win = NULL;1179 ts->thumb.win = NULL;
1208 ts->thumb.opacity = 0;1180 ts->thumb.opacity = 0;
1209 }1181 }
12101182
1211 if (ts->oldThumb.win == window)1183 if (ts->oldThumb.win == window)
1212 {1184 {
1213 ts->damageThumbRegion (&ts->oldThumb);1185 ts->damageThumbRegion (&ts->oldThumb);
1214 ts->oldThumb.win = NULL;1186 ts->oldThumb.win = NULL;
1215 ts->oldThumb.opacity = 0;1187 ts->oldThumb.opacity = 0;
1216 }1188 }
12171189
12181190
=== modified file 'plugins/thumbnail/src/thumbnail.h'
--- plugins/thumbnail/src/thumbnail.h 2012-09-07 23:56:21 +0000
+++ plugins/thumbnail/src/thumbnail.h 2013-06-28 14:26:23 +0000
@@ -53,24 +53,17 @@
53#define THUMB_WINDOW(w) \53#define THUMB_WINDOW(w) \
54 ThumbWindow *tw = ThumbWindow::get (w)54 ThumbWindow *tw = ThumbWindow::get (w)
5555
56#define WIN_X(w) ((w)->x () - (w)->border ().left)
57#define WIN_Y(w) ((w)->y () - (w)->border ().top)
58#define WIN_W(w) ((w)->width () + (w)->border ().left + (w)->border ().right)
59#define WIN_H(w) ((w)->height () + (w)->border ().top + (w)->border ().bottom)
60
61extern const unsigned short TEXT_DISTANCE;
62
63bool textPluginLoaded;56bool textPluginLoaded;
6457
65typedef struct _Thumbnail58typedef struct _Thumbnail
66{59{
67 int x;60 int x;
68 int y;61 int y;
69 int width;62 int width;
70 int height;63 int height;
71 float scale;64 float scale;
72 float opacity;65 float opacity;
73 int offset;66 int offset;
7467
75 CompWindow *win;68 CompWindow *win;
76 CompWindow *dock;69 CompWindow *dock;
@@ -97,30 +90,30 @@
9790
98 bool91 bool
99 glPaintOutput (const GLScreenPaintAttrib &,92 glPaintOutput (const GLScreenPaintAttrib &,
100 const GLMatrix &,93 const GLMatrix &,
101 const CompRegion &,94 const CompRegion &,
102 CompOutput *,95 CompOutput *,
103 unsigned int);96 unsigned int );
10497
105 void98 void
106 donePaint ();99 donePaint ();
107100
108 void101 void
109 glPaintTransformedOutput (const GLScreenPaintAttrib &,102 glPaintTransformedOutput (const GLScreenPaintAttrib &,
110 const GLMatrix &,103 const GLMatrix &,
111 const CompRegion &,104 const CompRegion &,
112 CompOutput *,105 CompOutput *,
113 unsigned int);106 unsigned int );
114107
115 void108 void
116 freeThumbText (Thumbnail *t);109 freeThumbText (Thumbnail *t);
117110
118 void111 void
119 renderThumbText (Thumbnail *t,112 renderThumbText (Thumbnail *t,
120 bool freeThumb);113 bool freeThumb);
121114
122 void115 void
123 damageThumbRegion (Thumbnail *t);116 damageThumbRegion (Thumbnail *t);
124117
125 void118 void
126 thumbUpdateThumbnail ();119 thumbUpdateThumbnail ();
@@ -136,19 +129,18 @@
136129
137 void130 void
138 paintTexture (const GLMatrix &transform,131 paintTexture (const GLMatrix &transform,
139 GLushort *color,132 GLushort *color,
140 int wx,133 int wx,
141 int wy,134 int wy,
142 int width,135 int width,
143 int height,136 int height,
144 int off);137 int off);
145138
146 void139 void
147 thumbPaintThumb (Thumbnail *t,140 thumbPaintThumb (Thumbnail *t,
148 const GLMatrix *transform);141 const GLMatrix *transform);
149142
150143 GLScreen *gScreen;
151 GLScreen *gScreen;
152 CompositeScreen *cScreen;144 CompositeScreen *cScreen;
153145
154 CompWindow *dock;146 CompWindow *dock;
@@ -181,15 +173,15 @@
181 ThumbWindow (CompWindow *window);173 ThumbWindow (CompWindow *window);
182 ~ThumbWindow ();174 ~ThumbWindow ();
183175
184 CompWindow *window;176 CompWindow *window;
185 CompositeWindow *cWindow;177 CompositeWindow *cWindow;
186 GLWindow *gWindow;178 GLWindow *gWindow;
187179
188 bool180 bool
189 glPaint (const GLWindowPaintAttrib &attrib,181 glPaint (const GLWindowPaintAttrib &attrib,
190 const GLMatrix &transform,182 const GLMatrix &transform,
191 const CompRegion &region,183 const CompRegion &region,
192 unsigned int mask);184 unsigned int mask);
193185
194 void186 void
195 resizeNotify (int dx,187 resizeNotify (int dx,
@@ -198,7 +190,7 @@
198 int dheight);190 int dheight);
199191
200 bool192 bool
201 damageRect (bool initial,193 damageRect (bool initial,
202 const CompRect &rect);194 const CompRect &rect);
203};195};
204196

Subscribers

People subscribed via source and target branches

to all changes: