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
1=== modified file 'src/PanelMenuView.cpp'
2--- src/PanelMenuView.cpp 2011-02-09 17:08:24 +0000
3+++ src/PanelMenuView.cpp 2011-02-10 14:37:16 +0000
4@@ -403,7 +403,7 @@
5 char *font_description = NULL;
6 GdkScreen *screen = gdk_screen_get_default ();
7 int dpi = 0;
8- const int text_margin = 20;
9+ const int text_margin = 30;
10
11 int x = 0;
12 int y = 0;
13@@ -462,9 +462,9 @@
14 double startalpha = 1.0 - ((double)text_margin/(double)width);
15
16 // Once for the homies that couldn't be here
17- if (text_width >= width)
18+ if (x+text_width >= width-1)
19 {
20- linpat = cairo_pattern_create_linear (x, y-1, width-x, y-1+text_height);
21+ linpat = cairo_pattern_create_linear (x, y-1, width-1, y-1+text_height);
22 cairo_pattern_add_color_stop_rgb (linpat, 0, 50/255.0f, 50/255.0f, 45/255.0f);
23 cairo_pattern_add_color_stop_rgb (linpat, startalpha, 50/255.0f, 50/255.0f, 45/255.0f);
24 cairo_pattern_add_color_stop_rgba (linpat, startalpha, 0, 0.0, 0.0, 0);
25@@ -481,9 +481,9 @@
26 cairo_stroke (cr);
27
28 // Once again for the homies that could
29- if (text_width >= width)
30+ if (x+text_width >= width-1)
31 {
32- linpat = cairo_pattern_create_linear (x, y, width-x, y+text_height);
33+ linpat = cairo_pattern_create_linear (x, y, width-1, y+text_height);
34 cairo_pattern_add_color_stop_rgb (linpat, 0, 223/255.0f, 219/255.0f, 210/255.0f);
35 cairo_pattern_add_color_stop_rgb (linpat, startalpha, 223/255.0f, 219/255.0f, 210/255.0f);
36 cairo_pattern_add_color_stop_rgba (linpat, 1, 0, 0.0, 0.0, 0);