Tk Source Code

Check-in [ea22295e]
Login

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

Overview
Comment:Add Tk_SetTypeInfoProc() to stub table
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | tip-714-alt
Files: files | file ages | folders
SHA3-256: ea22295e23f2b625808780ffb814e19a14eb2144127134db280c3de26c14e830
User & Date: jan.nijtmans 2025-04-03 09:46:21.889
Context
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
09:46
Add Tk_SetTypeInfoProc() to stub table check-in: ea22295e user: jan.nijtmans tags: tip-714-alt
08:27
TIP714 image format info: add file and write reporting for the photo image type, add tests check-in: 79b6c940 user: oehhar tags: tip-714-alt
Changes
Unified Diff Ignore Whitespace Patch
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.
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
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);

int Tk_SetTypeInfoProc(Tk_ImageType *typePtr, Tk_ImageInfoProc *typeInfo);

/*
 * 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.
 */







<
<







1217
1218
1219
1220
1221
1222
1223


1224
1225
1226
1227
1228
1229
1230
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 \
Changes to generic/tkImgPhoto.c.
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
TkPhotoInfoProc(Tcl_Interp *interp) {

    Tcl_Obj *resultObj, *formatValueObj, *fileValueObj, *writeValueObj;
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
    Tk_PhotoImageFormat *formatPtr;
    Tk_PhotoImageFormatVersion3 *formatVersion3Ptr;
    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);







|












|








|







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

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







|










|





|







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

    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);
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 */