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

Proposed by Marco Trevisan (Treviño)
Status: Merged
Merge reported by: Neil J. Patel
Merged at revision: not available
Proposed branch: lp://qastaging/~3v1n0/unity/fading-title-fix
Merge into: lp://qastaging/unity
Diff against target: 81 lines (+22/-26)
1 file modified
plugins/unityshell/src/PanelMenuView.cpp (+22/-26)
To merge this branch: bzr merge lp://qastaging/~3v1n0/unity/fading-title-fix
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+68164@code.qastaging.launchpad.net

Description of the change

In latest unity the title fading didn't work anymore since it's used gtk_render_layout to apply the pango layout settings to the panel using the theme settings.

To make the fading work again I had to use gtk_render_layout to apply the theme, then use its result as my cairo_source and finally apply a mask over it to set the fading transparency. I used different solutions before, but I proposed all my ideas to Cimi and he preferred this one.

I also changed the way we fade out, avoiding to make the effect to be the same for titles too long just for few pixels, and I only applied the effect on the latest few pixels of the panel bar. The value of the faded pixels, is actually hardcoded to 35 pixels (while before I used a more dynamic way to compute it), but it should be fine for any resolution. Let me know if I should adjust that.

To post a comment you must log in.
Revision history for this message
Andrea Cimitan (cimi) wrote :

My 2 cents (stylistic changes):
- I'd use cairo_pattern_add_color_stop_rgba (linpat, 0, 0, 0, 0, 1); instead cairo_pattern_add_color_stop_rgb (linpat, 0, 0, 0, 0); to make more clear we're moving from alpha 1 to alpha 0.
- attach cairo_mask to the pattern creation and then add a white line afterwards (too keep a logical separation between "creation" and "destruction" of the elements.
- do not remove the line before gtk_style_context_restore (style_context);, I like to keep separated the calls when saving and restoring the context, as I usually do for cairo_save and restore.

Thanks, good logical approach with cairo.

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

> My 2 cents (stylistic changes):
> - I'd use cairo_pattern_add_color_stop_rgba (linpat, 0, 0, 0, 0, 1); instead
> cairo_pattern_add_color_stop_rgb (linpat, 0, 0, 0, 0); to make more clear
> we're moving from alpha 1 to alpha 0.

Done... I used that before, but I liked more to use just rgb :P

> - attach cairo_mask to the pattern creation and then add a white line
> afterwards (too keep a logical separation between "creation" and "destruction"
> of the elements.

Mh, I've attached it to the pattern creation code, but I can't put the pattern
color stop code afterwards, otherwise the mask wouldn't be applied...
Is this what you meant?

> - do not remove the line before gtk_style_context_restore (style_context);, I
> like to keep separated the calls when saving and restoring the context, as I
> usually do for cairo_save and restore.

Done ;)

> Thanks, good logical approach with cairo.

Thank you for your advices! ;)

Revision history for this message
Andrea Cimitan (cimi) wrote :

> > My 2 cents (stylistic changes):
> > - I'd use cairo_pattern_add_color_stop_rgba (linpat, 0, 0, 0, 0, 1); instead
> > cairo_pattern_add_color_stop_rgb (linpat, 0, 0, 0, 0); to make more clear
> > we're moving from alpha 1 to alpha 0.
>
> Done... I used that before, but I liked more to use just rgb :P
>
> > - attach cairo_mask to the pattern creation and then add a white line
> > afterwards (too keep a logical separation between "creation" and
> "destruction"
> > of the elements.
>
> Mh, I've attached it to the pattern creation code, but I can't put the pattern
> color stop code afterwards, otherwise the mask wouldn't be applied...
> Is this what you meant?
>

I just meant removing the white line before and add a new line after cairo mask :D
It's just to met my stylistic tastes, the branch is fine.

>
> Thank you for your advices! ;)

Again, the branch was fine before, I just spot subtle changes to improve readability

For me, I'd approve if neil agrees with the static 35px for the fading

Revision history for this message
Neil J. Patel (njpatel) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.