diff options
Diffstat (limited to 'win')
-rwxr-xr-x | win/configure | 65 | ||||
-rw-r--r-- | win/configure.in | 2 | ||||
-rw-r--r-- | win/makefile.vc | 2 | ||||
-rw-r--r-- | win/nmakehlp.c | 77 | ||||
-rw-r--r-- | win/rules.vc | 37 | ||||
-rw-r--r-- | win/tcl.m4 | 15 | ||||
-rw-r--r-- | win/tkWin32Dll.c | 4 | ||||
-rw-r--r-- | win/tkWinButton.c | 22 | ||||
-rw-r--r-- | win/tkWinCursor.c | 4 | ||||
-rw-r--r-- | win/tkWinDefault.h | 1 | ||||
-rw-r--r-- | win/tkWinDialog.c | 14 | ||||
-rw-r--r-- | win/tkWinDraw.c | 3 | ||||
-rw-r--r-- | win/tkWinEmbed.c | 2 | ||||
-rw-r--r-- | win/tkWinFont.c | 18 | ||||
-rw-r--r-- | win/tkWinMenu.c | 7 | ||||
-rw-r--r-- | win/tkWinPort.h | 4 | ||||
-rw-r--r-- | win/tkWinScrlbr.c | 20 | ||||
-rw-r--r-- | win/tkWinWm.c | 122 | ||||
-rw-r--r-- | win/winMain.c | 39 |
19 files changed, 266 insertions, 192 deletions
diff --git a/win/configure b/win/configure index fbc5b45..e176fb3 100755 --- a/win/configure +++ b/win/configure @@ -1325,7 +1325,7 @@ SHELL=/bin/sh TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 -TK_PATCH_LEVEL=".11" +TK_PATCH_LEVEL=".12" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ @@ -3665,6 +3665,7 @@ echo "${ECHO_T}$ac_cv_municode" >&6 else extra_cflags="$extra_cflags -DTCL_BROKEN_MAINARGS" fi + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto" echo "$as_me:$LINENO: checking for working -fno-lto" >&5 echo $ECHO_N "checking for working -fno-lto... $ECHO_C" >&6 if test "${ac_cv_nolto+set}" = set; then @@ -3727,6 +3728,66 @@ echo "${ECHO_T}$ac_cv_nolto" >&6 fi fi + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Wl,--enable-auto-image-base" + echo "$as_me:$LINENO: checking for working --enable-auto-image-base" >&5 +echo $ECHO_N "checking for working --enable-auto-image-base... $ECHO_C" >&6 +if test "${ac_cv_enable_auto_image_base+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_enable_auto_image_base=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_enable_auto_image_base=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_enable_auto_image_base" >&5 +echo "${ECHO_T}$ac_cv_enable_auto_image_base" >&6 + CFLAGS=$hold_cflags + if test "$ac_cv_enable_auto_image_base" == "yes" ; then + extra_ldflags="$extra_ldflags -Wl,--enable-auto-image-base" + fi + echo "$as_me:$LINENO: checking compiler flags" >&5 echo $ECHO_N "checking compiler flags... $ECHO_C" >&6 if test "${GCC}" = "yes" ; then @@ -5237,7 +5298,7 @@ echo "${ECHO_T}$result" >&6 echo "$as_me:$LINENO: checking for tclsh in Tcl build directory" >&5 echo $ECHO_N "checking for tclsh in Tcl build directory... $ECHO_C" >&6 - BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT} + BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}\${EXESUFFIX} echo "$as_me:$LINENO: result: $BUILD_TCLSH" >&5 echo "${ECHO_T}$BUILD_TCLSH" >&6 diff --git a/win/configure.in b/win/configure.in index 038dc26..d331d8d 100644 --- a/win/configure.in +++ b/win/configure.in @@ -15,7 +15,7 @@ SHELL=/bin/sh TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 -TK_PATCH_LEVEL=".11" +TK_PATCH_LEVEL=".12" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ diff --git a/win/makefile.vc b/win/makefile.vc index 2f30590..ee14935 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -455,7 +455,7 @@ $(TKTEST): $(TKTESTOBJS) $(TKSTUBLIB) $(TKIMPLIB) $(CAT32): $(_TCLDIR)\win\cat.c
$(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE /DUNICODE /D_UNICODE -Fo$(TMP_DIR)\ $?
- $(CONEXECMD) /DCONSOLE -stack:16384 $(TMP_DIR)\cat.obj
+ $(CONEXECMD) -stack:16384 $(TMP_DIR)\cat.obj
$(_VC_MANIFEST_EMBED_EXE)
#---------------------------------------------------------------------
diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 4e3d792..2dc33cc 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -14,13 +14,10 @@ #define _CRT_SECURE_NO_DEPRECATE #include <windows.h> -#define NO_SHLWAPI_GDI -#define NO_SHLWAPI_STREAM -#define NO_SHLWAPI_REG -#include <shlwapi.h> +#ifdef _MSC_VER #pragma comment (lib, "user32.lib") #pragma comment (lib, "kernel32.lib") -#pragma comment (lib, "shlwapi.lib") +#endif #include <stdio.h> #include <math.h> @@ -42,7 +39,7 @@ /* protos */ static int CheckForCompilerFeature(const char *option); -static int CheckForLinkerFeature(const char **options, int count); +static int CheckForLinkerFeature(char **options, int count); static int IsIn(const char *string, const char *substring); static int SubstituteFile(const char *substs, const char *filename); static int QualifyPath(const char *path); @@ -59,8 +56,8 @@ typedef struct { char buffer[STATICBUFFERSIZE]; } pipeinfo; -pipeinfo Out = {INVALID_HANDLE_VALUE, '\0'}; -pipeinfo Err = {INVALID_HANDLE_VALUE, '\0'}; +pipeinfo Out = {INVALID_HANDLE_VALUE, ""}; +pipeinfo Err = {INVALID_HANDLE_VALUE, ""}; /* * exitcodes: 0 == no, 1 == yes, 2 == error @@ -74,7 +71,7 @@ main( char msg[300]; DWORD dwWritten; int chars; - char *s; + const char *s; /* * Make sure children (cl.exe and link.exe) are kept quiet. @@ -278,7 +275,7 @@ CheckForCompilerFeature( "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| - FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars], + FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPSTR)&msg[chars], (300-chars), 0); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL); return 2; @@ -331,7 +328,7 @@ CheckForCompilerFeature( static int CheckForLinkerFeature( - const char **options, + char **options, int count) { STARTUPINFO si; @@ -412,7 +409,7 @@ CheckForLinkerFeature( "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| - FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars], + FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPSTR)&msg[chars], (300-chars), 0); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL); return 2; @@ -508,7 +505,6 @@ GetVersionFromFile( const char *match, int numdots) { - size_t cbBuffer = 100; static char szBuffer[100]; char *szResult = NULL; FILE *fp = fopen(filename, "rt"); @@ -518,7 +514,7 @@ GetVersionFromFile( * Read data until we see our match string. */ - while (fgets(szBuffer, cbBuffer, fp) != NULL) { + while (fgets(szBuffer, sizeof(szBuffer), fp) != NULL) { LPSTR p, q; p = strstr(szBuffer, match); @@ -528,7 +524,7 @@ GetVersionFromFile( */ p += strlen(match); - while (*p && !isdigit(*p)) { + while (*p && !isdigit((unsigned char)*p)) { ++p; } @@ -537,14 +533,13 @@ GetVersionFromFile( */ q = p; - while (*q && (strchr("0123456789.ab", *q)) && ((!strchr(".ab", *q) - && (!strchr("ab", q[-1])) || --numdots))) { + while (*q && (strchr("0123456789.ab", *q)) && (((!strchr(".ab", *q) + && !strchr("ab", q[-1])) || --numdots))) { ++q; } - memcpy(szBuffer, p, q - p); - szBuffer[q-p] = 0; - szResult = szBuffer; + *q = 0; + szResult = p; break; } } @@ -567,7 +562,7 @@ typedef struct list_item_t { static list_item_t * list_insert(list_item_t **listPtrPtr, const char *key, const char *value) { - list_item_t *itemPtr = malloc(sizeof(list_item_t)); + list_item_t *itemPtr = (list_item_t *)malloc(sizeof(list_item_t)); if (itemPtr) { itemPtr->key = strdup(key); itemPtr->value = strdup(value); @@ -616,9 +611,7 @@ SubstituteFile( const char *substitutions, const char *filename) { - size_t cbBuffer = 1024; static char szBuffer[1024], szCopy[1024]; - char *szResult = NULL; list_item_t *substPtr = NULL; FILE *fp, *sp; @@ -631,7 +624,7 @@ SubstituteFile( sp = fopen(substitutions, "rt"); if (sp != NULL) { - while (fgets(szBuffer, cbBuffer, sp) != NULL) { + while (fgets(szBuffer, sizeof(szBuffer), sp) != NULL) { unsigned char *ks, *ke, *vs, *ve; ks = (unsigned char*)szBuffer; while (ks && *ks && isspace(*ks)) ++ks; @@ -648,7 +641,7 @@ SubstituteFile( } /* debug: dump the list */ -#ifdef _DEBUG +#ifndef NDEBUG { int n = 0; list_item_t *p = NULL; @@ -662,7 +655,7 @@ SubstituteFile( * Run the substitutions over each line of the input */ - while (fgets(szBuffer, cbBuffer, fp) != NULL) { + while (fgets(szBuffer, sizeof(szBuffer), fp) != NULL) { list_item_t *p = NULL; for (p = substPtr; p != NULL; p = p->nextPtr) { char *m = strstr(szBuffer, p->key); @@ -679,7 +672,7 @@ SubstituteFile( memcpy(szBuffer, szCopy, sizeof(szCopy)); } } - printf(szBuffer); + printf("%s", szBuffer); } list_free(&substPtr); @@ -688,6 +681,17 @@ SubstituteFile( return 0; } +BOOL FileExists(LPCTSTR szPath) +{ +#ifndef INVALID_FILE_ATTRIBUTES + #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) +#endif + DWORD pathAttr = GetFileAttributes(szPath); + return (pathAttr != INVALID_FILE_ATTRIBUTES && + !(pathAttr & FILE_ATTRIBUTE_DIRECTORY)); +} + + /* * QualifyPath -- * @@ -701,13 +705,8 @@ QualifyPath( const char *szPath) { char szCwd[MAX_PATH + 1]; - char szTmp[MAX_PATH + 1]; - char *p; - GetCurrentDirectory(MAX_PATH, szCwd); - while ((p = strchr(szPath, '/')) && *p) - *p = '\\'; - PathCombine(szTmp, szCwd, szPath); - PathCanonicalize(szCwd, szTmp); + + GetFullPathName(szPath, sizeof(szCwd)-1, szCwd, NULL); printf("%s\n", szCwd); return 0; } @@ -724,7 +723,8 @@ static int LocateDependencyHelper(const char *dir, const char *keypath) { HANDLE hSearch; char path[MAX_PATH+1]; - int dirlen, keylen, ret; + size_t dirlen; + int keylen, ret; WIN32_FIND_DATA finfo; if (dir == NULL || keypath == NULL) @@ -765,7 +765,7 @@ static int LocateDependencyHelper(const char *dir, const char *keypath) strncpy(path+dirlen+1, finfo.cFileName, sublen); path[dirlen+1+sublen] = '\\'; strncpy(path+dirlen+1+sublen+1, keypath, keylen+1); - if (PathFileExists(path)) { + if (FileExists(path)) { /* Found a match, print to stdout */ path[dirlen+1+sublen] = '\0'; QualifyPath(path); @@ -791,8 +791,9 @@ static int LocateDependencyHelper(const char *dir, const char *keypath) */ static int LocateDependency(const char *keypath) { - int i, ret; - static char *paths[] = {"..", "..\\..", "..\\..\\.."}; + size_t i; + int ret; + static const char *paths[] = {"..", "..\\..", "..\\..\\.."}; for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) { ret = LocateDependencyHelper(paths[i], keypath); diff --git a/win/rules.vc b/win/rules.vc index 2ec5292..c24fce3 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1123,7 +1123,7 @@ STUBPREFIX = $(PROJECT)stub # TIP 430. Unused for 8.6 but no harm defining it to allow a common rules.vc
TCLSCRIPTZIPNAME = libtcl$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)$(TCL_PATCH_LETTER)$(TCL_RELEASE_SERIAL).zip
-TKSCRIPTZIPNAME = libtk$(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)$(TK_PATCH_LETTER)$(TK_RELEASE_SERIAL).zip
+TKSCRIPTZIPNAME = libtk$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)$(TK_PATCH_LETTER)$(TK_RELEASE_SERIAL).zip
!if $(DOING_TCL)
TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe
@@ -1203,9 +1203,16 @@ TCLSH_NATIVE = $(TCLSH) !if $(DOING_TK) || $(NEED_TK)
WISHNAMEPREFIX = wish
WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe
-TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT)
-TKSTUBLIBNAME = tkstub$(TK_VERSION).lib
+TKLIBNAME8 = tk$(TK_VERSION)$(SUFX).$(EXT)
+TKLIBNAME9 = tcl9tk$(TK_VERSION)$(SUFX).$(EXT)
+!if $(TCL_MAJOR_VERSION) == 8
+TKLIBNAME = tk$(TK_VERSION)$(SUFX).$(EXT)
TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib
+!else
+TKLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).$(EXT)
+TKIMPLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).lib
+!endif
+TKSTUBLIBNAME = tkstub$(TK_VERSION).lib
!if $(DOING_TK)
WISH = $(OUT_DIR)\$(WISHNAME)
@@ -1253,7 +1260,13 @@ tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)" # Various output paths
PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
-PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
+PRJLIBNAME8 = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
+PRJLIBNAME9 = tcl9$(PROJECT)$(VERSION)$(SUFX).$(EXT)
+!if $(TCL_MAJOR_VERSION) == 8
+PRJLIBNAME = $(PRJLIBNAME8)
+!else
+PRJLIBNAME = $(PRJLIBNAME9)
+!endif
PRJLIB = $(OUT_DIR)\$(PRJLIBNAME)
PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
@@ -1583,12 +1596,22 @@ default-target: $(DEFAULT_BUILD_TARGET) !if $(MULTIPLATFORM_INSTALL)
default-pkgindex:
+ @echo if {[package vsatisfies [package provide Tcl] 9.0-]} { > $(OUT_DIR)\pkgIndex.tcl
@echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
- [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl
+ [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME9)]] >> $(OUT_DIR)\pkgIndex.tcl
+ @echo } else { >> $(OUT_DIR)\pkgIndex.tcl
+ @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
+ [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME8)]] >> $(OUT_DIR)\pkgIndex.tcl
+ @echo } >> $(OUT_DIR)\pkgIndex.tcl
!else
default-pkgindex:
+ @echo if {[package vsatisfies [package provide Tcl] 9.0-]} { > $(OUT_DIR)\pkgIndex.tcl
+ @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
+ [list load [file join $$dir $(PRJLIBNAME9)]] >> $(OUT_DIR)\pkgIndex.tcl
+ @echo } else { >> $(OUT_DIR)\pkgIndex.tcl
@echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
- [list load [file join $$dir $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl
+ [list load [file join $$dir $(PRJLIBNAME8)]] >> $(OUT_DIR)\pkgIndex.tcl
+ @echo } >> $(OUT_DIR)\pkgIndex.tcl
!endif
default-pkgindex-tea:
@@ -1597,6 +1620,8 @@ default-pkgindex-tea: @PACKAGE_NAME@ $(PRJ_PACKAGE_TCLNAME)
@PACKAGE_TCLNAME@ $(PRJ_PACKAGE_TCLNAME)
@PKG_LIB_FILE@ $(PRJLIBNAME)
+@PKG_LIB_FILE8@ $(PRJLIBNAME8)
+@PKG_LIB_FILE9@ $(PRJLIBNAME9)
<<
default-install: default-install-binaries default-install-libraries
@@ -659,6 +659,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ else extra_cflags="$extra_cflags -DTCL_BROKEN_MAINARGS" fi + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto" AC_CACHE_CHECK(for working -fno-lto, ac_cv_nolto, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], @@ -673,6 +674,18 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ fi fi + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Wl,--enable-auto-image-base" + AC_CACHE_CHECK(for working --enable-auto-image-base, + ac_cv_enable_auto_image_base, + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [ac_cv_enable_auto_image_base=yes], + [ac_cv_enable_auto_image_base=no]) + ) + CFLAGS=$hold_cflags + if test "$ac_cv_enable_auto_image_base" == "yes" ; then + extra_ldflags="$extra_ldflags -Wl,--enable-auto-image-base" + fi + AC_MSG_CHECKING([compiler flags]) if test "${GCC}" = "yes" ; then SHLIB_LD="" @@ -1204,7 +1217,7 @@ AC_DEFUN([SC_PROG_TCLSH], [ AC_DEFUN([SC_BUILD_TCLSH], [ AC_MSG_CHECKING([for tclsh in Tcl build directory]) - BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT} + BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}\${EXESUFFIX} AC_MSG_RESULT($BUILD_TCLSH) AC_SUBST(BUILD_TCLSH) ]) diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c index 8cfddee..802b1f3 100644 --- a/win/tkWin32Dll.c +++ b/win/tkWin32Dll.c @@ -119,11 +119,11 @@ DllMain( case DLL_PROCESS_DETACH: /* * Protect the call to TkFinalize in an SEH block. We can't be - * guarenteed Tk is always being unloaded from a stable condition. + * guaranteed Tk is always being unloaded from a stable condition. */ #ifdef HAVE_NO_SEH -# ifdef __WIN64 +# ifdef _WIN64 __asm__ __volatile__ ( /* diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 7332c93..4e965c2 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -149,7 +149,7 @@ InitBoxes(void) size = tsdPtr->boxesPtr->biSize + (sizeof(RGBQUAD) << tsdPtr->boxesPtr->biBitCount) + tsdPtr->boxesPtr->biSizeImage; - newBitmap = ckalloc(size); + newBitmap = (LPBITMAPINFOHEADER)ckalloc(size); memcpy(newBitmap, tsdPtr->boxesPtr, size); tsdPtr->boxesPtr = newBitmap; tsdPtr->boxWidth = tsdPtr->boxesPtr->biWidth / 4; @@ -182,7 +182,7 @@ InitBoxes(void) */ void -TkpButtonSetDefaults() +TkpButtonSetDefaults(void) { int width = GetSystemMetrics(SM_CXEDGE); if (width > 0) { @@ -208,11 +208,11 @@ TkpButtonSetDefaults() TkButton * TkpCreateButton( - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { WinButton *butPtr; - butPtr = ckalloc(sizeof(WinButton)); + butPtr = (WinButton *)ckalloc(sizeof(WinButton)); butPtr->hwnd = NULL; return (TkButton *) butPtr; } @@ -316,14 +316,14 @@ TkpDisplayButton( { TkWinDCState state; HDC dc; - register TkButton *butPtr = (TkButton *) clientData; + TkButton *butPtr = (TkButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; int x = 0; /* Initialization only needed to stop compiler * warning. */ int y, relief; - register Tk_Window tkwin = butPtr->tkwin; + Tk_Window tkwin = butPtr->tkwin; int width = 0, height = 0, haveImage = 0, haveText = 0, drawRing = 0; RECT rect; int defaultWidth; /* Width of default ring. */ @@ -818,7 +818,7 @@ TkpDisplayButton( void TkpComputeButtonGeometry( - register TkButton *butPtr) /* Button whose geometry may have changed. */ + TkButton *butPtr) /* Button whose geometry may have changed. */ { int txtWidth, txtHeight; /* Width and height of text */ int imgWidth, imgHeight; /* Width and height of image */ @@ -1264,7 +1264,7 @@ ButtonProc( PAINTSTRUCT ps; BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps); - TkpDisplayButton((ClientData)butPtr); + TkpDisplayButton(butPtr); /* * Special note: must cancel any existing idle handler for @@ -1272,7 +1272,7 @@ ButtonProc( * cleared the REDRAW_PENDING flag. */ - Tcl_CancelIdleCall(TkpDisplayButton, (ClientData)butPtr); + Tcl_CancelIdleCall(TkpDisplayButton, butPtr); return 0; } case BN_CLICKED: { @@ -1287,14 +1287,14 @@ ButtonProc( Tcl_Interp *interp = butPtr->info.interp; if (butPtr->info.state != STATE_DISABLED) { - Tcl_Preserve((ClientData)interp); + Tcl_Preserve(interp); code = TkInvokeButton((TkButton*)butPtr); if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (button invoke)"); Tcl_BackgroundException(interp, code); } - Tcl_Release((ClientData)interp); + Tcl_Release(interp); } Tcl_ServiceAll(); return 0; diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c index 774eddc..8c9399a 100644 --- a/win/tkWinCursor.c +++ b/win/tkWinCursor.c @@ -39,7 +39,7 @@ typedef struct { * resource identifier. */ -static struct CursorName { +static const struct CursorName { const char *name; LPCTSTR id; } cursorNames[] = { @@ -96,7 +96,7 @@ TkGetCursorByName( Tk_Uid string) /* Description of cursor. See manual entry for * details on legal syntax. */ { - struct CursorName *namePtr; + const struct CursorName *namePtr; TkWinCursor *cursorPtr; int argc; const char **argv = NULL; diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h index 852de02..b03cbd7 100644 --- a/win/tkWinDefault.h +++ b/win/tkWinDefault.h @@ -59,6 +59,7 @@ #define DEF_BUTTON_DEFAULT "disabled" #define DEF_BUTTON_DISABLED_FG_COLOR DISABLED #define DEF_BUTTON_DISABLED_FG_MONO "" +#define DEF_LABEL_FG NORMAL_FG #define DEF_BUTTON_FG NORMAL_FG #define DEF_CHKRAD_FG TEXT_FG #define DEF_BUTTON_FONT "TkDefaultFont" diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index cdfdafa..176ba88 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -782,7 +782,7 @@ Tk_ChooseColorObjCmd( } parent = tkwin; - chooseColor.lStructSize = sizeof(CHOOSECOLOR); + chooseColor.lStructSize = sizeof(CHOOSECOLORW); chooseColor.hwndOwner = NULL; chooseColor.hInstance = NULL; chooseColor.rgbResult = oldColor; @@ -908,7 +908,7 @@ ColorDlgHookProc( ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *title; - CHOOSECOLOR *ccPtr; + CHOOSECOLORW *ccPtr; (void)wParam; if (WM_INITDIALOG == uMsg) { @@ -917,7 +917,7 @@ ColorDlgHookProc( * Set the title string of the dialog. */ - ccPtr = (CHOOSECOLOR *) lParam; + ccPtr = (CHOOSECOLORW *) lParam; title = (const char *) ccPtr->lCustData; if ((title != NULL) && (title[0] != '\0')) { @@ -3151,7 +3151,7 @@ HookProc( WPARAM wParam, LPARAM lParam) { - CHOOSEFONT *pcf = (CHOOSEFONT *) lParam; + CHOOSEFONTW *pcf = (CHOOSEFONTW *) lParam; HWND hwndCtrl; static HookData *phd = NULL; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) @@ -3463,10 +3463,10 @@ FontchooserShowCmd( Tk_MakeWindowExist(parent); - ZeroMemory(&cf, sizeof(CHOOSEFONT)); - ZeroMemory(&lf, sizeof(LOGFONT)); + ZeroMemory(&cf, sizeof(CHOOSEFONTW)); + ZeroMemory(&lf, sizeof(LOGFONTW)); lf.lfCharSet = DEFAULT_CHARSET; - cf.lStructSize = sizeof(CHOOSEFONT); + cf.lStructSize = sizeof(CHOOSEFONTW); cf.hwndOwner = Tk_GetHWND(Tk_WindowId(parent)); cf.lpLogFont = &lf; cf.nFontType = SCREEN_FONTTYPE; diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index 042d1b1..4ed8ab2 100644 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.c @@ -587,9 +587,6 @@ TkPutImage( } if (!bitmap) { Tcl_Panic("Fail to allocate bitmap"); - DeleteDC(dcMem); - TkWinReleaseDrawableDC(d, dc, &state); - return BadValue; } bitmap = SelectObject(dcMem, bitmap); BitBlt(dc, dest_x, dest_y, (int) width, (int) height, dcMem, src_x, src_y, diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index 1c6ba6c..36c6047 100644 --- a/win/tkWinEmbed.c +++ b/win/tkWinEmbed.c @@ -1088,8 +1088,8 @@ EmbedWindowDeleted( prevPtr = NULL; containerPtr = tsdPtr->firstContainerPtr; - if (containerPtr == NULL) return; while (1) { + if (containerPtr == NULL) return; if (containerPtr->embeddedPtr == winPtr) { containerPtr->embeddedHWnd = NULL; containerPtr->embeddedPtr = NULL; diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 5eed32c..c24cd5f 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -2748,7 +2748,7 @@ LoadFontRanges( * range information. */ int *symbolPtr) { - int n, i, swapped, offset, cbData, segCount; + int n, i, j, k, swapped, offset, cbData, segCount; DWORD cmapKey; USHORT *startCount, *endCount; CMAPTABLE cmapTable; @@ -2824,9 +2824,9 @@ LoadFontRanges( offset += cbData + sizeof(USHORT); GetFontData(hdc, cmapKey, (DWORD) offset, startCount, cbData); if (swapped) { - for (i = 0; i < segCount; i++) { - SwapShort(&endCount[i]); - SwapShort(&startCount[i]); + for (j = 0; j < segCount; j++) { + SwapShort(&endCount[j]); + SwapShort(&startCount[j]); } } if (*symbolPtr != 0) { @@ -2842,11 +2842,11 @@ LoadFontRanges( * 8-bit characters [note Bug: 2406] */ - for (i = 0; i < segCount; i++) { - if (((startCount[i] & 0xff00) == 0xf000) - && ((endCount[i] & 0xff00) == 0xf000)) { - startCount[i] &= 0xff; - endCount[i] &= 0xff; + for (k = 0; k < segCount; k++) { + if (((startCount[k] & 0xff00) == 0xf000) + && ((endCount[k] & 0xff00) == 0xf000)) { + startCount[k] &= 0xff; + endCount[k] &= 0xff; } } } diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 67894c7..22e84cb 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -511,7 +511,7 @@ GetEntryText( : Tcl_GetString(mePtr->accelPtr); const char *p, *next; Tcl_DString itemString; - int ch; + Tcl_UniChar ch = 0; /* * We have to construct the string with an ampersand preceeding the @@ -528,16 +528,17 @@ GetEntryText( if (*p == '&') { Tcl_DStringAppend(&itemString, "&", 1); } - next = p + TkUtfToUniChar(p, &ch); + next = p + Tcl_UtfToUniChar(p, &ch); Tcl_DStringAppend(&itemString, p, (int) (next - p)); } + ch = 0; if (mePtr->accelLength > 0) { Tcl_DStringAppend(&itemString, "\t", 1); for (p = accel, i = 0; *p != '\0'; i++, p = next) { if (*p == '&') { Tcl_DStringAppend(&itemString, "&", 1); } - next = p + TkUtfToUniChar(p, &ch); + next = p + Tcl_UtfToUniChar(p, &ch); Tcl_DStringAppend(&itemString, p, (int) (next - p)); } } diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 337a866..0118608 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -21,6 +21,7 @@ *--------------------------------------------------------------------------- */ +#include <stdio.h> #include <wchar.h> #include <io.h> #include <stdlib.h> @@ -64,6 +65,9 @@ typedef _TCHAR TCHAR; #endif +#if defined(__GNUC__) && !defined(__cplusplus) +# pragma GCC diagnostic ignored "-Wc++-compat" +#endif #include <X11/Xlib.h> #include <X11/cursorfont.h> #include <X11/keysym.h> diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index a633dc2..409a6db 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -4,7 +4,7 @@ * This file implements the Windows specific portion of the scrollbar * widget. * - * Copyright (c) 1996 by Sun Microsystems, Inc. + * Copyright (c) 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -82,7 +82,7 @@ const Tk_ClassProcs tkpScrollbarProcs = { static void WinScrollbarEventProc(ClientData clientData, XEvent *eventPtr) { - WinScrollbar *scrollPtr = clientData; + WinScrollbar *scrollPtr = (WinScrollbar *)clientData; if (eventPtr->type == ButtonPress) { ModalLoop(scrollPtr, eventPtr); @@ -121,7 +121,7 @@ TkpCreateScrollbar( Tcl_MutexUnlock(&winScrlbrMutex); } - scrollPtr = ckalloc(sizeof(WinScrollbar)); + scrollPtr = (WinScrollbar *)ckalloc(sizeof(WinScrollbar)); scrollPtr->winFlags = 0; scrollPtr->hwnd = NULL; @@ -275,7 +275,7 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - WinScrollbar *scrollPtr = (WinScrollbar *) clientData; + WinScrollbar *scrollPtr = (WinScrollbar *)clientData; Tk_Window tkwin = scrollPtr->info.tkwin; scrollPtr->info.flags &= ~REDRAW_PENDING; @@ -295,7 +295,7 @@ TkpDisplayScrollbar( DestroyWindow(hwnd); CreateProc(tkwin, Tk_WindowId(Tk_Parent(tkwin)), - (ClientData) scrollPtr); + scrollPtr); } else { UpdateScrollbar(scrollPtr); } @@ -383,7 +383,7 @@ UpdateScrollbarMetrics(void) void TkpComputeScrollbarGeometry( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) /* Scrollbar whose geometry may have * changed. */ { @@ -591,7 +591,7 @@ ScrollbarProc( void TkpConfigureScrollbar( - register TkScrollbar *scrollPtr) + TCL_UNUSED(TkScrollbar *)) /* Information about widget; may or may not * already have values for some fields. */ { @@ -617,7 +617,7 @@ ModalLoop( int oldMode; if (scrollPtr->hwnd) { - Tcl_Preserve((ClientData)scrollPtr); + Tcl_Preserve(scrollPtr); scrollPtr->winFlags |= IN_MODAL_LOOP; oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); TkWinResendEvent(scrollPtr->oldProc, scrollPtr->hwnd, eventPtr); @@ -626,7 +626,7 @@ ModalLoop( if (scrollPtr->hwnd && scrollPtr->winFlags & ALREADY_DEAD) { DestroyWindow(scrollPtr->hwnd); } - Tcl_Release((ClientData)scrollPtr); + Tcl_Release(scrollPtr); } } @@ -650,7 +650,7 @@ ModalLoop( int TkpScrollbarPosition( - register TkScrollbar *scrollPtr, + TkScrollbar *scrollPtr, /* Scrollbar widget record. */ int x, int y) /* Coordinates within scrollPtr's window. */ { diff --git a/win/tkWinWm.c b/win/tkWinWm.c index ff83ad2..d2602f7 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -358,7 +358,7 @@ typedef struct TkWmInfo { * of top-level windows. */ -static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin); +static void TopLevelReqProc(void *, Tk_Window); static void RemapWindows(TkWindow *winPtr, HWND parentHWND); static const Tk_GeomMgr wmMgrType = { @@ -436,9 +436,9 @@ static BlockOfIconImagesPtr ReadIconOrCursorFromFile(Tcl_Interp *interp, Tcl_Obj* fileName, BOOL isIcon); static WinIconPtr ReadIconFromFile(Tcl_Interp *interp, Tcl_Obj *fileName); +static BOOL AdjustIconImagePointers(LPICONIMAGE lpImage); static WinIconPtr GetIconFromPixmap(Display *dsPtr, Pixmap pixmap); static int ReadICOHeader(Tcl_Channel channel); -static BOOL AdjustIconImagePointers(LPICONIMAGE lpImage); static HICON MakeIconOrCursorFromResource(LPICONIMAGE lpIcon, BOOL isIcon); static HICON GetIcon(WinIconPtr titlebaricon, int icon_size); @@ -2740,10 +2740,8 @@ TkWmDeadWindow( void TkWmSetClass( - TkWindow *winPtr) /* Newly-created top-level window. */ + TCL_UNUSED(TkWindow *)) /* Newly-created top-level window. */ { - (void)winPtr; - /* Do nothing */ return; } @@ -2946,7 +2944,7 @@ Tk_WmObjCmd( static int WmAspectCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2954,7 +2952,6 @@ WmAspectCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; - (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -3075,9 +3072,6 @@ WmAttributesCmd( } for (i = 3; i < objc; i += 2) { string = Tcl_GetStringFromObj(objv[i], &length); - if ((length < 2) || (string[0] != '-')) { - goto configArgs; - } if (strncmp(string, "-disabled", length) == 0) { stylePtr = &style; styleBit = WS_DISABLED; @@ -3110,6 +3104,12 @@ WmAttributesCmd( Tcl_SetErrorCode(interp, "TK", "WM", "ATTR", "TOPMOST", NULL); return TCL_ERROR; } + } else if (i == 3) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad attribute \"%s\": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost", + string)); + Tcl_SetErrorCode(interp, "TK", "WM", "ATTR", "UNRECOGNIZED", NULL); + return TCL_ERROR; } else { goto configArgs; } @@ -3313,7 +3313,7 @@ WmAttributesCmd( static int WmClientCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3322,7 +3322,6 @@ WmClientCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int length; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name?"); @@ -3478,7 +3477,7 @@ WmColormapwindowsCmd( static int WmCommandCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3488,7 +3487,6 @@ WmCommandCmd( const char *argv3; int cmdArgc; const char **cmdArgv; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?value?"); @@ -3548,14 +3546,13 @@ WmCommandCmd( static int WmDeiconifyCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3601,7 +3598,7 @@ WmDeiconifyCmd( static int WmFocusmodelCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3615,7 +3612,6 @@ WmFocusmodelCmd( OPT_ACTIVE, OPT_PASSIVE }; int index; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?"); @@ -3658,17 +3654,13 @@ WmFocusmodelCmd( static int WmForgetCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ - Tcl_Interp *dummy, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ + Tcl_Interp *interp, /* Current interpreter. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window) winPtr; - (void)tkwin; - (void)dummy; - (void)objc; - (void)objv; if (Tk_IsTopLevel(frameWin)) { Tk_UnmapWindow(frameWin); @@ -3676,10 +3668,10 @@ WmForgetCmd( Tk_MakeWindowExist((Tk_Window)winPtr->parentPtr); RemapWindows(winPtr, Tk_GetHWND(winPtr->parentPtr->window)); - /* - * Make sure wm no longer manages this window - */ - Tk_ManageGeometry(frameWin, NULL, NULL); + /* + * Make sure wm no longer manages this window + */ + Tk_ManageGeometry(frameWin, NULL, NULL); TkWmDeadWindow(winPtr); /* flags (above) must be cleared before calling */ @@ -3710,7 +3702,7 @@ WmForgetCmd( static int WmFrameCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3719,7 +3711,6 @@ WmFrameCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; HWND hwnd; char buf[TCL_INTEGER_SPACE]; - (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3756,7 +3747,7 @@ WmFrameCmd( static int WmGeometryCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3766,7 +3757,6 @@ WmGeometryCmd( char xSign, ySign; int width, height; const char *argv3; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?"); @@ -3825,7 +3815,7 @@ WmGeometryCmd( static int WmGridCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3833,7 +3823,6 @@ WmGridCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; - (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -3987,7 +3976,7 @@ WmGroupCmd( static int WmIconbitmapCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3996,7 +3985,6 @@ WmIconbitmapCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ const char *string; - (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? ?image?"); @@ -4124,14 +4112,13 @@ WmIconbitmapCmd( static int WmIconifyCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -4249,7 +4236,7 @@ WmIconmaskCmd( static int WmIconnameCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4258,7 +4245,6 @@ WmIconnameCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int length; - (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); @@ -4301,7 +4287,7 @@ WmIconnameCmd( static int WmIconphotoCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4319,7 +4305,6 @@ WmIconphotoCmd( unsigned size; BITMAPINFO bmInfo; ICONINFO iconInfo; - (void)tkwin; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, @@ -4495,7 +4480,7 @@ WmIconphotoCmd( static int WmIconpositionCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4503,7 +4488,6 @@ WmIconpositionCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; - (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); @@ -4662,17 +4646,14 @@ WmIconwindowCmd( static int WmManageCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window) winPtr; WmInfo *wmPtr = winPtr->wmInfoPtr; - (void)tkwin; - (void)objc; - (void)objv; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { @@ -4719,7 +4700,7 @@ WmManageCmd( static int WmMaxsizeCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4727,7 +4708,6 @@ WmMaxsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; - (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -4771,7 +4751,7 @@ WmMaxsizeCmd( static int WmMinsizeCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4779,7 +4759,6 @@ WmMinsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; - (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -4823,7 +4802,7 @@ WmMinsizeCmd( static int WmOverrideredirectCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4832,7 +4811,6 @@ WmOverrideredirectCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; int boolean, curValue; XSetWindowAttributes atts; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -4896,7 +4874,7 @@ WmOverrideredirectCmd( static int WmPositionfromCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4910,7 +4888,6 @@ WmPositionfromCmd( OPT_PROGRAM, OPT_USER }; int index; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?"); @@ -4965,7 +4942,7 @@ WmPositionfromCmd( static int WmProtocolCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4977,7 +4954,6 @@ WmProtocolCmd( const char *cmd; int cmdLength; Tcl_Obj *resultObj; - (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); @@ -5062,7 +5038,7 @@ WmProtocolCmd( static int WmResizableCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -5070,7 +5046,6 @@ WmResizableCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; - (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -5125,7 +5100,7 @@ WmResizableCmd( static int WmSizefromCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -5139,7 +5114,6 @@ WmSizefromCmd( OPT_PROGRAM, OPT_USER }; int index; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?"); @@ -5323,7 +5297,7 @@ WmStackorderCmd( static int WmStateCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -5337,7 +5311,6 @@ WmStateCmd( OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED }; int index; - (void)tkwin; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?state?"); @@ -5464,7 +5437,7 @@ WmStateCmd( static int WmTitleCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -5474,7 +5447,6 @@ WmTitleCmd( const char *argv3; int length; HWND wrapper; - (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); @@ -5670,14 +5642,13 @@ WmTransientCmd( static int WmWithdrawCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -5986,12 +5957,11 @@ TopLevelEventProc( static void TopLevelReqProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(void *), Tk_Window tkwin) /* Information about window. */ { TkWindow *winPtr = (TkWindow *) tkwin; WmInfo *wmPtr; - (void)dummy; wmPtr = winPtr->wmInfoPtr; if (wmPtr) { @@ -6538,15 +6508,13 @@ Tk_CoordsToWindow( void Tk_GetVRootGeometry( - Tk_Window tkwin, /* Window whose virtual root is to be + TCL_UNUSED(Tk_Window), /* Window whose virtual root is to be * queried. */ int *xPtr, int *yPtr, /* Store x and y offsets of virtual root * here. */ int *widthPtr, int *heightPtr) /* Store dimensions of virtual root here. */ { - (void)tkwin; - *xPtr = GetSystemMetrics(SM_XVIRTUALSCREEN); *yPtr = GetSystemMetrics(SM_YVIRTUALSCREEN); *widthPtr = GetSystemMetrics(SM_CXVIRTUALSCREEN); diff --git a/win/winMain.c b/win/winMain.c index f072f78..14eb718 100644 --- a/win/winMain.c +++ b/win/winMain.c @@ -19,6 +19,10 @@ #include <locale.h> #include <stdlib.h> #include <tchar.h> +#if TCL_MAJOR_VERSION < 9 && TCL_MINOR_VERSION < 7 +# define Tcl_LibraryInitProc Tcl_PackageInitProc +# define Tcl_StaticLibrary Tcl_StaticPackage +#endif #if defined(__GNUC__) int _CRT_glob = 0; @@ -28,7 +32,7 @@ int _CRT_glob = 0; #ifdef __cplusplus extern "C" { #endif -extern Tcl_PackageInitProc Tktest_Init; +extern Tcl_LibraryInitProc Tktest_Init; #endif /* TK_TEST */ #if !defined(TCL_USE_STATIC_PACKAGES) @@ -40,9 +44,9 @@ extern Tcl_PackageInitProc Tktest_Init; #endif #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES -extern Tcl_PackageInitProc Registry_Init; -extern Tcl_PackageInitProc Dde_Init; -extern Tcl_PackageInitProc Dde_SafeInit; +extern Tcl_LibraryInitProc Registry_Init; +extern Tcl_LibraryInitProc Dde_Init; +extern Tcl_LibraryInitProc Dde_SafeInit; #endif #ifdef __cplusplus @@ -199,10 +203,21 @@ Tcl_AppInit( if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } +#if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES + if (Registry_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticLibrary(interp, "Registry", Registry_Init, 0); + + if (Dde_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticLibrary(interp, "Dde", Dde_Init, Dde_SafeInit); +#endif if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } - Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit); + Tcl_StaticLibrary(interp, "Tk", Tk_Init, Tk_SafeInit); /* * Initialize the console only if we are running as an interactive @@ -214,23 +229,11 @@ Tcl_AppInit( return TCL_ERROR; } } -#if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES - if (Registry_Init(interp) == TCL_ERROR) { - return TCL_ERROR; - } - Tcl_StaticPackage(interp, "Registry", Registry_Init, 0); - - if (Dde_Init(interp) == TCL_ERROR) { - return TCL_ERROR; - } - Tcl_StaticPackage(interp, "Dde", Dde_Init, Dde_SafeInit); -#endif - #ifdef TK_TEST if (Tktest_Init(interp) == TCL_ERROR) { return TCL_ERROR; } - Tcl_StaticPackage(interp, "Tktest", Tktest_Init, 0); + Tcl_StaticLibrary(interp, "Tktest", Tktest_Init, 0); #endif /* TK_TEST */ /* |