Tk Source Code

Check-in [55e551bb]
Login

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

Overview
Comment:Eliminate some unneeded write-only variables (discovered by gcc-4.6)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: 55e551bb43a15ec7ccbfdd832ae359f6d0a1dc8d
User & Date: jan.nijtmans 2011-03-11 09:13:00
Context
2011-03-11
15:01
merge-mark check-in: b078bfa9 user: jan.nijtmans tags: core-8-5-branch
09:19
Eliminate some unneeded write-only variables (discovered by gcc-4.6) check-in: f8b0c7f2 user: jan.nijtmans tags: trunk
09:13
Eliminate some unneeded write-only variables (discovered by gcc-4.6) check-in: 55e551bb user: jan.nijtmans tags: core-8-5-branch
2011-03-10
15:27
[Bug 3205260] avoid crash in wm manage of children with null class

The tkhtml widget doesn't set it's window class. The Windows implementation of the wm manage command checks to see if the contained window is actually a menu (looking for torn-off menus) by examining the class. This patch adds a check for a null class to avoid crashing as suggested.

Suggested-by: Eric Boudaillier <[email protected]> Signed-off-by: Pat Thoyts <[email protected]> check-in: 27afdfb6 user: patthoyts tags: core-8-5-branch

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.







1
2
3
4
5
6
7






2011-03-09  Reinhard Max  <[email protected]>

	* unix/configure.in: Use a symbol from libXft itself for the link
	test rather than one from libfreetype, because the latter doesn't
	work when the linker is called with --as-needed.
	
2011-01-25  Jan Nijtmans  <[email protected]>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2011-03-11  Jan Nijtmans  <[email protected]>

	* generic/ttk/ttkDefaultTheme.c: Eliminate some unneeded write-only
	* generic/ttk/ttkManager.c:      variables (discovered by gcc-4.6)
	* generic/ttk/ttkSquare.c:

2011-03-09  Reinhard Max  <[email protected]>

	* unix/configure.in: Use a symbol from libXft itself for the link
	test rather than one from libfreetype, because the latter doesn't
	work when the linker is called with --as-needed.
	
2011-01-25  Jan Nijtmans  <[email protected]>

Changes to generic/ttk/ttkDefaultTheme.c.

495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, unsigned int state)
{
    IndicatorSpec *spec = clientData;
    IndicatorElement *indicator = elementRecord;
    Display *display = Tk_Display(tkwin);
    Ttk_Padding padding;
    XColor *fgColor, *frameColor, *lightColor, *shadeColor, *indicatorColor, *borderColor;

    int index, ix, iy;
    XGCValues gcValues;
    GC copyGC;
    unsigned long imgColors[8];
    XImage *img;








|







495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, unsigned int state)
{
    IndicatorSpec *spec = clientData;
    IndicatorElement *indicator = elementRecord;
    Display *display = Tk_Display(tkwin);
    Ttk_Padding padding;
    XColor *fgColor, *frameColor, *shadeColor, *indicatorColor, *borderColor;

    int index, ix, iy;
    XGCValues gcValues;
    GC copyGC;
    unsigned long imgColors[8];
    XImage *img;

525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
     * Fill in imgColors palette:
     *
     * (SHOULD: take light and shade colors from the border object,
     * but Tk doesn't provide easy access to these in the public API.)
     */
    fgColor = Tk_GetColorFromObj(tkwin, indicator->foregroundObj);
    frameColor = Tk_GetColorFromObj(tkwin, indicator->backgroundObj);
    lightColor = Tk_GetColorFromObj(tkwin, indicator->lightColorObj);
    shadeColor = Tk_GetColorFromObj(tkwin, indicator->shadeColorObj);
    indicatorColor = Tk_GetColorFromObj(tkwin, indicator->colorObj);
    borderColor = Tk_GetColorFromObj(tkwin, indicator->borderColorObj);

    imgColors[0 /*A*/] = shadeColor->pixel;
    imgColors[1 /*B*/] = indicatorColor->pixel;
    imgColors[2 /*C*/] = frameColor->pixel;







<







525
526
527
528
529
530
531

532
533
534
535
536
537
538
     * Fill in imgColors palette:
     *
     * (SHOULD: take light and shade colors from the border object,
     * but Tk doesn't provide easy access to these in the public API.)
     */
    fgColor = Tk_GetColorFromObj(tkwin, indicator->foregroundObj);
    frameColor = Tk_GetColorFromObj(tkwin, indicator->backgroundObj);

    shadeColor = Tk_GetColorFromObj(tkwin, indicator->shadeColorObj);
    indicatorColor = Tk_GetColorFromObj(tkwin, indicator->colorObj);
    borderColor = Tk_GetColorFromObj(tkwin, indicator->borderColorObj);

    imgColors[0 /*A*/] = shadeColor->pixel;
    imgColors[1 /*B*/] = indicatorColor->pixel;
    imgColors[2 /*C*/] = frameColor->pixel;

Changes to generic/ttk/ttkManager.c.

524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
 * 	+ 'slave' is not a toplevel window
 * 	+ 'slave' belongs to the same toplevel as 'master'
 *
 * Returns: 1 if OK; otherwise 0, leaving an error message in 'interp'.
 */
int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master)
{
    Tk_Window ancestor = master, parent = Tk_Parent(slave), sibling = NULL;

    if (Tk_IsTopLevel(slave) || slave == master) {
	goto badWindow;
    }

    while (ancestor != parent) {
	if (Tk_IsTopLevel(ancestor)) {
	    goto badWindow;
	}
	sibling = ancestor;
	ancestor = Tk_Parent(ancestor);
    }

    return 1;

badWindow:
    Tcl_AppendResult(interp,







|









<







524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540

541
542
543
544
545
546
547
 * 	+ 'slave' is not a toplevel window
 * 	+ 'slave' belongs to the same toplevel as 'master'
 *
 * Returns: 1 if OK; otherwise 0, leaving an error message in 'interp'.
 */
int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master)
{
    Tk_Window ancestor = master, parent = Tk_Parent(slave);

    if (Tk_IsTopLevel(slave) || slave == master) {
	goto badWindow;
    }

    while (ancestor != parent) {
	if (Tk_IsTopLevel(ancestor)) {
	    goto badWindow;
	}

	ancestor = Tk_Parent(ancestor);
    }

    return 1;

badWindow:
    Tcl_AppendResult(interp,

Changes to generic/ttk/ttkSquare.c.

218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
 */

static void SquareElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, unsigned int state)
{
    SquareElement *square = elementRecord;
    Tk_3DBorder border = NULL, foreground = NULL;
    int borderWidth = 1, relief = TK_RELIEF_FLAT;

    border = Tk_Get3DBorderFromObj(tkwin, square->borderObj);
    foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj);
    Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
    Tk_GetReliefFromObj(NULL, square->reliefObj, &relief);

    Tk_Fill3DRectangle(tkwin, d, foreground,
	b.x, b.y, b.width, b.height, borderWidth, relief);
}







|


<







218
219
220
221
222
223
224
225
226
227

228
229
230
231
232
233
234
 */

static void SquareElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, unsigned int state)
{
    SquareElement *square = elementRecord;
    Tk_3DBorder foreground = NULL;
    int borderWidth = 1, relief = TK_RELIEF_FLAT;


    foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj);
    Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
    Tk_GetReliefFromObj(NULL, square->reliefObj, &relief);

    Tk_Fill3DRectangle(tkwin, d, foreground,
	b.x, b.y, b.width, b.height, borderWidth, relief);
}