diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-04-30 11:17:05 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-04-30 11:17:05 (GMT) |
commit | ccce0ec5c05d43b30187dc2151d463107e98e971 (patch) | |
tree | 3d2d5f3fd84a0d64e2061aac6938fa39ca7323ab | |
parent | 98569ea619958f5bd5f7c4cee905d0eaf2e1a4ad (diff) | |
parent | a05abd162d6d3eda86cb3842832225cc89f76864 (diff) | |
download | tk-ccce0ec5c05d43b30187dc2151d463107e98e971.zip tk-ccce0ec5c05d43b30187dc2151d463107e98e971.tar.gz tk-ccce0ec5c05d43b30187dc2151d463107e98e971.tar.bz2 |
Fix TkCygwinMainEx() function: Didn't work on Cygwin X11 yet, because it used the wrong Tk library name. Also symplify this function (int -> void return)
Fix warning in tkWinTest.c
-rw-r--r-- | generic/tkMain.c | 12 | ||||
-rw-r--r-- | generic/tkWindow.c | 40 | ||||
-rw-r--r-- | win/tkWinTest.c | 2 |
3 files changed, 26 insertions, 28 deletions
diff --git a/generic/tkMain.c b/generic/tkMain.c index c41715b..0cce890 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -16,7 +16,9 @@ #include "tkInt.h" -extern int TkCygwinMainEx(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *); +#if defined(_WIN32) && !defined(UNICODE) && !defined(STATIC_BUILD) +MODULE_SCOPE void TkCygwinMainEx(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *); +#endif /* * The default prompt used when the user has not overridden it. @@ -201,13 +203,11 @@ Tk_MainEx( /* We are running win32 Tk under Cygwin, so let's check * whether the env("DISPLAY") variable or the -display * argument is set. If so, we really want to run the - * Tk_MainEx function of libtk8.?.dll, not this one. */ + * Tk_MainEx function of libtcl9tk9.?.dll, not this one. */ if (Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY)) { loadCygwinTk: - if (TkCygwinMainEx(argc, argv, appInitProc, interp)) { - /* Should never reach here. */ - return; - } + TkCygwinMainEx(argc, argv, appInitProc, interp); + /* Only returns when Tk_MainEx() was not found */ } else { Tcl_Size j; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 2163620..6b1e154 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -1028,9 +1028,6 @@ TkCreateMainWindow( #ifdef STATIC_BUILD ".static" #endif -#if TCL_UTF_MAX < 4 - ".utf-16" -#endif #if defined(_WIN32) ".win32" #endif @@ -2946,20 +2943,19 @@ DeleteWindowsExitProc( tsdPtr->initialized = 0; } -#if defined(_WIN32) +#if defined(_WIN32) && !defined(STATIC_BUILD) static HMODULE tkcygwindll = NULL; /* - * Run Tk_MainEx from libtk8.?.dll + * Run Tk_MainEx from libtcl9tk9.?.dll * - * This function is only ever called from wish8.?.exe, the cygwin port of Tcl. + * This function is only ever called from wish9.?.exe, the cygwin port of Tcl. * This means that the system encoding is utf-8, so we don't have to do any * encoding conversions. */ -extern int TkCygwinMainEx(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *); -int +MODULE_SCOPE void TkCygwinMainEx( Tcl_Size argc, /* Number of arguments. */ char **argv, /* Array of argument strings. */ @@ -2973,25 +2969,25 @@ TkCygwinMainEx( size_t len; void (*tkmainex)(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *); - /* construct "<path>/libtk8.?.dll", from "<path>/tk8?.dll" */ + /* construct "<path>/libtcl9tk9.?.dll", from "<path>/tcl9tk9?.dll" */ len = GetModuleFileNameW((HINSTANCE)Tk_GetHINSTANCE(), name, MAX_PATH); name[len-2] = '.'; name[len-1] = name[len-5]; wcscpy(name+len, L".dll"); - memcpy(name+len-8, L"libtk8", 6 * sizeof(WCHAR)); +#if TCL_MAJOR_VERSION > 8 + memcpy(name+len-12, L"libtcl9tk9", 10 * sizeof(WCHAR)); +#else + memcpy(name+len-8, L"libtk9", 6 * sizeof(WCHAR)); +#endif tkcygwindll = LoadLibraryW(name); - if (!tkcygwindll) { - /* dll is not present */ - return 0; - } - tkmainex = (void (*)(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *)) - (void *)GetProcAddress(tkcygwindll, "Tk_MainEx"); - if (!tkmainex) { - return 0; + if (tkcygwindll) { + tkmainex = (void (*)(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *)) + (void *)GetProcAddress(tkcygwindll, "Tk_MainEx"); + if (tkmainex) { + tkmainex(argc, argv, appInitProc, interp); + } } - tkmainex(argc, argv, appInitProc, interp); - return 1; } #endif /* _WIN32 */ @@ -3022,7 +3018,7 @@ int Tk_Init( Tcl_Interp *interp) /* Interpreter to initialize. */ { -#if defined(_WIN32) +#if defined(_WIN32) && !defined(STATIC_BUILD) if (tkcygwindll) { int (*tkinit)(Tcl_Interp *); @@ -3095,7 +3091,7 @@ Tk_SafeInit( * checked at several places to differentiate the two initialisations. */ -#if defined(_WIN32) +#if defined(_WIN32) && !defined(STATIC_BUILD) if (tkcygwindll) { int (*tksafeinit)(Tcl_Interp *); diff --git a/win/tkWinTest.c b/win/tkWinTest.c index 8f186be..693d1c3 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -17,6 +17,8 @@ #undef USE_TK_STUBS #define USE_TK_STUBS #include "tkWinInt.h" +#undef TCLBOOLWARNING +#define TCLBOOLWARNING(boolPtr) /* needed here because we compile with -Wc++-compat */ HWND tkWinCurrentDialog; |