diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-06-12 08:29:27 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-06-12 08:29:27 (GMT) |
commit | 39d72111959231b56e0527857bc2a5950f1301e7 (patch) | |
tree | 152cc41513346198a20a352370b2d8b0fe9dd1d0 /generic/ttk/ttkLabel.c | |
parent | 966d791c8830a743eb416ae9e80070813fa1ba99 (diff) | |
download | tk-39d72111959231b56e0527857bc2a5950f1301e7.zip tk-39d72111959231b56e0527857bc2a5950f1301e7.tar.gz tk-39d72111959231b56e0527857bc2a5950f1301e7.tar.bz2 |
Fix text clipping when working with the Xft-based renderer.
Diffstat (limited to 'generic/ttk/ttkLabel.c')
-rw-r--r-- | generic/ttk/ttkLabel.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index df6a686..52782ea 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -131,6 +131,7 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) XGCValues gcValues; GC gc1, gc2; Tk_Anchor anchor = TK_ANCHOR_CENTER; + TkRegion clipRegion = NULL; gcValues.font = Tk_FontId(text->tkfont); gcValues.foreground = color->pixel; @@ -148,9 +149,9 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) * Clip text if it's too wide: */ if (b.width < text->width) { - TkRegion clipRegion = TkCreateRegion(); XRectangle rect; + clipRegion = TkCreateRegion(); rect.x = b.x; rect.y = b.y; rect.width = b.width + (text->embossed ? 1 : 0); @@ -158,7 +159,11 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) TkUnionRectWithRegion(&rect, clipRegion, clipRegion); TkSetRegion(Tk_Display(tkwin), gc1, clipRegion); TkSetRegion(Tk_Display(tkwin), gc2, clipRegion); +#ifdef HAVE_XFT + TkUnixSetXftClipRegion(clipRegion); +#else TkDestroyRegion(clipRegion); +#endif } if (text->embossed) { @@ -180,6 +185,12 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) Tk_FreeGC(Tk_Display(tkwin), gc1); Tk_FreeGC(Tk_Display(tkwin), gc2); +#ifdef HAVE_XFT + if (clipRegion != NULL) { + TkUnixSetXftClipRegion(None); + TkDestroyRegion(clipRegion); + } +#endif } static void TextElementSize( |