diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-12-08 12:14:45 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-12-08 12:14:45 (GMT) |
commit | da3e7bc8435ad15a7c0a495539994dc579fe50cc (patch) | |
tree | f2e901231fcc7889ee39744e903c1b6cc144b98f /generic/ttk | |
parent | 7696b5f9e55594492063aa904e77de0e4060926c (diff) | |
download | tk-da3e7bc8435ad15a7c0a495539994dc579fe50cc.zip tk-da3e7bc8435ad15a7c0a495539994dc579fe50cc.tar.gz tk-da3e7bc8435ad15a7c0a495539994dc579fe50cc.tar.bz2 |
TIP #590 follow-up: When to use Tk/Ttk resp. tk/ttk
Diffstat (limited to 'generic/ttk')
-rw-r--r-- | generic/ttk/ttkDecls.h | 6 | ||||
-rw-r--r-- | generic/ttk/ttkInit.c | 4 | ||||
-rw-r--r-- | generic/ttk/ttkStubLib.c | 14 |
3 files changed, 15 insertions, 9 deletions
diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h index 5f76634..2b074ac 100644 --- a/generic/ttk/ttkDecls.h +++ b/generic/ttk/ttkDecls.h @@ -13,7 +13,11 @@ extern const char *TtkInitializeStubs( interp, TTK_VERSION, TTK_STUBS_EPOCH, TTK_STUBS_REVISION) #else -#define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "Ttk", TTK_VERSION, 0, NULL) +#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 +# define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "Ttk", TTK_VERSION, 0, NULL) +#else +# define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "ttk", TTK_VERSION, 0, NULL) +#endif #endif diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index 9384be4..b84489f 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -272,9 +272,9 @@ Ttk_Init(Tcl_Interp *interp) Ttk_PlatformInit(interp); #ifndef TK_NO_DEPRECATED - Tcl_PkgProvideEx(interp, "ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs); -#endif Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs); +#endif + Tcl_PkgProvideEx(interp, "ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs); return TCL_OK; } diff --git a/generic/ttk/ttkStubLib.c b/generic/ttk/ttkStubLib.c index 3bd0baa..a3b3376 100644 --- a/generic/ttk/ttkStubLib.c +++ b/generic/ttk/ttkStubLib.c @@ -34,21 +34,23 @@ TtkInitializeStubs( Tcl_Interp *interp, const char *version, int epoch, int revision) { int exact = 0; -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - const char *packageName = "Ttk"; -#else const char *packageName = "ttk"; -#endif const char *errMsg = NULL; void *pkgClientData = NULL; const char *actualVersion = Tcl_PkgRequireEx( interp, packageName, version, exact, &pkgClientData); - const TtkStubs *stubsPtr = (const TtkStubs *)pkgClientData; + const TtkStubs *stubsPtr; if (!actualVersion) { - return NULL; + packageName = "Ttk"; + actualVersion = Tcl_PkgRequireEx( + interp, packageName, version, exact, &pkgClientData); + if (!actualVersion) { + return NULL; + } } + stubsPtr = (const TtkStubs *)pkgClientData; if (!stubsPtr) { errMsg = "missing stub table pointer"; goto error; |