Merge lp:~3v1n0/unity/quicklist-item-glow-selection into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Rejected
Rejected by: Marco Trevisan (Treviño)
Proposed branch: lp:~3v1n0/unity/quicklist-item-glow-selection
Merge into: lp:unity
Prerequisite: lp:~3v1n0/unity/fixed-bad-quicklist-items-drawing
Diff against target: 571 lines (+106/-146)
7 files modified
plugins/unityshell/src/QuicklistMenuItem.cpp (+54/-10)
plugins/unityshell/src/QuicklistMenuItem.h (+4/-5)
plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp (+10/-37)
plugins/unityshell/src/QuicklistMenuItemLabel.cpp (+5/-25)
plugins/unityshell/src/QuicklistMenuItemRadio.cpp (+9/-42)
plugins/unityshell/src/QuicklistMenuItemSeparator.cpp (+8/-8)
plugins/unityshell/src/QuicklistView.cpp (+16/-19)
To merge this branch: bzr merge lp:~3v1n0/unity/quicklist-item-glow-selection
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+87410@code.launchpad.net

Description of the change

Fixed bug #911443 applying a glow to the quicklist item selection.

The glow is applied using some heuristic, since from dozen of tests I've done this seems the best result so far.

Also, the disabled items are now using a different opacity, following the design mokup.

Here you are some examples to show of how this branch works:
 - http://go.3v1n0.net/xJRglg
 - http://go.3v1n0.net/xIXzcd

To post a comment you must log in.
Revision history for this message
MC Return (mc-return) wrote :

Looks very nice.
Will we see that merged soon ?

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Unfortunately not... Design decisions have been changed.

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

:(

Unmerged revisions

1803. By Marco Trevisan (Treviño)

QuicklistMenuItem*: add a shared function to Draw the Prelight that applies a blurred glow

All the kinds of QuicklistMenuitems now uses the shared DrawText and DrawPrelight functions
to draw the content, these functions are also aware of the padding that the quicklist item
should use.

The DrawPrelight function uses some heuristic to get the best result, instead of just drawing
a blurred rectangle under the opaque one.

Plus, now the disabled quicklist are using a semi-transparent white color, computed comaparing
the results with the design mokups.

1802. By Marco Trevisan (Treviño)

QuicklistView: don't define the padding of each MenuItemView, leave the children to set it

The quicklist view shouldn't define the padding of each child, but each one should take all the
space and then draw there what it wants. This allows to use all the quicklist space on the menu items
and to draw a glow without reducing the item area.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/QuicklistMenuItem.cpp'
2--- plugins/unityshell/src/QuicklistMenuItem.cpp 2011-12-14 21:12:28 +0000
3+++ plugins/unityshell/src/QuicklistMenuItem.cpp 2012-01-03 21:46:26 +0000
4@@ -15,7 +15,8 @@
5 * along with this program. If not, see <http://www.gnu.org/licenses/>.
6 *
7 * Authored by: Mirco Müller <mirco.mueller@canonical.com>
8- * Authored by: Jay Taoko <jay.taoko@canonical.com>
9+ * Jay Taoko <jay.taoko@canonical.com>
10+ * Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
11 */
12
13 #include <gdk/gdk.h>
14@@ -134,8 +135,8 @@
15 int textWidth = 1;
16 int textHeight = 1;
17 GetTextExtents(textWidth, textHeight);
18- SetMinimumSize(textWidth + ITEM_INDENT_ABS + 3 * ITEM_MARGIN,
19- textHeight + 2 * ITEM_MARGIN);
20+ SetMinimumSize(textWidth + ITEM_INDENT_ABS + 4 * ITEM_MARGIN + 2 * ITEM_PADDING,
21+ textHeight + 2 * ITEM_MARGIN + 2 * ITEM_PADDING);
22 }
23
24 QuicklistMenuItemType QuicklistMenuItem::GetItemType()
25@@ -370,15 +371,12 @@
26 sigMouseLeave.emit(this);
27 }
28
29-void
30-QuicklistMenuItem::DrawText(cairo_t* cr,
31- int width,
32- int height,
33- nux::Color color)
34+void QuicklistMenuItem::DrawText(nux::CairoGraphics *cairo, int width, int height, nux::Color color)
35 {
36- if (_text == NULL)
37+ if (_text == nullptr || cairo == nullptr)
38 return;
39
40+ cairo_t* cr = cairo->GetContext();
41 int textWidth = 0;
42 int textHeight = 0;
43 PangoLayout* layout = NULL;
44@@ -392,6 +390,8 @@
45 g_object_get(settings, "gtk-font-name", &fontName, NULL);
46 GetTextExtents(fontName, textWidth, textHeight);
47
48+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
49+ cairo_set_source_rgba(cr, color.red, color.blue, color.green, color.alpha);
50 cairo_set_font_options(cr, gdk_screen_get_font_options(screen));
51 layout = pango_cairo_create_layout(cr);
52 desc = pango_font_description_from_string(fontName);
53@@ -417,7 +417,7 @@
54 pango_layout_context_changed(layout);
55
56 cairo_move_to(cr,
57- 2 * ITEM_MARGIN + ITEM_INDENT_ABS,
58+ ITEM_MARGIN + ITEM_PADDING + ITEM_INDENT_ABS,
59 (float)(height - textHeight) / 2.0f);
60 pango_cairo_show_layout(cr, layout);
61
62@@ -427,6 +427,50 @@
63 g_object_unref(layout);
64 }
65
66+void QuicklistMenuItem::DrawPrelight(nux::CairoGraphics *cairo, int width, int height, nux::Color color)
67+{
68+ if (!cairo)
69+ return;
70+
71+ /* The item prelight should be a blurred rounded rectangle, however to get
72+ * the best result so far, instead of just drawing a blurred rectangle and
73+ * an opaque one, we firstly manually create a kind of gradient of the
74+ * shape redrawing the rectangle of different dimensions and with different
75+ * opacities, then we blur the results and we finally draw the opauqe
76+ * rectangle */
77+ cairo_t* cr = cairo->GetContext();
78+ const double max_glow_opacity = 0.4f * color.alpha;
79+ const double opacity_step = max_glow_opacity/ITEM_PADDING;
80+
81+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
82+
83+ for (int i = 0; i <= ITEM_PADDING; ++i)
84+ {
85+ double opacity;
86+
87+ switch (i) {
88+ case 0:
89+ opacity = opacity_step / 2.0f;
90+ break;
91+ case ITEM_PADDING:
92+ opacity = color.alpha;
93+ break;
94+ default:
95+ opacity = opacity_step * (i + 1.0f);
96+ }
97+
98+ cairo_set_source_rgba(cr, color.red, color.blue, color.green, opacity);
99+ cairo->DrawRoundedRectangle(cr, 1.0f, i + 1, i,
100+ ITEM_CORNER_RADIUS_ABS+(ITEM_PADDING-i),
101+ width - (i + 1) * 2, height - (i) * 2);
102+
103+ if (i == ITEM_PADDING-1)
104+ cairo->BlurSurface(1);
105+
106+ cairo_fill(cr);
107+ }
108+}
109+
110 void
111 QuicklistMenuItem::EnableLabelMarkup(bool enabled)
112 {
113
114=== modified file 'plugins/unityshell/src/QuicklistMenuItem.h'
115--- plugins/unityshell/src/QuicklistMenuItem.h 2011-12-14 21:12:28 +0000
116+++ plugins/unityshell/src/QuicklistMenuItem.h 2012-01-03 21:46:26 +0000
117@@ -35,7 +35,8 @@
118
119 #define ITEM_INDENT_ABS 16
120 #define ITEM_CORNER_RADIUS_ABS 3
121-#define ITEM_MARGIN 4
122+#define ITEM_MARGIN 3
123+#define ITEM_PADDING 3
124
125 typedef enum
126 {
127@@ -135,10 +136,8 @@
128
129 bool _prelight; //!< True when the mouse is over the item.
130
131- void DrawText(cairo_t* cr,
132- int width,
133- int height,
134- nux::Color color);
135+ void DrawText(nux::CairoGraphics *cairo, int width, int height, nux::Color color);
136+ void DrawPrelight(nux::CairoGraphics *cairo, int width, int height, nux::Color color);
137
138 // Introspection
139 std::string _name;
140
141=== modified file 'plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp'
142--- plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp 2012-01-03 21:46:26 +0000
143+++ plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp 2012-01-03 21:46:26 +0000
144@@ -140,7 +140,7 @@
145 texture = _prelightTexture[texture_idx]->GetDeviceTexture();
146 }
147
148- _color = GetEnabled() ? nux::color::White : nux::Color(0.8f, 0.8f, 0.8f, 1.0f);
149+ _color = GetEnabled() ? nux::color::White : nux::color::White * 0.35;
150
151 gfxContext.QRP_1Tex(base.x,
152 base.y,
153@@ -168,7 +168,6 @@
154 void
155 QuicklistMenuItemCheckmark::UpdateTexture()
156 {
157- nux::Color transparent = nux::Color(0.0f, 0.0f, 0.0f, 0.0f);
158 int width = GetBaseWidth();
159 int height = GetBaseHeight();
160
161@@ -184,7 +183,7 @@
162 cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
163 cairo_set_line_width(cr, 1.0f);
164
165- DrawText(cr, width, height, nux::color::White);
166+ DrawText(_cairoGraphics, width, height, nux::color::White);
167
168 if (_normalTexture[0])
169 _normalTexture[0]->UnReference();
170@@ -201,7 +200,7 @@
171
172 cairo_save(cr);
173 cairo_translate(cr,
174- _align((ITEM_INDENT_ABS - 16.0f + ITEM_MARGIN) / 2.0f),
175+ _align((ITEM_INDENT_ABS - 16.0f + ITEM_MARGIN + ITEM_PADDING) / 2.0f),
176 _align(((double) height - 16.0f) / 2.0f));
177
178 cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
179@@ -221,7 +220,7 @@
180
181 cairo_restore(cr);
182
183- DrawText(cr, width, height, nux::color::White);
184+ DrawText(_cairoGraphics, width, height, nux::color::White);
185
186 if (_normalTexture[1])
187 _normalTexture[1]->UnReference();
188@@ -232,23 +231,8 @@
189 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
190 cairo_paint(cr);
191
192- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
193- cairo_scale(cr, 1.0f, 1.0f);
194- cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
195- cairo_set_line_width(cr, 1.0f);
196-
197- _cairoGraphics->DrawRoundedRectangle(cr,
198- 1.0f,
199- 0.5f,
200- 0.5f,
201- ITEM_CORNER_RADIUS_ABS,
202- width - 1.0f,
203- height - 1.0f);
204- cairo_fill(cr);
205-
206- cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.0f);
207-
208- DrawText(cr, width, height, transparent);
209+ DrawPrelight(_cairoGraphics, width, height, nux::color::White);
210+ DrawText(_cairoGraphics, width, height, nux::color::White * 0.0f);
211
212 if (_prelightTexture[0])
213 _prelightTexture[0]->UnReference();
214@@ -259,25 +243,13 @@
215 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
216 cairo_paint(cr);
217
218- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
219- cairo_scale(cr, 1.0f, 1.0f);
220- cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
221- cairo_set_line_width(cr, 1.0f);
222-
223- _cairoGraphics->DrawRoundedRectangle(cr,
224- 1.0f,
225- 0.5f,
226- 0.5f,
227- ITEM_CORNER_RADIUS_ABS,
228- width - 1.0f,
229- height - 1.0f);
230- cairo_fill(cr);
231+ DrawPrelight(_cairoGraphics, width, height, nux::color::White);
232
233 cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.0f);
234
235 cairo_save(cr);
236 cairo_translate(cr,
237- _align((ITEM_INDENT_ABS - 16.0f + ITEM_MARGIN) / 2.0f),
238+ _align((ITEM_INDENT_ABS - 16.0f + ITEM_MARGIN + ITEM_PADDING) / 2.0f),
239 _align(((double) height - 16.0f) / 2.0f));
240
241 cairo_translate(cr, 3.0f, 1.0f);
242@@ -295,7 +267,7 @@
243
244 cairo_restore(cr);
245
246- DrawText(cr, width, height, transparent);
247+ DrawText(_cairoGraphics, width, height, nux::color::White * 0.0f);
248
249 if (_prelightTexture[1])
250 _prelightTexture[1]->UnReference();
251@@ -303,6 +275,7 @@
252 _prelightTexture[1] = texture_from_cairo_graphics(*_cairoGraphics);
253
254 // finally clean up
255+ cairo_destroy(cr);
256 delete _cairoGraphics;
257 }
258
259
260=== modified file 'plugins/unityshell/src/QuicklistMenuItemLabel.cpp'
261--- plugins/unityshell/src/QuicklistMenuItemLabel.cpp 2011-12-14 21:12:28 +0000
262+++ plugins/unityshell/src/QuicklistMenuItemLabel.cpp 2012-01-03 21:46:26 +0000
263@@ -134,7 +134,7 @@
264 else
265 {
266 texture = _normalTexture[0]->GetDeviceTexture();
267- _color = nux::Color(0.8f, 0.8f, 0.8f, 1.0f);
268+ _color = nux::color::White * 0.35;
269 }
270
271 gfxContext.QRP_1Tex(base.x,
272@@ -165,7 +165,6 @@
273 void
274 QuicklistMenuItemLabel::UpdateTexture()
275 {
276- nux::Color transparent = nux::Color(0.0f, 0.0f, 0.0f, 0.0f);
277 int width = GetBaseWidth();
278 int height = GetBaseHeight();
279
280@@ -176,12 +175,7 @@
281 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
282 cairo_paint(cr);
283
284- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
285- cairo_scale(cr, 1.0f, 1.0f);
286- cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
287- cairo_set_line_width(cr, 1.0f);
288-
289- DrawText(cr, width, height, nux::color::White);
290+ DrawText(_cairoGraphics, width, height, nux::color::White);
291
292 if (_normalTexture[0])
293 _normalTexture[0]->UnReference();
294@@ -192,23 +186,8 @@
295 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
296 cairo_paint(cr);
297
298- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
299- cairo_scale(cr, 1.0f, 1.0f);
300- cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
301- cairo_set_line_width(cr, 1.0f);
302-
303- _cairoGraphics->DrawRoundedRectangle(cr,
304- 1.0f,
305- 0.5f,
306- 0.5f,
307- ITEM_CORNER_RADIUS_ABS,
308- width - 1.0f,
309- height - 1.0f);
310- cairo_fill(cr);
311-
312- cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.0f);
313-
314- DrawText(cr, width, height, transparent);
315+ DrawPrelight(_cairoGraphics, width, height, nux::color::White);
316+ DrawText(_cairoGraphics, width, height, nux::color::White * 0.0f);
317
318 if (_prelightTexture[0])
319 _prelightTexture[0]->UnReference();
320@@ -216,6 +195,7 @@
321 _prelightTexture[0] = texture_from_cairo_graphics(*_cairoGraphics);
322
323 // finally clean up
324+ cairo_destroy(cr);
325 delete _cairoGraphics;
326 }
327
328
329=== modified file 'plugins/unityshell/src/QuicklistMenuItemRadio.cpp'
330--- plugins/unityshell/src/QuicklistMenuItemRadio.cpp 2012-01-03 21:46:26 +0000
331+++ plugins/unityshell/src/QuicklistMenuItemRadio.cpp 2012-01-03 21:46:26 +0000
332@@ -139,7 +139,7 @@
333 texture = _prelightTexture[texture_idx]->GetDeviceTexture();
334 }
335
336- _color = GetEnabled() ? nux::color::White : nux::Color(0.8f, 0.8f, 0.8f, 1.0f);
337+ _color = GetEnabled() ? nux::color::White : nux::color::White * 0.35;
338
339 gfxContext.QRP_1Tex(base.x,
340 base.y,
341@@ -169,7 +169,6 @@
342 void
343 QuicklistMenuItemRadio::UpdateTexture()
344 {
345- nux::Color transparent = nux::Color(0.0f, 0.0f, 0.0f, 0.0f);
346 int width = GetBaseWidth();
347 int height = GetBaseHeight();
348
349@@ -180,12 +179,7 @@
350 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
351 cairo_paint(cr);
352
353- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
354- cairo_scale(cr, 1.0f, 1.0f);
355- cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
356- cairo_set_line_width(cr, 1.0f);
357-
358- DrawText(cr, width, height, nux::color::White);
359+ DrawText(_cairoGraphics, width, height, nux::color::White);
360
361 if (_normalTexture[0])
362 _normalTexture[0]->UnReference();
363@@ -201,7 +195,7 @@
364 cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
365 cairo_set_line_width(cr, 1.0f);
366
367- double x = _align((ITEM_INDENT_ABS + ITEM_MARGIN) / 2.0f);
368+ double x = _align((ITEM_INDENT_ABS + ITEM_MARGIN + ITEM_PADDING) / 2.0f);
369 double y = _align((double) height / 2.0f);
370 double radius = 3.5f;
371
372@@ -209,8 +203,7 @@
373 cairo_arc(cr, x, y, radius, 0.0f * (G_PI / 180.0f), 360.0f * (G_PI / 180.0f));
374 cairo_fill(cr);
375
376- cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
377- DrawText(cr, width, height, nux::color::White);
378+ DrawText(_cairoGraphics, width, height, nux::color::White);
379
380 if (_normalTexture[1])
381 _normalTexture[1]->UnReference();
382@@ -221,23 +214,8 @@
383 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
384 cairo_paint(cr);
385
386- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
387- cairo_scale(cr, 1.0f, 1.0f);
388- cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
389- cairo_set_line_width(cr, 1.0f);
390-
391- _cairoGraphics->DrawRoundedRectangle(cr,
392- 1.0f,
393- 0.5f,
394- 0.5f,
395- ITEM_CORNER_RADIUS_ABS,
396- width - 1.0f,
397- height - 1.0f);
398- cairo_fill(cr);
399-
400- cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.0f);
401-
402- DrawText(cr, width, height, transparent);
403+ DrawPrelight(_cairoGraphics, width, height, nux::color::White);
404+ DrawText(_cairoGraphics, width, height, nux::color::White * 0.0f);
405
406 if (_prelightTexture[0])
407 _prelightTexture[0]->UnReference();
408@@ -248,26 +226,14 @@
409 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
410 cairo_paint(cr);
411
412- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
413- cairo_scale(cr, 1.0f, 1.0f);
414- cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
415- cairo_set_line_width(cr, 1.0f);
416-
417- _cairoGraphics->DrawRoundedRectangle(cr,
418- 1.0f,
419- 0.5f,
420- 0.5f,
421- ITEM_CORNER_RADIUS_ABS,
422- width - 1.0f,
423- height - 1.0f);
424- cairo_fill(cr);
425+ DrawPrelight(_cairoGraphics, width, height, nux::color::White);
426
427 cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.0f);
428
429 cairo_arc(cr, x, y, radius, 0.0f * (G_PI / 180.0f), 360.0f * (G_PI / 180.0f));
430 cairo_fill(cr);
431
432- DrawText(cr, width, height, transparent);
433+ DrawText(_cairoGraphics, width, height, nux::color::White * 0.0f);
434
435 if (_prelightTexture[1])
436 _prelightTexture[1]->UnReference();
437@@ -275,6 +241,7 @@
438 _prelightTexture[1] = texture_from_cairo_graphics(*_cairoGraphics);
439
440 // finally clean up
441+ cairo_destroy(cr);
442 delete _cairoGraphics;
443 }
444
445
446=== modified file 'plugins/unityshell/src/QuicklistMenuItemSeparator.cpp'
447--- plugins/unityshell/src/QuicklistMenuItemSeparator.cpp 2011-12-14 21:12:28 +0000
448+++ plugins/unityshell/src/QuicklistMenuItemSeparator.cpp 2012-01-03 21:46:26 +0000
449@@ -30,9 +30,9 @@
450 NUX_FILE_LINE_PARAM)
451 {
452 _name = "QuicklistMenuItemSeparator";
453- SetMinimumHeight(5);
454- SetBaseSize(64, 5);
455- //_normalTexture = NULL;
456+ SetMinimumHeight(3);
457+ SetBaseSize(64, 3);
458+
459 _color = nux::Color(1.0f, 1.0f, 1.0f, 0.5f);
460 _premultiplied_color = nux::Color(0.5f, 0.5f, 0.5f, 0.5f);
461 _item_type = MENUITEM_TYPE_SEPARATOR;
462@@ -145,10 +145,9 @@
463 QuicklistMenuItemSeparator::UpdateTexture()
464 {
465 int width = GetBaseWidth();
466+ int height = GetBaseHeight();
467
468- _cairoGraphics = new nux::CairoGraphics(CAIRO_FORMAT_ARGB32,
469- GetBaseWidth(),
470- GetBaseHeight());
471+ _cairoGraphics = new nux::CairoGraphics(CAIRO_FORMAT_ARGB32, width, height);
472 cairo_t* cr = _cairoGraphics->GetContext();
473
474 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
475@@ -156,8 +155,8 @@
476 cairo_paint(cr);
477 cairo_set_source_rgba(cr, _color.red, _color.green, _color.blue, _color.alpha);
478 cairo_set_line_width(cr, 1.0f);
479- cairo_move_to(cr, 0.5f, 2.5f);
480- cairo_line_to(cr, width - 0.5f, 2.5f);
481+ cairo_move_to(cr, ITEM_PADDING + 0.5f, height/2.0f);
482+ cairo_line_to(cr, width - ITEM_PADDING - 0.5f, height/2.0f);
483 cairo_stroke(cr);
484
485 if (_normalTexture[0])
486@@ -165,6 +164,7 @@
487
488 _normalTexture[0] = texture_from_cairo_graphics(*_cairoGraphics);
489
490+ cairo_destroy(cr);
491 delete _cairoGraphics;
492 }
493
494
495=== modified file 'plugins/unityshell/src/QuicklistView.cpp'
496--- plugins/unityshell/src/QuicklistView.cpp 2011-12-19 20:20:22 +0000
497+++ plugins/unityshell/src/QuicklistView.cpp 2012-01-03 21:46:26 +0000
498@@ -69,8 +69,8 @@
499 , _corner_radius(4)
500 , _padding(13)
501 , _left_padding_correction(-1)
502- , _bottom_padding_correction_normal(-2)
503- , _bottom_padding_correction_single_item(-4)
504+ , _bottom_padding_correction_normal(-1)
505+ , _bottom_padding_correction_single_item(-2)
506 , _offset_correction(-1)
507 , _cairo_text_has_changed(true)
508 , _compute_blur_bkg(true)
509@@ -80,22 +80,20 @@
510
511 _left_space = new nux::SpaceLayout(_padding +
512 _anchor_width +
513- _corner_radius +
514 _left_padding_correction,
515 _padding +
516 _anchor_width +
517- _corner_radius +
518 _left_padding_correction,
519 1, 1000);
520- _right_space = new nux::SpaceLayout(_padding + _corner_radius,
521- _padding + _corner_radius,
522+ _right_space = new nux::SpaceLayout(_padding,
523+ _padding,
524 1, 1000);
525 _top_space = new nux::SpaceLayout(1, 1000,
526- _padding + _corner_radius,
527- _padding + _corner_radius);
528+ _padding,
529+ _padding);
530 _bottom_space = new nux::SpaceLayout(1, 1000,
531- _padding + _corner_radius,
532- _padding + _corner_radius);
533+ _padding,
534+ _padding);
535
536 _vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);
537 _vlayout->AddLayout(_top_space, 0);
538@@ -542,16 +540,15 @@
539
540 if (TotalItemHeight < _anchor_height)
541 {
542- _top_space->SetMinMaxSize(1, (_anchor_height - TotalItemHeight) / 2 + 1 + _padding + _corner_radius);
543- _bottom_space->SetMinMaxSize(1, (_anchor_height - TotalItemHeight) / 2 + 1 +
544- _padding + _corner_radius +
545- _bottom_padding_correction_single_item);
546+ int minimum_height = (_anchor_height - TotalItemHeight) / 2 + 1 + _padding;
547+ _top_space->SetMinimumHeight(minimum_height);
548+ _bottom_space->SetMinimumHeight(minimum_height + _bottom_padding_correction_single_item);
549 }
550 else
551 {
552- _top_space->SetMinMaxSize(_padding + _corner_radius, _padding + _corner_radius);
553- _bottom_space->SetMinMaxSize(_padding + _corner_radius - 2,
554- _padding + _corner_radius +
555+ _top_space->SetMinimumHeight(_padding);
556+ _bottom_space->SetMinMaxSize(_padding - 2,
557+ _padding +
558 _bottom_padding_correction_normal);
559 }
560
561@@ -567,8 +564,8 @@
562
563 UpdateTexture();
564
565- int x = _padding + _anchor_width + _corner_radius + _offset_correction;
566- int y = _padding + _corner_radius + _offset_correction;
567+ int x = _padding + _anchor_width + _offset_correction;
568+ int y = _padding + _offset_correction;
569
570 std::list<QuicklistMenuItem*>::iterator it;
571 for (it = _item_list.begin(); it != _item_list.end(); it++)