Merge lp:~3v1n0/unity/fading-title into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Merged at revision: 853
Proposed branch: lp:~3v1n0/unity/fading-title
Merge into: lp:unity
Diff against target: 36 lines (+5/-5)
1 file modified
src/PanelMenuView.cpp (+5/-5)
To merge this branch: bzr merge lp:~3v1n0/unity/fading-title
Reviewer Review Type Date Requested Status
Jorge Castro Pending
Jason Smith Pending
Review via email: mp+49232@code.launchpad.net

This proposal supersedes a proposal from 2011-02-09.

Description of the change

Adding a small fade-out effect on Menu to cut the window Title when it's longer than the panel

All this using cairo linear patterns when needed (the pattern is using non-alpha colors until the end margin is reached, then it's faded to transparent).

Example: http://go.3v1n0.net/eivzuo
The fading space can be adjusted setting the variable text_margin.

This fixes #694924.

==================

UPDATED!

Yesterday evening I forgot to push a commit I did that fixed two issues with the current implementation:
 - The title was fading-out too early, and not just when it was reaching the indicator panel
 - If the title was slightly longer (at least a surplus of padding) than the panel menu it wasn't cut

This new commit fixes these issues (here how it looks http://go.3v1n0.net/gEmYbI), sorry but I just forgot to push :(.

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote : Posted in a previous version of this proposal

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/PanelMenuView.cpp'
--- src/PanelMenuView.cpp 2011-02-09 17:08:24 +0000
+++ src/PanelMenuView.cpp 2011-02-10 14:37:16 +0000
@@ -403,7 +403,7 @@
403 char *font_description = NULL;403 char *font_description = NULL;
404 GdkScreen *screen = gdk_screen_get_default ();404 GdkScreen *screen = gdk_screen_get_default ();
405 int dpi = 0;405 int dpi = 0;
406 const int text_margin = 20;406 const int text_margin = 30;
407407
408 int x = 0;408 int x = 0;
409 int y = 0;409 int y = 0;
@@ -462,9 +462,9 @@
462 double startalpha = 1.0 - ((double)text_margin/(double)width);462 double startalpha = 1.0 - ((double)text_margin/(double)width);
463463
464 // Once for the homies that couldn't be here464 // Once for the homies that couldn't be here
465 if (text_width >= width)465 if (x+text_width >= width-1)
466 {466 {
467 linpat = cairo_pattern_create_linear (x, y-1, width-x, y-1+text_height);467 linpat = cairo_pattern_create_linear (x, y-1, width-1, y-1+text_height);
468 cairo_pattern_add_color_stop_rgb (linpat, 0, 50/255.0f, 50/255.0f, 45/255.0f);468 cairo_pattern_add_color_stop_rgb (linpat, 0, 50/255.0f, 50/255.0f, 45/255.0f);
469 cairo_pattern_add_color_stop_rgb (linpat, startalpha, 50/255.0f, 50/255.0f, 45/255.0f);469 cairo_pattern_add_color_stop_rgb (linpat, startalpha, 50/255.0f, 50/255.0f, 45/255.0f);
470 cairo_pattern_add_color_stop_rgba (linpat, startalpha, 0, 0.0, 0.0, 0);470 cairo_pattern_add_color_stop_rgba (linpat, startalpha, 0, 0.0, 0.0, 0);
@@ -481,9 +481,9 @@
481 cairo_stroke (cr);481 cairo_stroke (cr);
482482
483 // Once again for the homies that could483 // Once again for the homies that could
484 if (text_width >= width)484 if (x+text_width >= width-1)
485 {485 {
486 linpat = cairo_pattern_create_linear (x, y, width-x, y+text_height);486 linpat = cairo_pattern_create_linear (x, y, width-1, y+text_height);
487 cairo_pattern_add_color_stop_rgb (linpat, 0, 223/255.0f, 219/255.0f, 210/255.0f);487 cairo_pattern_add_color_stop_rgb (linpat, 0, 223/255.0f, 219/255.0f, 210/255.0f);
488 cairo_pattern_add_color_stop_rgb (linpat, startalpha, 223/255.0f, 219/255.0f, 210/255.0f);488 cairo_pattern_add_color_stop_rgb (linpat, startalpha, 223/255.0f, 219/255.0f, 210/255.0f);
489 cairo_pattern_add_color_stop_rgba (linpat, 1, 0, 0.0, 0.0, 0);489 cairo_pattern_add_color_stop_rgba (linpat, 1, 0, 0.0, 0.0, 0);