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 | fde697af64aae8450b540fb7eeb4f0f19aa3f005 (patch) | |
tree | 152cc41513346198a20a352370b2d8b0fe9dd1d0 /generic/ttk/ttkLabel.c | |
parent | 725e61cc4033c4fd2cccb831bac3c997fa61e712 (diff) | |
download | tk-fde697af64aae8450b540fb7eeb4f0f19aa3f005.zip tk-fde697af64aae8450b540fb7eeb4f0f19aa3f005.tar.gz tk-fde697af64aae8450b540fb7eeb4f0f19aa3f005.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( |