summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonal.k.fellows@manchester.ac.uk <dkf>2012-09-11 19:00:46 (GMT)
committerdonal.k.fellows@manchester.ac.uk <dkf>2012-09-11 19:00:46 (GMT)
commit0d97ec7ccc6afc084595a096b55a88fff54876e8 (patch)
treeb86f5881527071f5af0f53ea442731fb4f9f592e
parentd40e45b3ffbb4e50f829c7c2e4f5782371e6a413 (diff)
downloadtk-0d97ec7ccc6afc084595a096b55a88fff54876e8.zip
tk-0d97ec7ccc6afc084595a096b55a88fff54876e8.tar.gz
tk-0d97ec7ccc6afc084595a096b55a88fff54876e8.tar.bz2
[Bug 3566594]: Fix clipping problem in classic X11; clip regions were leaking in
reused GCs.
-rw-r--r--ChangeLog8
-rw-r--r--generic/ttk/ttkEntry.c3
-rw-r--r--generic/ttk/ttkLabel.c12
3 files changed, 17 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index be4fc2b..54beeb3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-09-11 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/ttk/ttkEntry.c (EntryDisplay): [Bug 3566594]: Must manually
+ * generic/ttk/ttkLabel.c (TextDraw): reset the clip region of GCs
+ when not using the Xft font renderer (well, especially on classic X11)
+ because the GC sharing code doesn't take into account clip handling.
+ Thanks to Christian Nassau for identifying the problem.
+
2012-08-28 Jan Nijtmans <nijtmans@users.sf.net>
* generic/tkMenuDraw.c: [Bug 3562426]: Context menu goes out of edge of
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index a3d0179..22da65c 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -1254,6 +1254,7 @@ static void EntryDisplay(void *clientData, Drawable d)
gc = EntryGetGC(entryPtr, es.insertColorObj, clipRegion);
XFillRectangle(Tk_Display(tkwin), d, gc,
cursorX-cursorWidth/2, cursorY, cursorWidth, cursorHeight);
+ TkSetRegion(Tk_Display(tkwin), gc, None);
Tk_FreeGC(Tk_Display(tkwin), gc);
}
@@ -1264,6 +1265,7 @@ static void EntryDisplay(void *clientData, Drawable d)
Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
entryPtr->entry.layoutX, entryPtr->entry.layoutY,
leftIndex, rightIndex);
+ TkSetRegion(Tk_Display(tkwin), gc, None);
Tk_FreeGC(Tk_Display(tkwin), gc);
/* Overwrite the selected portion (if any) in the -selectforeground color:
@@ -1274,6 +1276,7 @@ static void EntryDisplay(void *clientData, Drawable d)
Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
entryPtr->entry.layoutX, entryPtr->entry.layoutY,
selFirst, selLast);
+ TkSetRegion(Tk_Display(tkwin), gc, None);
Tk_FreeGC(Tk_Display(tkwin), gc);
}
diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c
index 6dd1a9e..55bf36d 100644
--- a/generic/ttk/ttkLabel.c
+++ b/generic/ttk/ttkLabel.c
@@ -161,8 +161,6 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b)
TkSetRegion(Tk_Display(tkwin), gc2, clipRegion);
#ifdef HAVE_XFT
TkUnixSetXftClipRegion(clipRegion);
-#else
- TkDestroyRegion(clipRegion);
#endif
}
@@ -183,14 +181,16 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b)
text->textLayout, b.x, b.y, underline);
}
- Tk_FreeGC(Tk_Display(tkwin), gc1);
- Tk_FreeGC(Tk_Display(tkwin), gc2);
-#ifdef HAVE_XFT
if (clipRegion != NULL) {
+#ifdef HAVE_XFT
TkUnixSetXftClipRegion(None);
+#endif
+ TkSetRegion(Tk_Display(tkwin), gc1, None);
+ TkSetRegion(Tk_Display(tkwin), gc2, None);
TkDestroyRegion(clipRegion);
}
-#endif
+ Tk_FreeGC(Tk_Display(tkwin), gc1);
+ Tk_FreeGC(Tk_Display(tkwin), gc2);
}
static void TextElementSize(