Tk Source Code

Check-in [df2abb1c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[Bug 3566594]: Fix clipping problem in classic X11; clip regions were leaking in reused GCs.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: df2abb1c57a51c5c519a274d4ef81cc6ac969f7e
User & Date: dkf 2012-09-11 19:00:46
Context
2012-09-13
20:47
[Bug 3567453]: Clip regions must be cleared with XSetClipMask and not TkSetRegion on X11. check-in: dfcf8982 user: dkf tags: core-8-5-branch
2012-09-12
13:44
merge core-8-5-branch Closed-Leaf check-in: 77b3f433 user: jan.nijtmans tags: tk-cocoa-8-5-backport
03:05
Review branch for merge of Tk-Cocoa into Tk 8.5 main branch check-in: 7f1b01b5 user: kevin_walzer tags: cocoa-full-merge-review-8.5
2012-09-11
19:03
[Bug 3566594]: Fix clipping problem in classic X11; clip regions were leaking in reused GCs. check-in: dda82bdc user: dkf tags: trunk
19:00
[Bug 3566594]: Fix clipping problem in classic X11; clip regions were leaking in reused GCs. check-in: df2abb1c user: dkf tags: core-8-5-branch
2012-08-28
14:12
[Bug 3562426]: Context menu goes out of edge of screen. check-in: 13c14cc5 user: jan.nijtmans tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.









1
2
3
4
5
6
7








2012-08-28  Jan Nijtmans  <[email protected]>

	* generic/tkMenuDraw.c: [Bug 3562426]: Context menu goes out of edge of
	screen.

2012-08-24  Donal K. Fellows  <[email protected]>

>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2012-09-11  Donal K. Fellows  <[email protected]>

	* 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  <[email protected]>

	* generic/tkMenuDraw.c: [Bug 3562426]: Context menu goes out of edge of
	screen.

2012-08-24  Donal K. Fellows  <[email protected]>

Changes to generic/ttk/ttkEntry.c.

1250
1251
1252
1253
1254
1255
1256

1257
1258
1259
1260
1261
1262
1263
1264
1265
1266

1267
1268
1269
1270
1271
1272
1273
1274
1275
1276

1277
1278
1279
1280
1281
1282
1283

	/* @@@ should: maybe: SetCaretPos even when blinked off */
	Tk_SetCaretPos(tkwin, cursorX, cursorY, cursorHeight);

	gc = EntryGetGC(entryPtr, es.insertColorObj, clipRegion);
	XFillRectangle(Tk_Display(tkwin), d, gc,
	    cursorX-cursorWidth/2, cursorY, cursorWidth, cursorHeight);

	Tk_FreeGC(Tk_Display(tkwin), gc);
    }

    /* Draw the text:
     */
    gc = EntryGetGC(entryPtr, es.foregroundObj, clipRegion);
    Tk_DrawTextLayout(
	Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
	entryPtr->entry.layoutX, entryPtr->entry.layoutY,
	leftIndex, rightIndex);

    Tk_FreeGC(Tk_Display(tkwin), gc);

    /* Overwrite the selected portion (if any) in the -selectforeground color:
     */
    if (showSelection) {
	gc = EntryGetGC(entryPtr, es.selForegroundObj, clipRegion);
	Tk_DrawTextLayout(
	    Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
	    entryPtr->entry.layoutX, entryPtr->entry.layoutY,
	    selFirst, selLast);

	Tk_FreeGC(Tk_Display(tkwin), gc);
    }

    /* Drop the region. Note that we have to manually remove the reference to
     * it from the Xft guts (if they're being used).
     */
#ifdef HAVE_XFT







>










>










>







1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286

	/* @@@ should: maybe: SetCaretPos even when blinked off */
	Tk_SetCaretPos(tkwin, cursorX, cursorY, cursorHeight);

	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);
    }

    /* Draw the text:
     */
    gc = EntryGetGC(entryPtr, es.foregroundObj, clipRegion);
    Tk_DrawTextLayout(
	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:
     */
    if (showSelection) {
	gc = EntryGetGC(entryPtr, es.selForegroundObj, clipRegion);
	Tk_DrawTextLayout(
	    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);
    }

    /* Drop the region. Note that we have to manually remove the reference to
     * it from the Xft guts (if they're being used).
     */
#ifdef HAVE_XFT

Changes to generic/ttk/ttkLabel.c.

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190



191
192
193


194
195
196
197
198
199
200
	rect.width = b.width + (text->embossed ? 1 : 0);
	rect.height = b.height + (text->embossed ? 1 : 0);
	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) {
	Tk_DrawTextLayout(Tk_Display(tkwin), d, gc2,
	    text->textLayout, b.x+1, b.y+1, 0/*firstChar*/, -1/*lastChar*/);
    }
    Tk_DrawTextLayout(Tk_Display(tkwin), d, gc1,
	    text->textLayout, b.x, b.y, 0/*firstChar*/, -1/*lastChar*/);

    Tcl_GetIntFromObj(NULL, text->underlineObj, &underline);
    if (underline >= 0) {
	if (text->embossed) {
	    Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc2,
		text->textLayout, b.x+1, b.y+1, underline);
	}
	Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc1,
	    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) {
	TkUnixSetXftClipRegion(None);



	TkDestroyRegion(clipRegion);
    }
#endif


}

static void TextElementSize(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
    TextElement *text = elementRecord;







<
<




















|
<

<

>
>
>


<
>
>







157
158
159
160
161
162
163


164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184

185

186
187
188
189
190
191

192
193
194
195
196
197
198
199
200
	rect.width = b.width + (text->embossed ? 1 : 0);
	rect.height = b.height + (text->embossed ? 1 : 0);
	TkUnionRectWithRegion(&rect, clipRegion, clipRegion);
	TkSetRegion(Tk_Display(tkwin), gc1, clipRegion);
	TkSetRegion(Tk_Display(tkwin), gc2, clipRegion);
#ifdef HAVE_XFT
	TkUnixSetXftClipRegion(clipRegion);


#endif
    }

    if (text->embossed) {
	Tk_DrawTextLayout(Tk_Display(tkwin), d, gc2,
	    text->textLayout, b.x+1, b.y+1, 0/*firstChar*/, -1/*lastChar*/);
    }
    Tk_DrawTextLayout(Tk_Display(tkwin), d, gc1,
	    text->textLayout, b.x, b.y, 0/*firstChar*/, -1/*lastChar*/);

    Tcl_GetIntFromObj(NULL, text->underlineObj, &underline);
    if (underline >= 0) {
	if (text->embossed) {
	    Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc2,
		text->textLayout, b.x+1, b.y+1, underline);
	}
	Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc1,
	    text->textLayout, b.x, b.y, underline);
    }

    if (clipRegion != NULL) {

#ifdef HAVE_XFT

	TkUnixSetXftClipRegion(None);
#endif
	TkSetRegion(Tk_Display(tkwin), gc1, None);
	TkSetRegion(Tk_Display(tkwin), gc2, None);
	TkDestroyRegion(clipRegion);
    }

    Tk_FreeGC(Tk_Display(tkwin), gc1);
    Tk_FreeGC(Tk_Display(tkwin), gc2);
}

static void TextElementSize(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
    TextElement *text = elementRecord;