Tk Source Code

Changes On Branch tip-714-alt
Login

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

Changes In Branch tip-714-alt Excluding Merge-Ins

This is equivalent to a diff from 6e560259 to 49cf5954

2025-04-24
21:01
Fix [bb5c3d0ecc]: tk print command fails on windows check-in: 8fd0f283 user: fvogel tags: bug-bb5c3d0ecc
11:59
Fix [855ec435ef]: Aqua sometimes fails to set TkEventTarget when a new keyWindow is assigned - breaks BWidget DND. check-in: 87e85a52 user: jan.nijtmans tags: core-9-0-branch
11:52
Merge 9.0 check-in: 43dd3043 user: jan.nijtmans tags: trunk, main
2025-04-23
09:42
Attempt to fix [d2eac285d9]: tk print command fails with canvas widget Closed-Leaf check-in: fada46f6 user: jan.nijtmans tags: bug-d2eac285d9
2025-04-22
22:56
Merge trunk, resolve conflicts in winDialog.test check-in: b5831181 user: erikleunissen tags: tk_collect_test_utils, FINAL_REVIEW
2025-04-18
02:52
Merge trunk check-in: 1b5bbef9 user: kevin_walzer tags: tka11y
2025-04-14
14:01
merge main Leaf check-in: 49cf5954 user: oehhar tags: tip-714-alt
13:56
merge main, minimize diff Leaf check-in: a68b9232 user: oehhar tags: tip-714-image-driver-info
2025-04-11
17:33
Fix [855ec435ef]: Aqua sometimes fails to set TkEventTarget when a new keyWindow is assigned - breaks BWidget DND. check-in: 6e560259 user: culler tags: trunk, main
15:57
Move the call to [NSApp setTkEventTarget:] into the windowActivation callback method of NSApp. Closed-Leaf check-in: 82221f8b user: culler tags: bug-855ec435ef
2025-04-10
19:32
WidgetDemo: Minor improvements in knightstour.tcl. check-in: 696a8519 user: csaba tags: trunk, main
2025-04-03
10:10
Protect Tk_SetTypeInfoProc(): If running in Tk 9.0, just make it a NOP check-in: 1bf9cf7d user: jan.nijtmans tags: tip-714-alt

Changes to generic/tk.decls.
998
999
1000
1001
1002
1003
1004





1005
1006
1007
1008
1009
1010
1011
}

# TIP #264
declare 271 {
    Tcl_Interp *Tk_Interp(Tk_Window tkwin)
}







# ----- BASELINE -- FOR -- 8.6.0 ----- #


# TIP#580
declare 274 {
    int Tk_AlwaysShowSelection(Tk_Window tkwin)







>
>
>
>
>







998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
}

# TIP #264
declare 271 {
    Tcl_Interp *Tk_Interp(Tk_Window tkwin)
}

# TIP #714
declare 273 {
    int Tk_SetTypeInfoProc(Tk_ImageType *typePtr,
	    Tk_ImageInfoProc *typeInfo)
}

# ----- BASELINE -- FOR -- 8.6.0 ----- #


# TIP#580
declare 274 {
    int Tk_AlwaysShowSelection(Tk_Window tkwin)
Changes to generic/tk.h.
1215
1216
1217
1218
1219
1220
1221

1222
1223
1224
1225
1226
1227
1228
typedef void (Tk_ImageFreeProc) (void *clientData, Display *display);
typedef void (Tk_ImageDeleteProc) (void *clientData);
typedef void (Tk_ImageChangedProc) (void *clientData, int x, int y,
	int width, int height, int imageWidth, int imageHeight);
typedef int (Tk_ImagePostscriptProc) (void *clientData,
	Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo,
	int x, int y, int width, int height, int prepass);


/*
 * The following structure represents a particular type of image (bitmap, xpm
 * image, etc.). It provides information common to all images of that type,
 * such as the type name and a collection of procedures in the image manager
 * that respond to various events. Each image manager is represented by one of
 * these structures.







>







1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
typedef void (Tk_ImageFreeProc) (void *clientData, Display *display);
typedef void (Tk_ImageDeleteProc) (void *clientData);
typedef void (Tk_ImageChangedProc) (void *clientData, int x, int y,
	int width, int height, int imageWidth, int imageHeight);
typedef int (Tk_ImagePostscriptProc) (void *clientData,
	Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo,
	int x, int y, int width, int height, int prepass);
typedef int (Tk_ImageInfoProc) (Tcl_Interp *interp);

/*
 * The following structure represents a particular type of image (bitmap, xpm
 * image, etc.). It provides information common to all images of that type,
 * such as the type name and a collection of procedures in the image manager
 * that respond to various events. Each image manager is represented by one of
 * these structures.
Changes to generic/tkDecls.h.
835
836
837
838
839
840
841
842


843
844
845
846
847
848
849
/* 269 */
EXTERN long		Tk_GetUserInactiveTime(Display *dpy);
/* 270 */
EXTERN void		Tk_ResetUserInactiveTime(Display *dpy);
/* 271 */
EXTERN Tcl_Interp *	Tk_Interp(Tk_Window tkwin);
/* Slot 272 is reserved */
/* Slot 273 is reserved */


/* 274 */
EXTERN int		Tk_AlwaysShowSelection(Tk_Window tkwin);
/* 275 */
EXTERN unsigned		Tk_GetButtonMask(unsigned button);
/* 276 */
EXTERN int		Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
				Tk_Window tkwin, Tcl_Obj *objPtr,







|
>
>







835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
/* 269 */
EXTERN long		Tk_GetUserInactiveTime(Display *dpy);
/* 270 */
EXTERN void		Tk_ResetUserInactiveTime(Display *dpy);
/* 271 */
EXTERN Tcl_Interp *	Tk_Interp(Tk_Window tkwin);
/* Slot 272 is reserved */
/* 273 */
EXTERN int		Tk_SetTypeInfoProc(Tk_ImageType *typePtr,
				Tk_ImageInfoProc *typeInfo);
/* 274 */
EXTERN int		Tk_AlwaysShowSelection(Tk_Window tkwin);
/* 275 */
EXTERN unsigned		Tk_GetButtonMask(unsigned button);
/* 276 */
EXTERN int		Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
				Tk_Window tkwin, Tcl_Obj *objPtr,
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
    int (*tk_PhotoPutBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 266 */
    int (*tk_PhotoPutZoomedBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 267 */
    int (*tk_PhotoSetSize) (Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height); /* 268 */
    long (*tk_GetUserInactiveTime) (Display *dpy); /* 269 */
    void (*tk_ResetUserInactiveTime) (Display *dpy); /* 270 */
    Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */
    void (*reserved272)(void);
    void (*reserved273)(void);
    int (*tk_AlwaysShowSelection) (Tk_Window tkwin); /* 274 */
    unsigned (*tk_GetButtonMask) (unsigned button); /* 275 */
    int (*tk_GetDoublePixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 276 */
    Tcl_Obj * (*tk_NewWindowObj) (Tk_Window tkwin); /* 277 */
    void (*tk_SendVirtualEvent) (Tk_Window tkwin, const char *eventName, Tcl_Obj *detail); /* 278 */
    Tcl_Obj * (*tk_FontGetDescription) (Tk_Font tkfont); /* 279 */
    void (*tk_CreatePhotoImageFormatVersion3) (const Tk_PhotoImageFormatVersion3 *formatPtr); /* 280 */







|







1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
    int (*tk_PhotoPutBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 266 */
    int (*tk_PhotoPutZoomedBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 267 */
    int (*tk_PhotoSetSize) (Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height); /* 268 */
    long (*tk_GetUserInactiveTime) (Display *dpy); /* 269 */
    void (*tk_ResetUserInactiveTime) (Display *dpy); /* 270 */
    Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */
    void (*reserved272)(void);
    int (*tk_SetTypeInfoProc) (Tk_ImageType *typePtr, Tk_ImageInfoProc *typeInfo); /* 273 */
    int (*tk_AlwaysShowSelection) (Tk_Window tkwin); /* 274 */
    unsigned (*tk_GetButtonMask) (unsigned button); /* 275 */
    int (*tk_GetDoublePixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 276 */
    Tcl_Obj * (*tk_NewWindowObj) (Tk_Window tkwin); /* 277 */
    void (*tk_SendVirtualEvent) (Tk_Window tkwin, const char *eventName, Tcl_Obj *detail); /* 278 */
    Tcl_Obj * (*tk_FontGetDescription) (Tk_Font tkfont); /* 279 */
    void (*tk_CreatePhotoImageFormatVersion3) (const Tk_PhotoImageFormatVersion3 *formatPtr); /* 280 */
1753
1754
1755
1756
1757
1758
1759

1760
1761
1762
1763
1764
1765
1766
1767
#define Tk_GetUserInactiveTime \
	(tkStubsPtr->tk_GetUserInactiveTime) /* 269 */
#define Tk_ResetUserInactiveTime \
	(tkStubsPtr->tk_ResetUserInactiveTime) /* 270 */
#define Tk_Interp \
	(tkStubsPtr->tk_Interp) /* 271 */
/* Slot 272 is reserved */

/* Slot 273 is reserved */
#define Tk_AlwaysShowSelection \
	(tkStubsPtr->tk_AlwaysShowSelection) /* 274 */
#define Tk_GetButtonMask \
	(tkStubsPtr->tk_GetButtonMask) /* 275 */
#define Tk_GetDoublePixelsFromObj \
	(tkStubsPtr->tk_GetDoublePixelsFromObj) /* 276 */
#define Tk_NewWindowObj \







>
|







1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
#define Tk_GetUserInactiveTime \
	(tkStubsPtr->tk_GetUserInactiveTime) /* 269 */
#define Tk_ResetUserInactiveTime \
	(tkStubsPtr->tk_ResetUserInactiveTime) /* 270 */
#define Tk_Interp \
	(tkStubsPtr->tk_Interp) /* 271 */
/* Slot 272 is reserved */
#define Tk_SetTypeInfoProc \
	(tkStubsPtr->tk_SetTypeInfoProc) /* 273 */
#define Tk_AlwaysShowSelection \
	(tkStubsPtr->tk_AlwaysShowSelection) /* 274 */
#define Tk_GetButtonMask \
	(tkStubsPtr->tk_GetButtonMask) /* 275 */
#define Tk_GetDoublePixelsFromObj \
	(tkStubsPtr->tk_GetDoublePixelsFromObj) /* 276 */
#define Tk_NewWindowObj \
1822
1823
1824
1825
1826
1827
1828
1829






1830
EXTERN int Tk_SafeInit(Tcl_Interp *interp);
EXTERN int Tk_CreateConsoleWindow(Tcl_Interp *interp);

#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT

#undef TkUnusedStubEntry







#endif /* _TKDECLS */








>
>
>
>
>
>

1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
EXTERN int Tk_SafeInit(Tcl_Interp *interp);
EXTERN int Tk_CreateConsoleWindow(Tcl_Interp *interp);

#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT

#undef TkUnusedStubEntry

#if defined(USE_TK_STUBS)
#   undef Tk_SetTypeInfoProc
#   define Tk_SetTypeInfoProc(t,i) \
	if (!tkStubsPtr->tk_SetTypeInfoProc) {/* NOP */} else tkStubsPtr->tk_SetTypeInfoProc(t,i)
#endif

#endif /* _TKDECLS */
Changes to generic/tkImage.c.
73
74
75
76
77
78
79

80
81
82
83
84
85
86
} ImageModel;

typedef struct {
    Tk_ImageType *imageTypeList;/* First in a list of all known image
				 * types. */
    int initialized;		/* Set to 1 if we've initialized the
				 * structure. */

} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;

/*
 * Prototypes for local functions:
 */








>







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
} ImageModel;

typedef struct {
    Tk_ImageType *imageTypeList;/* First in a list of all known image
				 * types. */
    int initialized;		/* Set to 1 if we've initialized the
				 * structure. */
    Tcl_HashTable *infoCmdTable;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;

/*
 * Prototypes for local functions:
 */

114
115
116
117
118
119
120

























121
122
123
124
125
126
127
	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));

    while (tsdPtr->imageTypeList != NULL) {
	freePtr = tsdPtr->imageTypeList;
	tsdPtr->imageTypeList = tsdPtr->imageTypeList->nextPtr;
	ckfree(freePtr);
    }

























}

/*
 *----------------------------------------------------------------------
 *
 * Tk_CreateImageType --
 *







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));

    while (tsdPtr->imageTypeList != NULL) {
	freePtr = tsdPtr->imageTypeList;
	tsdPtr->imageTypeList = tsdPtr->imageTypeList->nextPtr;
	ckfree(freePtr);
    }
    /* Cleanup the infoCmdTable hash table */
    Tcl_HashEntry *entryPtr;
    Tcl_HashSearch search;
    for (entryPtr = Tcl_FirstHashEntry(tsdPtr->infoCmdTable, &search);
	    entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) {
	Tcl_DeleteHashEntry(entryPtr);
    }
    Tcl_DeleteHashTable(tsdPtr->infoCmdTable);
    ckfree(tsdPtr->infoCmdTable);
}

int Tk_SetTypeInfoProc(
    Tk_ImageType *typePtr,
    Tk_ImageInfoProc *infoProc)
{
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
    Tcl_HashEntry *entryPtr;
    int isNew;

    entryPtr = Tcl_CreateHashEntry(tsdPtr->infoCmdTable, typePtr->name, &isNew);
    if (isNew) {
	Tcl_SetHashValue(entryPtr, infoProc);
    } /* else? */
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * Tk_CreateImageType --
 *
149
150
151
152
153
154
155


156
157
158
159
160
161
162
    Tk_ImageType *copyPtr;
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));

    if (!tsdPtr->initialized) {
	tsdPtr->initialized = 1;
	Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL);


    }
    copyPtr = (Tk_ImageType *)ckalloc(sizeof(Tk_ImageType));
    *copyPtr = *typePtr;
    copyPtr->nextPtr = tsdPtr->imageTypeList;
    tsdPtr->imageTypeList = copyPtr;
}








>
>







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
    Tk_ImageType *copyPtr;
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));

    if (!tsdPtr->initialized) {
	tsdPtr->initialized = 1;
	Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL);
	tsdPtr->infoCmdTable = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable));
	Tcl_InitHashTable(tsdPtr->infoCmdTable, TCL_STRING_KEYS);
    }
    copyPtr = (Tk_ImageType *)ckalloc(sizeof(Tk_ImageType));
    *copyPtr = *typePtr;
    copyPtr->nextPtr = tsdPtr->imageTypeList;
    tsdPtr->imageTypeList = copyPtr;
}

373
374
375
376
377
378
379
380
381
382
383

384
385
386
387
388
389
390










391
392
393
394
395
396
397
	    }
	    Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
		    (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), TCL_INDEX_NONE));
	}
	Tcl_SetObjResult(interp, resultObj);
	break;
    case IMAGE_TYPES:
	if (objc != 2) {
	    Tcl_WrongNumArgs(interp, 2, objv, NULL);
	    return TCL_ERROR;
	}

	resultObj = Tcl_NewObj();
	for (typePtr = tsdPtr->imageTypeList; typePtr != NULL;
		typePtr = typePtr->nextPtr) {
	    Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
		    typePtr->name, TCL_INDEX_NONE));
	}
	Tcl_SetObjResult(interp, resultObj);










	break;

    case IMAGE_HEIGHT:
    case IMAGE_INUSE:
    case IMAGE_TYPE:
    case IMAGE_WIDTH:
	/*







|
|


>







>
>
>
>
>
>
>
>
>
>







401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
	    }
	    Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
		    (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), TCL_INDEX_NONE));
	}
	Tcl_SetObjResult(interp, resultObj);
	break;
    case IMAGE_TYPES:
	if (objc != 2 && objc != 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "?type?");
	    return TCL_ERROR;
	}
if (objc == 2) {
	resultObj = Tcl_NewObj();
	for (typePtr = tsdPtr->imageTypeList; typePtr != NULL;
		typePtr = typePtr->nextPtr) {
	    Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
		    typePtr->name, TCL_INDEX_NONE));
	}
	Tcl_SetObjResult(interp, resultObj);
} else {
	Tk_ImageInfoProc *proc;
	Tcl_HashEntry *entryPtr;

	entryPtr = Tcl_FindHashEntry(tsdPtr->infoCmdTable, Tcl_GetString(objv[2]));
	if (entryPtr) {
	    proc = (Tk_ImageInfoProc *) Tcl_GetHashValue(entryPtr);
	    proc(interp);
	}
}
	break;

    case IMAGE_HEIGHT:
    case IMAGE_INUSE:
    case IMAGE_TYPE:
    case IMAGE_WIDTH:
	/*
Changes to generic/tkImgPhoto.c.
4373
4374
4375
4376
4377
4378
4379



































































































4380
4381
4382
4383
4384
4385
4386
    Tk_PhotoImageBlock block;

    Tk_PhotoGetImage(clientData, &block);
    block.pixelPtr += y * block.pitch + x * block.pixelSize;

    return Tk_PostscriptPhoto(interp, &block, psInfo, width, height);
}




































































































/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * tab-width: 8







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
    Tk_PhotoImageBlock block;

    Tk_PhotoGetImage(clientData, &block);
    block.pixelPtr += y * block.pitch + x * block.pixelSize;

    return Tk_PostscriptPhoto(interp, &block, psInfo, width, height);
}

/*
 *--------------------------------------------------------------
 *
 * TkPhotoInfoProc --
 *
 *	This function is called to return an information dict on
 *	all photo images.
 *	It is called by the command "image types photo".
 *
 * Results:
 *	Returns a standard Tcl return value.
 *
 * Side effects:
 *	None.
 *
 *--------------------------------------------------------------
 */

int
TkPhotoInfoProc(Tcl_Interp *interp) {

    Tcl_Obj *resultObj, *formatValueObj, *fileValueObj, *writeValueObj;
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
    Tk_PhotoImageFormat *formatPtr;
    Tk_PhotoImageFormatVersion3 *formatVersion3Ptr;
    const char * defaultFormatName = NULL;

    formatValueObj = Tcl_NewListObj(0, NULL);
    fileValueObj = Tcl_NewListObj(0, NULL);
    writeValueObj = Tcl_NewListObj(0, NULL);

    /*
     * Scan through the table of file format handlers and collect the
     * data.
     */

    for (formatPtr = tsdPtr->formatList; formatPtr != NULL;
	    formatPtr = formatPtr->nextPtr) {

	/*
	 * Default will be evaluated last, so put it at the end of the
	 * evaluation list
	 */

	if (strncasecmp("default", formatPtr->name,
		strlen(formatPtr->name)) == 0) {
	    defaultFormatName = formatPtr->name;

	    /*
	     * The default format does not implement any file operations.
	     * So no need to check for fileMatchProc or fileWriteProc
	     */

	} else {
	    Tcl_Obj *formatNameObj = Tcl_NewStringObj(formatPtr->name,-1);
	    Tcl_ListObjAppendElement(NULL, formatValueObj, formatNameObj);
	    if (NULL != formatPtr->fileMatchProc) {
		Tcl_ListObjAppendElement(NULL, fileValueObj, formatNameObj);
	    }
	    if (NULL != formatPtr->fileWriteProc) {
		Tcl_ListObjAppendElement(NULL, writeValueObj, formatNameObj);
	    }
	}
    }

    for (formatVersion3Ptr = tsdPtr->formatListVersion3;
	    formatVersion3Ptr != NULL;
	    formatVersion3Ptr = formatVersion3Ptr->nextPtr) {
	Tcl_Obj *formatNameObj = Tcl_NewStringObj(formatVersion3Ptr->name,-1);
	Tcl_ListObjAppendElement(NULL, formatValueObj, formatNameObj);
	if (NULL != formatVersion3Ptr->fileMatchProc) {
	    Tcl_ListObjAppendElement(NULL, fileValueObj, formatNameObj);
	}
	if (NULL != formatVersion3Ptr->fileWriteProc) {
	    Tcl_ListObjAppendElement(NULL, writeValueObj, formatNameObj);
	}
    }

    if (NULL != defaultFormatName) {
	Tcl_ListObjAppendElement(interp, formatValueObj,
		Tcl_NewStringObj(defaultFormatName, -1));
    }

    /*
     * set the format key in the result dictionary
     */

    resultObj = Tcl_NewObj();
    Tcl_DictObjPut(NULL, resultObj, Tcl_NewStringObj("format", -1),
	    formatValueObj);
    Tcl_DictObjPut(NULL, resultObj, Tcl_NewStringObj("file", -1),
	    fileValueObj);
    Tcl_DictObjPut(NULL, resultObj, Tcl_NewStringObj("write", -1),
	    writeValueObj);
    Tcl_SetObjResult(interp, resultObj);
    return TCL_OK;
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * tab-width: 8
Changes to generic/tkInt.h.
1067
1068
1069
1070
1071
1072
1073

1074
1075
1076
1077
1078
1079
1080
MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtSVGnano;
MODULE_SCOPE TkMainInfo		*tkMainWindowList;
MODULE_SCOPE Tk_ImageType	tkPhotoImageType;
MODULE_SCOPE Tcl_HashTable	tkPredefBitmapTable;

MODULE_SCOPE const char *const tkWebColors[20];


/*
 * The definition of pi, at least from the perspective of double-precision
 * floats.
 */

#ifndef PI
#ifdef M_PI







>







1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtSVGnano;
MODULE_SCOPE TkMainInfo		*tkMainWindowList;
MODULE_SCOPE Tk_ImageType	tkPhotoImageType;
MODULE_SCOPE Tcl_HashTable	tkPredefBitmapTable;

MODULE_SCOPE const char *const tkWebColors[20];

MODULE_SCOPE Tk_ImageInfoProc TkPhotoInfoProc;
/*
 * The definition of pi, at least from the perspective of double-precision
 * floats.
 */

#ifndef PI
#ifdef M_PI
Changes to generic/tkStubInit.c.
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
    Tk_PhotoPutBlock, /* 266 */
    Tk_PhotoPutZoomedBlock, /* 267 */
    Tk_PhotoSetSize, /* 268 */
    Tk_GetUserInactiveTime, /* 269 */
    Tk_ResetUserInactiveTime, /* 270 */
    Tk_Interp, /* 271 */
    0, /* 272 */
    0, /* 273 */
    Tk_AlwaysShowSelection, /* 274 */
    Tk_GetButtonMask, /* 275 */
    Tk_GetDoublePixelsFromObj, /* 276 */
    Tk_NewWindowObj, /* 277 */
    Tk_SendVirtualEvent, /* 278 */
    Tk_FontGetDescription, /* 279 */
    Tk_CreatePhotoImageFormatVersion3, /* 280 */







|







1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
    Tk_PhotoPutBlock, /* 266 */
    Tk_PhotoPutZoomedBlock, /* 267 */
    Tk_PhotoSetSize, /* 268 */
    Tk_GetUserInactiveTime, /* 269 */
    Tk_ResetUserInactiveTime, /* 270 */
    Tk_Interp, /* 271 */
    0, /* 272 */
    Tk_SetTypeInfoProc, /* 273 */
    Tk_AlwaysShowSelection, /* 274 */
    Tk_GetButtonMask, /* 275 */
    Tk_GetDoublePixelsFromObj, /* 276 */
    Tk_NewWindowObj, /* 277 */
    Tk_SendVirtualEvent, /* 278 */
    Tk_FontGetDescription, /* 279 */
    Tk_CreatePhotoImageFormatVersion3, /* 280 */
Changes to generic/tkWindow.c.
339
340
341
342
343
344
345


346
347
348
349
350
351
352

	/*
	 * Create built-in image types.
	 */

	Tk_CreateImageType(&tkBitmapImageType);
	Tk_CreateImageType(&tkPhotoImageType);



	/*
	 * Create built-in photo image formats.
	 */

	Tk_CreatePhotoImageFormat(&tkImgFmtDefault);
	Tk_CreatePhotoImageFormatVersion3(&tkImgFmtGIF);







>
>







339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354

	/*
	 * Create built-in image types.
	 */

	Tk_CreateImageType(&tkBitmapImageType);
	Tk_CreateImageType(&tkPhotoImageType);

	Tk_SetTypeInfoProc(&tkPhotoImageType, TkPhotoInfoProc);

	/*
	 * Create built-in photo image formats.
	 */

	Tk_CreatePhotoImageFormat(&tkImgFmtDefault);
	Tk_CreatePhotoImageFormatVersion3(&tkImgFmtGIF);
Changes to tests/image.test.
283
284
285
286
287
288
289
290
291
292
293
294



295
296
297
298
299
300
301
    imageCleanup
} -returnCodes error -result {image "myimage" does not exist}


test image-6.1 {Tk_ImageCmd procedure, "types" option} -constraints {
    testImageType
} -body {
    image types x
} -returnCodes error -result {wrong # args: should be "image types"}
test image-6.2 {Tk_ImageCmd procedure, "types" option} -body {
    lsort [image types]
} -match glob -result {bitmap*photo test}





test image-7.1 {Tk_ImageCmd procedure, "width" option} -body {
    image width
} -returnCodes error -result {wrong # args: should be "image width name"}
test image-7.2 {Tk_ImageCmd procedure, "width" option} -body {
    image width a b







|
|



>
>
>







283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
    imageCleanup
} -returnCodes error -result {image "myimage" does not exist}


test image-6.1 {Tk_ImageCmd procedure, "types" option} -constraints {
    testImageType
} -body {
    image types x y
} -returnCodes error -result {wrong # args: should be "image types ?type?"}
test image-6.2 {Tk_ImageCmd procedure, "types" option} -body {
    lsort [image types]
} -match glob -result {bitmap*photo test}
test image-6.3 {Tk_ImageCmd procedure, "types" argument} -body {
    image types x
} -result {}


test image-7.1 {Tk_ImageCmd procedure, "width" option} -body {
    image width
} -returnCodes error -result {wrong # args: should be "image width name"}
test image-7.2 {Tk_ImageCmd procedure, "width" option} -body {
    image width a b
Changes to tests/imgPhoto.test.
2695
2696
2697
2698
2699
2700
2701
















2702
2703
2704
2705
2706
2707
2708
    image create photo png1
    catch {png1 read $ousterPhotoFile -from 102 62 2000 1000} msg
    list $msg [image width png1] [image height png1]
} -cleanup {
    catch {image delete png1}
} -result {{coordinates for -from option extend outside source image} 0 0}
unset ousterPhotoFile

















catch {rename foreachPixel {}}
catch {rename checkImgTrans {}}
catch {rename checkImgTransLoop {}}
imageFinish

# cleanup







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
    image create photo png1
    catch {png1 read $ousterPhotoFile -from 102 62 2000 1000} msg
    list $msg [image width png1] [image height png1]
} -cleanup {
    catch {image delete png1}
} -result {{coordinates for -from option extend outside source image} 0 0}
unset ousterPhotoFile

# test 26.x: ImgPhotoInfo, command "image types photo"

test image-26.1 {ImgPhotoDriver/image types photo: format key} -body {
    dict get [image types photo] format
} -match glob -result {svg ppm png gif *default}
# take into account, that the list of formats may extend
# Any new format may be inserted between our own ones and the default format.

test image-26.2 {ImgPhotoDriver/image types photo: format file} -body {
    dict get [image types photo] file
} -match glob -result {svg ppm png gif*}

test image-26.3 {ImgPhotoDriver/image types photo: format write} -body {
    dict get [image types photo] write
} -match glob -result {ppm png gif*}

catch {rename foreachPixel {}}
catch {rename checkImgTrans {}}
catch {rename checkImgTransLoop {}}
imageFinish

# cleanup