summaryrefslogtreecommitdiff
path: root/plugins/unityshell
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2012-09-23 22:03:16 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2012-09-23 22:03:16 +0200
commitf31e26d7fcc04c94e17aaa6b99381fe6ea048e43 (patch)
tree5de6f9e4cc404ea1fde8cbeb21f93bd1f4fb2ed1 /plugins/unityshell
parentaf06c3caa1e914a3261e17189356534d1631d14a (diff)
UnityWindow: correctly fade out the decoration text
(bzr r2713.1.10)
Diffstat (limited to 'plugins/unityshell')
-rw-r--r--plugins/unityshell/src/unityshell.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 85a205505..33647f71d 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -3502,13 +3502,14 @@ void UnityWindow::RenderText(CairoContext const& context, int x, int y, int widt
int text_width = lRect.width / PANGO_SCALE;
int text_height = lRect.height / PANGO_SCALE;
y += (height - text_height) / 2.0f;
+ int text_space = width - x;
- if (text_width > width)
+ if (text_width > text_space)
{
// Cut the text with fade
- int out_pixels = text_width - width;
+ int out_pixels = text_width - text_space;
const int fading_pixels = 35;
- int fading_width = out_pixels < fading_pixels ? out_pixels : fading_pixels;
+ int fading_width = (out_pixels < fading_pixels) ? out_pixels : fading_pixels;
cairo_push_group(context.cr_);
gtk_render_layout(style_context, context.cr_, x, y, layout);
@@ -3567,7 +3568,7 @@ void UnityWindow::DrawWindowDecoration(GLWindowPaintAttrib const& attrib,
{
// Draw windows title
const float xText = SCALE_ITEMS_PADDING * 2 + SCALE_CLOSE_ICON_SIZE;
- RenderText(context, xText, 0.0, width - xText - SCALE_ITEMS_PADDING, height);
+ RenderText(context, xText, 0.0, width - SCALE_ITEMS_PADDING, height);
}
mask |= PAINT_WINDOW_BLEND_MASK;