/* Function to hook the TkImageDisplayProc of the photo image type. As we can copy frame only when we need to display it */ int PlaceHook(Tcl_Interp *interp) { char buf[255]; strcpy(buf, "image create photo"); if (Tcl_EvalEx(interp,buf,-1,TCL_EVAL_GLOBAL) != TCL_OK) { LOG("Error creating photo for hook creation "); APPENDLOG( Tcl_GetStringResult(interp) ); return TCL_ERROR; } const char *name = Tcl_GetStringResult(interp); const Tk_ImageType *ctypePhotoPtr = NULL; Tk_ImageType *typePhotoPtr = NULL; #if TK_MINOR_VERSION >= 6 Tk_GetImageMasterData(interp, name, &ctypePhotoPtr); typePhotoPtr = (Tk_ImageType *) ctypePhotoPtr; #else Tk_GetImageMasterData(interp, name, &typePhotoPtr); #endif if (PhotoDisplayOriginal == NULL) { PhotoDisplayOriginal = typePhotoPtr->displayProc; typePhotoPtr->displayProc = (Tk_ImageDisplayProc *) PhotoDisplayProcHook; } // else we already put the hook Tk_DeleteImage(interp, name); Tcl_ResetResult(interp); return TCL_OK; }
static void ImgBmapCmdDeletedProc( ClientData clientData) /* Pointer to BitmapMaster structure for * image. */ { BitmapMaster *masterPtr = clientData; masterPtr->imageCmd = NULL; if (masterPtr->tkMaster != NULL) { Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster)); } }