From b214554afac1888e696aabb53e87a04468ec9359 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 23 Oct 2020 10:42:02 +0000 Subject: Always "source -encoding utf-8" Tk's own script files. Since Tk 8.7 runs in either Tcl 8.6 or 8.7, we then can trust the real encoding used, even though (in Tk 8.6) all those files are still ASCII --- library/console.tcl | 4 ++-- library/tk.tcl | 6 +++--- library/ttk/ttk.tcl | 34 +++++++++++++++++----------------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/library/console.tcl b/library/console.tcl index 4e2b9d0..e59e6e2 100644 --- a/library/console.tcl +++ b/library/console.tcl @@ -215,7 +215,7 @@ proc ::tk::ConsoleSource {} { [list [mc "Tcl Scripts"] .tcl] \ [list [mc "All Files"] *]]] if {$filename ne ""} { - set cmd [list source $filename] + set cmd [list source -encoding utf-8 $filename] if {[catch {consoleinterp eval $cmd} result]} { ConsoleOutput stderr "$result\n" } @@ -592,7 +592,7 @@ proc ::tk::ConsoleBind {w} { } bind Console { eval destroy [winfo child .] - source [file join $tk_library console.tcl] + source -encoding utf-8 [file join $tk_library console.tcl] } if {[tk windowingsystem] eq "aqua"} { bind Console { diff --git a/library/tk.tcl b/library/tk.tcl index 3657511..514ebcf 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -496,7 +496,7 @@ switch -exact -- [tk windowingsystem] { if {$::tk_library ne ""} { proc ::tk::SourceLibFile {file} { - namespace eval :: [list source [file join $::tk_library $file.tcl]] + namespace eval :: [list source -encoding utf-8 [file join $::tk_library $file.tcl]] } namespace eval ::tk { SourceLibFile icons @@ -688,7 +688,7 @@ if {[tk windowingsystem] eq "aqua"} { #stub procedures to respond to "do script" Apple Events proc ::tk::mac::DoScriptFile {file} { uplevel #0 $file - source $file + source -encoding utf-8 $file } proc ::tk::mac::DoScriptText {script} { uplevel #0 $script @@ -703,7 +703,7 @@ set ::tk::Priv(IMETextMark) [dict create] # Run the Ttk themed widget set initialization if {$::ttk::library ne ""} { - uplevel \#0 [list source $::ttk::library/ttk.tcl] + uplevel \#0 [list source -encoding utf-8 $::ttk::library/ttk.tcl] } # Local Variables: diff --git a/library/ttk/ttk.tcl b/library/ttk/ttk.tcl index 665222d..73ee3d9 100644 --- a/library/ttk/ttk.tcl +++ b/library/ttk/ttk.tcl @@ -12,9 +12,9 @@ namespace eval ::ttk { } } -source [file join $::ttk::library fonts.tcl] -source [file join $::ttk::library cursors.tcl] -source [file join $::ttk::library utils.tcl] +source -encoding utf-8 [file join $::ttk::library fonts.tcl] +source -encoding utf-8 [file join $::ttk::library cursors.tcl] +source -encoding utf-8 [file join $::ttk::library utils.tcl] ## ttk::deprecated $old $new -- # Define $old command as a deprecated alias for $new command @@ -97,18 +97,18 @@ proc ::ttk::setTheme {theme} { ### Load widget bindings. # -source [file join $::ttk::library button.tcl] -source [file join $::ttk::library menubutton.tcl] -source [file join $::ttk::library scrollbar.tcl] -source [file join $::ttk::library scale.tcl] -source [file join $::ttk::library progress.tcl] -source [file join $::ttk::library notebook.tcl] -source [file join $::ttk::library panedwindow.tcl] -source [file join $::ttk::library entry.tcl] -source [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl -source [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl -source [file join $::ttk::library treeview.tcl] -source [file join $::ttk::library sizegrip.tcl] +source -encoding utf-8 [file join $::ttk::library button.tcl] +source -encoding utf-8 [file join $::ttk::library menubutton.tcl] +source -encoding utf-8 [file join $::ttk::library scrollbar.tcl] +source -encoding utf-8 [file join $::ttk::library scale.tcl] +source -encoding utf-8 [file join $::ttk::library progress.tcl] +source -encoding utf-8 [file join $::ttk::library notebook.tcl] +source -encoding utf-8 [file join $::ttk::library panedwindow.tcl] +source -encoding utf-8 [file join $::ttk::library entry.tcl] +source -encoding utf-8 [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl +source -encoding utf-8 [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl +source -encoding utf-8 [file join $::ttk::library treeview.tcl] +source -encoding utf-8 [file join $::ttk::library sizegrip.tcl] ## Label and Labelframe bindings: # (not enough to justify their own file...) @@ -122,7 +122,7 @@ proc ttk::LoadThemes {} { variable library # "default" always present: - uplevel #0 [list source [file join $library defaults.tcl]] + uplevel #0 [list source -encoding utf-8 [file join $library defaults.tcl]] set builtinThemes [style theme names] foreach {theme scripts} { @@ -135,7 +135,7 @@ proc ttk::LoadThemes {} { } { if {[lsearch -exact $builtinThemes $theme] >= 0} { foreach script $scripts { - uplevel #0 [list source [file join $library $script]] + uplevel #0 [list source -encoding utf-8 [file join $library $script]] } } } -- cgit v0.12 From 4d8498f181894261f21358d49ab8ba2dfe3b021a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 23 Oct 2020 10:47:53 +0000 Subject: See previous commit, but don't do this for user-provided script files --- library/console.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/console.tcl b/library/console.tcl index e59e6e2..30c4d88 100644 --- a/library/console.tcl +++ b/library/console.tcl @@ -215,7 +215,7 @@ proc ::tk::ConsoleSource {} { [list [mc "Tcl Scripts"] .tcl] \ [list [mc "All Files"] *]]] if {$filename ne ""} { - set cmd [list source -encoding utf-8 $filename] + set cmd [list source $filename] if {[catch {consoleinterp eval $cmd} result]} { ConsoleOutput stderr "$result\n" } -- cgit v0.12 From e164fe342189dd2f98830e9b3854b56519d8bf74 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 23 Oct 2020 11:07:51 +0000 Subject: One more use of "source -encoding utf-8", in case we are running with Tcl 8.6 --- tests/visual_bb.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/visual_bb.test b/tests/visual_bb.test index eda67e4..36612a9 100644 --- a/tests/visual_bb.test +++ b/tests/visual_bb.test @@ -23,7 +23,7 @@ proc runTest {file} { global testNum test "2.$testNum" "testing $file" {userInteraction} { - uplevel \#0 source [file join [testsDirectory] $file] + uplevel #0 [list source -encoding utf-8 [file join [testsDirectory] $file]] concat "" } {} incr testNum -- cgit v0.12 From 36747f6a9df2594bce1221bb241ff76364f1a324 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 23 Oct 2020 16:36:56 +0000 Subject: Fix [b5c419c8a6]: scrollbar-3.42 fails --- generic/tkScrollbar.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 86ec25a..d646434 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -226,8 +226,8 @@ ScrollbarWidgetObjCmd( Tcl_Obj *const objv[]) /* Argument strings. */ { TkScrollbar *scrollPtr = (TkScrollbar *)clientData; - int result = TCL_OK, cmdIndex; - TkSizeT length; + int result = TCL_OK, cmdIndex, length; + TkSizeT len; static const char *const commandNames[] = { "activate", "cget", "configure", "delta", "fraction", "get", "identify", "set", NULL @@ -271,13 +271,13 @@ ScrollbarWidgetObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "activate element"); goto error; } - c = TkGetStringFromObj(objv[2], &length)[0]; + c = TkGetStringFromObj(objv[2], &len)[0]; oldActiveField = scrollPtr->activeField; if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow1") == 0)) { scrollPtr->activeField = TOP_ARROW; } else if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow2") == 0)) { scrollPtr->activeField = BOTTOM_ARROW; - } else if ((c == 's') && (strncmp(Tcl_GetString(objv[2]), "slider", length) == 0)) { + } else if ((c == 's') && (strncmp(Tcl_GetString(objv[2]), "slider", len) == 0)) { scrollPtr->activeField = SLIDER; } else { scrollPtr->activeField = OUTSIDE; -- cgit v0.12 From 38f8f81b3b2a5ed3db23fc8fa7edb35c52a9eac5 Mon Sep 17 00:00:00 2001 From: marc_culler Date: Sun, 25 Oct 2020 00:01:47 +0000 Subject: Back out change to tkMacOSXDialog.c from commit b53baf71. The preferred API works in Catalina and Big Sur but fails in earlier OS versions. --- macosx/tkMacOSXDialog.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index ba6fabd..42cb4a5 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -346,25 +346,23 @@ static NSInteger showOpenSavePanel( NSWindow *parent, FilePanelCallbackInfo *callbackInfo) { - __block NSInteger modalReturnCode = modalOther; + NSInteger modalReturnCode; if (parent && ![parent attachedSheet]) { [panel beginSheetModalForWindow:parent - completionHandler:^(NSModalResponse result) { - [NSApp tkFilePanelDidEnd:panel - returnCode:result - contextInfo:callbackInfo ]; - modalReturnCode = result; + completionHandler:^(NSModalResponse returnCode) { + [NSApp tkFilePanelDidEnd:panel + returnCode:returnCode + contextInfo:callbackInfo ]; }]; + + modalReturnCode = callbackInfo->cmdObj ? modalOther : + [panel runModal]; } else { - [panel beginWithCompletionHandler:^(NSModalResponse result) { - [NSApp tkFilePanelDidEnd:panel - returnCode:result - contextInfo:callbackInfo ]; - modalReturnCode = result; - }]; + modalReturnCode = [panel runModal]; + [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode + contextInfo:callbackInfo]; } - [panel runModal]; return modalReturnCode; } -- cgit v0.12 From 9be66cd1af6db0fad2e35ff761f35f69f13d77f4 Mon Sep 17 00:00:00 2001 From: marc_culler Date: Sun, 25 Oct 2020 15:04:54 +0000 Subject: Document the TK_CONSOLE environment variable for macOS --- doc/console.n | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/console.n b/doc/console.n index 1313d3a..86dbd46 100644 --- a/doc/console.n +++ b/doc/console.n @@ -25,9 +25,12 @@ the Tk library. Except for TkAqua, this command is not available when Tk is loaded into a tclsh interpreter with .QW "\fBpackage require Tk\fR" , as a conventional terminal is expected to be present in that case. -In TkAqua, this command is only available when stdin is \fB/dev/null\fR -(as is the case e.g. when the application embedding Tk is started -from the Mac OS X Finder). +In TkAqua, this command is disabled when there is a startup script +and stdin is \fB/dev/null\fR (as is the case e.g. when a bundled application +embedding Tk is started by the macOS Launcher). To enable the command +in that case, define the environment variable \fBTK_CONSOLE\fR. This can be +done by modifying the Info.plist file by adding the LSEnvironment key +to the main dict and setting its value to be a dict with the key \fBTK_CONSOLE\fR. .PP .TP \fBconsole eval \fIscript\fR -- cgit v0.12 From 9a4cae2ef7fa38418385bd4d35e0095f3e59cdc2 Mon Sep 17 00:00:00 2001 From: marc_culler Date: Sun, 25 Oct 2020 19:45:08 +0000 Subject: Fix [5cc72e002c]: file dialogs return an empty string on older macOS systems. --- macosx/tkMacOSXDialog.c | 52 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 42cb4a5..05cdd95 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -23,7 +23,7 @@ #define modalOK NSModalResponseOK #define modalCancel NSModalResponseCancel #endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1090 -#define modalOther -1 +#define modalOther -1 // indicates that the -command option was used. #define modalError -2 /* @@ -52,6 +52,10 @@ typedef struct { * filter. */ } filepanelFilterInfo; +/* + * Only one of these is needed for the application, so they can be static. + */ + static filepanelFilterInfo filterInfo; static NSOpenPanel *openpanel; static NSSavePanel *savepanel; @@ -250,13 +254,13 @@ getFileURL( } else if (returnCode == modalCancel) { Tcl_ResetResult(callbackInfo->interp); } - if (panel == [NSApp modalWindow]) { - [NSApp stopModalWithCode:returnCode]; - } if (callbackInfo->cmdObj) { Tcl_DecrRefCount(callbackInfo->cmdObj); + } + if (callbackInfo) { ckfree(callbackInfo); } + [NSApp stopModalWithCode:returnCode]; } - (void) tkAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode @@ -356,14 +360,42 @@ static NSInteger showOpenSavePanel( contextInfo:callbackInfo ]; }]; - modalReturnCode = callbackInfo->cmdObj ? modalOther : - [panel runModal]; + /* + * The sheet has been prepared, so now we have to run it as a modal + * window. Using [NSApp runModalForWindow:] on macOS 10.15 or later + * generates warnings on stderr. But using [NSOpenPanel runModal] or + * [NSSavePanel runModal] on 10.14 or earler does not cause the + * completion handler to run when the panel is closed. + */ + + if ([NSApp macOSVersion] > 101400) { + modalReturnCode = [panel runModal]; + } else { + modalReturnCode = [NSApp runModalForWindow:panel]; + } } else { - modalReturnCode = [panel runModal]; - [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode - contextInfo:callbackInfo]; + + /* + * For the standalone file dialog, completion handlers do not work + * at all on macOS 10.14 and earlier. + */ + + if ([NSApp macOSVersion] > 101400) { + [panel beginWithCompletionHandler:^(NSModalResponse returnCode) { + [NSApp tkFilePanelDidEnd:panel + returnCode:returnCode + contextInfo:callbackInfo ]; + }]; + modalReturnCode = [panel runModal]; + } else { + modalReturnCode = [NSApp runModalForWindow:panel]; + [NSApp tkFilePanelDidEnd:panel + returnCode:modalReturnCode + contextInfo:callbackInfo ]; + [panel close]; + } } - return modalReturnCode; + return callbackInfo->cmdObj ? modalOther : modalReturnCode; } /* -- cgit v0.12 From fd9301ebb217fdc1bfc1726a2ccdb450bbfc89f7 Mon Sep 17 00:00:00 2001 From: culler Date: Sun, 25 Oct 2020 20:11:47 +0000 Subject: Adjustment for Sierra. --- macosx/tkMacOSXDialog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 05cdd95..40f4b12 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -388,7 +388,7 @@ static NSInteger showOpenSavePanel( }]; modalReturnCode = [panel runModal]; } else { - modalReturnCode = [NSApp runModalForWindow:panel]; + modalReturnCode = [panel runModal]; [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode contextInfo:callbackInfo ]; -- cgit v0.12 From 7bd5c1e5436cf2f6f8fd655d891cf7d964c2a3e1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 26 Oct 2020 08:55:43 +0000 Subject: Don't use \\U escape sequence any more in demo: No longer needed starting with Tcl 8.7a4 --- library/demos/unicodeout.tcl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/demos/unicodeout.tcl b/library/demos/unicodeout.tcl index bb4d8f8..759dc00 100644 --- a/library/demos/unicodeout.tcl +++ b/library/demos/unicodeout.tcl @@ -133,8 +133,7 @@ addSample $w Russian \ "\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A" if {([tk windowingsystem] ne "x11") || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))} { if {[package vsatisfies [package provide Tcl] 8.7-]} { - addSample $w Emoji \ - "\U1F600\U1F4A9\U1F44D\U1F1F3\U1F1F1" + addSample $w Emoji "😀💩👍🇳🇱" } else { addSample $w Emoji \ "\uD83D\uDE00\uD83D\uDCA9\uD83D\uDC4D\uD83C\uDDF3\uD83C\uDDF1" -- cgit v0.12 -- cgit v0.12 From 9c4c75d2646667f334d7b2abf2942f47ed06bc4e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 27 Oct 2020 12:19:41 +0000 Subject: No need to specify "install" and "script" in sub-builds, when they are equal to the global specification --- .travis.yml | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index f52dc1b..3621b0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -137,37 +137,24 @@ jobs: env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: &mactest - - make binaries libraries tktest - name: "macOS/Xcode 12/Static" os: osx osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --disable-shared CFLAGS=-I/usr/local/opt/tcl-tk/include" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest - name: "macOS/Xcode 12/Debug" os: osx osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --enable-symbols CFLAGS=-I/usr/local/opt/tcl-tk/include" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest - name: "macOS/Xcode 12/Shared/XQuartz" os: osx osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --disable-corefoundation --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib CFLAGS=-I/usr/local/opt/tcl-tk/include" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest # Older MacOS versions - name: "macOS/Xcode 11/Shared" os: osx @@ -175,9 +162,6 @@ jobs: env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest - name: "macOS/Xcode 10/Shared" os: osx osx_image: xcode10.3 @@ -189,9 +173,6 @@ jobs: env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest - name: "macOS/Xcode 9/Shared" os: osx osx_image: xcode9.4 @@ -203,9 +184,6 @@ jobs: env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.13" - install: - - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) - script: *mactest # Test on Windows with MSVC native # - name: "Windows/MSVC/Shared" # os: windows -- cgit v0.12 From 0fd1dde8cc2bed51e25230af8f739e7280e54389 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 28 Oct 2020 13:22:32 +0000 Subject: MSVC++ 6.0 does't handle C++ comments --- macosx/tkMacOSXDialog.c | 4 ++-- win/tkWinDialog.c | 6 +++--- win/ttkWinXPTheme.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 40f4b12..71bb120 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -23,7 +23,7 @@ #define modalOK NSModalResponseOK #define modalCancel NSModalResponseCancel #endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1090 -#define modalOther -1 // indicates that the -command option was used. +#define modalOther -1 // indicates that the -command option was used. #define modalError -2 /* @@ -375,7 +375,7 @@ static NSInteger showOpenSavePanel( } } else { - /* + /* * For the standalone file dialog, completion handlers do not work * at all on macOS 10.14 and earlier. */ diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 3702efa..cdfdafa 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -1086,7 +1086,7 @@ ParseOFNOptions( } ZeroMemory(optsPtr, sizeof(*optsPtr)); - // optsPtr->forceXPStyle = 1; + /* optsPtr->forceXPStyle = 1; */ optsPtr->tkwin = (Tk_Window)clientData; optsPtr->confirmOverwrite = 1; /* By default we ask for confirmation */ Tcl_DStringInit(&optsPtr->utfDirString); @@ -2711,10 +2711,10 @@ ChooseDirectoryValidateProc( if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) { SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) selDir); - // enable the OK button + /* enable the OK button */ SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); } else { - // disable the OK button + /* disable the OK button */ SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0); } UpdateWindow(hwnd); diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 361ee8a..1c543d0 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -849,7 +849,7 @@ static void TextElementSize( Ttk_StateTableLookup(elementData->info->statemap, 0), Tcl_UtfToWCharDString(src, len, &ds), -1, - DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, + DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */, NULL, &rc); @@ -888,7 +888,7 @@ static void TextElementDraw( Ttk_StateTableLookup(elementData->info->statemap, state), Tcl_UtfToWCharDString(src, len, &ds), -1, - DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, + DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */, (state & TTK_STATE_DISABLED) ? DTT_GRAYED : 0, &rc); -- cgit v0.12 From 561fe24459c6d4f750c4ebe2a138aa563b1fb58c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 28 Oct 2020 14:20:10 +0000 Subject: Fix some C++ comments in ttkWinXPTheme.c (needed for MSVC++ 6.0) Fix some typing errors in code comments. Some eol-spacing elimination --- generic/tkCanvUtil.c | 2 +- generic/tkImgPhoto.c | 4 ++-- macosx/tkMacOSXWm.c | 8 ++++---- win/tkWin.h | 8 ++++---- win/tkWinCursor.c | 2 +- win/tkWinFont.c | 8 ++++---- win/tkWinInt.h | 4 ++-- win/tkWinMenu.c | 2 +- win/tkWinPort.h | 2 +- win/ttkWinMonitor.c | 4 ++-- win/ttkWinXPTheme.c | 46 +++++++++++++++++++++++++--------------------- xlib/xcolors.c | 6 +++--- 12 files changed, 50 insertions(+), 46 deletions(-) diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index bbf8bea..420e11a 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -757,7 +757,7 @@ TkSmoothParseProc( } /* - * Backward compatability hack. + * Backward compatibility hack. */ if (strncmp(value, "bezier", length) == 0) { diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index ffe4a3f..aaea896 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -6069,7 +6069,7 @@ ImgPhotoPostscript( * * Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite -- * - * These backward-compatability functions just exist to fill slots in stubs + * These backward-compatibility functions just exist to fill slots in stubs * table. For the behaviour of *_NoComposite, refer to the corresponding * function without the extra suffix, except that the compositing rule is * always "overlay" and the function always panics on memory-allocation @@ -6110,7 +6110,7 @@ Tk_PhotoPutZoomedBlock_NoComposite( * Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic, * Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic * - * Backward compatability functions for preserving the old behaviour (i.e. + * Backward compatibility functions for preserving the old behaviour (i.e. * panic on memory allocation failure) so that extensions do not need to be * significantly updated to take account of TIP #116. These call the new * interface (i.e. the interface without the extra suffix), but panic if an diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index be7bf47..f4cc084 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -1568,7 +1568,7 @@ WmColormapwindowsCmd( wmPtr->cmapCount = windowObjc; /* - * On the Macintosh all of this is just an excercise in compatability as + * On the Macintosh all of this is just an excercise in compatibility as * we don't support colormaps. If we did they would be installed here. */ @@ -4677,7 +4677,7 @@ TkWmAddToColormapWindows( topPtr->wmInfoPtr->cmapCount = count+1; /* - * On the Macintosh all of this is just an excercise in compatability as + * On the Macintosh all of this is just an excercise in compatibility as * we don't support colormaps. If we did they would be installed here. */ } @@ -5965,7 +5965,7 @@ TkpChangeFocus( [win makeKeyAndOrderFront:NSApp]; } } - + /* * Remember the current serial number for the X server and issue a dummy * server request. This marks the position at which we changed the focus, @@ -6447,7 +6447,7 @@ TkMacOSXMakeFullscreen( [window setStyleMask: NSBorderlessWindowMask]; [NSApp setPresentationOptions: NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar]; - + #endif /*TK_GOT_AT_LEAST_SNOW_LEOPARD*/ } else { wmPtr->flags &= ~WM_FULLSCREEN; diff --git a/win/tkWin.h b/win/tkWin.h index 00d3486..8e4bdef 100644 --- a/win/tkWin.h +++ b/win/tkWin.h @@ -43,9 +43,9 @@ /* * The following messages are used to communicate between a Tk toplevel - * and its container window. A Tk container may not be able to provide - * service to all of the following requests at the moment. But an embedded - * Tk window will send out these requests to support external Tk container + * and its container window. A Tk container may not be able to provide + * service to all of the following requests at the moment. But an embedded + * Tk window will send out these requests to support external Tk container * application. */ @@ -66,7 +66,7 @@ /* * The following are sub-messages (wParam) for TK_INFO. An embedded window may - * send a TK_INFO message with one of the sub-messages to query a container + * send a TK_INFO message with one of the sub-messages to query a container * for verification and availability */ #define TK_CONTAINER_VERIFY 0x01 diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c index dee3419..cb36b29 100644 --- a/win/tkWinCursor.c +++ b/win/tkWinCursor.c @@ -104,7 +104,7 @@ TkGetCursorByName( /* * All cursor names are valid lists of one element (for - * Unix-compatability), even unadorned system cursor names. + * Unix-compatibility), even unadorned system cursor names. */ if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) { diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 1292772..bdd0d05 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -338,7 +338,7 @@ CreateNamedSystemLogFont( { HFONT hFont; int r; - + hFont = CreateFontIndirect(logFontPtr); r = CreateNamedSystemFont(interp, tkwin, name, hFont); DeleteObject((HGDIOBJ)hFont); @@ -368,7 +368,7 @@ CreateNamedSystemFont( { WinFont winfont; int r; - + TkDeleteNamedFont(NULL, tkwin, name); InitFont(tkwin, hFont, 0, &winfont); r = TkCreateNamedFont(interp, tkwin, name, &winfont.font.fa); @@ -446,7 +446,7 @@ TkWinSetupSystemFonts(TkMainInfo *mainPtr) { LOGFONTA lfFixed = { 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, - 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "" + 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "" }; long pointSize, dpi; HDC hdc = GetDC(NULL); @@ -457,7 +457,7 @@ TkWinSetupSystemFonts(TkMainInfo *mainPtr) CreateNamedSystemLogFont(interp, tkwin, "TkFixedFont", &lfFixed); } - /* + /* * Setup the remaining standard Tk font names as named fonts. */ diff --git a/win/tkWinInt.h b/win/tkWinInt.h index abac7b0..451457d 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -243,8 +243,8 @@ int TkpWmGetState(TkWindow *winPtr); /* * The following functions are not present in old versions of Windows - * API headers but are used in the Tk source to ensure 64bit - * compatability. + * API headers but are used in the Tk source to ensure 64bit + * compatibility. */ #ifndef GetClassLongPtr diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 5772f04..64d3d65 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -217,7 +217,7 @@ GetNewID( TkMenuEntry *mePtr, /* The menu we are working with. */ WORD *menuIDPtr) /* The resulting id. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); WORD curID = tsdPtr->lastCommandID; diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 2925dae..54e07b7 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -118,7 +118,7 @@ | ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000) /* - * These calls implement native bitmaps which are not currently + * These calls implement native bitmaps which are not currently * supported under Windows. The macros eliminate the calls. */ diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c index 25c9c0c..6848a1b 100644 --- a/win/ttkWinMonitor.c +++ b/win/ttkWinMonitor.c @@ -74,7 +74,7 @@ CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp) HWND hwnd = NULL; TCHAR title[32] = TEXT("TtkMonitorWindow"); TCHAR name[32] = TEXT("TtkMonitorClass"); - + wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)WndProc; @@ -99,7 +99,7 @@ CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp) return hwnd; } -static void +static void DestroyThemeMonitorWindow(void *clientData) { HWND hwnd = (HWND)clientData; diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 5bc2483..bd83dfa 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -106,7 +106,7 @@ LoadXPThemeProcs(HINSTANCE *phlib) * We have successfully loaded the library. Proceed in storing the * addresses of the functions we want to use. */ - XPThemeProcs *procs = (XPThemeProcs*)ckalloc(sizeof(XPThemeProcs)); + XPThemeProcs *procs = (XPThemeProcs *)ckalloc(sizeof(XPThemeProcs)); #define LOADPROC(name) \ (0 != (procs->name = (name ## Proc *)(void *)GetProcAddress(handle, #name) )) @@ -138,7 +138,7 @@ LoadXPThemeProcs(HINSTANCE *phlib) static void XPThemeDeleteProc(void *clientData) { - XPThemeData *themeData = clientData; + XPThemeData *themeData = (XPThemeData *)clientData; FreeLibrary(themeData->hlibrary); ckfree(clientData); } @@ -146,9 +146,11 @@ XPThemeDeleteProc(void *clientData) static int XPThemeEnabled(Ttk_Theme theme, void *clientData) { - XPThemeData *themeData = clientData; + XPThemeData *themeData = (XPThemeData *)clientData; int active = themeData->procs->IsThemeActive(); int themed = themeData->procs->IsAppThemed(); + (void)theme; + return (active && themed); } @@ -411,7 +413,7 @@ typedef struct static ElementData * NewElementData(XPThemeProcs *procs, ElementInfo *info) { - ElementData *elementData = (ElementData*)ckalloc(sizeof(ElementData)); + ElementData *elementData = (ElementData *)ckalloc(sizeof(ElementData)); elementData->procs = procs; elementData->info = info; @@ -427,7 +429,7 @@ NewElementData(XPThemeProcs *procs, ElementInfo *info) */ static void DestroyElementData(void *clientData) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; if (elementData->info->flags & HEAP_ELEMENT) { ckfree((char *)elementData->info->statemap); ckfree((char *)elementData->info->className); @@ -453,7 +455,7 @@ InitElementData(ElementData *elementData, Tk_Window tkwin, Drawable d) { Window win = Tk_WindowId(tkwin); - if (win != None) { + if (win) { elementData->hwnd = Tk_GetHWND(win); } else { elementData->hwnd = elementData->procs->stubWindow; @@ -495,9 +497,10 @@ static void GenericElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; HRESULT result; SIZE size; + (void)elementRecord; if (!InitElementData(elementData, tkwin, 0)) return; @@ -531,8 +534,9 @@ static void GenericElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; RECT rc; + (void)elementRecord; if (!InitElementData(elementData, tkwin, d)) { return; @@ -576,7 +580,7 @@ GenericSizedElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; if (!InitElementData(elementData, tkwin, 0)) return; @@ -612,7 +616,7 @@ SpinboxArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; if (!InitElementData(elementData, tkwin, 0)) return; @@ -641,9 +645,10 @@ static void ThumbElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; unsigned stateId = Ttk_StateTableLookup(elementData->info->statemap, state); RECT rc = BoxToRect(b); + (void)elementRecord; /* * Don't draw the thumb if we are disabled. @@ -680,7 +685,7 @@ static void PbarElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; int nBars = 3; GenericElementSize(clientData, elementRecord, tkwin, @@ -720,9 +725,10 @@ static void TabElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; int partId = elementData->info->partId; RECT rc = BoxToRect(b); + (void)elementRecord; if (!InitElementData(elementData, tkwin, d)) return; @@ -791,7 +797,7 @@ static Ttk_ElementSpec TreeIndicatorElementSpec = TreeIndicatorElementDraw }; -#if BROKEN_TEXT_ELEMENT +#ifdef BROKEN_TEXT_ELEMENT /* *---------------------------------------------------------------------- @@ -838,7 +844,7 @@ static void TextElementSize( Ttk_StateTableLookup(elementData->info->statemap, 0), Tcl_GetUnicode(element->textObj), -1, - DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, + DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */, NULL, &rc); @@ -871,7 +877,7 @@ static void TextElementDraw( Ttk_StateTableLookup(elementData->info->statemap, state), Tcl_GetUnicode(element->textObj), -1, - DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, + DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */, (state & TTK_STATE_DISABLED) ? DTT_GRAYED : 0, &rc); FreeElementData(elementData); @@ -1029,12 +1035,10 @@ static ElementInfo ElementInfoTable[] = { { "Spinbox.downarrow", &SpinboxArrowElementSpec, L"SPIN", SPNP_DOWN, spinbutton_statemap, NOPAD, PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) }, - -#if BROKEN_TEXT_ELEMENT +#ifdef BROKEN_TEXT_ELEMENT { "Labelframe.text", &TextElementSpec, L"BUTTON", BP_GROUPBOX, groupbox_statemap, NOPAD,0 }, #endif - { 0,0,0,0,0,NOPAD,0 } }; #undef PAD @@ -1096,7 +1100,7 @@ Ttk_CreateVsapiElement( int objc, Tcl_Obj *const objv[]) { - XPThemeData *themeData = clientData; + XPThemeData *themeData = (XPThemeData *)clientData; ElementInfo *elementPtr = NULL; ClientData elementData; Tcl_UniChar *className; @@ -1227,7 +1231,7 @@ Ttk_CreateVsapiElement( elementPtr->flags = HEAP_ELEMENT | flags; /* set the element name to an allocated copy */ - name = ckalloc(strlen(elementName) + 1); + name = (char *)ckalloc(strlen(elementName) + 1); strcpy(name, elementName); elementPtr->elementName = name; diff --git a/xlib/xcolors.c b/xlib/xcolors.c index 7b7223c..b5fdd5d 100644 --- a/xlib/xcolors.c +++ b/xlib/xcolors.c @@ -347,14 +347,14 @@ XParseColor( /* * If *p does not point to the end of the string, there were invalid - * digits in the spec. Ergo, it is not a vailid color string. + * digits in the spec. Ergo, it is not a valid color string. * (Bug f0188aca9e) */ - + if (*p != '\0') { return 0; } - + switch ((int)(p-spec)) { case 3: colorPtr->red = US(((value >> 8) & 0xf) * 0x1111); -- cgit v0.12