summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml4
-rw-r--r--changes2
-rw-r--r--doc/GetScroll.34
-rw-r--r--doc/SetOptions.32
-rw-r--r--doc/bitmap.n2
-rw-r--r--doc/button.n2
-rw-r--r--doc/canvas.n8
-rw-r--r--doc/checkbutton.n2
-rw-r--r--doc/clipboard.n2
-rw-r--r--doc/colors.n102
-rw-r--r--doc/entry.n2
-rw-r--r--doc/event.n2
-rw-r--r--doc/focus.n2
-rw-r--r--doc/font.n2
-rw-r--r--doc/frame.n4
-rw-r--r--doc/grab.n2
-rw-r--r--doc/image.n2
-rw-r--r--doc/label.n2
-rw-r--r--doc/labelframe.n4
-rw-r--r--doc/listbox.n2
-rw-r--r--doc/loadTk.n14
-rw-r--r--doc/menu.n2
-rw-r--r--doc/menubar.n2
-rw-r--r--doc/menubutton.n2
-rw-r--r--doc/message.n2
-rw-r--r--doc/panedwindow.n2
-rw-r--r--doc/photo.n6
-rw-r--r--doc/radiobutton.n2
-rw-r--r--doc/scale.n2
-rw-r--r--doc/scrollbar.n2
-rw-r--r--doc/selection.n4
-rw-r--r--doc/send.n2
-rw-r--r--doc/spinbox.n2
-rw-r--r--doc/text.n16
-rw-r--r--doc/tk.n2
-rw-r--r--doc/toplevel.n2
-rw-r--r--doc/winfo.n2
-rw-r--r--doc/wish.12
-rw-r--r--generic/tkBusy.c8
-rw-r--r--generic/tkCmds.c16
-rw-r--r--generic/tkConfig.c168
-rw-r--r--generic/tkConsole.c4
-rw-r--r--generic/tkEntry.c2
-rw-r--r--generic/tkFont.c4
-rw-r--r--generic/tkInt.decls16
-rw-r--r--generic/tkIntDecls.h38
-rw-r--r--generic/tkMenu.c96
-rw-r--r--generic/tkMenu.h16
-rw-r--r--generic/tkPanedWindow.c4
-rw-r--r--generic/tkSquare.c2
-rw-r--r--generic/tkStubInit.c26
-rw-r--r--generic/tkTest.c66
-rw-r--r--generic/tkText.c2
-rw-r--r--generic/tkWindow.c34
-rw-r--r--generic/ttk/ttkLayout.c8
-rw-r--r--generic/ttk/ttkProgress.c2
-rw-r--r--generic/ttk/ttkScale.c4
-rw-r--r--generic/ttk/ttkTreeview.c4
-rw-r--r--library/console.tcl4
-rw-r--r--library/demos/dialog1.tcl14
-rw-r--r--library/demos/fontchoose.tcl6
-rw-r--r--library/safetk.tcl80
-rw-r--r--macosx/README36
-rw-r--r--macosx/Tk.xcode/project.pbxproj4
-rw-r--r--macosx/Tk.xcodeproj/project.pbxproj4
-rw-r--r--macosx/tkMacOSXBitmap.c3
-rw-r--r--macosx/tkMacOSXButton.c34
-rw-r--r--macosx/tkMacOSXClipboard.c11
-rw-r--r--macosx/tkMacOSXColor.c807
-rw-r--r--macosx/tkMacOSXColor.h202
-rw-r--r--macosx/tkMacOSXConstants.h4
-rw-r--r--macosx/tkMacOSXDefault.h38
-rw-r--r--macosx/tkMacOSXDraw.c68
-rw-r--r--macosx/tkMacOSXImage.c53
-rw-r--r--macosx/tkMacOSXInit.c81
-rw-r--r--macosx/tkMacOSXKeyEvent.c2
-rw-r--r--macosx/tkMacOSXKeyboard.c13
-rw-r--r--macosx/tkMacOSXMenu.c61
-rw-r--r--macosx/tkMacOSXMenubutton.c7
-rw-r--r--macosx/tkMacOSXNotify.c7
-rw-r--r--macosx/tkMacOSXPort.h26
-rw-r--r--macosx/tkMacOSXPrivate.h5
-rw-r--r--macosx/tkMacOSXScale.c2
-rw-r--r--macosx/tkMacOSXServices.c9
-rw-r--r--macosx/tkMacOSXSubwindows.c36
-rw-r--r--macosx/tkMacOSXTest.c77
-rw-r--r--macosx/tkMacOSXWindowEvent.c108
-rw-r--r--macosx/tkMacOSXWm.c23
-rw-r--r--macosx/tkMacOSXXStubs.c4
-rw-r--r--macosx/ttkMacOSXTheme.c312
-rw-r--r--tests/bind.test2
-rw-r--r--tests/busy.test6
-rw-r--r--tests/canvImg.test25
-rw-r--r--tests/constraints.tcl2
-rw-r--r--tests/entry.test63
-rw-r--r--tests/font.test10
-rw-r--r--tests/grid.test2
-rw-r--r--tests/listbox.test40
-rw-r--r--tests/menu.test2
-rw-r--r--tests/pack.test24
-rw-r--r--tests/place.test23
-rw-r--r--tests/safe.test2
-rw-r--r--tests/safePrimarySelection.test328
-rw-r--r--tests/scrollbar.test14
-rw-r--r--tests/send.test4
-rw-r--r--tests/spinbox.test44
-rw-r--r--tests/text.test104
-rw-r--r--tests/textDisp.test110
-rw-r--r--tests/textIndex.test2
-rw-r--r--tests/textMark.test4
-rw-r--r--tests/textWind.test2
-rw-r--r--tests/ttk/spinbox.test9
-rw-r--r--tests/unixEmbed.test12
-rw-r--r--tests/unixFont.test10
-rw-r--r--tests/unixWm.test101
-rw-r--r--tests/winSend.test10
-rw-r--r--tests/wm.test20
-rw-r--r--unix/tkUnixMenu.c16
-rw-r--r--unix/tkUnixPort.h2
-rw-r--r--win/tkWinMenu.c10
-rw-r--r--win/tkWinPort.h2
-rw-r--r--xlib/xgc.c7
122 files changed, 2050 insertions, 1845 deletions
diff --git a/.travis.yml b/.travis.yml
index df0bd2c..e4662b3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,3 @@
-sudo: required
language: c
addons:
apt:
@@ -17,8 +16,7 @@ addons:
- tcl-tk
casks:
- xquartz
- update: true
-matrix:
+jobs:
include:
# Testing on Linux with various compilers
- name: "Linux/GCC/Shared"
diff --git a/changes b/changes
index f92e083..61aff06 100644
--- a/changes
+++ b/changes
@@ -3488,7 +3488,7 @@ Macintosh, the menubar is displayed accross the top of the main monitor,
just like with other applications. Under Windows and Unix, the menu is
attached to the toplevel window. Also, changed some semantics.
Tearoff menus will now reflect changes to the menu it was
-torn off from, and are deleted when the master menu is
+torn off from, and are deleted when the main menu is
deleted. Tearoffs also reflect more look-and-feel of the
platforms they are running on. (SRP)
diff --git a/doc/GetScroll.3 b/doc/GetScroll.3
index dd12cca..0df159b 100644
--- a/doc/GetScroll.3
+++ b/doc/GetScroll.3
@@ -25,13 +25,13 @@ int
Interpreter to use for error reporting.
.AP int objc in
Number of Tcl_Obj's in \fIobjv\fR array.
-.AP "Tcl_Obj *const" objv[] in
+.AP "Tcl_Obj *const *" objv in
Argument objects. These represent the entire widget command, of
which the first word is typically the widget name and the second
word is typically \fBxview\fR or \fByview\fR.
.AP int argc in
Number of strings in \fIargv\fR array.
-.AP "const char" *argv[] in
+.AP "const char **" argv in
Argument strings. These represent the entire widget command, of
which the first word is typically the widget name and the second
word is typically \fBxview\fR or \fByview\fR.
diff --git a/doc/SetOptions.3 b/doc/SetOptions.3
index cb04655..65fe8cd 100644
--- a/doc/SetOptions.3
+++ b/doc/SetOptions.3
@@ -60,7 +60,7 @@ no window-dependent options, then a NULL value may be supplied for
this argument.
.AP int objc in
Number of values in \fIobjv\fR.
-.AP Tcl_Obj "*const objv[]" in
+.AP Tcl_Obj "*const *objv" in
Command-line arguments for setting configuring options.
.AP Tk_SavedOptions *savePtr out
If not NULL, the structure pointed to by this argument is filled
diff --git a/doc/bitmap.n b/doc/bitmap.n
index 1751913..19716e1 100644
--- a/doc/bitmap.n
+++ b/doc/bitmap.n
@@ -90,7 +90,7 @@ This command may be used to invoke various operations
on the image.
It has the following general form:
.CS
-\fIimageName option \fR?\fIarg arg ...\fR?
+\fIimageName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/button.n b/doc/button.n
index 233feb6..70e0e65 100644
--- a/doc/button.n
+++ b/doc/button.n
@@ -109,7 +109,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/canvas.n b/doc/canvas.n
index 623154f..1b43983 100644
--- a/doc/canvas.n
+++ b/doc/canvas.n
@@ -348,13 +348,13 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
The following widget commands are possible for canvas widgets:
.TP
-\fIpathName \fBaddtag \fItag searchSpec \fR?\fIarg arg ...\fR?
+\fIpathName \fBaddtag \fItag searchSpec \fR?\fIarg ...\fR?
.
For each item that meets the constraints specified by
\fIsearchSpec\fR and the \fIarg\fRs, add
@@ -602,7 +602,7 @@ the item is unaffected by the command.
If \fItagToDelete\fR is omitted then it defaults to \fItagOrId\fR.
This command returns an empty string.
.TP
-\fIpathName \fBfind \fIsearchCommand \fR?\fIarg arg ...\fR?
+\fIpathName \fBfind \fIsearchCommand \fR?\fIarg ...\fR?
.
This command returns a list consisting of all the items that
meet the constraints specified by \fIsearchCommand\fR and
@@ -1160,7 +1160,7 @@ of the \fBxScrollIncrement\fR option, if it is greater than zero,
or in units of one-tenth the window's width otherwise.
.RE
.TP
-\fIpathName \fByview \fI?args\fR?
+\fIpathName \fByview ?\fIargs\fR?
.
This command is used to query and change the vertical position of the
information displayed in the canvas's window.
diff --git a/doc/checkbutton.n b/doc/checkbutton.n
index bfefca4..411045f 100644
--- a/doc/checkbutton.n
+++ b/doc/checkbutton.n
@@ -192,7 +192,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/clipboard.n b/doc/clipboard.n
index 6f047dd..ee964df 100644
--- a/doc/clipboard.n
+++ b/doc/clipboard.n
@@ -12,7 +12,7 @@
.SH NAME
clipboard \- Manipulate Tk clipboard
.SH SYNOPSIS
-\fBclipboard \fIoption\fR ?\fIarg arg ...\fR?
+\fBclipboard \fIoption\fR ?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/colors.n b/doc/colors.n
index 9234824..3747ee8 100644
--- a/doc/colors.n
+++ b/doc/colors.n
@@ -784,30 +784,23 @@ YellowGreen 154 205 50
.TP
\fBMac OS X\fR
.
-On macOS, the following additional system colors are available.
-This first group contains all colors available in the HIToolbox library.
-(Note that in some cases the actual color values may depend on the
-current Appearance.)
+On macOS, the following additional system colors are available. This
+first group contains all of the HIBrush colors available in the
+HIToolbox library. Note that on macOS 10.14 (Mojave) and later these
+colors are unlikely to match the color actually used for the purpose
+suggested by the color name.
.RS
.DS
systemActiveAreaFill
-systemAlertActiveText
systemAlertBackgroundActive
systemAlertBackgroundInactive
-systemAlertInactiveText
systemAlternatePrimaryHighlightColor
systemAppleGuideCoachmark
systemBevelActiveDark
systemBevelActiveLight
-systemBevelButtonActiveText
-systemBevelButtonInactiveText
-systemBevelButtonPressedText
-systemBevelButtonStickyActiveText
-systemBevelButtonStickyInactiveText
systemBevelInactiveDark
systemBevelInactiveLight
systemBlack
-systemBlackText
systemButtonActiveDarkHighlight
systemButtonActiveDarkShadow
systemButtonActiveLightHighlight
@@ -827,15 +820,10 @@ systemButtonPressedDarkHighlight
systemButtonPressedDarkShadow
systemButtonPressedLightHighlight
systemButtonPressedLightShadow
-systemButtonText
systemChasingArrows
-systemDialogActiveText
systemDialogBackgroundActive
systemDialogBackgroundInactive
-systemDialogInactiveText
systemDocumentWindowBackground
-systemDocumentWindowTitleActiveText
-systemDocumentWindowTitleInactiveText
systemDragHilite
systemDrawerBackground
systemFinderWindowBackground
@@ -843,101 +831,53 @@ systemFocusHighlight
systemHighlight
systemHighlightAlternate
systemHighlightSecondary
-systemHighlightText
systemIconLabelBackground
systemIconLabelBackgroundSelected
-systemIconLabelSelectedText
-systemIconLabelText
systemListViewBackground
systemListViewColumnDivider
systemListViewEvenRowBackground
systemListViewOddRowBackground
systemListViewSeparator
systemListViewSortColumnBackground
-systemListViewText
-systemListViewWindowHeaderBackground
systemMenu
systemMenuActive
-systemMenuActiveText
systemMenuBackground
systemMenuBackgroundSelected
-systemMenuDisabled
-systemMenuItemActiveText
-systemMenuItemDisabledText
-systemMenuItemSelectedText
-systemMenuText
-systemMetalBackground
-systemModelessDialogActiveText
systemModelessDialogBackgroundActive
systemModelessDialogBackgroundInactive
-systemModelessDialogInactiveText
systemMovableModalBackground
-systemMovableModalWindowTitleActiveText
-systemMovableModalWindowTitleInactiveText
-systemNotificationText
systemNotificationWindowBackground
-systemPlacardActiveText
-systemPlacardBackground
-systemPlacardInactiveText
-systemPlacardPressedText
systemPopupArrowActive
systemPopupArrowInactive
systemPopupArrowPressed
-systemPopupButtonActiveText
-systemPopupButtonInactiveText
-systemPopupButtonPressedText
-systemPopupLabelActiveText
-systemPopupLabelInactiveText
-systemPopupWindowTitleActiveText
-systemPopupWindowTitleInactiveText
systemPrimaryHighlightColor
-systemPushButtonActiveText
-systemPushButtonInactiveText
-systemPushButtonPressedText
-systemRootMenuActiveText
-systemRootMenuDisabledText
-systemRootMenuSelectedText
systemScrollBarDelimiterActive
systemScrollBarDelimiterInactive
-systemSecondaryGroupBoxBackground
systemSecondaryHighlightColor
systemSelectedTabTextColor
systemSheetBackground
systemSheetBackgroundOpaque
systemSheetBackgroundTransparent
systemStaticAreaFill
-systemSystemDetailText
-systemTabFrontActiveText
-systemTabFrontInactiveText
-systemTabNonFrontActiveText
-systemTabNonFrontInactiveText
-systemTabNonFrontPressedText
-systemTabPaneBackground
systemToolbarBackground
systemTransparent
systemUtilityWindowBackgroundActive
systemUtilityWindowBackgroundInactive
-systemUtilityWindowTitleActiveText
-systemUtilityWindowTitleInactiveText
systemWhite
-systemWhiteText
systemWindowBody
-systemWindowHeaderActiveText
-systemWindowHeaderBackground
-systemWindowHeaderInactiveText
.DE
.RE
.
-The second group of MacOS colors below are based on Apple's "semantic"
-NScolors. On OSX 10.14 (Mojave) and later these colors change value
-when Dark Mode is enabled. However, the change is only observable
-when the Apple window manager is drawing to the screen. So the
-\fBwinfo rgb\fR command will return the color coordinates used in the
-standard Aqua mode, even if Dark Mode has been selected in the system
-preferences. The numbered systemWindowBackgroundColors are used in
-the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets to provide a
-contrasting background. Each numbered color constrasts with its
-predecessor.
+Tk supports all of the NSColors in the macOS System ColorList. The
+convention for naming these colors is that the Tk name is generated by
+capitalizing the macOS name and adding the prefix "system". On OSX
+10.14 (Mojave) and later many of these "semantic" colors will appear
+differently depending on whether the NSWindow in which they are used has
+the Aqua or DarkAqua appearance. The System ColorList differs between
+releases of macOS and some colors, such as systemLinkColor and
+systemControlAccentColor, are simulated on older systems which did not
+provide them. All of the colors below are available on all supported
+macOS releases, but newer systems will support additional colors.
.RS
.DS
systemControlAccentColor
@@ -945,10 +885,21 @@ systemControlTextColor
systemDisabledControlTextColor
systemLabelColor
systemLinkColor
+systemPlaceholderTextColor
systemSelectedTextBackgroundColor
systemSelectedTextColor
+systemSeparatorColor
systemTextBackgroundColor
systemTextColor
+.DE
+.RE
+.
+The numbered systemWindowBackgroundColors below
+are used in the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets
+to provide a contrasting background. Each numbered color constrasts
+with its predecessor.
+.RS
+.DS
systemWindowBackgroundColor
systemWindowBackgroundColor1
systemWindowBackgroundColor2
@@ -961,7 +912,6 @@ systemWindowBackgroundColor7
.RE
.TP
-
\fBWindows\fR
.
On Windows, the following additional system colors are available
diff --git a/doc/entry.n b/doc/entry.n
index 9eea51b..99ebbf4 100644
--- a/doc/entry.n
+++ b/doc/entry.n
@@ -190,7 +190,7 @@ The \fBentry\fR command creates a new Tcl command whose
name is \fIpathName\fR. This command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName subcommand \fR?\fIarg arg ...\fR?
+\fIpathName subcommand \fR?\fIarg ...\fR?
.CE
\fISubcommand\fR and the \fIarg\fRs
determine the exact behavior of the command.
diff --git a/doc/event.n b/doc/event.n
index f4eb426..0160e26 100644
--- a/doc/event.n
+++ b/doc/event.n
@@ -12,7 +12,7 @@
.SH NAME
event \- Miscellaneous event facilities: define virtual events and generate events
.SH SYNOPSIS
-\fBevent\fI option \fR?\fIarg arg ...\fR?
+\fBevent\fI option \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/focus.n b/doc/focus.n
index e3efcd3..a6b0575 100644
--- a/doc/focus.n
+++ b/doc/focus.n
@@ -15,7 +15,7 @@ focus \- Manage the input focus
.nf
\fBfocus\fR
\fBfocus \fIwindow\fR
-\fBfocus \fIoption\fR ?\fIarg arg ...\fR?
+\fBfocus \fIoption\fR ?\fIarg ...\fR?
.fi
.BE
.SH DESCRIPTION
diff --git a/doc/font.n b/doc/font.n
index 72f9270..4d2f5f4 100644
--- a/doc/font.n
+++ b/doc/font.n
@@ -12,7 +12,7 @@
.SH NAME
font \- Create and inspect fonts.
.SH SYNOPSIS
-\fBfont\fI option \fR?\fIarg arg ...\fR?
+\fBfont\fI option \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/frame.n b/doc/frame.n
index 54e8e2f..5520f32 100644
--- a/doc/frame.n
+++ b/doc/frame.n
@@ -120,7 +120,7 @@ command may be used to invoke various
operations on the widget. It has the following general form:
.PP
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
.PP
\fIPathName\fR is the name of the command, which is the same as
@@ -135,7 +135,7 @@ by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBframe\fR
command.
.TP
-\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR?
+\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
.
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
diff --git a/doc/grab.n b/doc/grab.n
index cee3ce7..259d68e 100644
--- a/doc/grab.n
+++ b/doc/grab.n
@@ -14,7 +14,7 @@ grab \- Confine pointer and keyboard events to a window sub-tree
.SH SYNOPSIS
\fBgrab \fR?\fB\-global\fR? \fIwindow\fR
.sp
-\fBgrab \fIoption \fR?\fIarg arg \fR...?
+\fBgrab \fIoption \fR?\fIarg \fR...?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/image.n b/doc/image.n
index 70f5acf..b620076 100644
--- a/doc/image.n
+++ b/doc/image.n
@@ -12,7 +12,7 @@
.SH NAME
image \- Create and manipulate images
.SH SYNOPSIS
-\fBimage\fR \fIoption \fR?\fIarg arg ...\fR?
+\fBimage\fR \fIoption \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/label.n b/doc/label.n
index 107175e..290ac8a 100644
--- a/doc/label.n
+++ b/doc/label.n
@@ -75,7 +75,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/labelframe.n b/doc/labelframe.n
index 857208e..89f56c4 100644
--- a/doc/labelframe.n
+++ b/doc/labelframe.n
@@ -95,7 +95,7 @@ name is the same as the path name of the labelframe's window. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIPathName\fR is the name of the command, which is the same as
the labelframe widget's path name. \fIOption\fR and the \fIarg\fRs
@@ -108,7 +108,7 @@ by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBlabelframe\fR
command.
.TP
-\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR?
+\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
diff --git a/doc/listbox.n b/doc/listbox.n
index ef3ae1c..9e4a459 100644
--- a/doc/listbox.n
+++ b/doc/listbox.n
@@ -136,7 +136,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/loadTk.n b/doc/loadTk.n
index 3673e98..e1c93c8 100644
--- a/doc/loadTk.n
+++ b/doc/loadTk.n
@@ -11,7 +11,7 @@
.SH NAME
safe::loadTk \- Load Tk into a safe interpreter.
.SH SYNOPSIS
-\fBsafe::loadTk \fIslave\fR ?\fB\-use\fR \fIwindowId\fR? ?\fB\-display\fR \fIdisplayName\fR?
+\fBsafe::loadTk \fIchild\fR ?\fB\-use\fR \fIwindowId\fR? ?\fB\-display\fR \fIdisplayName\fR?
.BE
.SH DESCRIPTION
.PP
@@ -43,13 +43,13 @@ the \fBSECURITY ISSUES\fR section below for implementation details.
Please read the \fBsafe\fR manual page for Tcl to learn about the basic
security considerations for Safe Tcl.
.PP
-\fBsafe::loadTk\fR adds the value of \fBtk_library\fR taken from the master
+\fBsafe::loadTk\fR adds the value of \fBtk_library\fR taken from the parent
interpreter to the virtual access path of the safe interpreter so that
auto-loading will work in the safe interpreter.
.PP
-Tk initialization is now safe with respect to not trusting the slave's state
-for startup. \fBsafe::loadTk\fR registers the slave's name so when the Tk
-initialization (\fBTk_SafeInit\fR) is called and in turn calls the master's
+Tk initialization is now safe with respect to not trusting the child's state
+for startup. \fBsafe::loadTk\fR registers the child's name so when the Tk
+initialization (\fBTk_SafeInit\fR) is called and in turn calls the parent's
\fBsafe::InitTk\fR it will return the desired \fBargv\fR equivalent
(\fB\-use\fR \fIwindowId\fR, correct \fB\-display\fR, etc.)
.PP
@@ -62,8 +62,8 @@ fatal X error.
.SH "SEE ALSO"
safe(n), interp(n), library(n), load(n), package(n), source(n), unknown(n)
.SH KEYWORDS
-alias, auto-loading, auto_mkindex, load, master interpreter, safe
-interpreter, slave interpreter, source
+alias, auto-loading, auto_mkindex, load, parent interpreter, safe
+interpreter, child interpreter, source
'\" Local Variables:
'\" mode: nroff
'\" End:
diff --git a/doc/menu.n b/doc/menu.n
index c6fcec3..7568820 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -303,7 +303,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
diff --git a/doc/menubar.n b/doc/menubar.n
index c3be85d..eeeb208 100644
--- a/doc/menubar.n
+++ b/doc/menubar.n
@@ -14,7 +14,7 @@ tk_menuBar, tk_bindForTraversal \- Obsolete support for menu bars
.SH SYNOPSIS
\fBtk_menuBar \fIframe \fR?\fImenu menu ...\fR?
.sp
-\fBtk_bindForTraversal \fIarg arg ... \fR
+\fBtk_bindForTraversal \fIarg ... \fR
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/menubutton.n b/doc/menubutton.n
index 1f596ce..ba874d5 100644
--- a/doc/menubutton.n
+++ b/doc/menubutton.n
@@ -117,7 +117,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/message.n b/doc/message.n
index 280c072..eb83d2f 100644
--- a/doc/message.n
+++ b/doc/message.n
@@ -106,7 +106,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/panedwindow.n b/doc/panedwindow.n
index 9fc2b72..a3c63a0 100644
--- a/doc/panedwindow.n
+++ b/doc/panedwindow.n
@@ -92,7 +92,7 @@ the same as the path name of the panedwindow's window. This command
may be used to invoke various operations on the widget. It has the
following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIPathName\fR is the name of the command, which is the same as
the panedwindow widget's path name. \fIOption\fR and the \fIarg\fRs
diff --git a/doc/photo.n b/doc/photo.n
index 2673985..3b206f5 100644
--- a/doc/photo.n
+++ b/doc/photo.n
@@ -28,7 +28,7 @@ photo \- Full-color images
\fIimageName \fBput \fIdata\fR ?\fIoption value(s) ...\fR?
\fIimageName \fBread \fIfilename\fR ?\fIoption value(s) ...\fR?
\fIimageName \fBredither\fR
-\fIimageName \fBtransparency \fIsubcommand \fR?\fIarg arg ...\fR?
+\fIimageName \fBtransparency \fIsubcommand \fR?\fIarg ...\fR?
\fIimageName \fBwrite \fIfilename\fR ?\fIoption value(s) ...\fR?
.fi
.BE
@@ -128,7 +128,7 @@ This command may be used to invoke various operations
on the image.
It has the following general form:
.CS
-\fIimageName option \fR?\fIarg arg ...\fR?
+\fIimageName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
@@ -394,7 +394,7 @@ not noticeable, but if it is a problem, this command can be used to
recalculate the dithered image in each window where the image is
displayed.
.TP
-\fIimageName \fBtransparency \fIsubcommand \fR?\fIarg arg ...\fR?
+\fIimageName \fBtransparency \fIsubcommand \fR?\fIarg ...\fR?
.
Allows examination and manipulation of the transparency information in
the photo image. Several subcommands are available:
diff --git a/doc/radiobutton.n b/doc/radiobutton.n
index fceb1ec..2169515 100644
--- a/doc/radiobutton.n
+++ b/doc/radiobutton.n
@@ -176,7 +176,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/scale.n b/doc/scale.n
index d6407a0..0499d0a 100644
--- a/doc/scale.n
+++ b/doc/scale.n
@@ -138,7 +138,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/scrollbar.n b/doc/scrollbar.n
index 5a062ce..ba11f5c 100644
--- a/doc/scrollbar.n
+++ b/doc/scrollbar.n
@@ -103,7 +103,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/selection.n b/doc/selection.n
index ec678fa..eb199ef 100644
--- a/doc/selection.n
+++ b/doc/selection.n
@@ -12,7 +12,7 @@
.SH NAME
selection \- Manipulate the X selection
.SH SYNOPSIS
-\fBselection \fIoption\fR ?\fIarg arg ...\fR?
+\fBselection \fIoption\fR ?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
@@ -150,7 +150,7 @@ A GUI event, for example \fB<<PasteSelection>>\fR, can copy the \fBPRIMARY\fR se
.PP
On X11, the \fBPRIMARY\fR selection is a system-wide feature of the X server, allowing communication between different processes that are X11 clients.
.PP
-On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a master interpreter and its unsafe slave interpreters. It is not shared between interpreters in different processes or different threads. Each master interpreter has a separate \fBPRIMARY\fR selection that is shared only with its unsafe slaves.
+On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a parent interpreter and its unsafe child interpreters. It is not shared between interpreters in different processes or different threads. Each parent interpreter has a separate \fBPRIMARY\fR selection that is shared only with its unsafe slaves.
.PP
.SH SECURITY
.PP
diff --git a/doc/send.n b/doc/send.n
index e33a504..f200128 100644
--- a/doc/send.n
+++ b/doc/send.n
@@ -12,7 +12,7 @@
.SH NAME
send \- Execute a command in a different application
.SH SYNOPSIS
-\fBsend ?\fIoptions\fR? \fIapp cmd \fR?\fIarg arg ...\fR?
+\fBsend ?\fIoptions\fR? \fIapp cmd \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/spinbox.n b/doc/spinbox.n
index 39961aa..1f556ba 100644
--- a/doc/spinbox.n
+++ b/doc/spinbox.n
@@ -239,7 +239,7 @@ The \fBspinbox\fR command creates a new Tcl command whose
name is \fIpathName\fR. This command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
diff --git a/doc/text.n b/doc/text.n
index 8915f71..60a55af 100644
--- a/doc/text.n
+++ b/doc/text.n
@@ -1052,7 +1052,7 @@ The \fBtext\fR command creates a new Tcl command whose name is the same as the
path name of the text's window. This command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIPathName\fR is the name of the command, which is the same as the text
widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact
@@ -1082,7 +1082,7 @@ satisfied and 0 if it is not. \fIOp\fR must be one of the operators <, <=, ==,
the same character, if \fIop\fR is < then 1 is returned if \fIindex1\fR refers
to an earlier character in the text than \fIindex2\fR, and so on.
.TP
-\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR?
+\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
.
Query or modify the configuration options of the widget. If no \fIoption\fR is
specified, returns a list describing all of the available options for
@@ -1095,7 +1095,7 @@ command modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string. \fIOption\fR may have any of
the values accepted by the \fBtext\fR command.
.TP
-\fIpathName \fBcount\fR \fI?options\fR? \fIindex1 index2\fR
+\fIpathName \fBcount\fR ?\fIoptions\fR? \fIindex1 index2\fR
.
Counts the number of relevant things between the two indices. If \fIindex1\fR
is after \fIindex2\fR, the result will be a negative number (and this holds
@@ -1281,7 +1281,7 @@ must have a create script.) In this case an empty string is returned, and you
must query the window by its index position to get more information.
.RE
.TP
-\fIpathName \fBedit \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBedit \fIoption \fR?\fIarg ...\fR?
.
This command controls the undo mechanism and the modified flag. The exact
behavior of the command depends on the \fIoption\fR argument that follows the
@@ -1349,7 +1349,7 @@ given, then, within each range, only those characters which are not elided
will be returned. This may have the effect that some of the returned ranges
are empty strings.
.TP
-\fIpathName \fBimage \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBimage \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate embedded images. The behavior of the
command depends on the \fIoption\fR argument that follows the \fBtag\fR
@@ -1414,7 +1414,7 @@ effect as if a separate \fIpathName \fBinsert\fR widget command had been
issued for each pair, in order. The last \fItagList\fR argument may be
omitted.
.TP
-\fIpathName \fBmark \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBmark \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate marks. The exact behavior of the command
depends on the \fIoption\fR argument that follows the \fBmark\fR argument. The
@@ -1694,7 +1694,7 @@ calculations, the scheduling is immediate. The command returns the empty
string. \fBbgerror\fR is called on \fIcommand\fR failure.
.RE
.TP
-\fIpathName \fBtag \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBtag \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate tags. The exact behavior of the command
depends on the \fIoption\fR argument that follows the \fBtag\fR argument. The
@@ -1861,7 +1861,7 @@ file or \fIindex2\fR is less than or equal to \fIindex1\fR) then the command
has no effect. This command returns an empty string.
.RE
.TP
-\fIpathName \fBwindow \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBwindow \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate embedded windows. The behavior of the
command depends on the \fIoption\fR argument that follows the \fBwindow\fR
diff --git a/doc/tk.n b/doc/tk.n
index 43ce64d..d32f4f7 100644
--- a/doc/tk.n
+++ b/doc/tk.n
@@ -12,7 +12,7 @@
.SH NAME
tk \- Manipulate Tk internal state
.SH SYNOPSIS
-\fBtk\fR \fIoption \fR?\fIarg arg ...\fR?
+\fBtk\fR \fIoption \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/toplevel.n b/doc/toplevel.n
index c56e035..a7c11d4 100644
--- a/doc/toplevel.n
+++ b/doc/toplevel.n
@@ -139,7 +139,7 @@ command may be used to invoke various
operations on the widget. It has the following general form:
.PP
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
.PP
\fIPathName\fR is the name of the command, which is the same as
diff --git a/doc/winfo.n b/doc/winfo.n
index fed5c39..5651f2c 100644
--- a/doc/winfo.n
+++ b/doc/winfo.n
@@ -12,7 +12,7 @@
.SH NAME
winfo \- Return window-related information
.SH SYNOPSIS
-\fBwinfo\fR \fIoption \fR?\fIarg arg ...\fR?
+\fBwinfo\fR \fIoption \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/wish.1 b/doc/wish.1
index f7d97d9..115911e 100644
--- a/doc/wish.1
+++ b/doc/wish.1
@@ -12,7 +12,7 @@
.SH NAME
wish \- Simple windowing shell
.SH SYNOPSIS
-\fBwish\fR ?\fB\-encoding \fIname\fR? ?\fIfileName arg arg ...\fR?
+\fBwish\fR ?\fB\-encoding \fIname\fR? ?\fIfileName arg ...\fR?
.SH OPTIONS
.IP "\fB\-encoding \fIname\fR" 20
Specifies the encoding of the text stored in \fIfileName\fR.
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index 5014eeb..de09d1c 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -809,7 +809,7 @@ Tk_BusyObjCmd(
};
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "options ?arg arg ...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "options ?arg ...?");
return TCL_ERROR;
}
@@ -819,7 +819,7 @@ Tk_BusyObjCmd(
if (Tcl_GetString(objv[1])[0] == '.') {
if (objc%2 == 1) {
- Tcl_WrongNumArgs(interp, 1, objv, "window ?option value ...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "window ?-option value ...?");
return TCL_ERROR;
}
return HoldBusy(busyTablePtr, interp, objv[1], objc-2, objv+2);
@@ -865,7 +865,7 @@ Tk_BusyObjCmd(
case BUSY_CONFIGURE:
if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?option? ?value ...?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-option? ?value ...?");
return TCL_ERROR;
}
busyPtr = GetBusy(interp, busyTablePtr, objv[2]);
@@ -922,7 +922,7 @@ Tk_BusyObjCmd(
case BUSY_HOLD:
if (objc < 3 || objc%2 != 1) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?option value ...?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?");
return TCL_ERROR;
}
return HoldBusy(busyTablePtr, interp, objv[2], objc-3, objv+3);
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index c9026ef..6a06185 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -1741,7 +1741,23 @@ Tk_WinfoObjCmd(
if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin) != TCL_OK) {
return TCL_ERROR;
}
+#ifdef TK_HAS_DYNAMIC_COLORS
+
+ /*
+ * Make sure that the TkColor used for the winfo rgb command is
+ * destroyed when we are through with it, so we do not get stale RGB
+ * values next time.
+ */
+
+ {
+ Colormap temp = Tk_Colormap(tkwin);
+ Tk_Colormap(tkwin) = TK_DYNAMIC_COLORMAP;
+ colorPtr = Tk_GetColor(interp, tkwin, Tcl_GetString(objv[3]));
+ Tk_Colormap(tkwin) = temp;
+ }
+#else
colorPtr = Tk_GetColor(interp, tkwin, Tcl_GetString(objv[3]));
+#endif
if (colorPtr == NULL) {
return TCL_ERROR;
}
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index d4ffa7c..859f2d0 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -1405,8 +1405,6 @@ Tk_RestoreSavedOptions(
CLANG_ASSERT(internalPtr);
switch (specPtr->type) {
case TK_OPTION_BOOLEAN:
- *((int *) internalPtr) = *((int *) ptr);
- break;
case TK_OPTION_INT:
*((int *) internalPtr) = *((int *) ptr);
break;
@@ -1874,106 +1872,106 @@ GetObjectForOption(
void *internalPtr; /* Points to internal value of option in
* record. */
- internalPtr = (char *)recordPtr + optionPtr->specPtr->internalOffset;
objPtr = NULL;
- switch (optionPtr->specPtr->type) {
- case TK_OPTION_BOOLEAN:
- objPtr = Tcl_NewWideIntObj(*((int *) internalPtr));
- break;
- case TK_OPTION_INT:
- objPtr = Tcl_NewWideIntObj(*((int *) internalPtr));
- break;
- case TK_OPTION_DOUBLE:
- objPtr = Tcl_NewDoubleObj(*((double *) internalPtr));
- break;
- case TK_OPTION_STRING:
- objPtr = Tcl_NewStringObj(*((char **) internalPtr), -1);
- break;
- case TK_OPTION_STRING_TABLE:
- objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[
- *((int *) internalPtr)], -1);
- break;
- case TK_OPTION_COLOR: {
- XColor *colorPtr = *((XColor **) internalPtr);
+ if (optionPtr->specPtr->internalOffset != TCL_INDEX_NONE) {
+ internalPtr = (char *)recordPtr + optionPtr->specPtr->internalOffset;
+ switch (optionPtr->specPtr->type) {
+ case TK_OPTION_BOOLEAN:
+ case TK_OPTION_INT:
+ objPtr = Tcl_NewWideIntObj(*((int *) internalPtr));
+ break;
+ case TK_OPTION_DOUBLE:
+ objPtr = Tcl_NewDoubleObj(*((double *) internalPtr));
+ break;
+ case TK_OPTION_STRING:
+ objPtr = Tcl_NewStringObj(*((char **) internalPtr), -1);
+ break;
+ case TK_OPTION_STRING_TABLE:
+ objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[
+ *((int *) internalPtr)], -1);
+ break;
+ case TK_OPTION_COLOR: {
+ XColor *colorPtr = *((XColor **) internalPtr);
- if (colorPtr != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1);
+ if (colorPtr != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_FONT: {
- Tk_Font tkfont = *((Tk_Font *) internalPtr);
+ case TK_OPTION_FONT: {
+ Tk_Font tkfont = *((Tk_Font *) internalPtr);
- if (tkfont != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1);
+ if (tkfont != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_STYLE: {
- Tk_Style style = *((Tk_Style *) internalPtr);
+ case TK_OPTION_STYLE: {
+ Tk_Style style = *((Tk_Style *) internalPtr);
- if (style != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1);
+ if (style != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_BITMAP: {
- Pixmap pixmap = *((Pixmap *) internalPtr);
+ case TK_OPTION_BITMAP: {
+ Pixmap pixmap = *((Pixmap *) internalPtr);
- if (pixmap != None) {
- objPtr = Tcl_NewStringObj(
+ if (pixmap != None) {
+ objPtr = Tcl_NewStringObj(
Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_BORDER: {
- Tk_3DBorder border = *((Tk_3DBorder *) internalPtr);
+ case TK_OPTION_BORDER: {
+ Tk_3DBorder border = *((Tk_3DBorder *) internalPtr);
- if (border != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1);
+ if (border != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_RELIEF:
- objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *) internalPtr)), -1);
- break;
- case TK_OPTION_CURSOR: {
- Tk_Cursor cursor = *((Tk_Cursor *) internalPtr);
+ case TK_OPTION_RELIEF:
+ objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *) internalPtr)), -1);
+ break;
+ case TK_OPTION_CURSOR: {
+ Tk_Cursor cursor = *((Tk_Cursor *) internalPtr);
- if (cursor != NULL) {
- objPtr = Tcl_NewStringObj(
- Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
+ if (cursor != NULL) {
+ objPtr = Tcl_NewStringObj(
+ Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_JUSTIFY:
- objPtr = Tcl_NewStringObj(Tk_NameOfJustify(
- *((Tk_Justify *) internalPtr)), -1);
- break;
- case TK_OPTION_ANCHOR:
- objPtr = Tcl_NewStringObj(Tk_NameOfAnchor(
- *((Tk_Anchor *) internalPtr)), -1);
- break;
- case TK_OPTION_PIXELS:
- objPtr = Tcl_NewWideIntObj(*((int *) internalPtr));
- break;
- case TK_OPTION_WINDOW: {
- Tk_Window tkwin = *((Tk_Window *) internalPtr);
+ case TK_OPTION_JUSTIFY:
+ objPtr = Tcl_NewStringObj(Tk_NameOfJustify(
+ *((Tk_Justify *) internalPtr)), -1);
+ break;
+ case TK_OPTION_ANCHOR:
+ objPtr = Tcl_NewStringObj(Tk_NameOfAnchor(
+ *((Tk_Anchor *) internalPtr)), -1);
+ break;
+ case TK_OPTION_PIXELS:
+ objPtr = Tcl_NewWideIntObj(*((int *) internalPtr));
+ break;
+ case TK_OPTION_WINDOW: {
+ Tk_Window tkwin = *((Tk_Window *) internalPtr);
- if (tkwin != NULL) {
- objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
+ if (tkwin != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_CUSTOM: {
- const Tk_ObjCustomOption *custom = optionPtr->extra.custom;
+ case TK_OPTION_CUSTOM: {
+ const Tk_ObjCustomOption *custom = optionPtr->extra.custom;
- objPtr = custom->getProc(custom->clientData, tkwin, (char *)recordPtr,
- optionPtr->specPtr->internalOffset);
- break;
- }
- default:
- Tcl_Panic("bad option type in GetObjectForOption");
+ objPtr = custom->getProc(custom->clientData, tkwin, (char *)recordPtr,
+ optionPtr->specPtr->internalOffset);
+ break;
+ }
+ default:
+ Tcl_Panic("bad option type in GetObjectForOption");
+ }
}
if (objPtr == NULL) {
objPtr = Tcl_NewObj();
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 0ab2954..cb2b2e0 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.c
@@ -824,7 +824,7 @@ InterpreterObjCmd(
if ((otherInterp == NULL) || Tcl_InterpDeleted(otherInterp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "no active master interp", -1));
+ "no active parent interp", -1));
Tcl_SetErrorCode(interp, "TK", "CONSOLE", "NO_INTERP", NULL);
return TCL_ERROR;
}
@@ -947,7 +947,7 @@ ConsoleDeleteProc(
*
* ConsoleEventProc --
*
- * This event function is registered on the main window of the slave
+ * This event function is registered on the main window of the child
* interpreter. If the user or a running script causes the main window to
* be destroyed, then we need to inform the console interpreter by
* invoking "::tk::ConsoleExit".
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 4c6c65f..f225420 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -1786,7 +1786,7 @@ DisplayEntry(
* Draw the selected and unselected portions separately.
*/
- int selFirst;
+ TkSizeT selFirst;
if (entryPtr->selectFirst + 1 < entryPtr->leftIndex + 1) {
selFirst = entryPtr->leftIndex;
diff --git a/generic/tkFont.c b/generic/tkFont.c
index dbc00e4..d2aa6d2 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -556,7 +556,7 @@ Tk_FontObjCmd(
if (objc < 3 || n < objc) {
Tcl_WrongNumArgs(interp, 2, objv,
- "font ?-displayof window? ?option? ?--? ?char?");
+ "font ?-displayof window? ?-option? ?--? ?char?");
return TCL_ERROR;
}
@@ -753,7 +753,7 @@ Tk_FontObjCmd(
}
if ((objc < 3) || ((objc - skip) > 4)) {
Tcl_WrongNumArgs(interp, 2, objv,
- "font ?-displayof window? ?option?");
+ "font ?-displayof window? ?-option?");
return TCL_ERROR;
}
tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index df1e9b2..7f3baaf 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -635,20 +635,20 @@ declare 184 {
double y, double angle)
}
-# Debugging / testing functions for photo images
-declare 185 {
- int TkDebugPhotoStringMatchDef(Tcl_Interp *inter, Tcl_Obj *data,
- Tcl_Obj *formatString, int *widthPtr, int *heightPtr)
-}
-
# Support for aqua's inability to draw outside [NSView drawRect:]
-declare 186 aqua {
+declare 185 aqua {
void TkpRedrawWidget(Tk_Window tkwin)
}
-declare 187 aqua {
+declare 186 aqua {
int TkpWillDrawWidget(Tk_Window tkwin)
}
+# Debugging / testing functions for photo images
+declare 187 {
+ int TkDebugPhotoStringMatchDef(Tcl_Interp *inter, Tcl_Obj *data,
+ Tcl_Obj *formatString, int *widthPtr, int *heightPtr)
+}
+
##############################################################################
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index 886964d..cee4da2 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -558,18 +558,18 @@ EXTERN void TkDrawAngledChars(Display *display,
Drawable drawable, GC gc, Tk_Font tkfont,
const char *source, int numBytes, double x,
double y, double angle);
-/* 185 */
-EXTERN int TkDebugPhotoStringMatchDef(Tcl_Interp *inter,
- Tcl_Obj *data, Tcl_Obj *formatString,
- int *widthPtr, int *heightPtr);
#ifdef MAC_OSX_TK /* AQUA */
-/* 186 */
+/* 185 */
EXTERN void TkpRedrawWidget(Tk_Window tkwin);
#endif /* AQUA */
#ifdef MAC_OSX_TK /* AQUA */
-/* 187 */
+/* 186 */
EXTERN int TkpWillDrawWidget(Tk_Window tkwin);
#endif /* AQUA */
+/* 187 */
+EXTERN int TkDebugPhotoStringMatchDef(Tcl_Interp *inter,
+ Tcl_Obj *data, Tcl_Obj *formatString,
+ int *widthPtr, int *heightPtr);
typedef struct TkIntStubs {
int magic;
@@ -787,27 +787,27 @@ typedef struct TkIntStubs {
void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */
int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */
void (*tkDrawAngledChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); /* 184 */
- int (*tkDebugPhotoStringMatchDef) (Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr); /* 185 */
#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved186)(void);
+ void (*reserved185)(void);
#endif /* X11 */
#if defined(_WIN32) /* WIN */
- void (*reserved186)(void);
+ void (*reserved185)(void);
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved186)(void); /* Dummy entry for stubs table backwards compatibility */
- void (*tkpRedrawWidget) (Tk_Window tkwin); /* 186 */
+ void (*reserved185)(void); /* Dummy entry for stubs table backwards compatibility */
+ void (*tkpRedrawWidget) (Tk_Window tkwin); /* 185 */
#endif /* AQUA */
#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved187)(void);
+ void (*reserved186)(void);
#endif /* X11 */
#if defined(_WIN32) /* WIN */
- void (*reserved187)(void);
+ void (*reserved186)(void);
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved187)(void); /* Dummy entry for stubs table backwards compatibility */
- int (*tkpWillDrawWidget) (Tk_Window tkwin); /* 187 */
+ void (*reserved186)(void); /* Dummy entry for stubs table backwards compatibility */
+ int (*tkpWillDrawWidget) (Tk_Window tkwin); /* 186 */
#endif /* AQUA */
+ int (*tkDebugPhotoStringMatchDef) (Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr); /* 187 */
} TkIntStubs;
extern const TkIntStubs *tkIntStubsPtr;
@@ -1180,16 +1180,16 @@ extern const TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */
#define TkDrawAngledChars \
(tkIntStubsPtr->tkDrawAngledChars) /* 184 */
-#define TkDebugPhotoStringMatchDef \
- (tkIntStubsPtr->tkDebugPhotoStringMatchDef) /* 185 */
#ifdef MAC_OSX_TK /* AQUA */
#define TkpRedrawWidget \
- (tkIntStubsPtr->tkpRedrawWidget) /* 186 */
+ (tkIntStubsPtr->tkpRedrawWidget) /* 185 */
#endif /* AQUA */
#ifdef MAC_OSX_TK /* AQUA */
#define TkpWillDrawWidget \
- (tkIntStubsPtr->tkpWillDrawWidget) /* 187 */
+ (tkIntStubsPtr->tkpWillDrawWidget) /* 186 */
#endif /* AQUA */
+#define TkDebugPhotoStringMatchDef \
+ (tkIntStubsPtr->tkDebugPhotoStringMatchDef) /* 187 */
#endif /* defined(USE_TK_STUBS) */
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 776c7e8..60f9eac 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -39,12 +39,12 @@
* right; they have a Tk window and pathname associated with them; they have a
* TkMenu structure and array of entries. However, they are linked with the
* original menu that they were cloned from. They reflect the attributes of the
- * original, or "master", menu. So if an item is added to a menu, and that
+ * original, or "main", menu. So if an item is added to a menu, and that
* menu has clones, then the item must be added to all of its clones also.
* Menus are cloned when a menu is torn-off or when a menu is assigned as a
* menubar using the "-menu" option of the toplevel's pathname configure
* subcommand. When a clone is destroyed, only the clone is destroyed, but
- * when the master menu is destroyed, all clones are also destroyed. This
+ * when the main menu is destroyed, all clones are also destroyed. This
* allows the developer to just deal with one set of menus when creating and
* destroying.
*
@@ -461,7 +461,7 @@ Tk_MenuObjCmd(
MenuCmdDeletedProc);
menuPtr->active = TCL_INDEX_NONE;
menuPtr->cursorPtr = NULL;
- menuPtr->masterMenuPtr = menuPtr;
+ menuPtr->mainMenuPtr = menuPtr;
menuPtr->menuType = UNKNOWN_TYPE;
TkMenuInitializeDrawingFields(menuPtr);
@@ -518,7 +518,7 @@ Tk_MenuObjCmd(
nextCascadePtr = cascadeListPtr->nextCascadePtr;
/*
- * If we have a new master menu, and an existing cloned menu
+ * If we have a new main menu, and an existing cloned menu
* points to this menu in a cascade entry, we have to clone the
* new menu and point the entry to the clone instead of the menu
* we are creating. Otherwise, ConfigureMenuEntry will hook up the
@@ -526,9 +526,9 @@ Tk_MenuObjCmd(
* creating exists.
*/
- if ((menuPtr->masterMenuPtr != menuPtr)
- || ((menuPtr->masterMenuPtr == menuPtr)
- && ((cascadeListPtr->menuPtr->masterMenuPtr
+ if ((menuPtr->mainMenuPtr != menuPtr)
+ || ((menuPtr->mainMenuPtr == menuPtr)
+ && ((cascadeListPtr->menuPtr->mainMenuPtr
== cascadeListPtr->menuPtr)))) {
newObjv[0] = Tcl_NewStringObj("-menu", -1);
newObjv[1] = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin),-1);
@@ -1108,8 +1108,8 @@ DestroyMenuInstance(
TkMenu *menuInstancePtr;
TkMenuEntry *cascadePtr, *nextCascadePtr;
Tcl_Obj *newObjv[2];
- TkMenu *parentMasterMenuPtr;
- TkMenuEntry *parentMasterEntryPtr;
+ TkMenu *parentMainMenuPtr;
+ TkMenuEntry *parentMainEntryPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -1118,11 +1118,11 @@ DestroyMenuInstance(
* entries need to be told that the menu is going away. We need to clear
* the menu ptr field in the menu reference at this point in the code so
* that everything else can forget about this menu properly. We also need
- * to reset -menu field of all entries that are not master menus back to
- * this entry name if this is a master menu pointed to by another master
+ * to reset -menu field of all entries that are not main menus back to
+ * this entry name if this is a main menu pointed to by another main
* menu. If there is a clone menu that points to this menu, then this menu
* is itself a clone, so when this menu goes away, the -menu field of the
- * pointing entry must be set back to this menu's master menu name so that
+ * pointing entry must be set back to this menu's main menu name so that
* later if another menu is created the cascade hierarchy can be
* maintained.
*/
@@ -1140,14 +1140,14 @@ DestroyMenuInstance(
for (; cascadePtr != NULL; cascadePtr = nextCascadePtr) {
nextCascadePtr = cascadePtr->nextCascadePtr;
- if (menuPtr->masterMenuPtr != menuPtr) {
+ if (menuPtr->mainMenuPtr != menuPtr) {
Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1);
- parentMasterMenuPtr = cascadePtr->menuPtr->masterMenuPtr;
- parentMasterEntryPtr =
- parentMasterMenuPtr->entries[cascadePtr->index];
+ parentMainMenuPtr = cascadePtr->menuPtr->mainMenuPtr;
+ parentMainEntryPtr =
+ parentMainMenuPtr->entries[cascadePtr->index];
newObjv[0] = menuNamePtr;
- newObjv[1] = parentMasterEntryPtr->namePtr;
+ newObjv[1] = parentMainEntryPtr->namePtr;
/*
* It is possible that the menu info is out of sync, and these
@@ -1166,8 +1166,8 @@ DestroyMenuInstance(
}
}
- if (menuPtr->masterMenuPtr != menuPtr) {
- for (menuInstancePtr = menuPtr->masterMenuPtr;
+ if (menuPtr->mainMenuPtr != menuPtr) {
+ for (menuInstancePtr = menuPtr->mainMenuPtr;
menuInstancePtr != NULL;
menuInstancePtr = menuInstancePtr->nextInstancePtr) {
if (menuInstancePtr->nextInstancePtr == menuPtr) {
@@ -1177,7 +1177,7 @@ DestroyMenuInstance(
}
}
} else if (menuPtr->nextInstancePtr != NULL) {
- Tcl_Panic("Attempting to delete master menu when there are still clones");
+ Tcl_Panic("Attempting to delete main menu when there are still clones");
}
/*
@@ -1217,8 +1217,8 @@ DestroyMenuInstance(
*
* This function is invoked by Tcl_EventuallyFree or Tcl_Release to clean
* up the internal structure of a menu at a safe time (when no-one is
- * using it anymore). If called on a master instance, destroys all of the
- * slave instances. If called on a non-master instance, just destroys
+ * using it anymore). If called on a main instance, destroys all of the
+ * instances. If called on a non-main instance, just destroys
* that instance.
*
* Results:
@@ -1264,7 +1264,7 @@ TkDestroyMenu(
topLevelListPtr = nextTopLevelPtr;
}
}
- if (menuPtr->masterMenuPtr == menuPtr) {
+ if (menuPtr->mainMenuPtr == menuPtr) {
while (menuPtr->nextInstancePtr != NULL) {
menuInstancePtr = menuPtr->nextInstancePtr;
menuPtr->nextInstancePtr = menuInstancePtr->nextInstancePtr;
@@ -1412,7 +1412,7 @@ DestroyMenuEntry(
*/
if (mePtr->type == CASCADE_ENTRY) {
- if (menuPtr->masterMenuPtr != menuPtr) {
+ if (menuPtr->mainMenuPtr != menuPtr) {
TkMenu *destroyThis = NULL;
TkMenuReferences *menuRefPtr = mePtr->childMenuRefPtr;
@@ -1432,7 +1432,7 @@ DestroyMenuEntry(
*/
if ((destroyThis != NULL)
- && (destroyThis->masterMenuPtr == destroyThis)) {
+ && (destroyThis->mainMenuPtr == destroyThis)) {
destroyThis = NULL;
}
}
@@ -1538,14 +1538,14 @@ ConfigureMenu(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
menuListPtr->errorStructPtr = (Tk_SavedOptions *)ckalloc(sizeof(Tk_SavedOptions));
result = Tk_SetOptions(interp, menuListPtr,
tsdPtr->menuOptionTable, objc, objv,
menuListPtr->tkwin, menuListPtr->errorStructPtr, NULL);
if (result != TCL_OK) {
- for (cleanupPtr = menuPtr->masterMenuPtr;
+ for (cleanupPtr = menuPtr->mainMenuPtr;
cleanupPtr != menuListPtr;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr);
@@ -1579,7 +1579,7 @@ ConfigureMenu(
* menuTypeName field to tell that this is a menu bar.
*/
- if (menuListPtr->menuType == MASTER_MENU) {
+ if (menuListPtr->menuType == MAIN_MENU) {
int typeFlag = TK_MAKE_MENU_POPUP;
Tk_Window tkwin = menuPtr->tkwin;
@@ -1614,7 +1614,7 @@ ConfigureMenu(
if ((menuListPtr->numEntries == 0)
|| (menuListPtr->entries[0]->type != TEAROFF_ENTRY)) {
if (MenuNewEntry(menuListPtr, 0, TEAROFF_ENTRY) == NULL) {
- for (cleanupPtr = menuPtr->masterMenuPtr;
+ for (cleanupPtr = menuPtr->mainMenuPtr;
cleanupPtr != menuListPtr;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr);
@@ -1664,7 +1664,7 @@ ConfigureMenu(
TkEventuallyRecomputeMenu(menuListPtr);
}
- for (cleanupPtr = menuPtr->masterMenuPtr; cleanupPtr != NULL;
+ for (cleanupPtr = menuPtr->mainMenuPtr; cleanupPtr != NULL;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_FreeSavedOptions(cleanupPtr->errorStructPtr);
ckfree(cleanupPtr->errorStructPtr);
@@ -1990,14 +1990,14 @@ ConfigureMenuCloneEntries(
/*
* Cascades are kind of tricky here. This is special case #3 in the
- * comment at the top of this file. Basically, if a menu is the master
+ * comment at the top of this file. Basically, if a menu is the main
* menu of a clone chain, and has an entry with a cascade menu, the clones
* of the menu will point to clones of the cascade menu. We have to
* destroy the clones of the cascades, clone the new cascade menu, and
* configure the entry to point to the new clone.
*/
- mePtr = menuPtr->masterMenuPtr->entries[index];
+ mePtr = menuPtr->mainMenuPtr->entries[index];
if (mePtr->type == CASCADE_ENTRY) {
oldCascadePtr = mePtr->namePtr;
if (oldCascadePtr != NULL) {
@@ -2042,7 +2042,7 @@ ConfigureMenuCloneEntries(
}
}
- for (menuListPtr = menuPtr->masterMenuPtr->nextInstancePtr;
+ for (menuListPtr = menuPtr->mainMenuPtr->nextInstancePtr;
menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
@@ -2382,7 +2382,7 @@ MenuAddOrInsert(
* Now we have to add an entry for every instance related to this menu.
*/
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
mePtr = MenuNewEntry(menuListPtr, index, type);
@@ -2393,7 +2393,7 @@ MenuAddOrInsert(
TkMenu *errorMenuPtr;
TkSizeT i;
- for (errorMenuPtr = menuPtr->masterMenuPtr;
+ for (errorMenuPtr = menuPtr->mainMenuPtr;
errorMenuPtr != NULL;
errorMenuPtr = errorMenuPtr->nextInstancePtr) {
Tcl_EventuallyFree(errorMenuPtr->entries[index],
@@ -2417,7 +2417,7 @@ MenuAddOrInsert(
* If a menu has cascades, then every instance of the menu has to have
* its own parallel cascade structure. So adding an entry to a menu
* with clones means that the menu that the entry points to has to be
- * cloned for every clone the master menu has. This is special case #2
+ * cloned for every clone the main menu has. This is special case #2
* in the comment at the top of this file.
*/
@@ -2426,7 +2426,7 @@ MenuAddOrInsert(
&& (mePtr->childMenuRefPtr != NULL)
&& (mePtr->childMenuRefPtr->menuPtr != NULL)) {
TkMenu *cascadeMenuPtr =
- mePtr->childMenuRefPtr->menuPtr->masterMenuPtr;
+ mePtr->childMenuRefPtr->menuPtr->mainMenuPtr;
Tcl_Obj *newCascadePtr, *newObjv[2];
Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1);
Tcl_Obj *windowNamePtr =
@@ -2700,7 +2700,7 @@ CloneMenu(
Tcl_Obj *menuDupCommandArray[4];
if (newMenuTypePtr == NULL) {
- menuType = MASTER_MENU;
+ menuType = MAIN_MENU;
} else {
if (Tcl_GetIndexFromObjStruct(menuPtr->interp, newMenuTypePtr,
menuTypeStrings, sizeof(char *), "menu type", 0, &menuType) != TCL_OK) {
@@ -2744,18 +2744,18 @@ CloneMenu(
if (menuPtr->nextInstancePtr == NULL) {
menuPtr->nextInstancePtr = newMenuPtr;
- newMenuPtr->masterMenuPtr = menuPtr->masterMenuPtr;
+ newMenuPtr->mainMenuPtr = menuPtr->mainMenuPtr;
} else {
- TkMenu *masterMenuPtr;
+ TkMenu *mainMenuPtr;
- masterMenuPtr = menuPtr->masterMenuPtr;
- newMenuPtr->nextInstancePtr = masterMenuPtr->nextInstancePtr;
- masterMenuPtr->nextInstancePtr = newMenuPtr;
- newMenuPtr->masterMenuPtr = masterMenuPtr;
+ mainMenuPtr = menuPtr->mainMenuPtr;
+ newMenuPtr->nextInstancePtr = mainMenuPtr->nextInstancePtr;
+ mainMenuPtr->nextInstancePtr = newMenuPtr;
+ newMenuPtr->mainMenuPtr = mainMenuPtr;
}
/*
- * Add the master menu's window to the bind tags for this window after
+ * Add the main menu's window to the bind tags for this window after
* this window's tag. This is so the user can bind to either this
* clone (which may not be easy to do) or the entire menu clone
* structure.
@@ -2781,7 +2781,7 @@ CloneMenu(
if (strcmp(windowName, Tk_PathName(newMenuPtr->tkwin))
== 0) {
Tcl_Obj *newElementPtr = Tcl_NewStringObj(
- Tk_PathName(newMenuPtr->masterMenuPtr->tkwin), -1);
+ Tk_PathName(newMenuPtr->mainMenuPtr->tkwin), -1);
/*
* The newElementPtr will have its refCount incremented
@@ -3181,7 +3181,7 @@ TkSetWindowMenuBar(
menuPtr = menuRefPtr->menuPtr;
- for (instancePtr = menuPtr->masterMenuPtr;
+ for (instancePtr = menuPtr->mainMenuPtr;
instancePtr != NULL;
instancePtr = instancePtr->nextInstancePtr) {
if (instancePtr->menuType == MENUBAR
@@ -3529,7 +3529,7 @@ DeleteMenuCloneEntries(
int numDeleted, i, j;
numDeleted = last + 1 - first;
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
for (i = last; i >= first; i--) {
Tcl_EventuallyFree(menuListPtr->entries[i], (Tcl_FreeProc *) DestroyMenuEntry);
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index ecb6fac..ee7405a 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -185,7 +185,7 @@ typedef struct TkMenuEntry {
* the menu. */
/*
- * Bookeeping for master menus and cascade menus.
+ * Bookeeping for main menus and cascade menus.
*/
struct TkMenuReferences *childMenuRefPtr;
@@ -266,7 +266,7 @@ typedef struct TkMenu {
TkSizeT numEntries; /* Number of elements in entries. */
TkSizeT active; /* Index of active entry. TCL_INDEX_NONE means
* nothing active. */
- int menuType; /* MASTER_MENU, TEAROFF_MENU, or MENUBAR. See
+ int menuType; /* MAIN_MENU, TEAROFF_MENU, or MENUBAR. See
* below for definitions. */
Tcl_Obj *menuTypePtr; /* Used to control whether created tkwin is a
* toplevel or not. "normal", "menubar", or
@@ -351,10 +351,10 @@ typedef struct TkMenu {
struct TkMenu *nextInstancePtr;
/* The next instance of this menu in the
* chain. */
- struct TkMenu *masterMenuPtr;
+ struct TkMenu *mainMenuPtr;
/* A pointer to the original menu for this
* clone chain. Points back to this structure
- * if this menu is a master menu. */
+ * if this menu is a main menu. */
void *reserved1; /* not used any more. */
Tk_Window parentTopLevelPtr;/* If this menu is a menubar, this is the
* toplevel that owns the menu. Only
@@ -434,7 +434,7 @@ typedef struct TkMenuReferences {
* MENU_DELETION_PENDING Non-zero means that we are currently
* destroying this menu's internal structures.
* This is useful when we are in the middle of
- * cleaning this master menu's chain of menus up
+ * cleaning this main menu's chain of menus up
* when TkDestroyMenu was called again on this
* menu (via a destroy binding or somesuch).
* MENU_WIN_DESTRUCTION_PENDING Non-zero means we are in the middle of
@@ -452,16 +452,16 @@ typedef struct TkMenuReferences {
#define MENU_PLATFORM_FLAG3 (1 << 28)
/*
- * Each menu created by the user is a MASTER_MENU. When a menu is torn off, a
+ * Each menu created by the user is a MAIN_MENU. When a menu is torn off, a
* TEAROFF_MENU instance is created. When a menu is assigned to a toplevel as
* a menu bar, a MENUBAR instance is created. All instances have the same
- * configuration information. If the master instance is deleted, all instances
+ * configuration information. If the main instance is deleted, all instances
* are deleted. If one of the other instances is deleted, only that instance
* is deleted.
*/
#define UNKNOWN_TYPE -1
-#define MASTER_MENU 0
+#define MAIN_MENU 0
#define TEAROFF_MENU 1
#define MENUBAR 2
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index f25726e..285e907 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -552,7 +552,7 @@ PanedWindowWidgetObjCmd(
Slave *slavePtr;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
@@ -690,7 +690,7 @@ PanedWindowWidgetObjCmd(
case PW_PANECONFIGURE:
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv,
- "pane ?option? ?value option value ...?");
+ "pane ?-option? ?value -option value ...?");
result = TCL_ERROR;
break;
}
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index 2b2d3c5..04c51fa 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.c
@@ -234,7 +234,7 @@ SquareWidgetObjCmd(
int index;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 5880d7b..1fbc7b3 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -43,6 +43,7 @@ MODULE_SCOPE const TkStubs tkStubs;
#undef TkWinGetPlatformId
#undef TkPutImage
#undef XPutImage
+#define TkMacOSXSetUpClippingRgn (void (*)(Drawable))(void *)doNothing
#if defined(_WIN32) && !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
# define Tk_TranslateWinEvent TkTranslateWinEvent
@@ -71,6 +72,13 @@ static int TkWinGetPlatformId(void) {
#define Tk_PhotoPutZoomedBlock_Panic 0
#define Tk_PhotoSetSize_Panic 0
#define Tk_CreateOldPhotoImageFormat 0
+#ifdef MAC_OSX_TK
+static void
+doNothing(void)
+{
+ /* dummy implementation, no need to do anything */
+}
+#endif
#else
static void
doNothing(void)
@@ -495,27 +503,27 @@ static const TkIntStubs tkIntStubs = {
TkUnderlineAngledTextLayout, /* 182 */
TkIntersectAngledTextLayout, /* 183 */
TkDrawAngledChars, /* 184 */
- TkDebugPhotoStringMatchDef, /* 185 */
#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 186 */
+ 0, /* 185 */
#endif /* X11 */
#if defined(_WIN32) /* WIN */
- 0, /* 186 */
+ 0, /* 185 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 186 */ /* Dummy entry for stubs table backwards compatibility */
- TkpRedrawWidget, /* 186 */
+ 0, /* 185 */ /* Dummy entry for stubs table backwards compatibility */
+ TkpRedrawWidget, /* 185 */
#endif /* AQUA */
#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 187 */
+ 0, /* 186 */
#endif /* X11 */
#if defined(_WIN32) /* WIN */
- 0, /* 187 */
+ 0, /* 186 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 187 */ /* Dummy entry for stubs table backwards compatibility */
- TkpWillDrawWidget, /* 187 */
+ 0, /* 186 */ /* Dummy entry for stubs table backwards compatibility */
+ TkpWillDrawWidget, /* 186 */
#endif /* AQUA */
+ TkDebugPhotoStringMatchDef, /* 187 */
};
static const TkIntPlatStubs tkIntPlatStubs = {
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 978d1c1..c222ad2 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -78,6 +78,8 @@ typedef struct TImageInstance {
TImageMaster *masterPtr; /* Pointer to master for image. */
XColor *fg; /* Foreground color for drawing in image. */
GC gc; /* Graphics context for drawing in image. */
+ Bool displayFailed; /* macOS display attempted out of drawRect. */
+ char buffer[200 + TCL_INTEGER_SPACE * 6]; /* message to log on display. */
} TImageInstance;
/*
@@ -1164,7 +1166,7 @@ TrivialConfigObjCmd(
Tk_SavedOptions saved;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
@@ -1526,6 +1528,7 @@ ImageGet(
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues);
+ instPtr->displayFailed = False;
return instPtr;
}
@@ -1560,41 +1563,50 @@ ImageDisplay(
* imageX and imageY. */
{
TImageInstance *instPtr = (TImageInstance *)clientData;
- char buffer[200 + TCL_INTEGER_SPACE * 6];
/*
* The purpose of the test image type is to track the calls to an image
- * display proc and record the parameters passed in each call. On macOS
- * a display proc must be run inside of the drawRect method of an NSView
- * in order for the graphics operations to have any effect. To deal with
+ * display proc and record the parameters passed in each call. On macOS a
+ * display proc must be run inside of the drawRect method of an NSView in
+ * order for the graphics operations to have any effect. To deal with
* this, whenever a display proc is called outside of any drawRect method
- * it schedules a redraw of the NSView by calling [view setNeedsDisplay:YES].
- * This will trigger a later call to the view's drawRect method which will
- * run the display proc a second time.
- *
- * This complicates testing, since it can result in more calls to the display
- * proc than are expected by the test. It can also result in an inconsistent
- * number of calls unless the test waits until the call to drawRect actually
- * occurs before validating its results.
- *
- * In an attempt to work around this, this display proc only logs those
- * calls which occur within a drawRect method. This means that tests must
- * be written so as to ensure that the drawRect method is run before
- * results are validated. In practice it usually suffices to run update
- * idletasks (to run the display proc the first time) followed by update
- * (to run the display proc in drawRect).
+ * it schedules a redraw of the NSView.
*
- * This also has the consequence that the image changed command will log
- * different results on Aqua than on other systems, because when the image
- * is redisplayed in the drawRect method the entire image will be drawn,
- * not just the changed portion. Tests must account for this.
+ * In an attempt to work around this, each image instance maintains it own
+ * copy of the log message which gets written on the first call to the
+ * display proc. This usually means that the message created on macOS is
+ * the same as that created on other platforms. However it is possible
+ * for the messages to differ for other reasons, namely differences in
+ * how damage regions are computed.
*/
if (LOG_DISPLAY(drawable)) {
- sprintf(buffer, "%s display %d %d %d %d",
- instPtr->masterPtr->imageName, imageX, imageY, width, height);
+ if (instPtr->displayFailed == False) {
+
+ /*
+ * Drawing is possible on the first call to DisplayImage.
+ * Log the message.
+ */
+
+ sprintf(instPtr->buffer, "%s display %d %d %d %d",
+ instPtr->masterPtr->imageName, imageX, imageY, width, height);
+ }
Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName,
- NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ NULL, instPtr->buffer,
+ TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ instPtr->displayFailed = False;
+ } else {
+
+ /*
+ * Drawing is not possible on the first call to DisplayImage.
+ * Save the message, but do not log it until the actual display.
+ */
+
+ if (instPtr->displayFailed == False) {
+ sprintf(instPtr->buffer, "%s display %d %d %d %d",
+ instPtr->masterPtr->imageName, imageX, imageY, width, height);
+ }
+ instPtr->displayFailed = True;
}
if (width > (instPtr->masterPtr->width - imageX)) {
width = instPtr->masterPtr->width - imageX;
diff --git a/generic/tkText.c b/generic/tkText.c
index 119f229..d7d7102 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -1051,7 +1051,7 @@ TextWidgetObjCmd(
badOption:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad option \"%s\" must be -chars, -displaychars, "
+ "bad option \"%s\": must be -chars, -displaychars, "
"-displayindices, -displaylines, -indices, -lines, -update, "
"-xpixels, or -ypixels", Tcl_GetString(objv[i])));
Tcl_SetErrorCode(interp, "TK", "TEXT", "INDEX_OPTION", NULL);
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 9d6c1f4..f327323 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -2959,7 +2959,7 @@ Tk_SafeInit(
* Current risks:
*
* - No CPU time limit, no memory allocation limits, no color limits.
- * CPU time limits can be imposed by an unsafe master interpreter.
+ * CPU time limits can be imposed by an unsafe parent interpreter.
*
* The actual code called is the same as Tk_Init but Tcl_IsSafe() is
* checked at several places to differentiate the two initialisations.
@@ -3079,24 +3079,24 @@ Initialize(
if (Tcl_IsSafe(interp)) {
/*
* Get the clearance to start Tk and the "argv" parameters from the
- * master.
+ * parent.
*/
/*
- * Step 1 : find the master and construct the interp name (could be a
+ * Step 1 : find the parent and construct the interp name (could be a
* function if new APIs were ok). We could also construct the path
* while walking, but there is no API to get the name of an interp
* either.
*/
- Tcl_Interp *master = interp;
+ Tcl_Interp *parent = interp;
- while (Tcl_IsSafe(master)) {
- master = Tcl_GetMaster(master);
- if (master == NULL) {
+ while (Tcl_IsSafe(parent)) {
+ parent = Tcl_GetMaster(parent);
+ if (parent == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "no controlling master interpreter", -1));
- Tcl_SetErrorCode(interp, "TK", "SAFE", "NO_MASTER", NULL);
+ "no controlling parent interpreter", -1));
+ Tcl_SetErrorCode(interp, "TK", "SAFE", "NO_PARENT", NULL);
return TCL_ERROR;
}
}
@@ -3105,35 +3105,35 @@ Initialize(
* Construct the name (rewalk...)
*/
- code = Tcl_GetInterpPath(master, interp);
+ code = Tcl_GetInterpPath(parent, interp);
if (code != TCL_OK) {
Tcl_Panic("Tcl_GetInterpPath broken!");
}
/*
- * Build the command to eval in trusted master.
+ * Build the command to eval in trusted parent.
*/
cmd = Tcl_NewListObj(2, NULL);
Tcl_ListObjAppendElement(NULL, cmd,
Tcl_NewStringObj("::safe::TkInit", -1));
- Tcl_ListObjAppendElement(NULL, cmd, Tcl_GetObjResult(master));
+ Tcl_ListObjAppendElement(NULL, cmd, Tcl_GetObjResult(parent));
/*
- * Step 2 : Eval in the master. The argument is the *reversed* interp
- * path of the slave.
+ * Step 2 : Eval in the parent. The argument is the *reversed* interp
+ * path of the child.
*/
Tcl_IncrRefCount(cmd);
- code = Tcl_EvalObjEx(master, cmd, 0);
+ code = Tcl_EvalObjEx(parent, cmd, 0);
Tcl_DecrRefCount(cmd);
- Tcl_TransferResult(master, code, interp);
+ Tcl_TransferResult(parent, code, interp);
if (code != TCL_OK) {
return code;
}
/*
- * Use the master's result as argv. Note: We don't use the Obj
+ * Use the parent's result as argv. Note: We don't use the Obj
* interfaces to avoid dealing with cross interp refcounting and
* changing the code below.
*/
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
index 5e8c69c..a39ae2b 100644
--- a/generic/ttk/ttkLayout.c
+++ b/generic/ttk/ttkLayout.c
@@ -36,10 +36,10 @@ Ttk_NewBoxObj(Ttk_Box box)
{
Tcl_Obj *result[4];
- result[0] = Tcl_NewIntObj(box.x);
- result[1] = Tcl_NewIntObj(box.y);
- result[2] = Tcl_NewIntObj(box.width);
- result[3] = Tcl_NewIntObj(box.height);
+ result[0] = Tcl_NewWideIntObj(box.x);
+ result[1] = Tcl_NewWideIntObj(box.y);
+ result[2] = Tcl_NewWideIntObj(box.width);
+ result[3] = Tcl_NewWideIntObj(box.height);
return Tcl_NewListObj(4, result);
}
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
index 6e5875e..505748b 100644
--- a/generic/ttk/ttkProgress.c
+++ b/generic/ttk/ttkProgress.c
@@ -137,7 +137,7 @@ static void AnimateProgressProc(ClientData clientData)
if (pb->progress.maxPhase)
phase %= pb->progress.maxPhase;
Tcl_DecrRefCount(pb->progress.phaseObj);
- pb->progress.phaseObj = Tcl_NewIntObj(phase);
+ pb->progress.phaseObj = Tcl_NewWideIntObj(phase);
Tcl_IncrRefCount(pb->progress.phaseObj);
/*
diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c
index a6bde9a..a2c5d59 100644
--- a/generic/ttk/ttkScale.c
+++ b/generic/ttk/ttkScale.c
@@ -376,8 +376,8 @@ ScaleCoordsCommand(
if (r == TCL_OK) {
Tcl_Obj *point[2];
XPoint pt = ValueToPoint(scalePtr, value);
- point[0] = Tcl_NewIntObj(pt.x);
- point[1] = Tcl_NewIntObj(pt.y);
+ point[0] = Tcl_NewWideIntObj(pt.x);
+ point[1] = Tcl_NewWideIntObj(pt.y);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, point));
}
return r;
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index b484d1c..d48a510 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -2125,7 +2125,7 @@ static int TreeviewIndexCommand(
item = item->prev;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
return TCL_OK;
}
@@ -2377,7 +2377,7 @@ static int TreeviewItemCommand(
TreeItem *item;
if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "item ?option ?value??...");
+ Tcl_WrongNumArgs(interp, 2, objv, "item ?-option ?value??...");
return TCL_ERROR;
}
if (!(item = FindItem(interp, tv, objv[2]))) {
diff --git a/library/console.tcl b/library/console.tcl
index eb8990a..b98689f 100644
--- a/library/console.tcl
+++ b/library/console.tcl
@@ -740,9 +740,9 @@ proc ::tk::console::FontchooserToggle {} {
}
proc ::tk::console::FontchooserVisibility {index} {
if {[tk fontchooser configure -visible]} {
- .menubar.edit entryconfigure $index -label [msgcat::mc "Hide Fonts"]
+ .menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Hide Fonts"]
} else {
- .menubar.edit entryconfigure $index -label [msgcat::mc "Show Fonts"]
+ .menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Show Fonts"]
}
}
proc ::tk::console::FontchooserFocus {w isFocusIn} {
diff --git a/library/demos/dialog1.tcl b/library/demos/dialog1.tcl
index 976e955..66d8c9a 100644
--- a/library/demos/dialog1.tcl
+++ b/library/demos/dialog1.tcl
@@ -2,16 +2,16 @@
#
# This demonstration script creates a dialog box with a local grab.
-interp create slave
-load {} Tk slave
-slave eval {
- wm title . slave
+interp create child
+load {} Tk child
+child eval {
+ wm title . child
wm geometry . +700+30
pack [text .t -width 30 -height 10]
}
after idle {.dialog1.msg configure -wraplength 4i}
-set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "slave" which was created by a slave interpreter.} \
+set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "child" which was created by a child interpreter.} \
info 0 OK Cancel {Show Code}]
switch $i {
@@ -20,6 +20,6 @@ switch $i {
2 {showCode .dialog1}
}
-if {[interp exists slave]} {
- interp delete slave
+if {[interp exists child]} {
+ interp delete child
}
diff --git a/library/demos/fontchoose.tcl b/library/demos/fontchoose.tcl
index 8b34377..446ed34 100644
--- a/library/demos/fontchoose.tcl
+++ b/library/demos/fontchoose.tcl
@@ -55,10 +55,6 @@ grid $f.msg $f.vs -sticky news
grid $f.font - -sticky e
grid columnconfigure $f 0 -weight 1
grid rowconfigure $f 0 -weight 1
-bind $w <Visibility> {
- bind %W <Visibility> {}
- grid propagate %W.f 0
-}
## See Code / Dismiss buttons
set btns [addSeeDismiss $w.buttons $w]
@@ -67,3 +63,5 @@ grid $f -sticky news
grid $btns -sticky ew
grid columnconfigure $w 0 -weight 1
grid rowconfigure $w 0 -weight 1
+update idletasks
+grid propagate $f 0
diff --git a/library/safetk.tcl b/library/safetk.tcl
index 9f8e25d..841a0b6 100644
--- a/library/safetk.tcl
+++ b/library/safetk.tcl
@@ -14,9 +14,9 @@
# Note: It is now ok to let untrusted code being executed
# between the creation of the interp and the actual loading
# of Tk in that interp because the C side Tk_Init will
-# now look up the master interp and ask its safe::TkInit
+# now look up the parent interp and ask its safe::TkInit
# for the actual parameters to use for it's initialization (if allowed),
-# not relying on the slave state.
+# not relying on the child state.
#
# We use opt (optional arguments parsing)
@@ -29,31 +29,31 @@ namespace eval ::safe {
}
#
-# tkInterpInit : prepare the slave interpreter for tk loading
+# tkInterpInit : prepare the child interpreter for tk loading
# most of the real job is done by loadTk
-# returns the slave name (tkInterpInit does)
+# returns the child name (tkInterpInit does)
#
-proc ::safe::tkInterpInit {slave argv} {
+proc ::safe::tkInterpInit {child argv} {
global env tk_library
# We have to make sure that the tk_library variable is normalized.
set tk_library [file normalize $tk_library]
# Clear Tk's access for that interp (path).
- allowTk $slave $argv
+ allowTk $child $argv
# Ensure tk_library and subdirs (eg, ttk) are on the access path
- ::interp eval $slave [list set tk_library [::safe::interpAddToAccessPath $slave $tk_library]]
+ ::interp eval $child [list set tk_library [::safe::interpAddToAccessPath $child $tk_library]]
foreach subdir [::safe::AddSubDirs [list $tk_library]] {
- ::safe::interpAddToAccessPath $slave $subdir
+ ::safe::interpAddToAccessPath $child $subdir
}
- return $slave
+ return $child
}
# tkInterpLoadTk:
# Do additional configuration as needed (calling tkInterpInit)
-# and actually load Tk into the slave.
+# and actually load Tk into the child.
#
# Either contained in the specified windowId (-use) or
# creating a decorated toplevel for it.
@@ -62,37 +62,37 @@ proc ::safe::tkInterpInit {slave argv} {
proc ::safe::loadTk {} {}
::tcl::OptProc ::safe::loadTk {
- {slave -interp "name of the slave interpreter"}
+ {child -interp "name of the child interpreter"}
{-use -windowId {} "window Id to use (new toplevel otherwise)"}
{-display -displayName {} "display name to use (current one otherwise)"}
} {
set displayGiven [::tcl::OptProcArgGiven "-display"]
if {!$displayGiven} {
# Try to get the current display from "."
- # (which might not exist if the master is tk-less)
+ # (which might not exist if the parent is tk-less)
if {[catch {set display [winfo screen .]}]} {
if {[info exists ::env(DISPLAY)]} {
set display $::env(DISPLAY)
} else {
- Log $slave "no winfo screen . nor env(DISPLAY)" WARNING
+ Log $child "no winfo screen . nor env(DISPLAY)" WARNING
set display ":0.0"
}
}
}
# Get state for access to the cleanupHook.
- namespace upvar ::safe S$slave state
+ namespace upvar ::safe S$child state
if {![::tcl::OptProcArgGiven "-use"]} {
# create a decorated toplevel
- lassign [tkTopLevel $slave $display] w use
+ lassign [tkTopLevel $child $display] w use
- # set our delete hook (slave arg is added by interpDelete)
- # to clean up both window related code and tkInit(slave)
+ # set our delete hook (child arg is added by interpDelete)
+ # to clean up both window related code and tkInit(child)
set state(cleanupHook) [list tkDelete {} $w]
} else {
- # set our delete hook (slave arg is added by interpDelete)
- # to clean up tkInit(slave)
+ # set our delete hook (child arg is added by interpDelete)
+ # to clean up tkInit(child)
set state(cleanupHook) [list disallowTk]
# Let's be nice and also accept tk window names instead of ids
@@ -122,12 +122,12 @@ proc ::safe::loadTk {} {}
}
}
- # Prepares the slave for tk with those parameters
- tkInterpInit $slave [list "-use" $use "-display" $display]
+ # Prepares the child for tk with those parameters
+ tkInterpInit $child [list "-use" $use "-display" $display]
- load {} Tk $slave
+ load {} Tk $child
- return $slave
+ return $child
}
proc ::safe::TkInit {interpPath} {
@@ -149,7 +149,7 @@ proc ::safe::TkInit {interpPath} {
# safe::TkInit.
#
# Arguments:
-# interpPath slave interpreter handle
+# interpPath child interpreter handle
# argv arguments passed to safe::TkInterpInit
#
# Results:
@@ -168,7 +168,7 @@ proc ::safe::allowTk {interpPath argv} {
# in safe::TkInit.
#
# Arguments:
-# interpPath slave interpreter handle
+# interpPath child interpreter handle
#
# Results:
# none.
@@ -188,43 +188,43 @@ proc ::safe::disallowTk {interpPath} {
# Clean up the window associated with the interp being deleted.
#
# Arguments:
-# interpPath slave interpreter handle
+# interpPath child interpreter handle
#
# Results:
# none.
-proc ::safe::tkDelete {W window slave} {
+proc ::safe::tkDelete {W window child} {
# we are going to be called for each widget... skip untill it's
# top level
- Log $slave "Called tkDelete $W $window" NOTICE
- if {[::interp exists $slave]} {
- if {[catch {::safe::interpDelete $slave} msg]} {
- Log $slave "Deletion error : $msg"
+ Log $child "Called tkDelete $W $window" NOTICE
+ if {[::interp exists $child]} {
+ if {[catch {::safe::interpDelete $child} msg]} {
+ Log $child "Deletion error : $msg"
}
}
if {[winfo exists $window]} {
- Log $slave "Destroy toplevel $window" NOTICE
+ Log $child "Destroy toplevel $window" NOTICE
destroy $window
}
- # clean up tkInit(slave)
- disallowTk $slave
+ # clean up tkInit(child)
+ disallowTk $child
return
}
-proc ::safe::tkTopLevel {slave display} {
+proc ::safe::tkTopLevel {child display} {
variable tkSafeId
incr tkSafeId
set w ".safe$tkSafeId"
if {[catch {toplevel $w -screen $display -class SafeTk} msg]} {
return -code error -errorcode {TK TOPLEVEL SAFE} \
- "Unable to create toplevel for safe slave \"$slave\" ($msg)"
+ "Unable to create toplevel for safe child \"$child\" ($msg)"
}
- Log $slave "New toplevel $w" NOTICE
+ Log $child "New toplevel $w" NOTICE
- set msg "Untrusted Tcl applet ($slave)"
+ set msg "Untrusted Tcl applet ($child)"
wm title $w $msg
# Control frame (we must create a style for it)
@@ -236,7 +236,7 @@ proc ::safe::tkTopLevel {slave display} {
# We will destroy the interp when the window is destroyed
bindtags $wc [concat Safe$wc [bindtags $wc]]
- bind Safe$wc <Destroy> [list ::safe::tkDelete %W $w $slave]
+ bind Safe$wc <Destroy> [list ::safe::tkDelete %W $w $child]
ttk::label $wc.l -text $msg -anchor w
@@ -247,7 +247,7 @@ proc ::safe::tkTopLevel {slave display} {
# but still have the default background instead of red one from the parent
ttk::frame $wc.fb -borderwidth 0
ttk::button $wc.fb.b -text "Delete" \
- -command [list ::safe::tkDelete $w $w $slave]
+ -command [list ::safe::tkDelete $w $w $child]
pack $wc.fb.b -side right -fill both
pack $wc.fb -side right -fill both -expand 1
pack $wc.l -side left -fill both -expand 1 -ipady 2
diff --git a/macosx/README b/macosx/README
index a3f10b6..9745d14 100644
--- a/macosx/README
+++ b/macosx/README
@@ -662,15 +662,35 @@ source and destination rectangles for the scrolling. The embedded
windows are redrawn within the DisplayText function by some
conditional code which is only used for macOS.
-6.0 Virtual events on 10.14
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+6.0 Virtual events on macOS 10.14 and later
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The 10.14 release added support for system appearance changes,
+including a "Dark Mode" that renders all window frames and menus in
+dark colors. Tk 8.6.11 provides three virtual events <<LightAqua>>,
+<<DarkAqua>> and <<AppearanceChanged>>, to allow you to update your Tk
+app's appearance when the system appearance changes. These events are
+generated in [NSView effectiveAppearanceChanged], which is called by
+the Apple window manager when the General Preferences is changed
+either by switching between Light Mode and Dark Mode or by changing
+the Accent Color or Highlight Color.
+
+The <<AppearanceChanged>> virtual event has a data string which can be
+accessed with the %d substitution. The format of the data string is
+that it consists of 6 words:
+ "Appearance XXXX Accent YYYY Highlight ZZZZ"
+For example, the following code will print the current appearance
+name, accent color and highlight color when the <<AppearanceChanged>>
+virtual event fires:
+
+bind . <<AppearanceChanged>> {
+ array set data [split %d]
+ puts " Appearance: $data(Appearance)"
+ puts " Accent: $data(Accent)"
+ puts " Highlight: $data(Highlight)\n"
+}
+
-10.14 supports system appearance changes, and has added a "Dark Mode"
-that casts all window frames and menus as black. Tk 8.6.9 has added two
-virtual events, <<LightAqua>> and <<DarkAqua>>, to allow you to update
-your Tk app's appearance when the system appearance changes. Just bind
-your appearance-updating code to these virtual events and you will see
-it triggered when the system appearance toggles between dark and light.
7.0 Mac Services
~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/macosx/Tk.xcode/project.pbxproj b/macosx/Tk.xcode/project.pbxproj
index 9598af9..c1c5b41 100644
--- a/macosx/Tk.xcode/project.pbxproj
+++ b/macosx/Tk.xcode/project.pbxproj
@@ -1408,7 +1408,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtInterp.3; sourceTree = "<group>"; };
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtMathFnc.3; sourceTree = "<group>"; };
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtObjCmd.3; sourceTree = "<group>"; };
- F96D3E2208F272A5004A47F5 /* CrtSlave.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSlave.3; sourceTree = "<group>"; };
+ F96D3E2208F272A5004A47F5 /* CrtAlias.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtAlias.3; sourceTree = "<group>"; };
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTimerHdlr.3; sourceTree = "<group>"; };
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTrace.3; sourceTree = "<group>"; };
F96D3E2508F272A5004A47F5 /* dde.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dde.n; sourceTree = "<group>"; };
@@ -3073,7 +3073,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */,
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */,
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */,
- F96D3E2208F272A5004A47F5 /* CrtSlave.3 */,
+ F96D3E2208F272A5004A47F5 /* CrtAlias.3 */,
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */,
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */,
F96D3E2508F272A5004A47F5 /* dde.n */,
diff --git a/macosx/Tk.xcodeproj/project.pbxproj b/macosx/Tk.xcodeproj/project.pbxproj
index 121c8a0..ea4ecfc 100644
--- a/macosx/Tk.xcodeproj/project.pbxproj
+++ b/macosx/Tk.xcodeproj/project.pbxproj
@@ -1408,7 +1408,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtInterp.3; sourceTree = "<group>"; };
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtMathFnc.3; sourceTree = "<group>"; };
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtObjCmd.3; sourceTree = "<group>"; };
- F96D3E2208F272A5004A47F5 /* CrtSlave.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSlave.3; sourceTree = "<group>"; };
+ F96D3E2208F272A5004A47F5 /* CrtAlias.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtAlias.3; sourceTree = "<group>"; };
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTimerHdlr.3; sourceTree = "<group>"; };
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTrace.3; sourceTree = "<group>"; };
F96D3E2508F272A5004A47F5 /* dde.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dde.n; sourceTree = "<group>"; };
@@ -3072,7 +3072,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */,
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */,
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */,
- F96D3E2208F272A5004A47F5 /* CrtSlave.3 */,
+ F96D3E2208F272A5004A47F5 /* CrtAlias.3 */,
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */,
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */,
F96D3E2508F272A5004A47F5 /* dde.n */,
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c
index a63a1b6..c1b325a 100644
--- a/macosx/tkMacOSXBitmap.c
+++ b/macosx/tkMacOSXBitmap.c
@@ -343,7 +343,7 @@ TkpGetNativeAppBitmap(
int
TkMacOSXIconBitmapObjCmd(
- ClientData dummy, /* Unused. */
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -352,7 +352,6 @@ TkMacOSXIconBitmapObjCmd(
int i = 1, len, isNew, result = TCL_ERROR;
const char *name, *value;
IconBitmap ib, *iconBitmap;
- (void)dummy;
if (objc != 6) {
Tcl_WrongNumArgs(interp, 1, objv, "name width height "
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index 7ca8c10..9f60b91 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -194,13 +194,6 @@ TkpDisplayButton(
}
pixmap = (Pixmap) Tk_WindowId(tkwin);
- /*
- * Set up clipping region. Make sure the we are using the port
- * for this button, or we will set the wrong window's clip.
- */
-
- TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin));
-
if (TkMacOSXComputeButtonDrawParams(butPtr, dpPtr)) {
macButtonPtr->useTkText = 0;
} else {
@@ -726,7 +719,7 @@ TkpDestroyButton(
static void
TkMacOSXDrawButton(
MacButton *mbPtr, /* Mac button. */
- GC gc, /* The GC we are drawing into - needed for
+ TCL_UNUSED(GC), /* The GC we are drawing into - needed for
* the bevel button */
Pixmap pixmap) /* The pixmap we are drawing into - needed
* for the bevel button */
@@ -737,7 +730,6 @@ TkMacOSXDrawButton(
TkMacOSXDrawingContext dc;
DrawParams *dpPtr = &mbPtr->drawParams;
int useNewerHITools = 1;
- (void)gc;
TkMacOSXComputeButtonParams(butPtr, &mbPtr->btnkind, &mbPtr->drawinfo);
@@ -813,19 +805,16 @@ TkMacOSXDrawButton(
static void
ButtonBackgroundDrawCB(
- const HIRect *btnbounds,
+ TCL_UNUSED(const HIRect *),
MacButton *ptr,
- SInt16 depth,
- Boolean isColorDev)
+ TCL_UNUSED(SInt16),
+ TCL_UNUSED(Boolean))
{
MacButton *mbPtr = (MacButton *) ptr;
TkButton *butPtr = (TkButton *) mbPtr;
Tk_Window tkwin = butPtr->tkwin;
Pixmap pixmap;
int usehlborder = 0;
- (void)btnbounds;
- (void)depth;
- (void)isColorDev;
if (tkwin == NULL || !Tk_IsMapped(tkwin)) {
return;
@@ -868,20 +857,15 @@ ButtonBackgroundDrawCB(
*/
static void
ButtonContentDrawCB (
- const HIRect * btnbounds,
- ThemeButtonKind kind,
- const HIThemeButtonDrawInfo *drawinfo,
+ TCL_UNUSED(const HIRect *),
+ TCL_UNUSED(ThemeButtonKind),
+ TCL_UNUSED(const HIThemeButtonDrawInfo *),
MacButton *ptr,
- SInt16 depth,
- Boolean isColorDev)
+ TCL_UNUSED(SInt16),
+ TCL_UNUSED(Boolean))
{
TkButton *butPtr = (TkButton *) ptr;
Tk_Window tkwin = butPtr->tkwin;
- (void)btnbounds;
- (void)kind;
- (void)drawinfo;
- (void)depth;
- (void)isColorDev;
if (tkwin == NULL || !Tk_IsMapped(tkwin)) {
return;
diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c
index 7df5bb9..47203e2 100644
--- a/macosx/tkMacOSXClipboard.c
+++ b/macosx/tkMacOSXClipboard.c
@@ -177,7 +177,7 @@ XSetSelectionOwner(
Display *display, /* X Display. */
Atom selection, /* What selection to own. */
Window owner, /* Window to be the owner. */
- Time time) /* The current time? */
+ TCL_UNUSED(Time)) /* The current time? */
{
TkDisplay *dispPtr = TkGetDisplayList();
(void)time;
@@ -238,13 +238,11 @@ TkMacOSXSelDeadWindow(
void
TkSelUpdateClipboard(
- TkWindow *winPtr, /* Window associated with clipboard. */
- TkClipboardTarget *targetPtr)
+ TCL_UNUSED(TkWindow *), /* Window associated with clipboard. */
+ TCL_UNUSED(TkClipboardTarget *))
/* Info about the content. */
{
NSPasteboard *pb = [NSPasteboard generalPasteboard];
- (void)winPtr;
- (void)targetPtr;
changeCount = [pb addTypes:[NSArray arrayWithObject:NSStringPboardType]
owner:NSApp];
@@ -297,9 +295,8 @@ TkSelEventProc(
void
TkSelPropProc(
- XEvent *eventPtr) /* X PropertyChange event. */
+ TCL_UNUSED(XEvent *)) /* X PropertyChange event. */
{
- (void)eventPtr;
}
/*
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 0931d7d..537290e 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -1,5 +1,5 @@
/*
- * tkMacOSXColor.c --
+ * TkMacOSXColor.c --
*
* This file maintains a database of color values for the Tk
* toolkit, in order to avoid round-trips to the server to
@@ -9,6 +9,7 @@
* Copyright (c) 1994-1996 Sun Microsystems, Inc.
* Copyright 2001-2009, Apple Inc.
* Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2020 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -16,286 +17,268 @@
#include "tkMacOSXPrivate.h"
#include "tkColor.h"
+#include "tkMacOSXColor.h"
+
+static Tcl_HashTable systemColors;
+static int numSystemColors;
+static int rgbColorIndex;
+static int controlAccentIndex;
+static Bool useFakeAccentColor = NO;
+static SystemColorDatum **systemColorIndex;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+static NSAppearance *lightAqua = nil;
+static NSAppearance *darkAqua = nil;
+#endif
+static NSColorSpace* sRGB = NULL;
+static CGFloat windowBackground[4] =
+ {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0};
-/*
- * The colorType specifies how the color value should be interpreted. For the
- * unique rgbColor entry, the RGB values are generated from the pixel value of
- * an XColor. The ttkBackground and semantic types are dynamic, meaning
- * that they change when dark mode is enabled on OSX 10.13 and later.
- */
+void initColorTable()
+{
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+ Tcl_InitHashTable(&systemColors, TCL_STRING_KEYS);
+ SystemColorDatum *entry, *oldEntry;
+ Tcl_HashSearch search;
+ Tcl_HashEntry *hPtr;
+ int newPtr, index = 0;
+ NSColorList *systemColorList = [NSColorList colorListNamed:@"System"];
+ NSString *key;
-enum colorType {
- clearColor, /* There should be only one of these. */
- rgbColor, /* There should be only one of these. */
- appearance, /* There should be only one of these. */
- HIBrush, /* The value is a HITheme brush color table index. */
- HIText, /* The value is a HITheme text color table index. */
- HIBackground, /* The value is a HITheme background color table index. */
- ttkBackground, /* The value can be used as a parameter.*/
- semantic, /* The value can be used as a parameter.*/
-};
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+ if (@available(macOS 10.14, *)) {
+ darkAqua = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
+ lightAqua = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
+ }
+#endif
-/*
+ /*
+ * Build a hash table for looking up a color by its name.
+ * First add all of the static entries from tkMacOSXColor.h
+ */
- */
+ for (entry = systemColorData; entry->name != NULL; entry++) {
+ hPtr = Tcl_CreateHashEntry(&systemColors, entry->name, &newPtr);
+ if (entry->type == semantic) {
+ NSString *colorName = [[NSString alloc]
+ initWithCString:entry->macName
+ encoding:NSUTF8StringEncoding];
+ SEL colorSelector = NSSelectorFromString(colorName);
+ if (![NSColor respondsToSelector:colorSelector]) {
+ if ([colorName isEqualToString:@"controlAccentColor"]) {
+ useFakeAccentColor = YES;
+ } else {
+ /* Uncomment to print all unsupported colors: */
+ /* printf("Unsupported color %s\n", colorName.UTF8String); */
+ continue;
+ }
+ }
+ entry->selector = [colorName retain];
+ }
+ if (newPtr == 0) {
+ oldEntry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ entry->index = oldEntry->index;
+ [oldEntry->selector release];
+ } else {
+ entry->index = index++;
+ }
+ Tcl_SetHashValue(hPtr, entry);
+ }
+
+ /*
+ * Add all of the colors in the System ColorList.
+ */
-struct SystemColorMapEntry {
- const char *name;
- enum colorType type;
- long value;
-}; /* unsigned char pixelCode; */
+ for (key in [systemColorList allKeys]) {
+ int length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
+ char *name;
+ entry = ckalloc(sizeof(SystemColorDatum));
+ bzero(entry, sizeof(SystemColorDatum));
+ name = ckalloc(length + 1);
+ strcpy(name, key.UTF8String);
+ name[0] = toupper(name[0]);
+ if (!strcmp(name, "WindowBackgroundColor")) {
+
+ /*
+ * Avoid black windows on old systems.
+ */
+
+ continue;
+ }
+ entry->type=semantic;
+ entry->name = name;
+ entry->selector = [key retain];
+ hPtr = Tcl_CreateHashEntry(&systemColors, entry->name, &newPtr);
+ if (newPtr == 0) {
+ oldEntry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ entry->index = oldEntry->index;
+ [oldEntry->selector release];
+ } else {
+ entry->index = index++;
+ }
+ Tcl_SetHashValue(hPtr, entry);
+ }
-/*
- * Array of system color definitions: the array index is required to equal the
- * color's (pixelCode - MIN_PIXELCODE), i.e. the array order needs to be kept
- * in sync with the public pixel code values in tkMacOSXPort.h !
- */
+ /*
+ * Build an array for looking up a color by its index.
+ */
-#define MIN_PIXELCODE 30
-static const struct SystemColorMapEntry systemColorMap[] = {
- { "Transparent", clearColor, 0 }, /* 30: TRANSPARENT_PIXEL */
- { "Highlight", HIBrush, kThemeBrushPrimaryHighlightColor }, /* 31 */
- { "HighlightSecondary", HIBrush, kThemeBrushSecondaryHighlightColor }, /* 32 */
- { "HighlightText", HIBrush, kThemeBrushBlack }, /* 33 */
- { "HighlightAlternate", HIBrush, kThemeBrushAlternatePrimaryHighlightColor }, /* 34 */
- { "ButtonText", HIText, kThemeTextColorPushButtonActive }, /* 35 */
- { "PrimaryHighlightColor", HIBrush, kThemeBrushPrimaryHighlightColor }, /* 36 */
- { "ButtonFace", HIBrush, kThemeBrushButtonFaceActive }, /* 37 */
- { "SecondaryHighlightColor", HIBrush, kThemeBrushSecondaryHighlightColor }, /* 38 */
- { "ButtonFrame", HIBrush, kThemeBrushButtonFrameActive }, /* 39 */
- { "AlternatePrimaryHighlightColor", HIBrush, kThemeBrushAlternatePrimaryHighlightColor }, /* 40 */
- { "WindowBody", HIBrush, kThemeBrushDocumentWindowBackground }, /* 41 */
- { "SheetBackground", HIBrush, kThemeBrushSheetBackground }, /* 42 */
- { "MenuActive", HIBrush, kThemeBrushMenuBackgroundSelected }, /* 43 */
- { "Black", HIBrush, kThemeBrushBlack }, /* 44 */
- { "MenuActiveText", HIText, kThemeTextColorMenuItemSelected }, /* 45 */
- { "White", HIBrush, kThemeBrushWhite }, /* 46 */
- { "Menu", HIBrush, kThemeBrushMenuBackground }, /* 47 */
- { "DialogBackgroundActive", HIBrush, kThemeBrushDialogBackgroundActive }, /* 48 */
- { "MenuDisabled", HIText, kThemeTextColorMenuItemDisabled }, /* 49 */
- { "DialogBackgroundInactive", HIBrush, kThemeBrushDialogBackgroundInactive }, /* 50 */
- { "MenuText", HIText, kThemeTextColorMenuItemActive }, /* 51 */
- { "AppearanceColor", appearance, 0 }, /* 52: APPEARANCE_PIXEL */
- { "AlertBackgroundActive", HIBrush, kThemeBrushAlertBackgroundActive }, /* 53 */
- { "AlertBackgroundInactive", HIBrush, kThemeBrushAlertBackgroundInactive }, /* 54 */
- { "ModelessDialogBackgroundActive", HIBrush, kThemeBrushModelessDialogBackgroundActive }, /* 55 */
- { "ModelessDialogBackgroundInactive", HIBrush, kThemeBrushModelessDialogBackgroundInactive }, /* 56 */
- { "UtilityWindowBackgroundActive", HIBrush, kThemeBrushUtilityWindowBackgroundActive }, /* 57 */
- { "UtilityWindowBackgroundInactive", HIBrush, kThemeBrushUtilityWindowBackgroundInactive }, /* 58 */
- { "ListViewSortColumnBackground", HIBrush, kThemeBrushListViewSortColumnBackground }, /* 59 */
- { "ListViewBackground", HIBrush, kThemeBrushListViewBackground }, /* 60 */
- { "IconLabelBackground", HIBrush, kThemeBrushIconLabelBackground }, /* 61 */
- { "ListViewSeparator", HIBrush, kThemeBrushListViewSeparator }, /* 62 */
- { "ChasingArrows", HIBrush, kThemeBrushChasingArrows }, /* 63 */
- { "DragHilite", HIBrush, kThemeBrushDragHilite }, /* 64 */
- { "DocumentWindowBackground", HIBrush, kThemeBrushDocumentWindowBackground }, /* 65 */
- { "FinderWindowBackground", HIBrush, kThemeBrushFinderWindowBackground }, /* 66 */
- { "ScrollBarDelimiterActive", HIBrush, kThemeBrushScrollBarDelimiterActive }, /* 67 */
- { "ScrollBarDelimiterInactive", HIBrush, kThemeBrushScrollBarDelimiterInactive }, /* 68 */
- { "FocusHighlight", HIBrush, kThemeBrushFocusHighlight }, /* 69 */
- { "PopupArrowActive", HIBrush, kThemeBrushPopupArrowActive }, /* 70 */
- { "PopupArrowPressed", HIBrush, kThemeBrushPopupArrowPressed }, /* 71 */
- { "PopupArrowInactive", HIBrush, kThemeBrushPopupArrowInactive }, /* 72 */
- { "AppleGuideCoachmark", HIBrush, kThemeBrushAppleGuideCoachmark }, /* 73 */
- { "IconLabelBackgroundSelected", HIBrush, kThemeBrushIconLabelBackgroundSelected }, /* 74 */
- { "StaticAreaFill", HIBrush, kThemeBrushStaticAreaFill }, /* 75 */
- { "ActiveAreaFill", HIBrush, kThemeBrushActiveAreaFill }, /* 76 */
- { "ButtonFrameActive", HIBrush, kThemeBrushButtonFrameActive }, /* 77 */
- { "ButtonFrameInactive", HIBrush, kThemeBrushButtonFrameInactive }, /* 78 */
- { "ButtonFaceActive", HIBrush, kThemeBrushButtonFaceActive }, /* 79 */
- { "ButtonFaceInactive", HIBrush, kThemeBrushButtonFaceInactive }, /* 80 */
- { "ButtonFacePressed", HIBrush, kThemeBrushButtonFacePressed }, /* 81 */
- { "ButtonActiveDarkShadow", HIBrush, kThemeBrushButtonActiveDarkShadow }, /* 82 */
- { "ButtonActiveDarkHighlight", HIBrush, kThemeBrushButtonActiveDarkHighlight }, /* 83 */
- { "ButtonActiveLightShadow", HIBrush, kThemeBrushButtonActiveLightShadow }, /* 84 */
- { "ButtonActiveLightHighlight", HIBrush, kThemeBrushButtonActiveLightHighlight }, /* 85 */
- { "ButtonInactiveDarkShadow", HIBrush, kThemeBrushButtonInactiveDarkShadow }, /* 86 */
- { "ButtonInactiveDarkHighlight", HIBrush, kThemeBrushButtonInactiveDarkHighlight }, /* 87 */
- { "ButtonInactiveLightShadow", HIBrush, kThemeBrushButtonInactiveLightShadow }, /* 88 */
- { "ButtonInactiveLightHighlight", HIBrush, kThemeBrushButtonInactiveLightHighlight }, /* 89 */
- { "ButtonPressedDarkShadow", HIBrush, kThemeBrushButtonPressedDarkShadow }, /* 90 */
- { "ButtonPressedDarkHighlight", HIBrush, kThemeBrushButtonPressedDarkHighlight }, /* 91 */
- { "ButtonPressedLightShadow", HIBrush, kThemeBrushButtonPressedLightShadow }, /* 92 */
- { "ButtonPressedLightHighlight", HIBrush, kThemeBrushButtonPressedLightHighlight }, /* 93 */
- { "BevelActiveLight", HIBrush, kThemeBrushBevelActiveLight }, /* 94 */
- { "BevelActiveDark", HIBrush, kThemeBrushBevelActiveDark }, /* 95 */
- { "BevelInactiveLight", HIBrush, kThemeBrushBevelInactiveLight }, /* 96 */
- { "BevelInactiveDark", HIBrush, kThemeBrushBevelInactiveDark }, /* 97 */
- { "NotificationWindowBackground", HIBrush, kThemeBrushNotificationWindowBackground }, /* 98 */
- { "MovableModalBackground", HIBrush, kThemeBrushMovableModalBackground }, /* 99 */
- { "SheetBackgroundOpaque", HIBrush, kThemeBrushSheetBackgroundOpaque }, /* 100 */
- { "DrawerBackground", HIBrush, kThemeBrushDrawerBackground }, /* 101 */
- { "ToolbarBackground", HIBrush, kThemeBrushToolbarBackground }, /* 102 */
- { "SheetBackgroundTransparent", HIBrush, kThemeBrushSheetBackgroundTransparent }, /* 103 */
- { "MenuBackground", HIBrush, kThemeBrushMenuBackground }, /* 104 */
- { "Pixel", rgbColor, 0 }, /* 105: PIXEL_MAGIC */
- { "MenuBackgroundSelected", HIBrush, kThemeBrushMenuBackgroundSelected }, /* 106 */
- { "ListViewOddRowBackground", HIBrush, kThemeBrushListViewOddRowBackground }, /* 107 */
- { "ListViewEvenRowBackground", HIBrush, kThemeBrushListViewEvenRowBackground }, /* 108 */
- { "ListViewColumnDivider", HIBrush, kThemeBrushListViewColumnDivider }, /* 109 */
- { "BlackText", HIText, kThemeTextColorBlack }, /* 110 */
- { "DialogActiveText", HIText, kThemeTextColorDialogActive }, /* 111 */
- { "DialogInactiveText", HIText, kThemeTextColorDialogInactive }, /* 112 */
- { "AlertActiveText", HIText, kThemeTextColorAlertActive }, /* 113 */
- { "AlertInactiveText", HIText, kThemeTextColorAlertInactive }, /* 114 */
- { "ModelessDialogActiveText", HIText, kThemeTextColorModelessDialogActive }, /* 115 */
- { "ModelessDialogInactiveText", HIText, kThemeTextColorModelessDialogInactive }, /* 116 */
- { "WindowHeaderActiveText", HIText, kThemeTextColorWindowHeaderActive }, /* 117 */
- { "WindowHeaderInactiveText", HIText, kThemeTextColorWindowHeaderInactive }, /* 118 */
- { "PlacardActiveText", HIText, kThemeTextColorPlacardActive }, /* 119 */
- { "PlacardInactiveText", HIText, kThemeTextColorPlacardInactive }, /* 120 */
- { "PlacardPressedText", HIText, kThemeTextColorPlacardPressed }, /* 121 */
- { "PushButtonActiveText", HIText, kThemeTextColorPushButtonActive }, /* 122 */
- { "PushButtonInactiveText", HIText, kThemeTextColorPushButtonInactive }, /* 123 */
- { "PushButtonPressedText", HIText, kThemeTextColorPushButtonPressed }, /* 124 */
- { "BevelButtonActiveText", HIText, kThemeTextColorBevelButtonActive }, /* 125 */
- { "BevelButtonInactiveText", HIText, kThemeTextColorBevelButtonInactive }, /* 126 */
- { "BevelButtonPressedText", HIText, kThemeTextColorBevelButtonPressed }, /* 127 */
- { "PopupButtonActiveText", HIText, kThemeTextColorPopupButtonActive }, /* 128 */
- { "PopupButtonInactiveText", HIText, kThemeTextColorPopupButtonInactive }, /* 129 */
- { "PopupButtonPressedText", HIText, kThemeTextColorPopupButtonPressed }, /* 130 */
- { "IconLabelText", HIText, kThemeTextColorIconLabel }, /* 131 */
- { "ListViewText", HIText, kThemeTextColorListView }, /* 132 */
- { "DocumentWindowTitleActiveText", HIText, kThemeTextColorDocumentWindowTitleActive }, /* 133 */
- { "DocumentWindowTitleInactiveText", HIText, kThemeTextColorDocumentWindowTitleInactive }, /* 134 */
- { "MovableModalWindowTitleActiveText", HIText, kThemeTextColorMovableModalWindowTitleActive }, /* 135 */
- { "MovableModalWindowTitleInactiveText",HIText, kThemeTextColorMovableModalWindowTitleInactive }, /* 136 */
- { "UtilityWindowTitleActiveText", HIText, kThemeTextColorUtilityWindowTitleActive }, /* 137 */
- { "UtilityWindowTitleInactiveText", HIText, kThemeTextColorUtilityWindowTitleInactive }, /* 138 */
- { "PopupWindowTitleActiveText", HIText, kThemeTextColorPopupWindowTitleActive }, /* 139 */
- { "PopupWindowTitleInactiveText", HIText, kThemeTextColorPopupWindowTitleInactive }, /* 140 */
- { "RootMenuActiveText", HIText, kThemeTextColorRootMenuActive }, /* 141 */
- { "RootMenuSelectedText", HIText, kThemeTextColorRootMenuSelected }, /* 142 */
- { "RootMenuDisabledText", HIText, kThemeTextColorRootMenuDisabled }, /* 143 */
- { "MenuItemActiveText", HIText, kThemeTextColorMenuItemActive }, /* 144 */
- { "MenuItemSelectedText", HIText, kThemeTextColorMenuItemSelected }, /* 145 */
- { "MenuItemDisabledText", HIText, kThemeTextColorMenuItemDisabled }, /* 146 */
- { "PopupLabelActiveText", HIText, kThemeTextColorPopupLabelActive }, /* 147 */
- { "PopupLabelInactiveText", HIText, kThemeTextColorPopupLabelInactive }, /* 148 */
- { "TabFrontActiveText", HIText, kThemeTextColorTabFrontActive }, /* 149 */
- { "TabNonFrontActiveText", HIText, kThemeTextColorTabNonFrontActive }, /* 150 */
- { "TabNonFrontPressedText", HIText, kThemeTextColorTabNonFrontPressed }, /* 151 */
- { "TabFrontInactiveText", HIText, kThemeTextColorTabFrontInactive }, /* 152 */
- { "TabNonFrontInactiveText", HIText, kThemeTextColorTabNonFrontInactive }, /* 153 */
- { "IconLabelSelectedText", HIText, kThemeTextColorIconLabelSelected }, /* 154 */
- { "BevelButtonStickyActiveText", HIText, kThemeTextColorBevelButtonStickyActive }, /* 155 */
- { "BevelButtonStickyInactiveText", HIText, kThemeTextColorBevelButtonStickyInactive }, /* 156 */
- { "NotificationText", HIText, kThemeTextColorNotification }, /* 157 */
- { "SystemDetailText", HIText, kThemeTextColorSystemDetail }, /* 158 */
- { "WhiteText", HIText, kThemeTextColorWhite }, /* 159 */
- { "TabPaneBackground", HIBackground, kThemeBackgroundTabPane }, /* 160 */
- { "PlacardBackground", HIBackground, kThemeBackgroundPlacard }, /* 161 */
- { "WindowHeaderBackground", HIBackground, kThemeBackgroundWindowHeader }, /* 162 */
- { "ListViewWindowHeaderBackground", HIBackground, kThemeBackgroundListViewWindowHeader }, /* 163 */
- { "SecondaryGroupBoxBackground", HIBackground, kThemeBackgroundSecondaryGroupBox }, /* 164 */
- { "MetalBackground", HIBackground, kThemeBackgroundMetal }, /* 165 */
+ numSystemColors = index;
+ systemColorIndex = ckalloc(numSystemColors * sizeof(SystemColorDatum*));
+ for (hPtr = Tcl_FirstHashEntry(&systemColors, &search); hPtr != NULL;
+ hPtr = Tcl_NextHashEntry(&search)) {
+ entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ if (entry == NULL) {
+ Tcl_Panic("Unsupported semantic color with no supported backup!");
+ }
+ systemColorIndex[entry->index] = entry;
+ }
/*
- * Colors based on "semantic" NSColors.
+ * Remember the indexes of some special entries.
*/
- { "WindowBackgroundColor", ttkBackground, 0 }, /* 166 */
- { "WindowBackgroundColor1", ttkBackground, 1 }, /* 167 */
- { "WindowBackgroundColor2", ttkBackground, 2 }, /* 168 */
- { "WindowBackgroundColor3", ttkBackground, 3 }, /* 169 */
- { "WindowBackgroundColor4", ttkBackground, 4 }, /* 170 */
- { "WindowBackgroundColor5", ttkBackground, 5 }, /* 171 */
- { "WindowBackgroundColor6", ttkBackground, 6 }, /* 172 */
- { "WindowBackgroundColor7", ttkBackground, 7 }, /* 173 */
- { "TextColor", semantic, 0 }, /* 174 */
- { "SelectedTextColor", semantic, 1 }, /* 175 */
- { "LabelColor", semantic, 2 }, /* 176 */
- { "ControlTextColor", semantic, 3 }, /* 177 */
- { "DisabledControlTextColor", semantic, 4 }, /* 178 */
- { "SelectedTabTextColor", semantic, 5 }, /* 179 */
- { "TextBackgroundColor", semantic, 6 }, /* 180 */
- { "SelectedTextBackgroundColor", semantic, 7 }, /* 181 */
- { "ControlAccentColor", semantic, 8 }, /* 182 */
- /* Apple's SecondaryLabelColor is the same as their LabelColor so we roll our own. */
- { "SecondaryLabelColor", ttkBackground, 14 }, /* 183 */
- { "LinkColor", semantic, 9 }, /* 184 */
- { NULL, 0, 0 }
-};
-#define FIRST_SEMANTIC_COLOR 166
-#define MAX_PIXELCODE 184
+ hPtr = Tcl_FindHashEntry(&systemColors, "Pixel");
+ entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ rgbColorIndex = entry->index;
+ hPtr = Tcl_FindHashEntry(&systemColors, "ControlAccentColor");
+ entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ controlAccentIndex = entry->index;
+ [pool drain];
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXRGBPixel --
+ *
+ * Return an unsigned long value suitable for use in the pixel
+ * field of an XColor with the specified red, green and blue
+ * intensities. The inputs are cast as unsigned longs but are
+ * expected to have values representable by an unsigned char.
+ *
+ * This is called in the TkpGetPixel macro, used in xcolor.c,
+ * and in ImageGetPixel.
+ *
+ * Results:
+ * An unsigned long that can be used as the pixel field of an XColor.
+ *
+ * Side effects:
+ * None.
+ *----------------------------------------------------------------------
+ */
+MODULE_SCOPE
+unsigned long
+TkMacOSXRGBPixel(
+ unsigned long red,
+ unsigned long green,
+ unsigned long blue)
+{
+ MacPixel p;
+ p.pixel.colortype = rgbColor;
+ p.pixel.value = ((red & 0xff) << 16) |
+ ((green & 0xff) << 8) |
+ (blue & 0xff);
+ return p.ulong;
+}
/*
*----------------------------------------------------------------------
*
- * GetEntryFromPixelCode --
+ * TkMacOSXClearPixel --
*
- * Extract a SystemColorMapEntry from the table.
+ * Return the unsigned long value that appears in the pixel
+ * field of the XColor for systemTransparentColor.
+ *
+ * This is used in tkMacOSXImage.c.
*
* Results:
- * Returns false if the code is out of bounds.
+ * The unsigned long that appears in the pixel field of the XColor
+ * for systemTransparentPixel.
*
* Side effects:
* None.
+ *----------------------------------------------------------------------
+ */
+MODULE_SCOPE
+unsigned long TkMacOSXClearPixel(
+ void)
+{
+ MacPixel p;
+ p.pixel.value = 0;
+ p.pixel.colortype = clearColor;
+ return p.ulong;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetEntryFromPixel --
+ *
+ * Look up a SystemColorDatum which describes the XColor with
+ * the specified value as its pixel field.
+ *
+ * Results:
+ * A pointer to a SystemColorDatum, or NULL if the pixel value is
+ * invalid.
+ *
+ * Side effects:
+ * None
*
*----------------------------------------------------------------------
*/
-static bool
-GetEntryFromPixelCode(
- unsigned char code,
- struct SystemColorMapEntry *entry)
+SystemColorDatum*
+GetEntryFromPixel(
+ unsigned long pixel)
{
- if (code >= MIN_PIXELCODE && code <= MAX_PIXELCODE) {
- *entry = systemColorMap[code - MIN_PIXELCODE];
- return true;
+ MacPixel p;
+ int index = rgbColorIndex;
+
+ p.ulong = pixel;
+ if (p.pixel.colortype != rgbColor) {
+ index = p.pixel.value;
+ }
+ if (index < numSystemColors) {
+ return systemColorIndex[index];
} else {
- return false;
+ return NULL;
}
}
+
/*
*----------------------------------------------------------------------
*
- * SetCGColorComponents --
+ * GetRGBA --
*
- * Set the components of a CGColorRef from an XColor pixel value and a
- * system color map entry. The pixel value is only used in the case where
- * the color is of type rgbColor. In that case the normalized XColor RGB
- * values are copied into the CGColorRef.
+ * Given a SystemColorDatum and a pointer to an array of 4 CGFloats, store
+ * the associated RGBA color values in the array. In the case of the
+ * RGBColor datum, the unsigned long pixel value containing the RGB values
+ * must also be provided as the pixel parameter. Otherwise the pixel
+ * parameter is ignored.
*
* Results:
- * OSStatus
+ * None
*
* Side effects:
- * None.
+ * The array rgba is filled in.
*
*----------------------------------------------------------------------
*/
-static NSColorSpace* sRGB = NULL;
-static CGFloat windowBackground[4] =
- {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0};
-
-static OSStatus
-SetCGColorComponents(
- struct SystemColorMapEntry entry,
+static void
+GetRGBA(
+ SystemColorDatum *entry,
unsigned long pixel,
- CGColorRef *c)
+ CGFloat *rgba)
{
- OSStatus err = noErr;
NSColor *bgColor, *color = nil;
- CGFloat rgba[4] = {0, 0, 0, 1};
if (!sRGB) {
sRGB = [NSColorSpace sRGBColorSpace];
}
-
- /*
- * This function is called before our autorelease pool is set up,
- * so it needs its own pool.
- */
-
- NSAutoreleasePool *pool = [NSAutoreleasePool new];
-
- switch (entry.type) {
- case HIBrush:
- err = ChkErr(HIThemeBrushCreateCGColor, entry.value, c);
- return err;
+ switch (entry->type) {
case rgbColor:
rgba[0] = ((pixel >> 16) & 0xff) / 255.0;
rgba[1] = ((pixel >> 8) & 0xff) / 255.0;
@@ -309,7 +292,7 @@ SetCGColorComponents(
*/
if ([NSApp macOSVersion] < 101400) {
- for (int i=0; i<3; i++) {
+ for (int i = 0; i < 3; i++) {
rgba[i] = windowBackground[i];
}
} else {
@@ -318,104 +301,75 @@ SetCGColorComponents(
}
if (rgba[0] + rgba[1] + rgba[2] < 1.5) {
for (int i=0; i<3; i++) {
- rgba[i] += entry.value*8.0 / 255.0;
+ rgba[i] += entry->value*8.0 / 255.0;
}
} else {
for (int i=0; i<3; i++) {
- rgba[i] -= entry.value*8.0 / 255.0;
+ rgba[i] -= entry->value*8.0 / 255.0;
}
}
break;
case semantic:
- switch (entry.value) {
- case 0:
- color = [[NSColor textColor] colorUsingColorSpace:sRGB];
- break;
- case 1:
- color = [[NSColor selectedTextColor] colorUsingColorSpace:sRGB];
- break;
- case 2:
- if ([NSApp macOSVersion] > 100900) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED > 1090
- color = [[NSColor labelColor] colorUsingColorSpace:sRGB];
+ if (entry->index == controlAccentIndex && useFakeAccentColor) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 101500
+ color = [[NSColor colorForControlTint: [NSColor currentControlTint]]
+ colorUsingColorSpace:sRGB];
#endif
- } else {
- color = [[NSColor textColor] colorUsingColorSpace:sRGB];
- }
- break;
- case 3:
- color = [[NSColor controlTextColor] colorUsingColorSpace:sRGB];
- break;
- case 4:
- color = [[NSColor disabledControlTextColor]
- colorUsingColorSpace:sRGB];
- break;
- case 5:
- if ([NSApp macOSVersion] > 100600) {
- color = [[NSColor whiteColor] colorUsingColorSpace:sRGB];
- } else {
- color = [[NSColor blackColor] colorUsingColorSpace:sRGB];
- }
- break;
- case 6:
- color = [[NSColor textBackgroundColor] colorUsingColorSpace:sRGB];
- break;
- case 7:
- color = [[NSColor selectedTextBackgroundColor]
- colorUsingColorSpace:sRGB];
- break;
- case 8:
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
- if (@available(macOS 14, *)) {
- color = [[NSColor controlAccentColor] colorUsingColorSpace:sRGB];
-#else
- if(false) {
-#endif
- } else {
- color = [[NSColor
- colorForControlTint:[NSColor currentControlTint]]
- colorUsingColorSpace: sRGB];
- }
- break;
- case 9:
- if ([NSApp macOSVersion] >= 101000) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
- color = [[NSColor linkColor] colorUsingColorSpace:sRGB];
-#endif
- } else {
- color = [[NSColor blueColor] colorUsingColorSpace:sRGB];
- }
- break;
- default:
- if ([NSApp macOSVersion] >= 101000) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
- color = [[NSColor labelColor] colorUsingColorSpace:sRGB];
-#endif
- } else {
- color = [[NSColor textColor] colorUsingColorSpace:sRGB];
- }
- break;
+ } else {
+ color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB];
}
[color getComponents: rgba];
break;
case clearColor:
- rgba[3] = 0.0;
+ rgba[3] = 0;
+ default:
break;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SetCGColorComponents --
+ *
+ * Set the components of a CGColorRef from an XColor pixel value and a
+ * SystemColorDatum. The pixel value is only used in the case where
+ * the color is of type rgbColor. In that case the normalized XColor RGB
+ * values are copied into the CGColorRef. Otherwise the components are
+ * computed from the SystemColorDatum.
+ *
+ * Results:
+ * True if the function succeeds, false otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Bool
+SetCGColorComponents(
+ SystemColorDatum *entry,
+ unsigned long pixel,
+ CGColorRef *c)
+{
+ CGFloat rgba[4] = {0, 0, 0, 1};
/*
- * There are no HITheme functions which convert Text or background colors
- * to CGColors. (GetThemeTextColor has been removed, and it was never
- * possible with backgrounds.) If we get one of these we return black.
+ * This function is called before our autorelease pool is set up,
+ * so it needs its own pool.
*/
- case HIText:
- case HIBackground:
- default:
- break;
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
+ if (entry->type == HIBrush) {
+ OSStatus err = ChkErr(HIThemeBrushCreateCGColor, entry->value, c);
+ return err == noErr;
}
+ GetRGBA(entry, pixel, rgba);
*c = CGColorCreate(sRGB.CGColorSpace, rgba);
[pool drain];
- return err;
+ return true;
}
/*
@@ -437,27 +391,24 @@ SetCGColorComponents(
MODULE_SCOPE Bool
TkMacOSXInDarkMode(Tk_Window tkwin)
{
- int result = false;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
- static NSAppearanceName darkAqua = @"NSAppearanceNameDarkAqua";
-
- if ([NSApp macOSVersion] >= 101400) {
+ if (@available(macOS 10.14, *)) {
TkWindow *winPtr = (TkWindow*) tkwin;
+ NSAppearanceName name;
NSView *view = nil;
if (winPtr && winPtr->privatePtr) {
view = TkMacOSXDrawableView(winPtr->privatePtr);
}
if (view) {
- result = [view.effectiveAppearance.name isEqualToString:darkAqua];
+ name = [[view effectiveAppearance] name];
} else {
- result = [[NSAppearance currentAppearance].name
- isEqualToString:darkAqua];
+ name = [[NSAppearance currentAppearance] name];
}
+ return (name == NSAppearanceNameDarkAqua);
}
#endif
-
- return result;
+ return false;
}
/*
@@ -465,14 +416,13 @@ TkMacOSXInDarkMode(Tk_Window tkwin)
*
* TkSetMacColor --
*
- * Sets the components of a CGColorRef from an XColor pixel value.
- * The high order byte of the pixel value is used as an index into
- * the system color table, and then SetCGColorComponents is called
- * with the table entry and the pixel value.
+ * Sets the components of a CGColorRef from an XColor pixel value. The
+ * pixel value is used to look up the color in the system color table, and
+ * then SetCGColorComponents is called with the table entry and the pixel
+ * value.
*
* Results:
- * Returns false if the high order byte is not a valid index, true
- * otherwise.
+ * Returns false if the color is not found, true otherwise.
*
* Side effects:
* The variable macColor is set to a new CGColorRef, the caller is
@@ -487,13 +437,13 @@ TkSetMacColor(
void *macColor) /* CGColorRef to modify. */
{
CGColorRef *color = (CGColorRef*)macColor;
- OSStatus err = -1;
- struct SystemColorMapEntry entry;
+ SystemColorDatum *entry = GetEntryFromPixel(pixel);
- if (GetEntryFromPixelCode((pixel >> 24) & 0xff, &entry)) {
- err = ChkErr(SetCGColorComponents, entry, pixel, color);
+ if (entry) {
+ return SetCGColorComponents(entry, pixel, color);
+ } else {
+ return false;
}
- return (err == noErr);
}
/*
@@ -614,9 +564,10 @@ TkMacOSXCreateCGColor(
* TkMacOSXGetNSColor --
*
* Creates an autoreleased NSColor from a X style pixel value.
+ * The return value is nil if the pixel value is invalid.
*
* Results:
- * Returns nil if not a real pixel, NSColor* otherwise.
+ * A possibly nil pointer to an NSColor.
*
* Side effects:
* None
@@ -650,10 +601,9 @@ TkMacOSXGetNSColor(
*
* TkMacOSXSetColorInContext --
*
- * Sets fill and stroke color in the given CG context from an X
- * pixel value, or if the pixel code indicates a system color,
- * sets the corresponding brush, textColor or background via
- * HITheme APIs if available or Appearance mgr APIs.
+ * Sets the fill and stroke colors in the given CGContext to the CGColor
+ * which corresponds to the XColor having the specified value for its pixel
+ * field.
*
* Results:
* None.
@@ -672,37 +622,20 @@ TkMacOSXSetColorInContext(
{
OSStatus err = noErr;
CGColorRef cgColor = nil;
- struct SystemColorMapEntry entry;
- CGRect rect;
- int code = (pixel >> 24) & 0xff;
- HIThemeBackgroundDrawInfo info = {0, kThemeStateActive, 0};;
+ SystemColorDatum *entry = GetEntryFromPixel(pixel);
- if (code < FIRST_SEMANTIC_COLOR) {
- cgColor = CopyCachedColor(gc, pixel);
- }
- if (!cgColor && GetEntryFromPixelCode(code, &entry)) {
- switch (entry.type) {
+ if (entry) {
+ switch (entry->type) {
case HIBrush:
- err = ChkErr(HIThemeSetFill, entry.value, NULL, context,
+ err = ChkErr(HIThemeSetFill, entry->value, NULL, context,
kHIThemeOrientationNormal);
if (err == noErr) {
- err = ChkErr(HIThemeSetStroke, entry.value, NULL, context,
+ err = ChkErr(HIThemeSetStroke, entry->value, NULL, context,
kHIThemeOrientationNormal);
}
break;
- case HIText:
- err = ChkErr(HIThemeSetTextFill, entry.value, NULL, context,
- kHIThemeOrientationNormal);
- break;
- case HIBackground:
- info.kind = entry.value;
- rect = CGContextGetClipBoundingBox(context);
- err = ChkErr(HIThemeApplyBackground, &rect, &info,
- context, kHIThemeOrientationNormal);
- break;
default:
- err = ChkErr(SetCGColorComponents, entry, pixel, &cgColor);
- if (err == noErr) {
+ if (SetCGColorComponents(entry, pixel, &cgColor)){
SetCachedColor(gc, pixel, cgColor);
}
break;
@@ -723,15 +656,20 @@ TkMacOSXSetColorInContext(
*
* TkpGetColor --
*
- * Allocate a new TkColor for the color with the given name.
+ * Create a new TkColor for the color with the given name, for use in the
+ * specified window. The colormap field is set to lightColormap if the
+ * window has a LightAqua appearance, or darkColormap if the window has a
+ * DarkAqua appearance. TkColors with different colormaps are managed
+ * separately in the per-display table of TkColors maintained by Tk.
+ *
+ * This function is called by Tk_GetColor.
*
* Results:
* Returns a newly allocated TkColor, or NULL on failure.
*
* Side effects:
- * May invalidate the colormap cache associated with tkwin upon
- * allocating a new colormap entry. Allocates a new TkColor
- * structure.
+ *
+ * Allocates memory for the TkColor structure.
*
*----------------------------------------------------------------------
*/
@@ -742,31 +680,64 @@ TkpGetColor(
Tk_Uid name) /* Name of color to be allocated (in form
* suitable for passing to XParseColor). */
{
- Display *display = tkwin != None ? Tk_Display(tkwin) : NULL;
- Colormap colormap = tkwin!= None ? Tk_Colormap(tkwin) : None;
+ Display *display = NULL;
TkColor *tkColPtr;
XColor color;
+ Colormap colormap = tkwin ? Tk_Colormap(tkwin) : noColormap;
+ NSView *view = nil;
+ static Bool initialized = NO;
+ static NSColorSpace* sRGB = NULL;
+
+ if (!initialized) {
+ initialized = YES;
+ sRGB = [NSColorSpace sRGBColorSpace];
+ initColorTable();
+ }
+ if (tkwin) {
+ display = Tk_Display(tkwin);
+ MacDrawable *macWin = (MacDrawable *) Tk_WindowId(tkwin);
+ view = TkMacOSXDrawableView(macWin);
+ }
/*
- * Check to see if this is a system color. Otherwise, XParseColor
- * will do all the work.
+ * Check to see if this is a system color. If not, just call XParseColor.
*/
if (strncasecmp(name, "system", 6) == 0) {
- Tcl_Obj *strPtr = Tcl_NewStringObj(name+6, -1);
- int idx, result;
-
- result = Tcl_GetIndexFromObjStruct(NULL, strPtr, systemColorMap,
- sizeof(struct SystemColorMapEntry), NULL, TCL_EXACT, &idx);
- Tcl_DecrRefCount(strPtr);
- if (result == TCL_OK) {
- OSStatus err;
+ Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&systemColors, name + 6);
+ MacPixel p;
+
+ if (hPtr != NULL) {
+ SystemColorDatum *entry = (SystemColorDatum *)Tcl_GetHashValue(hPtr);
CGColorRef c;
- unsigned char pixelCode = idx + MIN_PIXELCODE;
- struct SystemColorMapEntry entry = systemColorMap[idx];
- err = ChkErr(SetCGColorComponents, entry, 0, &c);
- if (err == noErr) {
+ p.pixel.colortype = entry->type;
+ p.pixel.value = entry->index;
+ color.pixel = p.ulong;
+ if (entry->type == semantic) {
+ CGFloat rgba[4];
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+ NSAppearance *savedAppearance = [NSAppearance currentAppearance];
+ NSAppearance *windowAppearance = savedAppearance;
+ if (view) {
+ windowAppearance = [view effectiveAppearance];
+ }
+ if ([windowAppearance name] == NSAppearanceNameDarkAqua) {
+ colormap = darkColormap;
+ } else {
+ colormap = lightColormap;
+ }
+ [NSAppearance setCurrentAppearance:windowAppearance];
+ GetRGBA(entry, p.ulong, rgba);
+ [NSAppearance setCurrentAppearance:savedAppearance];
+#else
+ GetRGBA(entry, p.ulong, rgba);
+#endif
+ color.red = rgba[0] * 65535.0;
+ color.green = rgba[1] * 65535.0;
+ color.blue = rgba[2] * 65535.0;
+ goto validXColor;
+ } else if (SetCGColorComponents(entry, 0, &c)) {
const size_t n = CGColorGetNumberOfComponents(c);
const CGFloat *rgba = CGColorGetComponents(c);
@@ -782,25 +753,19 @@ TkpGetColor(
default:
Tcl_Panic("CGColor with %d components", (int) n);
}
- color.pixel = ((((((pixelCode << 8)
- | ((color.red >> 8) & 0xff)) << 8)
- | ((color.green >> 8) & 0xff)) << 8)
- | ((color.blue >> 8) & 0xff));
CGColorRelease(c);
goto validXColor;
}
- CGColorRelease(c);
}
}
-
if (TkParseColor(display, colormap, name, &color) == 0) {
return NULL;
}
validXColor:
tkColPtr = (TkColor *)ckalloc(sizeof(TkColor));
+ tkColPtr->colormap = colormap;
tkColPtr->color = color;
-
return tkColPtr;
}
@@ -809,36 +774,35 @@ validXColor:
*
* TkpGetColorByValue --
*
- * Given a desired set of red-green-blue intensities for a color,
- * locate a pixel value to use to draw that color in a given
- * window.
+ * Given an pointer to an XColor, construct a TkColor whose red, green and
+ * blue intensities match those of the XColor as closely as possible. For
+ * the Macintosh, this means that the colortype bitfield of the pixel
+ * value will be RGBColor and that the color intensities stored in its
+ * 24-bit value bitfield are computed from the 16-bit red green and blue
+ * values in the XColor by dividing by 256.
*
* Results:
- * The return value is a pointer to an TkColor structure that
- * indicates the closest red, blue, and green intensities available
- * to those specified in colorPtr, and also specifies a pixel
- * value to use to draw in that color.
+ * A pointer to a newly allocated TkColor structure.
*
* Side effects:
* May invalidate the colormap cache for the specified window.
- * Allocates a new TkColor structure.
+ * Allocates memory for a TkColor structure.
*
*----------------------------------------------------------------------
*/
TkColor *
TkpGetColorByValue(
- Tk_Window tkwin, /* Window in which color will be used. */
+ TCL_UNUSED(Tk_Window), /* Window in which color will be used. */
XColor *colorPtr) /* Red, green, and blue fields indicate
* desired color. */
{
TkColor *tkColPtr = (TkColor *)ckalloc(sizeof(TkColor));
- (void)tkwin;
tkColPtr->color.red = colorPtr->red;
tkColPtr->color.green = colorPtr->green;
tkColPtr->color.blue = colorPtr->blue;
- tkColPtr->color.pixel = TkpGetPixel(&tkColPtr->color);
+ tkColPtr->color.pixel = TkpGetPixel(colorPtr);
return tkColPtr;
}
@@ -862,11 +826,9 @@ TkpGetColorByValue(
Status
XAllocColor(
Display *display, /* Display. */
- Colormap map, /* Not used. */
+ TCL_UNUSED(Colormap), /* Not used. */
XColor *colorPtr) /* XColor struct to modify. */
{
- (void)map;
-
display->request++;
colorPtr->pixel = TkpGetPixel(colorPtr);
return 1;
@@ -874,52 +836,39 @@ XAllocColor(
Colormap
XCreateColormap(
- Display *display, /* Display. */
- Window window, /* X window. */
- Visual *visual, /* Not used. */
- int alloc) /* Not used. */
+ TCL_UNUSED(Display *), /* Display. */
+ TCL_UNUSED(Window), /* X window. */
+ TCL_UNUSED(Visual *), /* Not used. */
+ TCL_UNUSED(int)) /* Not used. */
{
- static Colormap index = 1;
- (void)display;
- (void)window;
- (void)visual;
- (void)alloc;
+ static Colormap index = 16;
/*
- * Just return a new value each time.
+ * Just return a new value each time, large enough that it will not
+ * conflict with any value of the macColormap enum.
*/
return index++;
}
int
XFreeColormap(
- Display* display, /* Display. */
- Colormap colormap) /* Colormap. */
+ TCL_UNUSED(Display *), /* Display. */
+ TCL_UNUSED(Colormap)) /* Colormap. */
{
- (void)display;
- (void)colormap;
-
return Success;
}
int
XFreeColors(
- Display* display, /* Display. */
- Colormap colormap, /* Colormap. */
- unsigned long* pixels, /* Array of pixels. */
- int npixels, /* Number of pixels. */
- unsigned long planes) /* Number of pixel planes. */
+ TCL_UNUSED(Display *), /* Display. */
+ TCL_UNUSED(Colormap), /* Colormap. */
+ TCL_UNUSED(unsigned long *), /* Array of pixels. */
+ TCL_UNUSED(int), /* Number of pixels. */
+ TCL_UNUSED(unsigned long)) /* Number of pixel planes. */
{
- (void)display;
- (void)colormap;
- (void)pixels;
- (void)npixels;
- (void)planes;
-
/*
- * The Macintosh version of Tk uses TrueColor. Nothing
- * needs to be done to release colors as there really is
- * no colormap in the Tk sense.
+ * Nothing needs to be done to release colors as there really is no
+ * colormap in the Tk sense.
*/
return Success;
}
diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h
new file mode 100644
index 0000000..58f8060
--- /dev/null
+++ b/macosx/tkMacOSXColor.h
@@ -0,0 +1,202 @@
+#ifndef MACOSXCOLOR_H
+#define MACOSXCOLOR_H
+/*
+ * The generic Tk code uses the X11 GC type to describe a graphics context.
+ * (A GC is a pointer to a struct XGCValues). The foreground and background
+ * colors in a GC are unsigned longs. These are meant to be used as indexes
+ * into a table of XColors, where an XColor is declared in Xlib.h as:
+ * typedef struct {
+ * unsigned long pixel;
+ * unsigned short red, green, blue;
+ * char flags;
+ * char pad;
+ * } XColor;
+ *
+ * The xlib function XParseColor creates XColors from strings. It recognizes
+ * literal hexadecimal color specifications such as "#RRGGBB" as well as the
+ * standard X11 color names. When XParseColor creates an XColor it fills in
+ * all of the fields except for the pixel field, and then passes the XColor
+ * to TkpGetPixel to get a value to use for the pixel field. Since TkpGetPixel
+ * is platform specific, each platform is free to choose a value which can
+ * be used to set the foreground or background color in the platform's graphics
+ * context.
+ *
+ * Tk represents a color by a struct TkColor, which extends the XColor struct.
+ * Tk provides a mapping from color names to TkColors which extends the mapping
+ * provided by XParseColor but also allows for platform specific color names.
+ * By convention, these platform specific color names begin with the string
+ * "system". The mapping from names to TkColors is implemented by the function
+ * TkpGetColor defined for the Macintosh in this file. The pixel field in the
+ * XColor contained in a TkColor will be stored in the X11 graphics context.
+ * In X11 the pixel field is used as an index into a colormap. On the Mac
+ * the high order byte of the pixel is used to indicate a color type and
+ * the low 24 bits are either used as an rgb value (if the type is rgbColor)
+ * or as an index into a table of color descriptions.
+ */
+
+enum colorType {
+ rgbColor, /* The 24 bit value is an rgb color. */
+ clearColor, /* The unique rgba color with all channels 0. */
+ HIBrush, /* A HITheme brush color.*/
+ ttkBackground, /* A background color which indicates nesting level.*/
+ semantic, /* A semantic NSColor.*/
+};
+
+typedef struct xpixel_t {
+ unsigned value: 24; /* Either RGB or an index into systemColorData. */
+ unsigned colortype: 8;
+} xpixel;
+
+typedef union MacPixel_t {
+ unsigned long ulong;
+ xpixel pixel;
+} MacPixel;
+
+/*
+ * We maintain two colormaps, one for the LightAqua appearance and one for the
+ * DarkAqua appearance.
+ */
+
+enum macColormap {
+ noColormap,
+ lightColormap,
+ darkColormap,
+};
+
+/*
+ * In TkMacOSXColor.c a Tk hash table is constructed from the static data
+ * below to map system color names to CGColors.
+ */
+
+typedef struct {
+ const char *name;
+ enum colorType type;
+ int value;
+ const char *macName;
+ /* Fields below are filled in after or during construction of the hash table. */
+ int index;
+ NSString *selector;
+} SystemColorDatum;
+
+/*
+ * WARNING: Semantic colors which are not supported on all systems must be
+ * preceded by a backup color with the same name which *is* supported. Systems
+ * which do support the color will replace the backup value when the table is
+ * constructed. Failing to ensure this will result in a Tcl_Panic abort.
+ */
+
+static SystemColorDatum systemColorData[] = {
+{"Pixel", rgbColor, 0, NULL, 0, NULL },
+{"Transparent", clearColor, 0, NULL, 0, NULL },
+
+{"Highlight", HIBrush, kThemeBrushPrimaryHighlightColor, NULL, 0, NULL },
+{"HighlightSecondary", HIBrush, kThemeBrushSecondaryHighlightColor, NULL, 0, NULL },
+{"HighlightText", HIBrush, kThemeBrushBlack, NULL, 0, NULL },
+{"HighlightAlternate", HIBrush, kThemeBrushAlternatePrimaryHighlightColor, NULL, 0, NULL },
+{"PrimaryHighlightColor", HIBrush, kThemeBrushPrimaryHighlightColor, NULL, 0, NULL },
+{"ButtonFace", HIBrush, kThemeBrushButtonFaceActive, NULL, 0, NULL },
+{"SecondaryHighlightColor", HIBrush, kThemeBrushSecondaryHighlightColor, NULL, 0, NULL },
+{"ButtonFrame", HIBrush, kThemeBrushButtonFrameActive, NULL, 0, NULL },
+{"AlternatePrimaryHighlightColor", HIBrush, kThemeBrushAlternatePrimaryHighlightColor, NULL, 0, NULL },
+{"WindowBody", HIBrush, kThemeBrushDocumentWindowBackground, NULL, 0, NULL },
+{"SheetBackground", HIBrush, kThemeBrushSheetBackground, NULL, 0, NULL },
+{"MenuActive", HIBrush, kThemeBrushMenuBackgroundSelected, NULL, 0, NULL },
+{"Menu", HIBrush, kThemeBrushMenuBackground, NULL, 0, NULL },
+{"DialogBackgroundInactive", HIBrush, kThemeBrushDialogBackgroundInactive, NULL, 0, NULL },
+{"DialogBackgroundActive", HIBrush, kThemeBrushDialogBackgroundActive, NULL, 0, NULL },
+{"AlertBackgroundActive", HIBrush, kThemeBrushAlertBackgroundActive, NULL, 0, NULL },
+{"AlertBackgroundInactive", HIBrush, kThemeBrushAlertBackgroundInactive, NULL, 0, NULL },
+{"ModelessDialogBackgroundActive", HIBrush, kThemeBrushModelessDialogBackgroundActive, NULL, 0, NULL },
+{"ModelessDialogBackgroundInactive", HIBrush, kThemeBrushModelessDialogBackgroundInactive, NULL, 0, NULL },
+{"UtilityWindowBackgroundActive", HIBrush, kThemeBrushUtilityWindowBackgroundActive, NULL, 0, NULL },
+{"UtilityWindowBackgroundInactive", HIBrush, kThemeBrushUtilityWindowBackgroundInactive, NULL, 0, NULL },
+{"ListViewSortColumnBackground", HIBrush, kThemeBrushListViewSortColumnBackground, NULL, 0, NULL },
+{"ListViewBackground", HIBrush, kThemeBrushListViewBackground, NULL, 0, NULL },
+{"IconLabelBackground", HIBrush, kThemeBrushIconLabelBackground, NULL, 0, NULL },
+{"ListViewSeparator", HIBrush, kThemeBrushListViewSeparator, NULL, 0, NULL },
+{"ChasingArrows", HIBrush, kThemeBrushChasingArrows, NULL, 0, NULL },
+{"DragHilite", HIBrush, kThemeBrushDragHilite, NULL, 0, NULL },
+{"DocumentWindowBackground", HIBrush, kThemeBrushDocumentWindowBackground, NULL, 0, NULL },
+{"FinderWindowBackground", HIBrush, kThemeBrushFinderWindowBackground, NULL, 0, NULL },
+{"ScrollBarDelimiterActive", HIBrush, kThemeBrushScrollBarDelimiterActive, NULL, 0, NULL },
+{"ScrollBarDelimiterInactive", HIBrush, kThemeBrushScrollBarDelimiterInactive, NULL, 0, NULL },
+{"FocusHighlight", HIBrush, kThemeBrushFocusHighlight, NULL, 0, NULL },
+{"PopupArrowActive", HIBrush, kThemeBrushPopupArrowActive, NULL, 0, NULL },
+{"PopupArrowPressed", HIBrush, kThemeBrushPopupArrowPressed, NULL, 0, NULL },
+{"PopupArrowInactive", HIBrush, kThemeBrushPopupArrowInactive, NULL, 0, NULL },
+{"AppleGuideCoachmark", HIBrush, kThemeBrushAppleGuideCoachmark, NULL, 0, NULL },
+{"IconLabelBackgroundSelected", HIBrush, kThemeBrushIconLabelBackgroundSelected, NULL, 0, NULL },
+{"StaticAreaFill", HIBrush, kThemeBrushStaticAreaFill, NULL, 0, NULL },
+{"ActiveAreaFill", HIBrush, kThemeBrushActiveAreaFill, NULL, 0, NULL },
+{"ButtonFrameActive", HIBrush, kThemeBrushButtonFrameActive, NULL, 0, NULL },
+{"ButtonFrameInactive", HIBrush, kThemeBrushButtonFrameInactive, NULL, 0, NULL },
+{"ButtonFaceActive", HIBrush, kThemeBrushButtonFaceActive, NULL, 0, NULL },
+{"ButtonFaceInactive", HIBrush, kThemeBrushButtonFaceInactive, NULL, 0, NULL },
+{"ButtonFacePressed", HIBrush, kThemeBrushButtonFacePressed, NULL, 0, NULL },
+{"ButtonActiveDarkShadow", HIBrush, kThemeBrushButtonActiveDarkShadow, NULL, 0, NULL },
+{"ButtonActiveDarkHighlight", HIBrush, kThemeBrushButtonActiveDarkHighlight, NULL, 0, NULL },
+{"ButtonActiveLightShadow", HIBrush, kThemeBrushButtonActiveLightShadow, NULL, 0, NULL },
+{"ButtonActiveLightHighlight", HIBrush, kThemeBrushButtonActiveLightHighlight, NULL, 0, NULL },
+{"ButtonInactiveDarkShadow", HIBrush, kThemeBrushButtonInactiveDarkShadow, NULL, 0, NULL },
+{"ButtonInactiveDarkHighlight", HIBrush, kThemeBrushButtonInactiveDarkHighlight, NULL, 0, NULL },
+{"ButtonInactiveLightShadow", HIBrush, kThemeBrushButtonInactiveLightShadow, NULL, 0, NULL },
+{"ButtonInactiveLightHighlight", HIBrush, kThemeBrushButtonInactiveLightHighlight, NULL, 0, NULL },
+{"ButtonPressedDarkShadow", HIBrush, kThemeBrushButtonPressedDarkShadow, NULL, 0, NULL },
+{"ButtonPressedDarkHighlight", HIBrush, kThemeBrushButtonPressedDarkHighlight, NULL, 0, NULL },
+{"ButtonPressedLightShadow", HIBrush, kThemeBrushButtonPressedLightShadow, NULL, 0, NULL },
+{"ButtonPressedLightHighlight", HIBrush, kThemeBrushButtonPressedLightHighlight, NULL, 0, NULL },
+{"BevelActiveLight", HIBrush, kThemeBrushBevelActiveLight, NULL, 0, NULL },
+{"BevelActiveDark", HIBrush, kThemeBrushBevelActiveDark, NULL, 0, NULL },
+{"BevelInactiveLight", HIBrush, kThemeBrushBevelInactiveLight, NULL, 0, NULL },
+{"BevelInactiveDark", HIBrush, kThemeBrushBevelInactiveDark, NULL, 0, NULL },
+{"NotificationWindowBackground", HIBrush, kThemeBrushNotificationWindowBackground, NULL, 0, NULL },
+{"MovableModalBackground", HIBrush, kThemeBrushMovableModalBackground, NULL, 0, NULL },
+{"SheetBackgroundOpaque", HIBrush, kThemeBrushSheetBackgroundOpaque, NULL, 0, NULL },
+{"DrawerBackground", HIBrush, kThemeBrushDrawerBackground, NULL, 0, NULL },
+{"ToolbarBackground", HIBrush, kThemeBrushToolbarBackground, NULL, 0, NULL },
+{"SheetBackgroundTransparent", HIBrush, kThemeBrushSheetBackgroundTransparent, NULL, 0, NULL },
+{"MenuBackground", HIBrush, kThemeBrushMenuBackground, NULL, 0, NULL },
+{"MenuBackgroundSelected", HIBrush, kThemeBrushMenuBackgroundSelected, NULL, 0, NULL },
+{"ListViewOddRowBackground", HIBrush, kThemeBrushListViewOddRowBackground, NULL, 0, NULL },
+{"ListViewEvenRowBackground", HIBrush, kThemeBrushListViewEvenRowBackground, NULL, 0, NULL },
+{"ListViewColumnDivider", HIBrush, kThemeBrushListViewColumnDivider, NULL, 0, NULL },
+
+ /*
+ * Dynamic Colors
+ */
+
+{"WindowBackgroundColor", ttkBackground, 0, NULL, 0, NULL },
+{"WindowBackgroundColor1", ttkBackground, 1, NULL, 0, NULL },
+{"WindowBackgroundColor2", ttkBackground, 2, NULL, 0, NULL },
+{"WindowBackgroundColor3", ttkBackground, 3, NULL, 0, NULL },
+{"WindowBackgroundColor4", ttkBackground, 4, NULL, 0, NULL },
+{"WindowBackgroundColor5", ttkBackground, 5, NULL, 0, NULL },
+{"WindowBackgroundColor6", ttkBackground, 6, NULL, 0, NULL },
+{"WindowBackgroundColor7", ttkBackground, 7, NULL, 0, NULL },
+/* Apple's SecondaryLabelColor is the same as their LabelColor so we roll our own. */
+{"SecondaryLabelColor", ttkBackground, 14, NULL, 0, NULL },
+/* Color to use for notebook tab labels. */
+#if MAC_OS_X_VERSION_MAX_ALLOWED > 1060
+{"SelectedTabTextColor", semantic, 0, "whiteColor", 0, NULL },
+#else
+{"SelectedTabTextColor", semantic, 0, "blackColor", 0, NULL },
+#endif
+/* Semantic colors that we simulate on older systems which don't supoort them. */
+{"SelectedMenuItemTextColor", semantic, 0, "selectedMenuItemTextColor", 0, NULL },
+{"ControlAccentColor", semantic, 0, "controlAccentColor", 0, NULL },
+{"LabelColor", semantic, 0, "blackColor", 0, NULL },
+{"LinkColor", semantic, 0, "blueColor", 0, NULL },
+{"PlaceholderTextColor", semantic, 0, "grayColor", 0, NULL },
+{"SeparatorColor", semantic, 0, "grayColor", 0, NULL },
+{NULL, 0, 0, NULL, 0, NULL }
+};
+
+#endif
+/*
+ * Local Variables:
+ * mode: objc
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/macosx/tkMacOSXConstants.h b/macosx/tkMacOSXConstants.h
index 739ff1c..e2e1b84 100644
--- a/macosx/tkMacOSXConstants.h
+++ b/macosx/tkMacOSXConstants.h
@@ -109,6 +109,8 @@ typedef NSInteger NSModalResponse;
#define graphicsContextWithGraphicsPort graphicsContextWithCGContext
#endif
-
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 110000
+#define NSWindowStyleMaskTexturedBackground 0
#endif
+#endif
diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h
index efaaa91..a71fbf2 100644
--- a/macosx/tkMacOSXDefault.h
+++ b/macosx/tkMacOSXDefault.h
@@ -45,7 +45,7 @@
#define INACTIVE_SELECT_BG "systemSelectedTextBackgroundColor"
#define TROUGH "#c3c3c3"
#define INDICATOR "#b03060"
-#define DISABLED "#a3a3a3"
+#define DISABLED "systemDisabledControlTextColor"
/*
* Defaults for labels, buttons, checkbuttons, and radiobuttons:
@@ -311,24 +311,24 @@
* Defaults for menus overall:
*/
-#define DEF_MENU_ACTIVE_BG_COLOR "systemMenuActive"
-#define DEF_MENU_ACTIVE_BG_MONO BLACK
+#define DEF_MENU_ACTIVE_BG_COLOR NORMAL_BG /*ignored*/
+#define DEF_MENU_ACTIVE_BG_MONO NORMAL_BG /*ignored*/
#define DEF_MENU_ACTIVE_BORDER_WIDTH "0"
-#define DEF_MENU_ACTIVE_FG_COLOR "systemMenuActiveText"
-#define DEF_MENU_ACTIVE_FG_MONO WHITE
+#define DEF_MENU_ACTIVE_FG_COLOR NORMAL_FG
+#define DEF_MENU_ACTIVE_FG_MONO NORMAL_FG
#define DEF_MENU_ACTIVE_RELIEF "flat"
-#define DEF_MENU_BG_COLOR "systemMenu"
-#define DEF_MENU_BG_MONO WHITE
+#define DEF_MENU_BG_COLOR NORMAL_BG /*ignored*/
+#define DEF_MENU_BG_MONO NORMAL_BG /*ignored*/
#define DEF_MENU_BORDER_WIDTH "0"
#define DEF_MENU_CURSOR "arrow"
-#define DEF_MENU_DISABLED_FG_COLOR "systemMenuDisabled"
-#define DEF_MENU_DISABLED_FG_MONO ""
+#define DEF_MENU_DISABLED_FG_COLOR DISABLED
+#define DEF_MENU_DISABLED_FG_MONO DISABLED
#define DEF_MENU_FONT "menu" /* special: see tkMacOSXMenu.c */
-#define DEF_MENU_FG "systemMenuText"
+#define DEF_MENU_FG NORMAL_FG
#define DEF_MENU_POST_COMMAND ""
#define DEF_MENU_RELIEF "flat"
-#define DEF_MENU_SELECT_COLOR "systemMenuActive"
-#define DEF_MENU_SELECT_MONO BLACK
+#define DEF_MENU_SELECT_COLOR "systemSelectedMenuItemTextColor"
+#define DEF_MENU_SELECT_MONO "systemSelectedMenuItemTextColor"
#define DEF_MENU_TAKE_FOCUS "0"
#define DEF_MENU_TEAROFF "0"
#define DEF_MENU_TEAROFF_CMD NULL
@@ -340,12 +340,12 @@
*/
#define DEF_MENUBUTTON_ANCHOR "w"
-#define DEF_MENUBUTTON_ACTIVE_BG_COLOR ACTIVE_BG
-#define DEF_MENUBUTTON_ACTIVE_BG_MONO WHITE
-#define DEF_MENUBUTTON_ACTIVE_FG_COLOR ACTIVE_FG
-#define DEF_MENUBUTTON_ACTIVE_FG_MONO BLACK
-#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG
-#define DEF_MENUBUTTON_BG_MONO WHITE
+#define DEF_MENUBUTTON_ACTIVE_BG_COLOR NORMAL_BG /*ignored*/
+#define DEF_MENUBUTTON_ACTIVE_BG_MONO NORMAL_BG /*ignored*/
+#define DEF_MENUBUTTON_ACTIVE_FG_COLOR "systemTextColor"
+#define DEF_MENUBUTTON_ACTIVE_FG_MONO "systemTextColor"
+#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG /*ignored*/
+#define DEF_MENUBUTTON_BG_MONO NORMAL_BG /*ignored*/
#define DEF_MENUBUTTON_BITMAP ""
#define DEF_MENUBUTTON_BORDER_WIDTH "0"
#define DEF_MENUBUTTON_CURSOR ""
@@ -357,7 +357,7 @@
#define DEF_MENUBUTTON_HEIGHT "0"
#define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR
#define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO
-#define DEF_MENUBUTTON_HIGHLIGHT BLACK
+#define DEF_MENUBUTTON_HIGHLIGHT NORMAL_BG
#define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
#define DEF_MENUBUTTON_IMAGE NULL
#define DEF_MENUBUTTON_INDICATOR "1"
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 25744ab..fa23e5c 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -17,7 +17,7 @@
#include "tkMacOSXDebug.h"
#include "tkButton.h"
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
#define GET_CGCONTEXT [[NSGraphicsContext currentContext] CGContext]
#else
#define GET_CGCONTEXT [[NSGraphicsContext currentContext] graphicsPort]
@@ -43,6 +43,7 @@ static int cgAntiAliasLimit = 0;
static int useThemedToplevel = 0;
static int useThemedFrame = 0;
+static unsigned long transparentColor;
/*
* Prototypes for functions used only in this file.
@@ -69,11 +70,10 @@ static void ClipToGC(Drawable d, GC gc, HIShapeRef *clipRgnPtr);
MODULE_SCOPE int
TkMacOSXInitCGDrawing(
Tcl_Interp *interp,
- int enable,
+ TCL_UNUSED(int),
int limit)
{
static Boolean initialized = FALSE;
- (void)enable;
if (!initialized) {
initialized = TRUE;
@@ -100,6 +100,7 @@ TkMacOSXInitCGDrawing(
(char *) &useThemedFrame, TCL_LINK_BOOLEAN) != TCL_OK) {
Tcl_ResetResult(interp);
}
+ transparentColor = TkMacOSXClearPixel();
}
return TCL_OK;
}
@@ -546,7 +547,7 @@ TkMacOSXGetNSImageWithBitmap(
unsigned long origBackground = gc->background;
- gc->background = TRANSPARENT_PIXEL << 24;
+ gc->background = transparentColor;
XSetClipOrigin(display, gc, 0, 0);
XCopyPlane(display, bitmap, pixmap, gc, 0, 0, width, height, 0, 0, 1);
gc->background = origBackground;
@@ -665,17 +666,18 @@ TkMacOSXDrawCGImage(
dstBounds = CGRectOffset(dstBounds, macDraw->xOff, macDraw->yOff);
if (CGImageIsMask(image)) {
if (macDraw->flags & TK_IS_BW_PIXMAP) {
+
/*
* Set fill color to black; background comes from the context,
* or is transparent.
*/
- if (imageBackground != TRANSPARENT_PIXEL << 24) {
+ if (imageBackground != transparentColor) {
CGContextClearRect(context, dstBounds);
}
CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 1.0);
} else {
- if (imageBackground != TRANSPARENT_PIXEL << 24) {
+ if (imageBackground != transparentColor) {
TkMacOSXSetColorInContext(gc, imageBackground, context);
CGContextFillRect(context, dstBounds);
}
@@ -863,13 +865,12 @@ XFillPolygon(
GC gc, /* Use this GC. */
XPoint *points, /* Array of points. */
int npoints, /* Number of points. */
- int shape, /* Shape to draw. */
+ TCL_UNUSED(int), /* Shape to draw. */
int mode) /* Drawing mode. */
{
MacDrawable *macWin = (MacDrawable *) d;
TkMacOSXDrawingContext dc;
int i;
- (void)shape;
display->request++;
if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
@@ -1442,7 +1443,7 @@ XFillArcs(
int
TkScrollWindow(
Tk_Window tkwin, /* The window to be scrolled. */
- GC gc, /* GC for window to be scrolled. */
+ TCL_UNUSED(GC), /* GC for window to be scrolled. */
int x, int y, /* Position rectangle to be scrolled. */
int width, int height,
int dx, int dy, /* Distance rectangle should be moved. */
@@ -1455,7 +1456,6 @@ TkScrollWindow(
HIShapeRef dmgRgn = NULL, extraRgn = NULL;
NSRect bounds, visRect, scrollSrc, scrollDst;
int result = 0;
- (void)gc;
if (view) {
/*
@@ -1539,12 +1539,9 @@ TkScrollWindow(
void
TkMacOSXSetUpGraphicsPort(
- GC gc, /* GC to apply to current port. */
- void *destPort)
+ TCL_UNUSED(GC), /* GC to apply to current port. */
+ TCL_UNUSED(void *))
{
- (void)gc;
- (void)destPort;
-
Tcl_Panic("TkMacOSXSetUpGraphicsPort: Obsolete, no more QD!");
}
@@ -1571,7 +1568,7 @@ Bool
TkMacOSXSetupDrawingContext(
Drawable d,
GC gc,
- int useCG, /* advisory only ! */
+ TCL_UNUSED(int),
TkMacOSXDrawingContext *dcPtr)
{
MacDrawable *macDraw = (MacDrawable *) d;
@@ -1579,7 +1576,6 @@ TkMacOSXSetupDrawingContext(
NSWindow *win = NULL;
TkMacOSXDrawingContext dc = {};
CGRect clipBounds;
- (void)useCG;
/*
* If the drawable is not a pixmap and it has an associated NSWindow then
@@ -1652,8 +1648,7 @@ TkMacOSXSetupDrawingContext(
* cycle.
*/
- CGRect currentClip = CGContextGetClipBoundingBox(
- [NSGraphicsContext currentContext].CGContext);
+ CGRect currentClip = CGContextGetClipBoundingBox(GET_CGCONTEXT);
if (!NSContainsRect(currentClip, clipBounds)) {
[view addTkDirtyRect:clipBounds];
}
@@ -1749,6 +1744,7 @@ TkMacOSXSetupDrawingContext(
int num = 0;
char *p = &gc->dashes;
CGFloat dashOffset = gc->dash_offset;
+ dashOffset -= (gc->line_width % 2) ? 0.5 : 0.0;
CGFloat lengths[10];
while (p[num] != '\0' && num < 10) {
@@ -1872,30 +1868,6 @@ TkMacOSXGetClipRgn(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXSetUpClippingRgn --
- *
- * Set up the clipping region so that drawing only occurs on the specified
- * X subwindow.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacOSXSetUpClippingRgn(
- Drawable drawable) /* Drawable to update. */
-{
- (void)drawable;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpClipDrawableToRect --
*
* Clip all drawing into the drawable d to the given rectangle. If width
@@ -1912,13 +1884,12 @@ TkMacOSXSetUpClippingRgn(
void
TkpClipDrawableToRect(
- Display *display,
+ TCL_UNUSED(Display *),
Drawable d,
int x, int y,
int width, int height)
{
MacDrawable *macDraw = (MacDrawable *) d;
- (void)display;
if (macDraw->drawRgn) {
CFRelease(macDraw->drawRgn);
@@ -2004,12 +1975,9 @@ ClipToGC(
void *
TkMacOSXMakeStippleMap(
- Drawable drawable, /* Window to apply stipple. */
- Drawable stipple) /* The stipple pattern. */
+ TCL_UNUSED(Drawable), /* Window to apply stipple. */
+ TCL_UNUSED(Drawable)) /* The stipple pattern. */
{
- (void)drawable;
- (void)stipple;
-
return NULL;
}
diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c
index 934a50e..c24b819 100644
--- a/macosx/tkMacOSXImage.c
+++ b/macosx/tkMacOSXImage.c
@@ -308,7 +308,11 @@ DestroyImage(
* Get a single pixel from an image.
*
* Results:
- * Returns the 32 bit pixel value.
+ * The XColor structure contains an unsigned long field named pixel which
+ * identifies the color. This function returns the unsigned long that
+ * would be used as the pixel value of an XColor that has the same red
+ * green and blue components as the XImage pixel at the specified
+ * location.
*
* Side effects:
* None.
@@ -324,13 +328,18 @@ ImageGetPixel(
{
unsigned char r = 0, g = 0, b = 0;
+ /*
+ * Compute 8 bit red green and blue values, which are passed as inputs to
+ * TkMacOSXRGBPixel to produce the pixel value.
+ */
+
if (image && image->data) {
unsigned char *srcPtr = ((unsigned char*) image->data)
+ (y * image->bytes_per_line)
+ (((image->xoffset + x) * image->bits_per_pixel) / NBBY);
switch (image->bits_per_pixel) {
- case 32:
+ case 32: /* 8 bits per channel */
r = (*((unsigned int*) srcPtr) >> 16) & 0xff;
g = (*((unsigned int*) srcPtr) >> 8) & 0xff;
b = (*((unsigned int*) srcPtr) ) & 0xff;
@@ -340,12 +349,12 @@ ImageGetPixel(
r = srcPtr[1]; g = srcPtr[2]; b = srcPtr[3];
}*/
break;
- case 16:
+ case 16: /* 5 bits per channel */
r = (*((unsigned short*) srcPtr) >> 7) & 0xf8;
g = (*((unsigned short*) srcPtr) >> 2) & 0xf8;
b = (*((unsigned short*) srcPtr) << 3) & 0xf8;
break;
- case 8:
+ case 8: /* 2 bits per channel */
r = (*srcPtr << 2) & 0xc0;
g = (*srcPtr << 4) & 0xc0;
b = (*srcPtr << 6) & 0xc0;
@@ -353,7 +362,7 @@ ImageGetPixel(
g |= g >> 2 | g >> 4 | g >> 6;
b |= b >> 2 | b >> 4 | b >> 6;
break;
- case 4: {
+ case 4: { /* 1 bit per channel */
unsigned char c = (x % 2) ? *srcPtr : (*srcPtr >> 4);
r = (c & 0x04) ? 0xff : 0;
@@ -361,12 +370,13 @@ ImageGetPixel(
b = (c & 0x01) ? 0xff : 0;
break;
}
- case 1:
+ case 1: /* Black-white bitmap. */
r = g = b = ((*srcPtr) & (0x80 >> (x % 8))) ? 0xff : 0;
break;
}
}
- return (PIXEL_MAGIC << 24) | (r << 16) | (g << 8) | b;
+
+ return TkMacOSXRGBPixel(r, g, b);
}
/*
@@ -1004,15 +1014,15 @@ TkNSImageObjCmd(
static int
TkNSImageCreate(
- Tcl_Interp *interp, /* Interpreter for application using image. */
- const char *name, /* Name to use for image. */
- int objc, /* Number of arguments. */
- Tcl_Obj *const objv[], /* Argument strings for options (not
- * including image name or type). */
- const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used in callbacks. */
- ClientData *clientDataPtr) /* Store manager's token for image here; it
- * will be returned in later callbacks. */
+ Tcl_Interp *interp, /* Interpreter for application using image. */
+ const char *name, /* Name to use for image. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[], /* Argument strings for options (not
+ * including image name or type). */
+ TCL_UNUSED(const Tk_ImageType *), /* Pointer to our type record (not used). */
+ Tk_ImageMaster master, /* Token for image, to be used in callbacks. */
+ ClientData *clientDataPtr) /* Store manager's token for image here; it
+ * will be returned in later callbacks. */
{
TkNSImageMaster *masterPtr;
Tk_OptionTable optionTable = Tk_CreateOptionTable(interp, systemImageOptions);
@@ -1064,8 +1074,7 @@ TkNSImageCreate(
static ClientData
TkNSImageGet(
- Tk_Window tkwin, /* Token for window in which image will be
- * used. */
+ TCL_UNUSED(Tk_Window), /* Window in which the image will be used. */
ClientData clientData) /* Pointer to TkNSImageMaster for image. */
{
TkNSImageMaster *masterPtr = (TkNSImageMaster *) clientData;
@@ -1095,7 +1104,7 @@ TkNSImageGet(
static void
TkNSImageDisplay(
ClientData clientData, /* Pointer to TkNSImageInstance for image. */
- Display *display, /* Display to use for drawing. */
+ TCL_UNUSED(Display *), /* Display to use for drawing. */
Drawable drawable, /* Where to draw or redraw image. */
int imageX, int imageY, /* Origin of area to redraw, relative to
* origin of image. */
@@ -1151,7 +1160,7 @@ TkNSImageDisplay(
static void
TkNSImageFree(
ClientData clientData, /* Pointer to TkNSImageInstance for instance. */
- Display *display) /* Display where image was to be drawn. */
+ TCL_UNUSED(Display *)) /* Display where image was to be drawn. */
{
TkNSImageInstance *instPtr = (TkNSImageInstance *) clientData;
ckfree(instPtr);
@@ -1199,7 +1208,7 @@ TkNSImageDelete(
*
* Results:
* Returns a standard Tcl completion code, and leaves an error message in
- * the interp's result if an error occurs.
+ * the interp's result if an eTCL_UNUSED(rror occurs.
*
* Side effects:
* Creates the command:
@@ -1210,7 +1219,7 @@ TkNSImageDelete(
int
TkMacOSXNSImage_Init(
- Tcl_Interp *interp) /* Interpreter for application. */
+ TCL_UNUSED(Tcl_Interp *)) /* Interpreter for application. */
{
Tk_CreateImageType(&TkNSImageType);
return 1;
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index dbc82cc..ca85d07 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -32,7 +32,9 @@ static char scriptPath[PATH_MAX + 1] = "";
* Forward declarations...
*/
-static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
+static int TkMacOSXGetAppPathObjCmd(ClientData cd, Tcl_Interp *ip,
+ int objc, Tcl_Obj *const objv[]);
+static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip,
int objc, Tcl_Obj *const objv[]);
#pragma mark TKApplication(TKInit)
@@ -255,38 +257,6 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
/*
*----------------------------------------------------------------------
*
- * TkMacOSXMinorVersion --
- *
- * Tcl command which returns the minor version number of the currently
- * running operating system.
- *
- * Results:
- * Returns the minor version number.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-static int
-TkMacOSXMinorVersion(
- ClientData cd,
- Tcl_Interp *ip,
- int objc,
- Tcl_Obj *const objv[])
-{
- static char version[16] = "";
- if (version[0] == '\0') {
- snprintf(version, 16, "%d", [NSApp macOSVersion]);
- }
- Tcl_SetResult(ip, version, NULL);
- return TCL_OK;
-}
-
-
-/*
- *----------------------------------------------------------------------
- *
* TkpInit --
*
* Performs Mac-specific interpreter initialization related to the
@@ -469,9 +439,9 @@ TkpInit(
Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap",
TkMacOSXIconBitmapObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath",
- TkMacOSXGetAppPathCmd, NULL, NULL);
+ TkMacOSXGetAppPathObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tk::mac::macOSVersion",
- TkMacOSXMinorVersion, NULL, NULL);
+ TkMacOSVersionObjCmd, NULL, NULL);
return TCL_OK;
}
@@ -515,7 +485,7 @@ TkpGetAppName(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXGetAppPathCmd --
+ * TkMacOSXGetAppPathObjCmd --
*
* Returns the path of the Wish application bundle.
*
@@ -529,7 +499,7 @@ TkpGetAppName(
*/
static int
-TkMacOSXGetAppPathCmd(
+TkMacOSXGetAppPathObjCmd(
ClientData dummy,
Tcl_Interp *interp,
int objc,
@@ -565,6 +535,43 @@ TkMacOSXGetAppPathCmd(
/*
*----------------------------------------------------------------------
*
+ * TkMacOSVersionObjCmd --
+ *
+ * Tcl command which returns an integer encoding the major and minor
+ * version numbers of the currently running operating system in the
+ * form 10000*majorVersion + 100*minorVersion.
+ *
+ * Results:
+ * Returns the OS version.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TkMacOSVersionObjCmd(
+ TCL_UNUSED(void *), /* ClientData */
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ static char version[16] = "";
+ if (objc > 1) {
+ Tcl_WrongNumArgs(interp, 1, objv, NULL);
+ return TCL_ERROR;
+ }
+ if (version[0] == '\0') {
+ snprintf(version, 16, "%d", [NSApp macOSVersion]);
+ }
+ Tcl_SetResult(interp, version, NULL);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkpDisplayWarning --
*
* This routines is called from Tk_Main to display warning messages that
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index 3ddc779..69bc40f 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -267,6 +267,8 @@ static NSUInteger textInputModifiers;
@implementation TKContentView
+@synthesize tkDirtyRect = _tkDirtyRect;
+@synthesize tkNeedsDisplay = _tkNeedsDisplay;;
/*
* Implementation of the NSTextInputClient protocol.
diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c
index ca2a9e5..67ecba3 100644
--- a/macosx/tkMacOSXKeyboard.c
+++ b/macosx/tkMacOSXKeyboard.c
@@ -154,6 +154,8 @@ static int KeyDataToUnicode(UniChar *uniChars, int maxChars,
(void)notification;
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
+#else
+ (void)notification;
#endif
keyboardChanged = YES;
UpdateKeymaps();
@@ -489,13 +491,12 @@ XKeycodeToKeysym(
const char *
TkpGetString(
- TkWindow *winPtr, /* Window where event occurred: Needed to get
+ TCL_UNUSED(TkWindow *), /* Window where event occurred: Needed to get
* input context. */
XEvent *eventPtr, /* X keyboard event. */
Tcl_DString *dsPtr) /* Uninitialized or empty string to hold
* result. */
{
- (void) winPtr; /*unused*/
MacKeycode macKC;
char utfChars[8];
int length = 0;
@@ -588,19 +589,15 @@ XFreeModifiermap(
char *
XKeysymToString(
- KeySym keysym)
+ TCL_UNUSED(KeySym))
{
- (void)keysym;
-
return NULL;
}
KeySym
XStringToKeysym(
- const char* string)
+ TCL_UNUSED(const char *))
{
- (void)string;
-
return NoSymbol;
}
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 230cead..05dc5e1 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -95,7 +95,6 @@ static int gNoTkMenus = 0; /* This is used by Tk_MacOSXTurnOffMenus as
* the flag that Tk is not to draw any
* menus. */
static int inPostMenu = 0;
-static unsigned long defaultBg = 0, defaultFg = 0;
static SInt32 menuMarkColumnWidth = 0, menuIconTrailingEdgeMargin = 0;
static SInt32 menuTextLeadingEdgeMargin = 0, menuTextTrailingEdgeMargin = 0;
static SInt16 menuItemExtraHeight = 0, menuItemExtraWidth = 0;
@@ -124,7 +123,7 @@ static int ModifierCharWidth(Tk_Font tkfont);
* the menu was posted. For example, opening a menu during the Rube Goldberg
* demo would cause the animation to stop. This was also the case for
* menubuttons.
- *
+ *
* The TKBackground object below works around this problem, and allows a Tk
* event loop to run while a menu is open. It is a subclass of NSThread which
* inserts requests to call [NSApp _runBackgroundLoop] onto the queue
@@ -139,34 +138,35 @@ static int ModifierCharWidth(Tk_Font tkfont);
@implementation TKBackgroundLoop
- (void) main
{
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSArray *modeArray = [NSArray arrayWithObjects: NSEventTrackingRunLoopMode,
nil];
while(1) {
-
+
/*
* Queue a request to process Tk events during event tracking.
*/
-
- [NSApp performSelectorOnMainThread:@selector(_runBackgroundLoop)
+
+ [NSApp performSelectorOnMainThread:@selector(_runBackgroundLoop)
withObject:nil
- waitUntilDone:true
+ waitUntilDone:true
modes:modeArray];
- if (self.cancelled) {
+ if ([self isCancelled]) {
[NSThread exit];
}
-
+
/*
* Allow the tracked events to be processed too.
*/
[NSThread sleepForTimeInterval:0.001];
- }
+ }
+ [pool drain];
}
@end
TKBackgroundLoop *backgroundLoop = nil;
-
#pragma mark TKMenu
/*
@@ -692,8 +692,19 @@ TkpConfigureMenuEntry(
NSDictionary *attributes;
int imageWidth, imageHeight;
GC gc = (mePtr->textGC ? mePtr->textGC : mePtr->menuPtr->textGC);
- Tcl_Obj *fontPtr = (mePtr->fontPtr ? mePtr->fontPtr :
- mePtr->menuPtr->fontPtr);
+ Tcl_Obj *fontPtr = (mePtr->fontPtr ?
+ mePtr->fontPtr : mePtr->menuPtr->fontPtr);
+ static unsigned long defaultBg, defaultFg;
+ static int initialized = 0;
+
+ if (!initialized) {
+ TkColor *tkColPtr = TkpGetColor(NULL, DEF_MENU_BG_COLOR);
+ defaultBg = tkColPtr->color.pixel;
+ ckfree(tkColPtr);
+ tkColPtr = TkpGetColor(NULL, DEF_MENU_FG);
+ defaultFg = tkColPtr->color.pixel;
+ ckfree(tkColPtr);
+ }
if (mePtr->image) {
Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight);
@@ -708,7 +719,6 @@ TkpConfigureMenuEntry(
image = TkMacOSXGetNSImageWithBitmap(mePtr->menuPtr->display, bitmap,
gc, imageWidth, imageHeight);
if (gc->foreground == defaultFg) {
- // Use a semantic foreground color by default
[image setTemplate:YES];
}
}
@@ -1109,8 +1119,8 @@ TkpSetMainMenubar(
if (winPtr->wmInfoPtr &&
winPtr->wmInfoPtr->menuPtr &&
- winPtr->wmInfoPtr->menuPtr->masterMenuPtr) {
- menubar = winPtr->wmInfoPtr->menuPtr->masterMenuPtr->tkwin;
+ winPtr->wmInfoPtr->menuPtr->mainMenuPtr) {
+ menubar = winPtr->wmInfoPtr->menuPtr->mainMenuPtr->tkwin;
}
/*
@@ -1164,25 +1174,25 @@ static void
CheckForSpecialMenu(
TkMenu *menuPtr) /* The menu we are checking */
{
- if (!menuPtr->masterMenuPtr->tkwin) {
+ if (!menuPtr->mainMenuPtr->tkwin) {
return;
}
for (TkMenuEntry *cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
cascadeEntryPtr;
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
if (cascadeEntryPtr->menuPtr->menuType == MENUBAR
- && cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin) {
- TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr;
+ && cascadeEntryPtr->menuPtr->mainMenuPtr->tkwin) {
+ TkMenu *mainMenuPtr = cascadeEntryPtr->menuPtr->mainMenuPtr;
int i = 0;
Tcl_DString ds;
Tcl_DStringInit(&ds);
- Tcl_DStringAppend(&ds, Tk_PathName(masterMenuPtr->tkwin), -1);
+ Tcl_DStringAppend(&ds, Tk_PathName(mainMenuPtr->tkwin), -1);
while (specialMenus[i].name) {
Tcl_DStringAppend(&ds, specialMenus[i].name,
specialMenus[i].len);
if (strcmp(Tcl_DStringValue(&ds),
- Tk_PathName(menuPtr->masterMenuPtr->tkwin)) == 0) {
+ Tk_PathName(menuPtr->mainMenuPtr->tkwin)) == 0) {
cascadeEntryPtr->entryFlags |= specialMenus[i].flag;
} else {
cascadeEntryPtr->entryFlags &= ~specialMenus[i].flag;
@@ -1341,7 +1351,7 @@ TkpComputeStandardMenuGeometry(
* Do nothing if this menu is a clone.
*/
- if (menuPtr->tkwin == NULL || menuPtr->masterMenuPtr != menuPtr) {
+ if (menuPtr->tkwin == NULL || menuPtr->mainMenuPtr != menuPtr) {
return;
}
@@ -1692,7 +1702,7 @@ Tk_MacOSXTurnOffMenus(void)
void
TkpMenuInit(void)
{
- TkColor *tkColPtr;
+ // TkColor *tkColPtr;
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
@@ -1703,13 +1713,6 @@ TkpMenuInit(void)
#undef observe
[NSMenuItem setUsesUserKeyEquivalents:NO];
- tkColPtr = TkpGetColor(NULL, DEF_MENU_BG_COLOR);
- defaultBg = tkColPtr->color.pixel;
- ckfree(tkColPtr);
- tkColPtr = TkpGetColor(NULL, DEF_MENU_FG);
- defaultFg = tkColPtr->color.pixel;
- ckfree(tkColPtr);
-
ChkErr(GetThemeMetric, kThemeMetricMenuMarkColumnWidth,
&menuMarkColumnWidth);
ChkErr(GetThemeMetric, kThemeMetricMenuTextLeadingEdgeMargin,
diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c
index 438053e..8eed4f0 100644
--- a/macosx/tkMacOSXMenubutton.c
+++ b/macosx/tkMacOSXMenubutton.c
@@ -181,13 +181,6 @@ TkpDisplayMenuButton(
TkMacOSXComputeMenuButtonDrawParams(butPtr, dpPtr);
/*
- * Set up clipping region. Make sure the we are using the port for this
- * button, or we will set the wrong window's clip.
- */
-
- TkMacOSXSetUpClippingRgn(pixmap);
-
- /*
* Draw the native portion of the buttons.
*/
diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c
index 995d845..a4f971f 100644
--- a/macosx/tkMacOSXNotify.c
+++ b/macosx/tkMacOSXNotify.c
@@ -156,6 +156,7 @@ void DebugPrintQueue(void)
* this block should be removed.
*/
+# if MAC_OSX_VERSION_MAX_ALLOWED >= 101500
if ([theEvent type] == NSAppKitDefined) {
static Bool aWindowIsMoving = NO;
switch([theEvent subtype]) {
@@ -174,6 +175,8 @@ void DebugPrintQueue(void)
break;
}
}
+#endif
+
[super sendEvent:theEvent];
[NSApp tkCheckPasteboard];
@@ -186,7 +189,9 @@ void DebugPrintQueue(void)
- (void) _runBackgroundLoop
{
- while(Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT)){};
+ while(Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_TIMER_EVENTS|TCL_DONT_WAIT)){
+ TkMacOSXDrawAllViews(NULL);
+ }
}
@end
diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h
index 28010ec..87f438d 100644
--- a/macosx/tkMacOSXPort.h
+++ b/macosx/tkMacOSXPort.h
@@ -131,29 +131,15 @@
*/
#define TK_NO_DOUBLE_BUFFERING 1
+#define TK_HAS_DYNAMIC_COLORS 1
+#define TK_DYNAMIC_COLORMAP 0x0fffffff
/*
- * Magic pixel code values for system colors.
- *
- * NOTE: values must be kept in sync with indices into the
- * systemColorMap array in tkMacOSXColor.c !
- */
-
-#define TRANSPARENT_PIXEL 30
-#define APPEARANCE_PIXEL 52
-#define PIXEL_MAGIC ((unsigned char) 0x69)
-
-/*
- * The following macro returns the pixel value that corresponds to the
- * 16-bit RGB values in the given XColor structure.
- * The format is: (PIXEL_MAGIC << 24) | (R << 16) | (G << 8) | B
- * where each of R, G and B is the high order byte of a 16-bit component.
+ * Used by xcolor.c
*/
-#define TkpGetPixel(p) ((((((PIXEL_MAGIC << 8) \
- | (((p)->red >> 8) & 0xff)) << 8) \
- | (((p)->green >> 8) & 0xff)) << 8) \
- | (((p)->blue >> 8) & 0xff))
-
+MODULE_SCOPE unsigned long TkMacOSXRGBPixel(unsigned long red, unsigned long green,
+ unsigned long blue);
+#define TkpGetPixel(p) (TkMacOSXRGBPixel(p->red >> 8, p->green >> 8, p->blue >> 8))
#endif /* _TKMACPORT */
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 69dfbc1..4d9666a 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -310,6 +310,7 @@ MODULE_SCOPE int TkMacOSXNSImage_Init(Tcl_Interp *interp);
MODULE_SCOPE void TkMacOSXWinNSBounds(TkWindow *winPtr, NSView *view,
NSRect *bounds);
MODULE_SCOPE void TkMacOSXDrawAllViews(ClientData clientData);
+MODULE_SCOPE unsigned long TkMacOSXClearPixel(void);
#pragma mark Private Objective-C Classes
@@ -341,13 +342,17 @@ VISIBILITY_HIDDEN
NSArray *_defaultHelpMenuItems, *_defaultFileMenuItems;
NSAutoreleasePool *_mainPool;
NSThread *_backgoundLoop;
+
#ifdef __i386__
+
/* The Objective C runtime used on i386 requires this. */
int _poolLock;
int _macOSVersion; /* 10000 * major + 100*minor */
Bool _isDrawing;
Bool _needsToDraw;
+
#endif
+
}
@property int poolLock;
@property int macOSVersion;
diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c
index a4c2046..80b1bda 100644
--- a/macosx/tkMacOSXScale.c
+++ b/macosx/tkMacOSXScale.c
@@ -219,7 +219,6 @@ TkpDisplayScale(
destPort = TkMacOSXGetDrawablePort(Tk_WindowId(tkwin));
windowRef = TkMacOSXDrawableWindow(Tk_WindowId(tkwin));
portChanged = QDSwapPort(destPort, &savePort);
- TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin));
/*
* Create Macintosh control.
@@ -416,7 +415,6 @@ MacScaleEventProc(
destPort = TkMacOSXGetDrawablePort(Tk_WindowId(macScalePtr->info.tkwin));
portChanged = QDSwapPort(destPort, &savePort);
- TkMacOSXSetUpClippingRgn(Tk_WindowId(macScalePtr->info.tkwin));
TkMacOSXWinBounds((TkWindow *) macScalePtr->info.tkwin, &bounds);
where.h = eventPtr->xbutton.x + bounds.left;
diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c
index 974fec1..6e1a9a1 100644
--- a/macosx/tkMacOSXServices.c
+++ b/macosx/tkMacOSXServices.c
@@ -20,12 +20,10 @@
static int
ServicesEventProc(
- Tcl_Event *event,
- int flags)
+ TCL_UNUSED(Tcl_Event *),
+ TCL_UNUSED(int))
{
TkMainInfo *info = TkGetMainInfoList();
- (void)event;
- (void)flags;
Tcl_GlobalEval(info->interp, "::tk::mac::PerformService");
return 1;
@@ -143,9 +141,8 @@ ServicesEventProc(
int
TkMacOSXServices_Init(
- Tcl_Interp *dummy)
+ TCL_UNUSED(Tcl_Interp *))
{
- (void)dummy;
/*
* Initialize an instance of TkService and register it with the NSApp.
*/
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index c631486..e1e57bb 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -51,11 +51,10 @@ static void NotifyVisibility(TkWindow *winPtr, XEvent *eventPtr);
int
XDestroyWindow(
- Display *display, /* Display. */
+ TCL_UNUSED(Display *), /* Display. */
Window window) /* Window. */
{
MacDrawable *macWin = (MacDrawable *) window;
- (void)display;
/*
* Remove any dangling pointers that may exist if the window we are
@@ -206,7 +205,15 @@ XMapWindow(
event.xmap.type = MapNotify;
event.xmap.event = window;
event.xmap.override_redirect = winPtr->atts.override_redirect;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+
+ /*
+ * To update the mapped status of packed or placed subwindows
+ * we handle this event immediately and then process the idle
+ * events that it generates.
+ */
+
+ Tk_HandleEvent(&event);
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
} else {
/*
@@ -316,7 +323,15 @@ XUnmapWindow(
event.xunmap.window = window;
event.xunmap.event = window;
event.xunmap.from_configure = false;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+
+ /*
+ * To update the mapped status of packed or placed subwindows
+ * we handle this event immediately and then process the idle
+ * events that it generates.
+ */
+
+ Tk_HandleEvent(&event);
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
} else {
/*
* Rebuild the visRgn clip region for the parent so it will be allowed
@@ -675,11 +690,10 @@ XConfigureWindow(
Display *display, /* Display. */
Window w, /* Window. */
unsigned int value_mask,
- XWindowChanges *values)
+ TCL_UNUSED(XWindowChanges *))
{
MacDrawable *macWin = (MacDrawable *) w;
TkWindow *winPtr = macWin->winPtr;
- (void)values;
display->request++;
@@ -984,14 +998,13 @@ TkMacOSXVisableClipRgn(
static OSStatus
InvalViewRect(
int msg,
- HIShapeRef rgn,
+ TCL_UNUSED(HIShapeRef),
const CGRect *rect,
void *ref)
{
static CGAffineTransform t;
TKContentView *view = ref;
NSRect dirtyRect;
- (void)rgn;
if (!view) {
return paramErr;
@@ -1120,10 +1133,8 @@ TkMacOSXDrawable(
void *
TkMacOSXGetDrawablePort(
- Drawable drawable)
+ TCL_UNUSED(Drawable))
{
- (void)drawable;
-
return NULL;
}
@@ -1450,13 +1461,12 @@ UpdateOffsets(
Pixmap
Tk_GetPixmap(
Display *display, /* Display for new pixmap (can be null). */
- Drawable d, /* Drawable where pixmap will be used (ignored). */
+ TCL_UNUSED(Drawable), /* Drawable where pixmap will be used (ignored). */
int width, /* Dimensions of pixmap. */
int height,
int depth) /* Bits per pixel for pixmap. */
{
MacDrawable *macPix;
- (void)d;
if (display != NULL) {
display->request++;
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 5358bc2..6cb0a13 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -26,9 +26,11 @@ static int DebuggerObjCmd (ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
#endif
static int PressButtonObjCmd (ClientData dummy, Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
+ int objc, Tcl_Obj *const *objv);
static int InjectKeyEventObjCmd (ClientData dummy, Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
+ int objc, Tcl_Obj *const *objv);
+static int MenuBarHeightObjCmd (ClientData dummy, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const *objv);
/*
@@ -61,7 +63,7 @@ TkplatformtestInit(
#endif
Tcl_CreateObjCommand(interp, "pressbutton", PressButtonObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "injectkeyevent", InjectKeyEventObjCmd, NULL, NULL);
-
+ Tcl_CreateObjCommand(interp, "menubarheight", MenuBarHeightObjCmd, NULL, NULL);
return TCL_OK;
}
@@ -98,22 +100,48 @@ DebuggerObjCmd(
/*
*----------------------------------------------------------------------
*
+ * MenuBarHeightObjCmd --
+ *
+ * This procedure calls [NSMenu menuBarHeight] and returns the result
+ * as an integer. Windows can never be placed to overlap the MenuBar,
+ * so tests need to be aware of its size.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+MenuBarHeightObjCmd(
+ TCL_UNUSED(void *), /* Not used. */
+ Tcl_Interp *interp, /* Not used. */
+ TCL_UNUSED(int), /* Not used. */
+ TCL_UNUSED(Tcl_Obj *const *)) /* Not used. */
+{
+ static int height = 0;
+ if (height == 0) {
+ height = (int) [[NSApp mainMenu] menuBarHeight];
+ }
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(height));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkTestLogDisplay --
*
* The test image display procedure calls this to determine whether it
- * should write a log message recording that it has being run. On OSX
- * 10.14 and later, only calls to the display procedure which occur inside
- * of the drawRect method should be logged, since those are the only ones
- * which actually draw anything. On earlier systems the opposite is true.
- * The calls from within the drawRect method are redundant, since the
- * first time the display procedure is run it will do the drawing and that
- * first call will usually not occur inside of drawRect.
+ * should write a log message recording that it has being run.
*
* Results:
- * On OSX 10.14 and later, returns true if and only if the NSView of the
- * drawable is the current focusView, which can only be the case when
- * within [NSView drawRect]. On earlier systems returns false if
- * and only if called from with [NSView drawRect].
+ * Returns true if and only if the NSView of the drawable is the
+ * current focusView, which on 10.14 and newer systems can only be the
+ * case when within [NSView drawRect].
*
* Side effects:
* None
@@ -133,18 +161,11 @@ TkTestLogDisplay(
} else if (macWin->winPtr && macWin->winPtr->wmInfoPtr &&
macWin->winPtr->wmInfoPtr->window) {
win = macWin->winPtr->wmInfoPtr->window;
- }/*
- else if (macWin->toplevel && (macWin->toplevel->flags & TK_EMBEDDED)) {
- TkWindow *contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);
- if (contWinPtr) {
- win = TkMacOSXDrawableWindow((Drawable) contWinPtr->privatePtr);
- }
- }*/
- if (win && [NSApp macOSVersion] >= 101400) {
- TKContentView *view = [win contentView];
- return (view == [NSView focusView]);
+ }
+ if (win) {
+ return ([win contentView] == [NSView focusView]);
} else {
- return ![NSApp isDrawing];
+ return True;
}
}
@@ -169,7 +190,7 @@ TkTestLogDisplay(
static int
PressButtonObjCmd(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -181,7 +202,6 @@ PressButtonObjCmd(
NSArray *screens = [NSScreen screens];
CGFloat ScreenHeight = 0;
enum {X=1, Y};
- (void)dummy;
if (screens && [screens count]) {
ScreenHeight = [[screens objectAtIndex:0] frame].size.height;
@@ -246,7 +266,7 @@ PressButtonObjCmd(
static int
InjectKeyEventObjCmd(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -263,7 +283,6 @@ InjectKeyEventObjCmd(
NSEvent *keyEvent;
NSUInteger type;
MacKeycode macKC;
- (void)dummy;
if (objc < 3) {
wrongArgs:
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 8ef3c71..382329f 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -210,6 +210,9 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
TkWindow *winPtr = TkMacOSXGetTkWindow(window);
if (winPtr) {
TKContentView *view = [window contentView];
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+ [view viewDidChangeEffectiveAppearance];
+#endif
[view addTkDirtyRect:[view bounds]];
Tcl_CancelIdleCall(TkMacOSXDrawAllViews, NULL);
Tcl_DoWhenIdle(TkMacOSXDrawAllViews, NULL);
@@ -1079,43 +1082,85 @@ ConfigureRestrictProc(
}
/*
- * This method is called when a user changes between light and dark mode. The
- * implementation here generates a Tk virtual event which can be bound to a
- * function that redraws the window in an appropriate style.
+ * In macOS 10.14 and later his method is called when a user changes between
+ * light and dark mode or changes the accent color. The implementation
+ * generates two virtual events. The first is either <<LightAqua>> or
+ * <<DarkAqua>>, depending on the view's current effective appearance. The
+ * second is <<AppearnceChanged>> and has a data string describing the
+ * effective appearance of the view and the current accent and highlight
+ * colors.
*/
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+
+static const char *accentNames[] = {
+ "Graphite",
+ "Red",
+ "Orange",
+ "Yellow",
+ "Green",
+ "Blue",
+ "Purple",
+ "Pink",
+};
+
- (void) viewDidChangeEffectiveAppearance
{
- XVirtualEvent event;
- int x, y;
- NSWindow *w = [self window];
- TkWindow *winPtr = TkMacOSXGetTkWindow(w);
- Tk_Window tkwin = (Tk_Window) winPtr;
-
- if (!winPtr) {
+ Tk_Window tkwin = (Tk_Window) TkMacOSXGetTkWindow([self window]);
+ if (!tkwin) {
return;
}
- bzero(&event, sizeof(XVirtualEvent));
- event.type = VirtualEvent;
- event.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
- event.send_event = false;
- event.display = Tk_Display(tkwin);
- event.event = Tk_WindowId(tkwin);
- event.root = XRootWindow(Tk_Display(tkwin), 0);
- event.subwindow = None;
- event.time = TkpGetMS();
- XQueryPointer(NULL, winPtr->window, NULL, NULL,
- &event.x_root, &event.y_root, &x, &y, &event.state);
- Tk_TopCoordsToWindow(tkwin, x, y, &event.x, &event.y);
- event.same_screen = true;
- if (TkMacOSXInDarkMode(tkwin)) {
- event.name = Tk_GetUid("DarkAqua");
- } else {
- event.name = Tk_GetUid("LightAqua");
+ NSAppearanceName effectiveAppearanceName = [[self effectiveAppearance] name];
+ const char *accentName, *highlightName;
+ NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
+ NSString *accent = [preferences stringForKey:@"AppleAccentColor"];
+ NSString *highlight = [[[preferences stringForKey:@"AppleHighlightColor"]
+ componentsSeparatedByString: @" "]
+ objectAtIndex:3];
+ static const char *defaultColor = NULL;
+
+ if (!defaultColor) {
+ defaultColor = [NSApp macOSVersion] < 110000 ? "Blue" : "Multicolor";
+
+ /*
+ * AppKit calls this method when the user changes the Accent Color
+ * but not when the user changes the Highlight Color. So we register
+ * to receive KVO notifications for Highlight Color as well.
+ */
+
+ [preferences addObserver:self
+ forKeyPath:@"AppleHighlightColor"
+ options:NSKeyValueObservingOptionNew
+ context:NULL];
+ }
+ accentName = accent ? accentNames[1 + accent.intValue] : defaultColor;
+ highlightName = highlight ? highlight.UTF8String: defaultColor;
+
+ char data[256];
+ snprintf(data, 256, "Appearance %s Accent %s Highlight %s",
+ effectiveAppearanceName.UTF8String, accentName,
+ highlightName);
+ TkSendVirtualEvent(tkwin, "AppearanceChanged", Tcl_NewStringObj(data, -1));
+ if (effectiveAppearanceName == NSAppearanceNameAqua) {
+ TkSendVirtualEvent(tkwin, "LightAqua", NULL);
+ } else if (effectiveAppearanceName == NSAppearanceNameDarkAqua) {
+ TkSendVirtualEvent(tkwin, "DarkAqua", NULL);
}
- Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
}
+- (void)observeValueForKeyPath:(NSString *)keyPath
+ ofObject:(id)object
+ change:(NSDictionary *)change
+ context:(void *)context
+{
+ NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
+ if (object == preferences && [keyPath isEqualToString:@"AppleHighlightColor"]) {
+ [self viewDidChangeEffectiveAppearance];
+ }
+}
+
+#endif
+
/*
* This is no-op on 10.7 and up because Apple has removed this widget, but we
* are leaving it here for backwards compatibility.
@@ -1152,13 +1197,6 @@ ConfigureRestrictProc(
Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
}
-- (BOOL) isOpaque
-{
- NSWindow *w = [self window];
- return (w && (([w styleMask] & NSTexturedBackgroundWindowMask) ||
- ![w isOpaque]) ? NO : YES);
-}
-
/*
* On Catalina this is never called and drawRect clips to the rect that
* is passed to it by AppKit.
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 4651c2d..725342e 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1806,7 +1806,6 @@ WmDeiconifyCmd(
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
-
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't deiconify %s: it is an icon for %s",
@@ -6421,17 +6420,15 @@ TkpWmSetState(
Tk_UnmapWindow((Tk_Window) winPtr);
} else if (state == NormalState || state == ZoomState) {
Tk_MapWindow((Tk_Window) winPtr);
- if (macWin && ([macWin styleMask] & NSMiniaturizableWindowMask)) {
- if ([macWin isMiniaturized]) {
- [macWin deminiaturize:NSApp];
- }
- else {
- [macWin orderFront:nil];
- }
- }
- TkMacOSXZoomToplevel(macWin, state == NormalState ? inZoomIn :
- inZoomOut);
+ [macWin deminiaturize:NSApp];
+ [macWin orderFront:NSApp];
+ TkMacOSXZoomToplevel(macWin, state == NormalState ? inZoomIn : inZoomOut);
}
+ /*
+ * Make sure windows are updated after the state change.
+ */
+
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)){}
}
/*
@@ -6877,7 +6874,6 @@ ApplyWindowAttributeFlagChanges(
b |= (NSWindowCollectionBehaviorCanJoinAllSpaces |
NSWindowCollectionBehaviorFullScreenAuxiliary);
} else {
- NSSize screenSize = [[macWindow screen] frame].size;
b |= NSWindowCollectionBehaviorFullScreenPrimary;
/*
@@ -6888,7 +6884,10 @@ ApplyWindowAttributeFlagChanges(
* to the screen size. (For 10.11 and up, only)
*/
if ([NSApp macOSVersion] > 101000) {
+#if !(MAC_OS_X_VERSION_MAX_ALLOWED > 101000)
+ NSSize screenSize = [[macWindow screen] frame].size;
[macWindow setMaxFullScreenContentSize:screenSize];
+#endif
}
}
}
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index c6ea384..f1ac020 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -256,8 +256,8 @@ XkbOpenDisplay(
*/
screen->root = ROOT_ID;
screen->display = display;
- screen->black_pixel = 0x00000000 | PIXEL_MAGIC << 24;
- screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24;
+ screen->black_pixel = 0x00000000;
+ screen->white_pixel = 0x00FFFFFF;
screen->ext_data = (XExtData *) &maxBounds;
screen->root_visual = (Visual *)ckalloc(sizeof(Visual));
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 89dd7ce..948d210 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -32,8 +32,26 @@
#include "tkMacOSXPrivate.h"
#include "ttk/ttkTheme.h"
#include "ttkMacOSXTheme.h"
+#include "tkColor.h"
#include <math.h>
+static NSColor *controlAccentColor(void) {
+ static int accentPixel = -1;
+ if (accentPixel == -1) {
+ TkColor *temp = TkpGetColor(NULL, "systemControlAccentColor");
+ accentPixel = temp->color.pixel;
+ ckfree(temp);
+ }
+ return TkMacOSXGetNSColor(NULL, accentPixel);
+}
+
+/*
+ * Padding values which depend on the OS version. These are initialized
+ * in Ttk_MacOSXInit.
+ */
+
+static Ttk_Padding entryElementPadding;
+
/*----------------------------------------------------------------------
* +++ ComputeButtonDrawInfo --
*
@@ -45,7 +63,7 @@
static inline HIThemeButtonDrawInfo ComputeButtonDrawInfo(
ThemeButtonParams *params,
Ttk_State state,
- TCL_UNUSED(Tk_Window) /* tkwin */)
+ TCL_UNUSED(Tk_Window))
{
/*
* See ButtonElementDraw for the explanation of why we always draw
@@ -153,26 +171,6 @@ CGColorFromGray(
#endif
-/*
- * Apple introduced the "semantic color" named controlAccentColor in OSX 10.14.
- * Prior to that release there was a system preferences setting for the system
- * "tint" which could be used to produce the accent color (blue or graphite
- * only).
- */
-
-static NSColor *controlAccentColor(void)
-{
- NSColor *color = nil;
- if ([NSApp macOSVersion] > 101400) {
- if (@available(macOS 10.14, *)) {
- color = [NSColor controlAccentColor];
- }
- } else {
- color = [NSColor colorForControlTint:[NSColor currentControlTint]];
- }
- return color;
-}
-
/*----------------------------------------------------------------------
* +++ Utilities.
*/
@@ -297,7 +295,7 @@ static CGRect NormalizeButtonBounds(
RGBACOLOR windowBackground[4] = RGBA256(235.0, 235.0, 235.0, 1.0);
/*----------------------------------------------------------------------
- * GetBackgroundColorRGBA --
+ * GetBackgroundColor --
*
* Fills the array rgba with the color coordinates for a background color.
* Start with the background color of a window's geometry master, or the
@@ -308,6 +306,7 @@ RGBACOLOR windowBackground[4] = RGBA256(235.0, 235.0, 235.0, 1.0);
*/
static void GetBackgroundColorRGBA(
+ TCL_UNUSED(CGContextRef),
Tk_Window tkwin,
int contrast,
CGFloat *rgba)
@@ -359,11 +358,12 @@ static void GetBackgroundColorRGBA(
}
static CGColorRef GetBackgroundCGColor(
+ CGContextRef context,
Tk_Window tkwin,
int contrast)
{
CGFloat rgba[4];
- GetBackgroundColorRGBA(tkwin, contrast, rgba);
+ GetBackgroundColorRGBA(context, tkwin, contrast, rgba);
return CGColorFromRGBA(rgba);
}
@@ -447,9 +447,9 @@ static void DrawFocusRing(
{
CGColorRef highlightColor;
CGFloat highlight[4] = {1.0, 1.0, 1.0, 0.2};
- NSColor *accent = controlAccentColor();
- CGColorRef focusColor = CGCOLOR([accent colorWithAlphaComponent:0.6]);
+ CGColorRef focusColor;
+ focusColor = CGCOLOR([controlAccentColor() colorWithAlphaComponent:0.6]);
FillRoundedRectangle(context, bounds, design->radius, focusColor);
bounds = CGRectInset(bounds, 3, 3);
highlightColor = CGColorFromRGBA(highlight);
@@ -495,7 +495,7 @@ static void DrawGrayButton(
*/
CGFloat rgba[4], gray;
- GetBackgroundColorRGBA(tkwin, 0, rgba);
+ GetBackgroundColorRGBA(context, tkwin, 0, rgba);
gray = (rgba[0] + rgba[1] + rgba[2]) / 3.0;
faceGray.grayscale = gray;
}
@@ -633,7 +633,7 @@ static void DrawEntry(
CGColorRef backgroundColor;
CGFloat bgRGBA[4];
if (isDark) {
- GetBackgroundColorRGBA(tkwin, 0, bgRGBA);
+ GetBackgroundColorRGBA(context, tkwin, 0, bgRGBA);
/*
* Lighten the entry background to provide contrast.
@@ -928,7 +928,7 @@ static void DrawProgressBar(
1.0, 1.0, 1.0, 0.0,
1.0, 1.0, 1.0, 0.0};
- GetBackgroundColorRGBA(tkwin, 0, rgba);
+ GetBackgroundColorRGBA(context, tkwin, 0, rgba);
if (info.attributes & kThemeTrackHorizontal) {
bounds = CGRectInset(bounds, 1, bounds.size.height / 2 - 3);
clipBounds.size.width = 5 + ratio*(bounds.size.width + 3);
@@ -1277,7 +1277,7 @@ static void DrawGroupBox(
CGPathRef path;
CGColorRef backgroundColor, borderColor;
- backgroundColor = GetBackgroundCGColor(tkwin, 1);
+ backgroundColor = GetBackgroundCGColor(context, tkwin, 1);
borderColor = CGColorFromGray(boxBorder);
CGContextSetFillColorWithColor(context, backgroundColor);
path = CGPathCreateWithRoundedRect(bounds, 5, 5, NULL);
@@ -1450,10 +1450,10 @@ DrawTab(
static void DrawDarkSeparator(
CGRect bounds,
- CGContextRef context)
+ CGContextRef context,
+ TCL_UNUSED(Tk_Window))
{
CGColorRef sepColor = CGColorFromGray(darkSeparator);
-
CGContextSetFillColorWithColor(context, sepColor);
CGContextFillRect(context, bounds);
}
@@ -1510,11 +1510,8 @@ static void DrawGradientBorder(
static void ButtonElementMinSize(
void *clientData,
- TCL_UNUSED(void *), /* elementRecord */
- TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
- int *minHeight,
- TCL_UNUSED(Ttk_Padding *) /* paddingPtr */)
+ int *minHeight)
{
ThemeButtonParams *params = clientData;
@@ -1548,7 +1545,7 @@ static void ButtonElementMinSize(
static void ButtonElementSize(
void *clientData,
- void *elementRecord,
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
int *minWidth,
int *minHeight,
@@ -1561,8 +1558,7 @@ static void ButtonElementSize(
CGRect contentBounds, backgroundBounds;
int verticalPad;
- ButtonElementMinSize(clientData, elementRecord, tkwin,
- minWidth, minHeight, paddingPtr);
+ ButtonElementMinSize(clientData, minWidth, minHeight);
switch (info.kind) {
case TkGradientButton:
*paddingPtr = Ttk_MakePadding(1, 1, 1, 1);
@@ -1614,7 +1610,7 @@ static void ButtonElementSize(
static void ButtonElementDraw(
void *clientData,
- TCL_UNUSED(void *), /* elementRecord*/
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
@@ -1803,8 +1799,8 @@ static void TabElementSize(
}
static void TabElementDraw(
- TCL_UNUSED(void *), /*clientData */
- TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
@@ -1844,19 +1840,19 @@ static Ttk_ElementSpec TabElementSpec = {
*/
static void PaneElementSize(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- int *minWidth,
- int *minHeight,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
+ TCL_UNUSED(int *), /* minWidth */
+ TCL_UNUSED(int *), /* minHeight */
Ttk_Padding *paddingPtr)
{
*paddingPtr = Ttk_MakePadding(9, 5, 9, 9);
}
static void PaneElementDraw(
- void *clientData,
- void *elementRecord,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
@@ -1903,19 +1899,19 @@ static Ttk_ElementSpec PaneElementSpec = {
*/
static void GroupElementSize(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- int *minWidth,
- int *minHeight,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
+ TCL_UNUSED(int *), /* minWidth */
+ TCL_UNUSED(int *), /* minHeight */
Ttk_Padding *paddingPtr)
{
*paddingPtr = Ttk_MakePadding(0, 0, 0, 0);
}
static void GroupElementDraw(
- void *clientData,
- void *elementRecord,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
@@ -1968,14 +1964,14 @@ static Ttk_ElementOptionSpec EntryElementOptions[] = {
};
static void EntryElementSize(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- int *minWidth,
- int *minHeight,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
+ TCL_UNUSED(int *), /* minWidth */
+ TCL_UNUSED(int *), /* minHeight */
Ttk_Padding *paddingPtr)
{
- *paddingPtr = Ttk_MakePadding(7, 6, 7, 5);
+ *paddingPtr = entryElementPadding;
}
static void EntryElementDraw(
@@ -2083,9 +2079,9 @@ static Ttk_ElementSpec EntryElementSpec = {
static Ttk_Padding ComboboxPadding = {7, 5, 24, 5};
static void ComboboxElementSize(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
Ttk_Padding *paddingPtr)
@@ -2096,8 +2092,8 @@ static void ComboboxElementSize(
}
static void ComboboxElementDraw(
- void *clientData,
- void *elementRecord,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
@@ -2171,12 +2167,12 @@ static void SpinButtonReBounds(
}
static void SpinButtonElementSize(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
- Ttk_Padding *paddingPtr)
+ TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
SInt32 s;
@@ -2187,8 +2183,8 @@ static void SpinButtonElementSize(
}
static void SpinButtonUpElementDraw(
- void *clientData,
- void *elementRecord,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
@@ -2230,8 +2226,8 @@ static Ttk_ElementSpec SpinButtonUpElementSpec = {
};
static void SpinButtonDownElementDraw(
- void *clientData,
- void *elementRecord,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
@@ -2289,7 +2285,7 @@ static Ttk_StateTable ThemeTrackEnableTable[] = {
{kThemeTrackDisabled, TTK_STATE_DISABLED, 0},
{kThemeTrackActive, TTK_STATE_BACKGROUND, 0},
{kThemeTrackActive, 0, 0}
- /* { kThemeTrackNothingToScroll, ?, ? }, */
+ /* { kThemeTrackNothingToScroll, ?, ? , 0}, */
};
typedef struct { /* TrackElement client data */
@@ -2309,19 +2305,19 @@ typedef struct {
} TrackElement;
static Ttk_ElementOptionSpec TrackElementOptions[] = {
- {"-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, fromObj), "0"},
- {"-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, toObj), "100"},
- {"-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, valueObj), "50"},
- {"-orient", TK_OPTION_STRING, Tk_Offset(TrackElement, orientObj), "horizontal"},
+ {"-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, fromObj), 0},
+ {"-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, toObj), 0},
+ {"-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, valueObj), 0},
+ {"-orient", TK_OPTION_STRING, Tk_Offset(TrackElement, orientObj), 0},
{0, 0, 0, 0}
};
static void TrackElementSize(
void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
- Ttk_Padding *paddingPtr)
+ TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
TrackElementData *data = clientData;
SInt32 size = 24; /* reasonable default ... */
@@ -2402,12 +2398,12 @@ static Ttk_ElementSpec TrackElementSpec = {
*/
static void SliderElementSize(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
- Ttk_Padding *paddingPtr)
+ TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
*minWidth = *minHeight = 24;
}
@@ -2450,12 +2446,12 @@ static Ttk_ElementOptionSpec PbarElementOptions[] = {
{0, 0, 0, 0}
};
static void PbarElementSize(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
- Ttk_Padding *paddingPtr)
+ TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
SInt32 size = 24; /* @@@ Check HIG for correct default */
@@ -2464,7 +2460,7 @@ static void PbarElementSize(
}
static void PbarElementDraw(
- void *clientData,
+ TCL_UNUSED(void *), /* clientData */
void *elementRecord,
Tk_Window tkwin,
Drawable d,
@@ -2534,9 +2530,9 @@ static Ttk_ElementOptionSpec ScrollbarElementOptions[] = {
{0, 0, 0, 0}
};
static void TroughElementSize(
- void *clientData,
+ TCL_UNUSED(void *), /* clientData */
void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
Ttk_Padding *paddingPtr)
@@ -2561,12 +2557,12 @@ static void TroughElementSize(
}
static void TroughElementDraw(
- void *clientData,
+ TCL_UNUSED(void *), /* clientData */
void *elementRecord,
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
- Ttk_State state)
+ TCL_UNUSED(Ttk_State)) /* state */
{
ScrollbarElement *scrollbar = elementRecord;
int orientation = TTK_ORIENT_HORIZONTAL;
@@ -2599,12 +2595,12 @@ static Ttk_ElementSpec TroughElementSpec = {
TroughElementDraw
};
static void ThumbElementSize(
- void *clientData,
+ TCL_UNUSED(void *), /* clientData */
void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
- Ttk_Padding *paddingPtr)
+ TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
ScrollbarElement *scrollbar = elementRecord;
int orientation = TTK_ORIENT_HORIZONTAL;
@@ -2620,7 +2616,7 @@ static void ThumbElementSize(
}
static void ThumbElementDraw(
- void *clientData,
+ TCL_UNUSED(void *), /* clientData */
void *elementRecord,
Tk_Window tkwin,
Drawable d,
@@ -2737,12 +2733,12 @@ static Ttk_ElementSpec ThumbElementSpec = {
ThumbElementDraw
};
static void ArrowElementSize(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
- Ttk_Padding *paddingPtr)
+ TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
if ([NSApp macOSVersion] < 100800) {
*minHeight = *minWidth = 14;
@@ -2768,19 +2764,19 @@ static Ttk_ElementSpec ArrowElementSpec = {
*/
static void SeparatorElementSize(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
- Ttk_Padding *paddingPtr)
+ TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
*minWidth = *minHeight = 1;
}
static void SeparatorElementDraw(
- void *clientData,
- void *elementRecord,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
@@ -2796,7 +2792,7 @@ static void SeparatorElementDraw(
BEGIN_DRAWING(d)
if (TkMacOSXInDarkMode(tkwin)) {
- DrawDarkSeparator(bounds, dc.context);
+ DrawDarkSeparator(bounds, dc.context, tkwin);
} else {
ChkErr(HIThemeDrawSeparator, &bounds, &info, dc.context,
HIOrientation);
@@ -2820,12 +2816,12 @@ static const ThemeGrowDirection sizegripGrowDirection
= kThemeGrowRight | kThemeGrowDown;
static void SizegripElementSize(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
- Ttk_Padding *paddingPtr)
+ TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
HIThemeGrowBoxDrawInfo info = {
.version = 0,
@@ -2842,9 +2838,9 @@ static void SizegripElementSize(
}
static void SizegripElementDraw(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
Drawable d,
Ttk_Box b,
unsigned int state)
@@ -2919,8 +2915,8 @@ static Ttk_ElementSpec SizegripElementSpec = {
*/
static void FillElementDraw(
- void *clientData,
- void *elementRecord,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
@@ -2931,7 +2927,7 @@ static void FillElementDraw(
if ([NSApp macOSVersion] > 100800) {
CGColorRef bgColor;
BEGIN_DRAWING(d)
- bgColor = GetBackgroundCGColor(tkwin, 0);
+ bgColor = GetBackgroundCGColor(dc.context, tkwin, 0);
CGContextSetFillColorWithColor(dc.context, bgColor);
CGContextFillRect(dc.context, bounds);
END_DRAWING
@@ -2951,7 +2947,7 @@ static void BackgroundElementDraw(
void *elementRecord,
Tk_Window tkwin,
Drawable d,
- Ttk_Box b,
+ TCL_UNUSED(Ttk_Box),
unsigned int state)
{
FillElementDraw(clientData, elementRecord, tkwin, d, Ttk_WinBox(tkwin),
@@ -2988,12 +2984,12 @@ static Ttk_ElementSpec BackgroundElementSpec = {
*/
static void ToolbarBackgroundElementDraw(
- void *clientData,
- void *elementRecord,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
- Ttk_Box b,
- Ttk_State state)
+ TCL_UNUSED(Ttk_Box),
+ TCL_UNUSED(Ttk_State))
{
ThemeBrush brush = kThemeBrushToolbarBackground;
CGRect bounds = BoxToRect(d, Ttk_WinBox(tkwin));
@@ -3027,16 +3023,16 @@ typedef struct {
static Ttk_ElementOptionSpec FieldElementOptions[] = {
{"-fieldbackground", TK_OPTION_BORDER,
Tk_Offset(FieldElement, backgroundObj), "white"},
- {NULL, 0, 0, 0}
+ {NULL, 0, 0, NULL}
};
static void FieldElementDraw(
- void *clientData,
+ TCL_UNUSED(void *), /* clientData */
void *elementRecord,
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
- Ttk_State state)
+ TCL_UNUSED(Ttk_State))
{
FieldElement *e = elementRecord;
Tk_3DBorder backgroundPtr =
@@ -3071,22 +3067,22 @@ static Ttk_StateTable TreeHeaderValueTable[] = {
static Ttk_StateTable TreeHeaderAdornmentTable[] = {
{kThemeAdornmentHeaderButtonSortUp,
- TTK_STATE_ALTERNATE | TTK_TREEVIEW_STATE_SORTARROW, 0, 0},
+ TTK_STATE_ALTERNATE | TTK_TREEVIEW_STATE_SORTARROW, 0},
{kThemeAdornmentDefault,
- TTK_STATE_SELECTED | TTK_TREEVIEW_STATE_SORTARROW, 0, 0},
- {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_ALTERNATE, 0, 0},
- {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_SELECTED, 0, 0},
- {kThemeAdornmentFocus, TTK_STATE_FOCUS, 0, 0},
- {kThemeAdornmentNone, 0}
+ TTK_STATE_SELECTED | TTK_TREEVIEW_STATE_SORTARROW, 0},
+ {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_ALTERNATE, 0},
+ {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_SELECTED, 0},
+ {kThemeAdornmentFocus, TTK_STATE_FOCUS, 0},
+ {kThemeAdornmentNone, 0, 0}
};
static void TreeAreaElementSize (
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- int *minWidth,
- int *minHeight,
- Ttk_Padding *paddingPtr)
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
+ TCL_UNUSED(int *), /* minWidth */
+ TCL_UNUSED(int *), /* minHeight */
+ TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
/*
@@ -3124,7 +3120,7 @@ static void TreeHeaderElementSize(
static void TreeHeaderElementDraw(
void *clientData,
- void *elementRecord,
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
@@ -3172,16 +3168,16 @@ static Ttk_ElementSpec TreeHeaderElementSpec = {
#define TTK_TREEVIEW_STATE_OPEN TTK_STATE_USER1
#define TTK_TREEVIEW_STATE_LEAF TTK_STATE_USER2
static Ttk_StateTable DisclosureValueTable[] = {
- {kThemeDisclosureDown, TTK_TREEVIEW_STATE_OPEN, 0, 0, 0},
- {kThemeDisclosureRight, 0, 0, 0, 0},
+ {kThemeDisclosureDown, TTK_TREEVIEW_STATE_OPEN, 0},
+ {kThemeDisclosureRight, 0, 0},
};
static void DisclosureElementSize(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
+ TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
- Ttk_Padding *paddingPtr)
+ TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
SInt32 s;
@@ -3192,8 +3188,8 @@ static void DisclosureElementSize(
}
static void DisclosureElementDraw(
- void *clientData,
- void *elementRecord,
+ TCL_UNUSED(void *), /* clientData */
+ TCL_UNUSED(void *), /* elementRecord */
Tk_Window tkwin,
Drawable d,
Ttk_Box b,
@@ -3368,6 +3364,24 @@ TTK_END_LAYOUT_TABLE
* +++ Initialization --
*/
+/*----------------------------------------------------------------------
+ * +++ Ttk_MacOSXInit --
+ *
+ * Initialize variables which depend on [NSApp macOSVersion]. Called from
+ * [NSApp applicationDidFinishLaunching].
+ */
+
+MODULE_SCOPE
+void Ttk_MacOSXInit(
+ void)
+{
+ if ([NSApp macOSVersion] < 101400) {
+ entryElementPadding = Ttk_MakePadding(7, 6, 7, 5);
+ } else {
+ entryElementPadding = Ttk_MakePadding(7, 5, 7, 6);
+ }
+}
+
static int AquaTheme_Init(
Tcl_Interp *interp)
{
diff --git a/tests/bind.test b/tests/bind.test
index 718c609..9d581ea 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -7037,7 +7037,7 @@ test bind-36.1 {pointer warp with grab on master, bug [e3888d5820]} -setup {
} -cleanup {
destroy .top
unset x1 y1 x2 y2
-} -result {1}
+} -result 1
# cleanup
cleanupTests
diff --git a/tests/busy.test b/tests/busy.test
index 6a1263f..f0b11be 100644
--- a/tests/busy.test
+++ b/tests/busy.test
@@ -17,11 +17,11 @@ namespace import -force tcltest::test
test busy-1.1 {Tk_BusyObjCmd} -returnCodes error -body {
tk busy
-} -result {wrong # args: should be "tk busy options ?arg arg ...?"}
+} -result {wrong # args: should be "tk busy options ?arg ...?"}
test busy-2.1 {tk busy hold} -returnCodes error -body {
tk busy hold
-} -result {wrong # args: should be "tk busy hold window ?option value ...?"}
+} -result {wrong # args: should be "tk busy hold window ?-option value ...?"}
test busy-2.2 {tk busy hold root window} -body {
set res [tk busy hold .]
update
@@ -182,7 +182,7 @@ test busy-3.7 {tk busy cget unix} -setup {
test busy-4.1 {tk busy configure no window} -returnCodes error -body {
tk busy configure
-} -result {wrong # args: should be "tk busy configure window ?option? ?value ...?"}
+} -result {wrong # args: should be "tk busy configure window ?-option? ?value ...?"}
test busy-4.2 {tk busy configure invalid window} -body {
tk busy configure .f
diff --git a/tests/canvImg.test b/tests/canvImg.test
index 0e0b47a..27c00d6 100644
--- a/tests/canvImg.test
+++ b/tests/canvImg.test
@@ -174,7 +174,7 @@ test canvImg-4.2 {ConfigureImage procedure} -constraints testImageType -setup {
while {"timed out" ni $y && [lindex $y end 1] ne "display"} {
vwait y
}
- after cancel timer
+ after cancel $timer
list $x $y [.c bbox i1]
} -cleanup {
.c delete all
@@ -739,12 +739,11 @@ test canvImg-10.1 {TranslateImage procedure} -constraints testImageType -setup {
foo changed 2 4 6 8 30 15
vwait x
after cancel $timer
- update
return $x
} -cleanup {
.c delete all
image delete foo
-} -result {{foo display 2 4 6 8}}
+} -result {{foo display 2 4 6 8}}
test canvImg-11.1 {TranslateImage procedure} -constraints testImageType -setup {
.c delete all
@@ -756,7 +755,7 @@ test canvImg-11.1 {TranslateImage procedure} -constraints testImageType -setup {
set x {}
set timer [after 500 {lappend x "timed out"}]
foo changed 2 4 6 8 40 50
- vwait x
+ vwait x
after cancel $timer
update
return $x
@@ -779,17 +778,12 @@ test canvImg-11.2 {ImageChangedProc procedure} -constraints {
.c delete all
image delete foo
} -result {30 75 70 125}
-if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
- # Aqua >= 10.14 will redraw the entire image.
- set result_11_3 {{foo2 display 0 0 80 60}}
-} else {
- set result_11_3 {{foo2 display 0 0 20 40}}
-}
+
test canvImg-11.3 {ImageChangedProc procedure} -constraints {
testImageType
} -setup {
.c delete all
- update
+ update idletasks
} -body {
image create test foo -variable x
image create test foo2 -variable z
@@ -797,17 +791,16 @@ test canvImg-11.3 {ImageChangedProc procedure} -constraints {
foo2 changed 0 0 0 0 80 60
.c create image 50 100 -image foo -tags image -anchor nw
.c create image 70 110 -image foo2 -anchor nw
- update idletasks
set z {}
set timer [after 500 {lappend z "timed out"}]
- image create test foo -variable x
- vwait x
+ image delete foo
+ vwait z
after cancel $timer
return $z
} -cleanup {
.c delete all
- image delete foo foo2
-} -result $result_11_3
+ image delete foo2
+} -result {{foo2 display 0 0 80 60}}
# cleanup
imageFinish
diff --git a/tests/constraints.tcl b/tests/constraints.tcl
index c77fb00..ff036f3 100644
--- a/tests/constraints.tcl
+++ b/tests/constraints.tcl
@@ -37,7 +37,7 @@ namespace eval tk {
namespace eval bg {
# Manage a background process.
- # Replace with slave interp or thread?
+ # Replace with child interp or thread?
namespace import ::tcltest::interpreter
namespace import ::tk::test::loadTkCommand
namespace export setup cleanup do
diff --git a/tests/entry.test b/tests/entry.test
index 8a4a457..262447f 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -12,6 +12,7 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
# For xscrollcommand
+set scrollInfo {}
proc scroll args {
global scrollInfo
set scrollInfo $args
@@ -1533,7 +1534,7 @@ test entry-3.79 {EntryWidgetCmd procedure, "xview" widget command} -setup {
.e insert end "runs off the end of the window quite a bit."
.e xview 0
update
- .e xview -4
+ .e xview -1
.e index @0
} -cleanup {
destroy .e
@@ -1617,7 +1618,7 @@ test entry-5.3 {ConfigureEntry procedure, -textvariable} -setup {
} -body {
.e insert 0 "Some text"
.e configure -textvariable x
- return $x
+ set x
} -cleanup {
destroy .e
} -result {Some text}
@@ -1652,7 +1653,7 @@ test entry-5.5 {ConfigureEntry procedure} -setup {
lappend x [selection get]
.e1 configure -exportselection 1
lappend x [selection get]
- return $x
+ set x
} -cleanup {
destroy .e1 .e2
} -result {{This is so} {This is so} 1234}
@@ -1688,9 +1689,10 @@ test entry-5.7 {ConfigureEntry procedure} -setup {
} -body {
.e configure -font {Courier -12} -width 4 -xscrollcommand scroll
.e insert end "01234567890"
- set timeout [after 500 {set $scrollInfo "timeout"}]
- vwait scrollInfo
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e configure -width 5
+ vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
destroy .e
@@ -1933,9 +1935,9 @@ test entry-7.1 {InsertChars procedure} -setup {
focus .e
} -body {
.e configure -textvariable contents -xscrollcommand scroll
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcde
.e insert 2 XXX
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -1950,9 +1952,9 @@ test entry-7.2 {InsertChars procedure} -setup {
focus .e
} -body {
.e configure -textvariable contents -xscrollcommand scroll
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcde
.e insert 500 XXX
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2084,9 +2086,9 @@ test entry-8.1 {DeleteChars procedure} -setup {
focus .e
} -body {
.e configure -textvariable contents -xscrollcommand scroll
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcde
.e delete 2 4
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2100,9 +2102,9 @@ test entry-8.2 {DeleteChars procedure} -setup {
focus .e
} -body {
.e configure -textvariable contents -xscrollcommand scroll
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcde
- .e delete -2 2
- set timeout [after 500 {set $scrollInfo "timeout"}]
+ .e delete -1 2
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2116,9 +2118,9 @@ test entry-8.3 {DeleteChars procedure} -setup {
focus .e
} -body {
.e configure -textvariable contents -xscrollcommand scroll
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcde
.e delete 3 1000
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2833,7 +2835,7 @@ test entry-13.23 {GetEntryIndex procedure} -body {
.e insert 0 012345678901234567890
.e xview 4
update
- .e index -10
+ .e index -1
} -cleanup {
destroy .e
} -result 0
@@ -2964,9 +2966,10 @@ test entry-16.4 {EntryVisibleRange procedure} -body {
test entry-17.1 {EntryUpdateScrollbar procedure} -body {
entry .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e delete 0 end
.e insert 0 123
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
@@ -2976,9 +2979,9 @@ test entry-17.1 {EntryUpdateScrollbar procedure} -body {
test entry-17.2 {EntryUpdateScrollbar procedure} -body {
entry .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 0123456789abcdef
.e xview 3
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
@@ -2988,9 +2991,9 @@ test entry-17.2 {EntryUpdateScrollbar procedure} -body {
test entry-17.3 {EntryUpdateScrollbar procedure} -body {
entry .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcdefghijklmnopqrs
.e xview 6
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
@@ -3003,8 +3006,10 @@ test entry-17.4 {EntryUpdateScrollbar procedure} -setup {
set x $msg
}
} -body {
- entry .e -width 5 -xscrollcommand thisisnotacommand
+ entry .e -width 5
pack .e
+ update idletasks
+ .e configure -xscrollcommand thisisnotacommand
vwait x
list $x $errorInfo
} -cleanup {
@@ -3047,7 +3052,7 @@ test entry-19.1 {entry widget validation} -setup {
-background red -foreground white
pack .e
.e insert 0 a
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e 1 0 a {} a all key}
@@ -3079,7 +3084,7 @@ test entry-19.3 {entry widget validation} -setup {
pack .e
.e insert 0 ab ;# previous settings
.e insert end c
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e 1 2 abc ab c all key}
@@ -3111,7 +3116,7 @@ test entry-19.5 {entry widget validation} -setup {
pack .e
.e insert 0 a123bc ;# previous settings
.e delete 2
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e 0 2 a13bc a123bc 2 all key}
@@ -3128,7 +3133,7 @@ test entry-19.6 {entry widget validation} -setup {
.e insert 0 a13bc ;# previous settings
.e configure -validate key
.e delete 1 3
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e 0 1 abc a13bc 13 key key}
@@ -3145,7 +3150,7 @@ test entry-19.7 {entry widget validation} -setup {
.e insert end abc ;# previous settings
set ::vVals {}
.e insert end d
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {}
@@ -3164,7 +3169,7 @@ test entry-19.8 {entry widget validation} -setup {
focus -force .e
# update necessary to process FocusIn event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focus focusin}
@@ -3185,7 +3190,7 @@ test entry-19.9 {entry widget validation} -setup {
focus -force .
# update necessary to process FocusOut event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focus focusout}
@@ -3203,7 +3208,7 @@ test entry-19.10 {entry widget validation} -setup {
focus -force .e
# update necessary to process FocusIn event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} all focusin}
@@ -3224,7 +3229,7 @@ test entry-19.11 {entry widget validation} -setup {
focus -force .
# update necessary to process FocusOut event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} all focusout}
@@ -3242,7 +3247,7 @@ test entry-19.12 {entry widget validation} -setup {
focus -force .e
# update necessary to process FocusIn event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focusin focusin}
@@ -3261,7 +3266,7 @@ test entry-19.13 {entry widget validation} -setup {
focus -force .
# update necessary to process FocusOut event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {}
@@ -3280,7 +3285,7 @@ test entry-19.14 {entry widget validation} -setup {
focus -force .e
# update necessary to process FocusIn event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {}
@@ -3302,7 +3307,7 @@ test entry-19.15 {entry widget validation} -setup {
focus -force .
# update necessary to process FocusOut event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focusout focusout}
diff --git a/tests/font.test b/tests/font.test
index 92894d1..aa7137a 100644
--- a/tests/font.test
+++ b/tests/font.test
@@ -114,11 +114,11 @@ test font-4.1 {font command: actual: arguments} -body {
test font-4.2 {font command: actual: arguments} -body {
# (objc < 3)
font actual
-} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}
+} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?-option? ?--? ?char?"}
test font-4.3 {font command: actual: arguments} -body {
# (objc - skip > 4) when skip == 0
font actual xyz abc def
-} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}
+} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?-option? ?--? ?char?"}
test font-4.4 {font command: actual: displayof specified, so skip to next} -body {
catch {font actual xyz -displayof . -size}
} -result 0
@@ -128,7 +128,7 @@ test font-4.5 {font command: actual: displayof specified, so skip to next} -body
test font-4.6 {font command: actual: arguments} -body {
# (objc - skip > 4) when skip == 2
font actual xyz -displayof . abc def
-} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}
+} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?-option? ?--? ?char?"}
test font-4.7 {font command: actual: arguments} -constraints noExceed -body {
# (tkfont == NULL)
font actual "\{xyz"
@@ -430,11 +430,11 @@ test font-10.2 {font command: metrics: arguments} -body {
test font-10.3 {font command: metrics: arguments} -body {
# (objc < 3)
font metrics
-} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?option?"}
+} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?-option?"}
test font-10.4 {font command: metrics: arguments} -body {
# (objc - skip) > 4) when skip == 0
font metrics xyz abc def
-} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?option?"}
+} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?-option?"}
test font-10.5 {font command: metrics: arguments} -body {
# (objc - skip) > 4) when skip == 2
font metrics xyz -displayof . abc
diff --git a/tests/grid.test b/tests/grid.test
index c138479..3e67b6e 100644
--- a/tests/grid.test
+++ b/tests/grid.test
@@ -2039,7 +2039,7 @@ test grid-23 {grid configure -in leaked from previous master - bug
pack forget .f
update
winfo ismapped .t ; # must return 1
-} {1}
+} 1
grid_reset 23
test grid-24.1 {<<NoManagedChild>> fires on last grid forget} -setup {
diff --git a/tests/listbox.test b/tests/listbox.test
index bf592b1..3520f99 100644
--- a/tests/listbox.test
+++ b/tests/listbox.test
@@ -587,7 +587,7 @@ test listbox-3.36 {ListboxWidgetCmd procedure, "delete" option} -setup {
} -body {
listbox .l2
.l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7
- .l2 delete -3 2
+ .l2 delete -1 2
.l2 get 0 end
} -cleanup {
destroy .l2
@@ -597,7 +597,7 @@ test listbox-3.37 {ListboxWidgetCmd procedure, "delete" option} -setup {
} -body {
listbox .l2
.l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7
- .l2 delete -3 -1
+ .l2 delete -1 -1
.l2 get 0 end
} -cleanup {
destroy .l2
@@ -684,10 +684,10 @@ test listbox-3.49 {ListboxWidgetCmd procedure, "get" option} -body {
.l get -1
} -result {}
test listbox-3.50 {ListboxWidgetCmd procedure, "get" option} -body {
- .l get -2 -1
+ .l get -1 -1
} -result {}
test listbox-3.51 {ListboxWidgetCmd procedure, "get" option} -body {
- .l get -2 3
+ .l get -1 3
} -result {el0 el1 el2 el3}
test listbox-3.52 {ListboxWidgetCmd procedure, "get" option} -body {
.l get 12 end
@@ -2129,7 +2129,7 @@ test listbox-10.19 {GetListboxIndex procedure} -setup {
pack [listbox .l]
.l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11
update
- .l index -2
+ .l index -1
} -cleanup {
destroy .l
} -result -1
@@ -2378,7 +2378,7 @@ test listbox-15.4 {ListboxSelect procedure, boundary conditions for indices} -bo
.l delete 0 end
.l insert 0 a b c d e f
.l select clear 0 end
- .l select set -2 -1
+ .l select set -1 -1
.l curselection
} -result {}
test listbox-15.5 {ListboxSelect procedure, boundary conditions for indices} -body {
@@ -2662,41 +2662,37 @@ test listbox-21.8 {ListboxListVarProc, test selection after listvar mod} -setup
test listbox-21.9 {ListboxListVarProc, test hscrollbar after listvar mod} -setup {
destroy .l
} -body {
- catch {unset x}
+ set x {}
listbox .l -font $fixed -width 10 -xscrollcommand "record x" -listvar x
- set log {}
pack .l
- set timeout [after 500 {lappend log timeout1}]
- vwait log
+ update idletasks
+ set log {}
lappend x "0000000000"
- update
+ update idletasks
lappend x "00000000000000000000"
- update
+ update idletasks
set log
} -cleanup {
destroy .l
- after cancel $timeout
-} -result [list {x 0 1} {x 0 1} {x 0 0.5}]
+} -result [list {x 0 1} {x 0 0.5}]
test listbox-21.10 {ListboxListVarProc, test hscrollbar after listvar mod} -setup {
destroy .l
} -body {
catch {unset x}
listbox .l -font $fixed -width 10 -xscrollcommand "record x" -listvar x
- set log {}
pack .l
- set timeout [after 500 {lappend log timeout2}]
- vwait log
+ update idletasks
+ set log {}
lappend x "0000000000"
- update
+ update idletasks
lappend x "00000000000000000000"
- update
+ update idletasks
set x [list "0000000000"]
- update
+ update idletasks
set log
} -cleanup {
destroy .l
- after cancel $timeout
-} -result [list {x 0 1} {x 0 1} {x 0 0.5} {x 0 1}]
+} -result [list {x 0 1} {x 0 0.5} {x 0 1}]
test listbox-21.11 {ListboxListVarProc, bad list} -setup {
destroy .l
} -body {
diff --git a/tests/menu.test b/tests/menu.test
index c288661..03e0dab 100644
--- a/tests/menu.test
+++ b/tests/menu.test
@@ -2060,7 +2060,7 @@ test menu-5.8 {DestroyMenuInstance - multiple clones} -setup {
set tearoff2 [tk::TearOffMenu .m1]
list [destroy $tearoff1] [destroy .m1]
} -returnCodes ok -result {{} {}}
-test menu-5.9 {DestroyMenuInstace - master menu} -setup {
+test menu-5.9 {DestroyMenuInstace - main menu} -setup {
destroy .m1
} -body {
menu .m1
diff --git a/tests/pack.test b/tests/pack.test
index c65727e..3ca2253 100644
--- a/tests/pack.test
+++ b/tests/pack.test
@@ -1532,6 +1532,15 @@ test pack-17.2 {PackLostSlaveProc procedure} -setup {
pack info .pack.a
} -returnCodes error -result {window ".pack.a" isn't packed}
+if {[tk windowingsystem] == "win32"} {
+ proc packUpdate {} {
+ update
+ }
+} else {
+ proc packUpdate {} {
+ }
+}
+
test pack-18.1 {unmap slaves when master unmapped} -constraints {
tempNotPc
} -setup {
@@ -1550,19 +1559,19 @@ test pack-18.1 {unmap slaves when master unmapped} -constraints {
eval destroy [winfo child .pack]
frame .pack.a -width 100 -height 50 -relief raised -bd 2
pack .pack.a
- update
+ update idletasks
set result [winfo ismapped .pack.a]
wm iconify .pack
- update
lappend result [winfo ismapped .pack.a]
.pack.a configure -width 200 -height 75
- update
+ update idletasks
lappend result [winfo width .pack.a ] [winfo height .pack.a] \
[winfo ismapped .pack.a]
wm deiconify .pack
- update
+ packUpdate
lappend result [winfo ismapped .pack.a]
} -result {1 0 200 75 0 1}
+
test pack-18.2 {unmap slaves when master unmapped} -setup {
eval destroy [winfo child .pack]
} -body {
@@ -1575,17 +1584,16 @@ test pack-18.2 {unmap slaves when master unmapped} -setup {
frame .pack.b -width 70 -height 30 -relief sunken -bd 2
pack .pack.a
pack .pack.b -in .pack.a
- update
+ update idletasks
set result [winfo ismapped .pack.b]
wm iconify .pack
- update
lappend result [winfo ismapped .pack.b]
.pack.b configure -width 100 -height 30
- update
+ update idletasks
lappend result [winfo width .pack.b ] [winfo height .pack.b] \
[winfo ismapped .pack.b]
wm deiconify .pack
- update
+ packUpdate
lappend result [winfo ismapped .pack.b]
} -result {1 0 100 30 0 1}
diff --git a/tests/place.test b/tests/place.test
index 975732a..041daa6 100644
--- a/tests/place.test
+++ b/tests/place.test
@@ -258,40 +258,47 @@ test place-7.10 {ReconfigurePlacement procedure, computing size} -setup {
list [winfo width .t.f2] [winfo height .t.f2]
} -result {30 60}
+if {[tk windowingsystem] == "win32"} {
+ proc placeUpdate {} {
+ update
+ }
+} else {
+ proc placeUpdate {} {
+ }
+}
test place-8.1 {MasterStructureProc, mapping and unmapping slaves} -setup {
place forget .t.f2
place forget .t.f
} -body {
place .t.f2 -relx 1.0 -rely 1.0 -anchor sw
- update
+ update idletasks
set result [winfo ismapped .t.f2]
wm iconify .t
- update
lappend result [winfo ismapped .t.f2]
place .t.f2 -x 40 -y 30 -relx 0 -rely 0 -anchor nw
- update
+ update idletasks
lappend result [winfo x .t.f2] [winfo y .t.f2] [winfo ismapped .t.f2]
wm deiconify .t
- update
+ placeUpdate
lappend result [winfo ismapped .t.f2]
} -result {1 0 40 30 0 1}
test place-8.2 {MasterStructureProc, mapping and unmapping slaves} -setup {
place forget .t.f2
place forget .t.f
+ update idletasks
} -body {
place .t.f -x 0 -y 0 -width 200 -height 100
place .t.f2 -in .t.f -relx 1.0 -rely 1.0 -anchor sw -width 50 -height 20
- update
+ update idletasks
set result [winfo ismapped .t.f2]
wm iconify .t
- update
lappend result [winfo ismapped .t.f2]
place .t.f2 -x 40 -y 30 -relx 0 -rely 0 -anchor nw
- update
+ update idletasks
lappend result [winfo x .t.f2] [winfo y .t.f2] [winfo ismapped .t.f2]
wm deiconify .t
- update
+ placeUpdate
lappend result [winfo ismapped .t.f2]
} -result {1 0 42 32 0 1}
destroy .t
diff --git a/tests/safe.test b/tests/safe.test
index 4f0ce15..6a870dd 100644
--- a/tests/safe.test
+++ b/tests/safe.test
@@ -202,7 +202,7 @@ test safe-4.2 {testing loadTk -use} -setup {
destroy $w
} -result {}
-test safe-5.1 {loading Tk in safe interps without master's clearance} -body {
+test safe-5.1 {loading Tk in safe interps without parent's clearance} -body {
set i [safe::interpCreate]
interp eval $i {load {} Tk}
} -cleanup {
diff --git a/tests/safePrimarySelection.test b/tests/safePrimarySelection.test
index 7c27c88..29cefa5 100644
--- a/tests/safePrimarySelection.test
+++ b/tests/safePrimarySelection.test
@@ -16,8 +16,8 @@ tcltest::loadTestedCommands
# ------------------------------------------------------------------------------
# - Tests 3.*, 6.* test that the fix for ticket de156e9efe implemented in branch
# bug-de156e9efe has been applied and still works. They test that a Safe Base
-# slave interpreter cannot write to the PRIMARY selection.
-# - The other tests verify that the master interpreter and an unsafe slave CAN
+# child interpreter cannot write to the PRIMARY selection.
+# - The other tests verify that the parent interpreter and an unsafe child CAN
# write to the PRIMARY selection, and therefore that the test scripts
# themselves are valid.
# - A text, entry, ttk::entry, listbox, spinbox or ttk::spinbox widget can have
@@ -38,7 +38,7 @@ namespace eval ::_test_tmp {}
# directory without installing Tk. In that case the usual auto_path loading
# mechanism cannot work because the tk binary is not where pkgIndex.tcl says
# it is.
-# - This command is not needed for Safe Base slaves because safe::loadTk does
+# - This command is not needed for Safe Base children because safe::loadTk does
# something similar and works correctly.
# - Based on scripts in winSend.test.
# ------------------------------------------------------------------------------
@@ -208,11 +208,11 @@ set ::_test_tmp::script {
}
}
-# Do this once for the master interpreter.
+# Do this once for the parent interpreter.
eval $::_test_tmp::script
-test safePrimarySelection-1.1 {master interpreter, text, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.1 {parent interpreter, text, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -223,8 +223,8 @@ test safePrimarySelection-1.1 {master interpreter, text, no existing selection}
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.2 {master interpreter, entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.2 {parent interpreter, entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -235,8 +235,8 @@ test safePrimarySelection-1.2 {master interpreter, entry, no existing selection}
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.3 {master interpreter, ttk::entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.3 {parent interpreter, ttk::entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -247,8 +247,8 @@ test safePrimarySelection-1.3 {master interpreter, ttk::entry, no existing selec
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.4 {master interpreter, listbox, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.4 {parent interpreter, listbox, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -259,8 +259,8 @@ test safePrimarySelection-1.4 {master interpreter, listbox, no existing selectio
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.5 {master interpreter, spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.5 {parent interpreter, spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -271,8 +271,8 @@ test safePrimarySelection-1.5 {master interpreter, spinbox as entry, no existing
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.6 {master interpreter, spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.6 {parent interpreter, spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -283,8 +283,8 @@ test safePrimarySelection-1.6 {master interpreter, spinbox spun, no existing sel
::_test_tmp::clearPrimarySelection
} -result 2
-test safePrimarySelection-1.7 {master interpreter, spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.7 {parent interpreter, spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -295,8 +295,8 @@ test safePrimarySelection-1.7 {master interpreter, spinbox spun/selected/spun, n
::_test_tmp::clearPrimarySelection
} -result 3
-test safePrimarySelection-1.8 {master interpreter, ttk::spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.8 {parent interpreter, ttk::spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -307,8 +307,8 @@ test safePrimarySelection-1.8 {master interpreter, ttk::spinbox as entry, no exi
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.9 {master interpreter, ttk::spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.9 {parent interpreter, ttk::spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -319,8 +319,8 @@ test safePrimarySelection-1.9 {master interpreter, ttk::spinbox spun, no existin
::_test_tmp::clearPrimarySelection
} -result 2
-test safePrimarySelection-1.10 {master interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.10 {parent interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -331,12 +331,12 @@ test safePrimarySelection-1.10 {master interpreter, ttk::spinbox spun/selected/s
::_test_tmp::clearPrimarySelection
} -result 3
-test safePrimarySelection-2.1 {unsafe slave interpreter, text, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.1 {unsafe child interpreter, text, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryText
@@ -348,12 +348,12 @@ test safePrimarySelection-2.1 {unsafe slave interpreter, text, no existing selec
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.2 {unsafe slave interpreter, entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.2 {unsafe child interpreter, entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryEntry
@@ -365,12 +365,12 @@ test safePrimarySelection-2.2 {unsafe slave interpreter, entry, no existing sele
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.3 {unsafe slave interpreter, ttk::entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.3 {unsafe child interpreter, ttk::entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkEntry
@@ -382,12 +382,12 @@ test safePrimarySelection-2.3 {unsafe slave interpreter, ttk::entry, no existing
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.4 {unsafe slave interpreter, listbox, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.4 {unsafe child interpreter, listbox, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryListbox
@@ -399,12 +399,12 @@ test safePrimarySelection-2.4 {unsafe slave interpreter, listbox, no existing se
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.5 {unsafe slave interpreter, spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.5 {unsafe child interpreter, spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 1
@@ -416,12 +416,12 @@ test safePrimarySelection-2.5 {unsafe slave interpreter, spinbox as entry, no ex
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.6 {unsafe slave interpreter, spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.6 {unsafe child interpreter, spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 2
@@ -433,12 +433,12 @@ test safePrimarySelection-2.6 {unsafe slave interpreter, spinbox spun, no existi
::_test_tmp::clearPrimarySelection
} -result 2
-test safePrimarySelection-2.7 {unsafe slave interpreter, spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.7 {unsafe child interpreter, spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 3
@@ -450,12 +450,12 @@ test safePrimarySelection-2.7 {unsafe slave interpreter, spinbox spun/selected/s
::_test_tmp::clearPrimarySelection
} -result 3
-test safePrimarySelection-2.8 {unsafe slave interpreter, ttk::spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.8 {unsafe child interpreter, ttk::spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 1
@@ -467,12 +467,12 @@ test safePrimarySelection-2.8 {unsafe slave interpreter, ttk::spinbox as entry,
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.9 {unsafe slave interpreter, ttk::spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.9 {unsafe child interpreter, ttk::spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 2
@@ -484,12 +484,12 @@ test safePrimarySelection-2.9 {unsafe slave interpreter, ttk::spinbox spun, no e
::_test_tmp::clearPrimarySelection
} -result 2
-test safePrimarySelection-2.10 {unsafe slave interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.10 {unsafe child interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 3
@@ -501,13 +501,13 @@ test safePrimarySelection-2.10 {unsafe slave interpreter, ttk::spinbox spun/sele
::_test_tmp::clearPrimarySelection
} -result 3
-test safePrimarySelection-3.1 {IMPORTANT, safe slave interpreter, text, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.1 {IMPORTANT, safe child interpreter, text, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -522,13 +522,13 @@ test safePrimarySelection-3.1 {IMPORTANT, safe slave interpreter, text, no exist
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.2 {IMPORTANT, safe slave interpreter, entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.2 {IMPORTANT, safe child interpreter, entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -543,13 +543,13 @@ test safePrimarySelection-3.2 {IMPORTANT, safe slave interpreter, entry, no exis
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.3 {IMPORTANT, safe slave interpreter, ttk::entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.3 {IMPORTANT, safe child interpreter, ttk::entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -564,13 +564,13 @@ test safePrimarySelection-3.3 {IMPORTANT, safe slave interpreter, ttk::entry, no
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.4 {IMPORTANT, safe slave interpreter, listbox, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.4 {IMPORTANT, safe child interpreter, listbox, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -585,13 +585,13 @@ test safePrimarySelection-3.4 {IMPORTANT, safe slave interpreter, listbox, no ex
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.5 {IMPORTANT, safe slave interpreter, spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.5 {IMPORTANT, safe child interpreter, spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -606,13 +606,13 @@ test safePrimarySelection-3.5 {IMPORTANT, safe slave interpreter, spinbox as ent
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.6 {IMPORTANT, safe slave interpreter, spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.6 {IMPORTANT, safe child interpreter, spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -627,13 +627,13 @@ test safePrimarySelection-3.6 {IMPORTANT, safe slave interpreter, spinbox spun,
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.7 {IMPORTANT, safe slave interpreter, spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.7 {IMPORTANT, safe child interpreter, spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -648,13 +648,13 @@ test safePrimarySelection-3.7 {IMPORTANT, safe slave interpreter, spinbox spun/s
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.8 {IMPORTANT, safe slave interpreter, ttk::spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.8 {IMPORTANT, safe child interpreter, ttk::spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -669,13 +669,13 @@ test safePrimarySelection-3.8 {IMPORTANT, safe slave interpreter, ttk::spinbox a
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.9 {IMPORTANT, safe slave interpreter, ttk::spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.9 {IMPORTANT, safe child interpreter, ttk::spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -690,13 +690,13 @@ test safePrimarySelection-3.9 {IMPORTANT, safe slave interpreter, ttk::spinbox s
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.10 {IMPORTANT, safe slave interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.10 {IMPORTANT, safe child interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -711,8 +711,8 @@ test safePrimarySelection-3.10 {IMPORTANT, safe slave interpreter, ttk::spinbox
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-4.1 {master interpreter, text, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.1 {parent interpreter, text, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -723,8 +723,8 @@ test safePrimarySelection-4.1 {master interpreter, text, existing selection} -se
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.2 {master interpreter, entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.2 {parent interpreter, entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -735,8 +735,8 @@ test safePrimarySelection-4.2 {master interpreter, entry, existing selection} -s
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.3 {master interpreter, ttk::entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.3 {parent interpreter, ttk::entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -747,8 +747,8 @@ test safePrimarySelection-4.3 {master interpreter, ttk::entry, existing selectio
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.4 {master interpreter, listbox, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.4 {parent interpreter, listbox, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -759,8 +759,8 @@ test safePrimarySelection-4.4 {master interpreter, listbox, existing selection}
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.5 {master interpreter, spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.5 {parent interpreter, spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -771,8 +771,8 @@ test safePrimarySelection-4.5 {master interpreter, spinbox as entry, existing se
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.6 {master interpreter, spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.6 {parent interpreter, spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -783,8 +783,8 @@ test safePrimarySelection-4.6 {master interpreter, spinbox spun, existing select
::_test_tmp::clearPrimarySelection
} -result 2
-test safePrimarySelection-4.7 {master interpreter, spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.7 {parent interpreter, spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -795,8 +795,8 @@ test safePrimarySelection-4.7 {master interpreter, spinbox spun/selected/spun, e
::_test_tmp::clearPrimarySelection
} -result 3
-test safePrimarySelection-4.8 {master interpreter, ttk::spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.8 {parent interpreter, ttk::spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -807,8 +807,8 @@ test safePrimarySelection-4.8 {master interpreter, ttk::spinbox as entry, existi
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.9 {master interpreter, ttk::spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.9 {parent interpreter, ttk::spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -819,8 +819,8 @@ test safePrimarySelection-4.9 {master interpreter, ttk::spinbox spun, existing s
::_test_tmp::clearPrimarySelection
} -result 2
-test safePrimarySelection-4.10 {master interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.10 {parent interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -831,12 +831,12 @@ test safePrimarySelection-4.10 {master interpreter, ttk::spinbox spun/selected/s
::_test_tmp::clearPrimarySelection
} -result 3
-test safePrimarySelection-5.1 {unsafe slave interpreter, text, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.1 {unsafe child interpreter, text, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryText
@@ -848,12 +848,12 @@ test safePrimarySelection-5.1 {unsafe slave interpreter, text, existing selectio
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.2 {unsafe slave interpreter, entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.2 {unsafe child interpreter, entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryEntry
@@ -865,12 +865,12 @@ test safePrimarySelection-5.2 {unsafe slave interpreter, entry, existing selecti
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.3 {unsafe slave interpreter, ttk::entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.3 {unsafe child interpreter, ttk::entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkEntry
@@ -882,12 +882,12 @@ test safePrimarySelection-5.3 {unsafe slave interpreter, ttk::entry, existing se
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.4 {unsafe slave interpreter, listbox, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.4 {unsafe child interpreter, listbox, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryListbox
@@ -899,12 +899,12 @@ test safePrimarySelection-5.4 {unsafe slave interpreter, listbox, existing selec
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.5 {unsafe slave interpreter, spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.5 {unsafe child interpreter, spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 1
@@ -916,12 +916,12 @@ test safePrimarySelection-5.5 {unsafe slave interpreter, spinbox as entry, exist
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.6 {unsafe slave interpreter, spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.6 {unsafe child interpreter, spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 2
@@ -933,12 +933,12 @@ test safePrimarySelection-5.6 {unsafe slave interpreter, spinbox spun, existing
::_test_tmp::clearPrimarySelection
} -result 2
-test safePrimarySelection-5.7 {unsafe slave interpreter, spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.7 {unsafe child interpreter, spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 3
@@ -950,12 +950,12 @@ test safePrimarySelection-5.7 {unsafe slave interpreter, spinbox spun/selected/s
::_test_tmp::clearPrimarySelection
} -result 3
-test safePrimarySelection-5.8 {unsafe slave interpreter, ttk::spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.8 {unsafe child interpreter, ttk::spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 1
@@ -967,12 +967,12 @@ test safePrimarySelection-5.8 {unsafe slave interpreter, ttk::spinbox as entry,
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.9 {unsafe slave interpreter, ttk::spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.9 {unsafe child interpreter, ttk::spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 2
@@ -984,12 +984,12 @@ test safePrimarySelection-5.9 {unsafe slave interpreter, ttk::spinbox spun, exis
::_test_tmp::clearPrimarySelection
} -result 2
-test safePrimarySelection-5.10 {unsafe slave interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.10 {unsafe child interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 3
@@ -1001,13 +1001,13 @@ test safePrimarySelection-5.10 {unsafe slave interpreter, ttk::spinbox spun/sele
::_test_tmp::clearPrimarySelection
} -result 3
-test safePrimarySelection-6.1 {IMPORTANT, safe slave interpreter, text, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.1 {IMPORTANT, safe child interpreter, text, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1022,13 +1022,13 @@ test safePrimarySelection-6.1 {IMPORTANT, safe slave interpreter, text, existing
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.2 {IMPORTANT, safe slave interpreter, entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.2 {IMPORTANT, safe child interpreter, entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1043,13 +1043,13 @@ test safePrimarySelection-6.2 {IMPORTANT, safe slave interpreter, entry, existin
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.3 {IMPORTANT, safe slave interpreter, ttk::entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.3 {IMPORTANT, safe child interpreter, ttk::entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1064,13 +1064,13 @@ test safePrimarySelection-6.3 {IMPORTANT, safe slave interpreter, ttk::entry, ex
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.4 {IMPORTANT, safe slave interpreter, listbox, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.4 {IMPORTANT, safe child interpreter, listbox, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1085,13 +1085,13 @@ test safePrimarySelection-6.4 {IMPORTANT, safe slave interpreter, listbox, exist
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.5 {IMPORTANT, safe slave interpreter, spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.5 {IMPORTANT, safe child interpreter, spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1106,13 +1106,13 @@ test safePrimarySelection-6.5 {IMPORTANT, safe slave interpreter, spinbox as ent
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.6 {IMPORTANT, safe slave interpreter, spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.6 {IMPORTANT, safe child interpreter, spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1127,13 +1127,13 @@ test safePrimarySelection-6.6 {IMPORTANT, safe slave interpreter, spinbox spun,
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.7 {IMPORTANT, safe slave interpreter, spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.7 {IMPORTANT, safe child interpreter, spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1148,13 +1148,13 @@ test safePrimarySelection-6.7 {IMPORTANT, safe slave interpreter, spinbox spun/s
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.8 {IMPORTANT, safe slave interpreter, ttk::spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.8 {IMPORTANT, safe child interpreter, ttk::spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1169,13 +1169,13 @@ test safePrimarySelection-6.8 {IMPORTANT, safe slave interpreter, ttk::spinbox a
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.9 {IMPORTANT, safe slave interpreter, ttk::spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.9 {IMPORTANT, safe child interpreter, ttk::spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1190,13 +1190,13 @@ test safePrimarySelection-6.9 {IMPORTANT, safe slave interpreter, ttk::spinbox s
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.10 {IMPORTANT, safe slave interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.10 {IMPORTANT, safe child interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index e02e3a8..873e564 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -197,7 +197,7 @@ test scrollbar-3.14.1 {ScrollbarWidgetCmd procedure, "cget" option} emptyTest {
destroy .s2
test scrollbar-3.15 {ScrollbarWidgetCmd procedure, "configure" option} {
llength [.s configure]
-} {20}
+} 20
test scrollbar-3.16 {ScrollbarWidgetCmd procedure, "configure" option} {
list [catch {.s configure -bad} msg] $msg
} {1 {unknown option "-bad"}}
@@ -230,7 +230,7 @@ test scrollbar-3.24 {ScrollbarWidgetCmd procedure, "delta" option} {
} {1 {expected integer but got "xxyz"}}
test scrollbar-3.25 {ScrollbarWidgetCmd procedure, "delta" option} {
format {%.6g} [.s delta 20 0]
-} {0}
+} 0
test scrollbar-3.26 {ScrollbarWidgetCmd procedure, "delta" option} {
format {%.6g} [.s delta 0 20]
} [format %.6g [expr {20.0/([getTroughSize .s]-1)}]]
@@ -262,20 +262,20 @@ test scrollbar-3.32 {ScrollbarWidgetCmd procedure, "fraction" option} {
} {1 {expected integer but got "bogus"}}
test scrollbar-3.33 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.s fraction 0 0]
-} {0}
+} 0
test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.s fraction 0 1000]
-} {1}
+} 1
test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.s fraction 4 21]
} [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \
/([getTroughSize .s] - 1)}]]
test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} x11 {
format {%.6g} [.s fraction 4 179]
-} {1}
+} 1
test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} {
format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s]}]]
-} {1}
+} 1
test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} x11 {
format {%.6g} [.s fraction 4 178]
} {0.993711}
@@ -309,7 +309,7 @@ if {[testConstraint testmetrics]} {
update
test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.t.s fraction 100 0]
-} {0}
+} 0
destroy .t
test scrollbar-3.43 {ScrollbarWidgetCmd procedure, "get" option} {
list [catch {.s get a} msg] $msg
diff --git a/tests/send.test b/tests/send.test
index 403a207..aad7032 100644
--- a/tests/send.test
+++ b/tests/send.test
@@ -401,14 +401,14 @@ test send-10.4 {SendEventProc procedure, leading nulls, bogus commands} {secures
set a null
update
set a
-} {44}
+} 44
test send-10.5 {SendEventProc procedure, extraneous command options} {secureserver testsend} {
testsend prop comm Comm \
"c\n-n tktest\n-x miscellanous\n-y who knows?\n-s set a new\n"
set a null
update
set a
-} {new}
+} new
test send-10.6 {SendEventProc procedure, unknown interpreter} {secureserver testsend} {
testsend prop [winfo id .f] Comm {}
testsend prop comm Comm \
diff --git a/tests/spinbox.test b/tests/spinbox.test
index 7a00627..e3c7009 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -12,6 +12,7 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
# For xscrollcommand
+set scrollInfo {}
proc scroll args {
global scrollInfo
set scrollInfo $args
@@ -1871,7 +1872,7 @@ test spinbox-3.79 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e insert end "runs off the end of the window quite a bit."
.e xview 0
update
- .e xview -4
+ .e xview -1
.e index @0
} -cleanup {
destroy .e
@@ -2013,9 +2014,10 @@ test spinbox-5.7 {ConfigureSpinbox procedure} -setup {
} -body {
.e configure -font {Courier -12} -width 4 -xscrollcommand scroll
.e insert end "01234567890"
- set timeout [after 500 {set $scrollInfo "timeout"}]
- vwait scrollInfo
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e configure -width 5
+ vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
destroy .e
@@ -2219,8 +2221,9 @@ test spinbox-7.1 {InsertChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 2 XXX
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2236,8 +2239,9 @@ test spinbox-7.2 {InsertChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 500 XXX
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2370,8 +2374,9 @@ test spinbox-8.1 {DeleteChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e delete 2 4
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2386,8 +2391,9 @@ test spinbox-8.2 {DeleteChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
- .e delete -2 2
- set timeout [after 500 {set $scrollInfo "timeout"}]
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
+ .e delete -1 2
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2402,8 +2408,9 @@ test spinbox-8.3 {DeleteChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e delete 3 1000
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -3115,7 +3122,7 @@ test spinbox-13.23 {GetSpinboxIndex procedure} -body {
.e insert 0 012345678901234567890
.e xview 4
update
- .e index -10
+ .e index -1
} -cleanup {
destroy .e
} -result 0
@@ -3203,9 +3210,10 @@ test spinbox-16.2 {SpinboxVisibleRange procedure} -body {
test spinbox-17.1 {SpinboxUpdateScrollbar procedure} -body {
spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e delete 0 end
.e insert 0 123
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
@@ -3216,8 +3224,9 @@ test spinbox-17.2 {SpinboxUpdateScrollbar procedure} -body {
spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
.e insert 0 0123456789abcdef
+ update idletasks
+ set timeout [after 500 {set $scrollInfo {-1000000 -1000000}}]
.e xview 3
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
@@ -3227,23 +3236,26 @@ test spinbox-17.2 {SpinboxUpdateScrollbar procedure} -body {
test spinbox-17.3 {SpinboxUpdateScrollbar procedure} -body {
spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcdefghijklmnopqrs
- .e xview 6
- set timeout [after 500 {set $scrollInfo "timeout"}]
+ .e xview
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
destroy .e
after cancel $timeout
-} -result {0.315789 0.842105}
+} -result {0.000000 0.526316}
test spinbox-17.4 {SpinboxUpdateScrollbar procedure} -setup {
proc bgerror msg {
global x
set x $msg
}
} -body {
- spinbox .e -width 5 -xscrollcommand thisisnotacommand
+ spinbox .e -width 5
pack .e
+ update idletasks
+ .e configure -xscrollcommand thisisnotacommand
vwait x
list $x $errorInfo
} -cleanup {
diff --git a/tests/text.test b/tests/text.test
index a810387..4a5c1b3 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -1514,9 +1514,9 @@ Line 7"
# Ensure that undo (even composite undo like 'replace')
# works when the widget shows nothing useful.
.t replace 2.1 2.3 foo
- .t configure -start 1 -end 1
+ .t configure -startline 1 -endline 1
.t edit undo
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
.t configure -undo 0
string equal [.t get 1.0 end-1c] $prevtext
} -cleanup {
@@ -1540,10 +1540,10 @@ Line 7"
# works when the the event took place in one peer, which
# is then deleted, before the undo takes place in another peer.
.tt replace 2.1 2.3 foo
- .tt configure -start 1 -end 1
+ .tt configure -startline 1 -endline 1
destroy .tt
.t edit undo
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
.t configure -undo 0
string equal [.t get 1.0 end-1c] $prevtext
} -cleanup {
@@ -1569,14 +1569,14 @@ Line 7"
# which isn't showing everything.
.tt replace 2.1 2.3 foo
set res [.tt get 2.1 2.4]
- .tt configure -start 1 -end 1
+ .tt configure -startline 1 -endline 1
destroy .tt
- .t configure -start 3 -end 4
+ .t configure -startline 3 -endline 4
# msg will actually be set to a silently ignored error message here,
# (that the .tt command doesn't exist), but that is not important.
lappend res [catch {.t edit undo}]
.t configure -undo 0
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [string equal [.t get 1.0 end-1c] $prevtext]
} -cleanup {
destroy .t
@@ -2068,7 +2068,7 @@ test text-10.2 {TextWidgetCmd procedure, "count" option} -setup {
.t count blah 1.0 2.0
} -cleanup {
destroy .t
-} -returnCodes {error} -result {bad option "blah" must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
+} -returnCodes {error} -result {bad option "blah": must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
test text-10.3 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2608,7 +2608,7 @@ test text-10.32 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines 1.0 2.0 3.0
} -cleanup {
destroy .t
-} -returnCodes {error} -result {bad option "1.0" must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
+} -returnCodes {error} -result {bad option "1.0": must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
test text-10.33 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -3488,7 +3488,7 @@ test text-14.18 {ConfigureText procedure} -constraints fonts -setup {
# to the appropriate size.
# On macOS, however, there is no way to make the window overlap the menubar.
if {[tk windowingsystem] == "aqua"} {
- set minY 23
+ set minY [expr [menubarheight] + 1]
} else {
set minY 0
}
@@ -7052,13 +7052,13 @@ test text-28.1 {bug fix - 624372, ControlUtfProc long lines} -body {
test text-29.1 {tabs - must be positive and must be increasing} -body {
pack [text .t -wrap none]
- .t configure -tabs {0}
+ .t configure -tabs 0
} -cleanup {
destroy .t
} -returnCodes {error} -result {tab stop "0" is not at a positive distance}
test text-29.2 {tabs - must be positive and must be increasing} -body {
pack [text .t -wrap none]
- .t configure -tabs {-5}
+ .t configure -tabs -5
} -cleanup {
destroy .t
} -returnCodes {error} -result {tab stop "-5" is not at a positive distance}
@@ -7172,7 +7172,7 @@ test text-31.4 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update
destroy .t .top
} -result {}
@@ -7182,7 +7182,7 @@ test text-31.5 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
pack [.top.t peer create .top.t2]
set res [list [.top.t index end] [.top.t2 index end]]
update
@@ -7196,8 +7196,8 @@ test text-31.6 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
- pack [.top.t peer create .top.t2 -start {} -end {}]
+ pack [.t peer create .top.t -startline 5 -endline 11]
+ pack [.top.t peer create .top.t2 -startline {} -endline {}]
set res [list [.top.t index end] [.top.t2 index end]]
update
return $res
@@ -7210,7 +7210,7 @@ test text-31.7 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
set p1 [.top.t count -update -ypixels 1.0 end]
set p2 [.t count -update -ypixels 5.0 11.0]
@@ -7224,7 +7224,7 @@ test text-31.8 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
.t delete 3.0 6.0
.top.t index end
@@ -7237,7 +7237,7 @@ test text-31.9 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
.t delete 8.0 12.0
.top.t index end
@@ -7250,7 +7250,7 @@ test text-31.10 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
.t delete 3.0 13.0
.top.t index end
@@ -7266,7 +7266,7 @@ test text-31.11 {peer widgets} -setup {
}
.t tag add sel 1.0 end-1c
lappend res [.t tag ranges sel]
- .t configure -start 10 -end 20
+ .t configure -startline 10 -endline 20
lappend res [.t tag ranges sel]
return $res
} -cleanup {
@@ -7281,7 +7281,7 @@ test text-31.12 {peer widgets} -setup {
}
.t tag add sel 1.0 end-1c
lappend res [.t tag ranges sel]
- .t configure -start 11
+ .t configure -startline 11
lappend res [.t tag ranges sel]
return $res
} -cleanup {
@@ -7296,7 +7296,7 @@ test text-31.13 {peer widgets} -setup {
}
.t tag add sel 1.0 end-1c
lappend res [.t tag ranges sel]
- .t configure -end 90
+ .t configure -endline 90
lappend res [.t tag ranges sel]
destroy .t
return $res
@@ -7312,7 +7312,7 @@ test text-31.14 {peer widgets} -setup {
}
.t tag add sel 1.0 3.0 5.0 7.0 9.0 11.0 13.0 15.0 17.0 19.0
lappend res [.t tag prevrange sel 1.0]
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
lappend res "next" [.t tag nextrange sel 4.0] \
[.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
@@ -7332,7 +7332,7 @@ test text-31.15 {peer widgets} -setup {
.t insert end "Line $i\n"
}
.t tag add sel 1.0 3.0 9.0 11.0 13.0 15.0 17.0 19.0
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
lappend res "next" [.t tag nextrange sel 4.0] \
[.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
@@ -7352,7 +7352,7 @@ test text-31.16 {peer widgets} -setup {
.t insert end "Line $i\n"
}
.t tag add sel 1.0 7.0 9.0 11.0 13.0 15.0 17.0 19.0
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
lappend res "next" [.t tag nextrange sel 4.0] \
[.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
@@ -7373,11 +7373,11 @@ test text-31.17 {peer widgets} -setup {
}
.t tag add sel 1.0 11.0
lappend res [.t tag ranges sel]
- lappend res [catch {.t configure -start 15 -end 10}]
+ lappend res [catch {.t configure -startline 15 -endline 10}]
lappend res [.t tag ranges sel]
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t tag ranges sel]
return $res
} -cleanup {
@@ -7446,7 +7446,7 @@ test text-32.1 {line heights on creation} -setup {
destroy .t
} -result 1
-test text-32.2 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.2 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7476,7 +7476,7 @@ test text-32.2 {peer widget -start, -end and deletion (bug 1630262)} -setup {
destroy .pt
} -result 1
-test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.3 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7497,7 +7497,7 @@ test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup {
destroy .pt
} -result {4 3}
-test text-32.4 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.4 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7540,7 +7540,7 @@ test text-32.4 {peer widget -start, -end and deletion (bug 1630262)} -setup {
destroy .pt .t
} -result {5 11 8 10 5 8 6 8 22 27 38 44 55 60 57 57}
-test text-32.2 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.2 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7570,7 +7570,7 @@ test text-32.2 {peer widget -start, -end and deletion (bug 1630262)} -setup {
destroy .pt
} -result 1
-test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.3 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7591,7 +7591,7 @@ test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup {
destroy .pt
} -result {4 3}
-test text-32.4 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.4 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7684,17 +7684,17 @@ test text-33.6 {TextWidgetCmd procedure, "peer" option} -setup {
} -result {.t2 .t {}}
test text-33.7 {peer widget -start, -end} -body {
text .t
- set res [.t configure -start 10 -end 5]
+ set res [.t configure -startline 10 -endline 5]
return $res
} -cleanup {
destroy .t
-} -returnCodes {2} -result {}
+} -returnCodes 2 -result {}
test text-33.8 {peer widget -start, -end} -body {
text .t
for {set i 1} {$i < 100} {incr i} {
.t insert end "Line $i\n"
}
- .t configure -start 10 -end 5
+ .t configure -startline 10 -endline 5
} -cleanup {
destroy .t
} -returnCodes {error} -result {-startline must be less than or equal to -endline}
@@ -7703,7 +7703,7 @@ test text-33.9 {peer widget -start, -end} -body {
for {set i 1} {$i < 100} {incr i} {
.t insert end "Line $i\n"
}
- .t configure -start 5 -end 10
+ .t configure -startline 5 -endline 10
} -cleanup {
destroy .t
} -returnCodes {ok} -result {}
@@ -7713,11 +7713,11 @@ test text-33.10 {peer widget -start, -end} -body {
.t insert end "Line $i\n"
}
set res [.t index end]
- lappend res [catch {.t configure -start 5 -end 10 -tab foo}]
+ lappend res [catch {.t configure -startline 5 -endline 10 -tab foo}]
lappend res [.t index end]
- lappend res [catch {.t configure -tab foo -start 15 -end 20}]
+ lappend res [catch {.t configure -tab foo -startline 15 -endline 20}]
lappend res [.t index end]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t index end]
return $res
} -cleanup {
@@ -7729,18 +7729,18 @@ test text-33.11 {peer widget -start, -end} -body {
.t insert end "Line $i\n"
}
set res [.t index end]
- lappend res [catch {.t configure -start 5 -end 15}]
+ lappend res [catch {.t configure -startline 5 -endline 15}]
lappend res [.t index end]
- lappend res [catch {.t configure -start 10 -end 40}]
+ lappend res [catch {.t configure -startline 10 -endline 40}]
lappend res [.t index end]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t index end]
return $res
} -cleanup {
destroy .t
} -result {101.0 0 11.0 0 31.0 101.0}
-test text-34.1 {peer widget -start, -end and selection} -setup {
+test text-34.1 {peer widget -start, -endline and selection} -setup {
text .t
set res {}
} -body {
@@ -7749,17 +7749,17 @@ test text-34.1 {peer widget -start, -end and selection} -setup {
}
.t tag add sel 10.0 20.0
lappend res [.t tag ranges sel]
- .t configure -start 5 -end 30
+ .t configure -startline 5 -endline 30
lappend res [.t tag ranges sel]
- .t configure -start 5 -end 15
+ .t configure -startline 5 -endline 15
lappend res [.t tag ranges sel]
- .t configure -start 15 -end 30
+ .t configure -startline 15 -endline 30
lappend res [.t tag ranges sel]
- .t configure -start 15 -end 16
+ .t configure -startline 15 -endline 16
lappend res [.t tag ranges sel]
- .t configure -start 25 -end 30
+ .t configure -startline 25 -endline 30
lappend res [.t tag ranges sel]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t tag ranges sel]
return $res
} -cleanup {
diff --git a/tests/textDisp.test b/tests/textDisp.test
index 7e02838..aeb1a70 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -17,10 +17,20 @@ if {[tk windowingsystem] == "aqua"} {
proc updateText {} {
update idletasks
}
+ proc delay {} {
+ update idletasks
+ after 100
+ update idletasks
+ }
} else {
proc updateText {} {
update
}
+ proc delay {} {
+ update
+ after 100
+ update
+ }
}
# The procedure below is used as the scrolling command for the text;
@@ -213,9 +223,9 @@ test textDisp-1.1 {GetStyle procedure, priorities and tab stops} {
.t delete 1.0 end
.t insert 1.0 "x\ty"
.t tag delete x y z
- .t tag configure x -tabs {50}
+ .t tag configure x -tabs 50
.t tag configure y -foreground black
- .t tag configure z -tabs {70}
+ .t tag configure z -tabs 70
.t tag add x 1.0 1.end
.t tag add y 1.0 1.end
.t tag add z 1.0 1.end
@@ -223,7 +233,7 @@ test textDisp-1.1 {GetStyle procedure, priorities and tab stops} {
set x [lindex [.t bbox 1.2] 0]
.t tag configure z -tabs {}
lappend x [lindex [.t bbox 1.2] 0]
- .t tag configure z -tabs {30}
+ .t tag configure z -tabs 30
.t tag raise x
update idletasks
lappend x [lindex [.t bbox 1.2] 0]
@@ -494,7 +504,7 @@ test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} {textfonts} {
.t tag add x 1.0 end
.t tag add y 1.1 end
lindex [.t bbox 1.3] 0
-} {75}
+} 75
test textDisp-2.25 {LayoutDLine, tabs, breaking chunks at tabs} {textfonts} {
.t delete 1.0 end
.t tag delete x
@@ -708,7 +718,7 @@ test textDisp-4.12 {UpdateDisplayInfo, filling in extra vertical space} {
.t yview moveto 1
updateText
winfo ismapped .b
-} {0}
+} 0
.t configure -wrap word
.t delete 1.0 end
.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\n"
@@ -1818,7 +1828,7 @@ test textDisp-13.11 {TkTextSeeCmd procedure} {} {
set res [.top2.t2 compare $ref == $new]
destroy .top2
set res
-} {0}
+} 0
wm geom . {}
.t configure -wrap none
@@ -2007,7 +2017,7 @@ test textDisp-15.8 {Scrolling near end of window} {
set res [.tf.f.t compare $newind > $refind]
destroy .tf
set res
-} {1}
+} 1
.t configure -wrap char
.t delete 1.0 end
@@ -2167,7 +2177,7 @@ test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
incr res -1
}
set res
-} {102}
+} 102
test textDisp-16.29 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
.t configure -height 1
updateText
@@ -2635,66 +2645,66 @@ test textDisp-19.11 {GetYView procedure} {
} {0.5 1.0}
test textDisp-19.11.2 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 1.0 end
-} {20}
+} 20
test textDisp-19.11.3 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines end 1.0
-} {-20}
+} -20
test textDisp-19.11.4 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 1.1 1.3
-} {0}
+} 0
test textDisp-19.11.5 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.1
-} {0}
+} 0
test textDisp-19.11.5.1 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.5
-} {0}
+} 0
test textDisp-19.11.6 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.24
-} {1}
+} 1
test textDisp-19.11.7 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.40
-} {2}
+} 2
test textDisp-19.11.8 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines "16.0 displaylineend +1c" "16.0 lineend"
-} {3}
+} 3
test textDisp-19.11.9 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 lineend"
-} {4}
+} 4
test textDisp-19.11.10 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.11 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 +2displaylines"
-} {2}
+} 2
test textDisp-19.11.12 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines "16.0 +1displayline" "16.0 +2displaylines -1c"
-} {0}
+} 0
.t tag configure elide -elide 1
test textDisp-19.11.13 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +1displaylines +6c"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.14 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +1displaylines displaylineend"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.15 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +2displaylines"
.t count -displaylines 16.0 "16.0 +4displaylines -1c"
-} {3}
+} 3
test textDisp-19.11.15a {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +2displaylines"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.16 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "14.0"
.t count -displaylines 12.0 16.0
-} {2}
+} 2
test textDisp-19.11.17 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "14.0"
@@ -2715,7 +2725,7 @@ test textDisp-19.11.19 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "16.0 +1displaylines"
.t count -displaylines 12.0 17.0
-} {4}
+} 4
test textDisp-19.11.20 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "16.0 +1displaylines"
@@ -3482,7 +3492,7 @@ test textDisp-26.5 {AdjustForTab procedure, numeric alignment} {
.t tag add y 1.2
.t tag add y 1.5
lindex [.t bbox 1.3] 0
-} {120}
+} 120
test textDisp-26.6 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1,456.234
@@ -3491,7 +3501,7 @@ test textDisp-26.6 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.7] 0
-} {120}
+} 120
test textDisp-26.7 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1.456.234,7
@@ -3500,7 +3510,7 @@ test textDisp-26.7 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.11] 0
-} {120}
+} 120
test textDisp-26.8 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\ttest
@@ -3509,7 +3519,7 @@ test textDisp-26.8 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.6] 0
-} {120}
+} 120
test textDisp-26.9 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1234
@@ -3518,7 +3528,7 @@ test textDisp-26.9 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.6] 0
-} {120}
+} 120
test textDisp-26.10 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1.234567
@@ -3527,7 +3537,7 @@ test textDisp-26.10 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.5
lindex [.t bbox 1.3] 0
-} {120}
+} 120
test textDisp-26.11 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\tx=1.234567
@@ -3537,7 +3547,7 @@ test textDisp-26.11 {AdjustForTab procedure, numeric alignment} {
.t tag add y 1.7
.t tag add y 1.9
lindex [.t bbox 1.5] 0
-} {120}
+} 120
test textDisp-26.12 {AdjustForTab procedure, adjusting chunks} {
.t delete 1.0 end
.t insert 1.0 a\tx1.234567
@@ -3550,7 +3560,7 @@ test textDisp-26.12 {AdjustForTab procedure, adjusting chunks} {
.t window create 1.3 -window .b
updateText
lindex [.t bbox 1.5] 0
-} {120}
+} 120
test textDisp-26.13 {AdjustForTab procedure, not enough space} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "abc\txyz\tqrs\txyz\t0"
@@ -3707,7 +3717,7 @@ test textDisp-27.7.2 {SizeOfTab procedure, fractional tab interpolation problem}
.t configure -tabs $precisetab
updateText
expr {[lindex $res 0] - [lindex [.t bbox 1.20] 0]}
-} {0}
+} 0
.t configure -wrap char -tabs {} -width 20
updateText
@@ -3723,7 +3733,7 @@ test textDisp-27.9 {SizeOfTab procedure, left alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\txyzzyabc
.t tag delete x
- .t tag configure x -tabs {120}
+ .t tag configure x -tabs 120
.t tag add x 1.0 end
list [.t bbox 1.3] [.t bbox 1.4]
} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
@@ -3739,7 +3749,7 @@ test textDisp-27.11 {SizeOfTab procedure, making tabs at least as wide as a spac
.t delete 1.0 end
.t insert 1.0 abc\tdefghijklmnopqrst
.t tag delete x
- .t tag configure x -tabs {120}
+ .t tag configure x -tabs 120
.t tag add x 1.0 end
list [.t bbox 1.5] [.t bbox 1.6]
} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
@@ -3912,14 +3922,14 @@ test textDisp-30.1 {elidden text joining multiple logical lines} {
.t2.t tag configure elidden -elide 1 -background red
.t2.t tag add elidden 1.2 3.2
.t2.t count -displaylines 1.0 end
-} {1}
+} 1
test textDisp-30.2 {elidden text joining multiple logical lines} {
.t2.t delete 1.0 end
.t2.t insert 1.0 "1111\n2222\n3333"
.t2.t tag configure elidden -elide 1 -background red
.t2.t tag add elidden 1.2 2.2
.t2.t count -displaylines 1.0 end
-} {2}
+} 2
catch {destroy .t2}
.t configure -height 1
@@ -3969,12 +3979,12 @@ test textDisp-31.3 {line update index shifting} {
.t insert 1.0 "abc\n"
.t insert 1.0 "abc\n"
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
.t.f configure -height 100
.t delete 1.0 3.0
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
set res
} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
@@ -4022,12 +4032,12 @@ test textDisp-31.6 {line update index shifting} {
.t insert 1.0 "abc\n"
.t insert 1.0 "abc\n"
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
textest configure -height 100
.t delete 1.0 3.0
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
set res
} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
@@ -4044,11 +4054,11 @@ test textDisp-31.7 {line update index shifting, elided} {
.t tag configure elide -elide 1
.t tag add elide 1.3 2.1
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
.t delete 1.0 3.0
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
set res
} [list [expr {$fixedHeight * 1}] [expr {$fixedHeight * 3}] [expr {$fixedHeight * 3}] [expr {$fixedHeight * 2}] [expr {$fixedHeight * 1}] [expr {$fixedHeight * 1}]]
@@ -4183,6 +4193,7 @@ test textDisp-32.3 "NULL undisplayProc problems: #1791052" -setup {
test textDisp-33.0 {one line longer than fits in the widget} {
pack [text .tt -wrap char]
+ updateText
.tt insert 1.0 [string repeat "more wrap + " 300]
updateText
.tt see 1.0
@@ -4191,6 +4202,7 @@ test textDisp-33.0 {one line longer than fits in the widget} {
test textDisp-33.1 {one line longer than fits in the widget} {
destroy .tt
pack [text .tt -wrap char]
+ updateText
.tt insert 1.0 [string repeat "more wrap + " 300]
updateText
.tt yview "1.0 +1 displaylines"
@@ -4204,12 +4216,12 @@ test textDisp-33.2 {one line longer than fits in the widget} {
destroy .tt
pack [text .tt -wrap char]
.tt debug 1
- update idletasks
+ updateText
set tk_textHeightCalc ""
- set timer [after 700 lappend tk_textHeightCalc "Timed out"]
+ set timer [after 200 lappend tk_textHeightCalc "Timed out"]
.tt insert 1.0 [string repeat "more wrap + " 1]
vwait tk_textHeightCalc
- after cancel timer
+ after cancel $timer
set tk_textHeightCalc
} {1.0}
test textDisp-33.3 {one line longer than fits in the widget} {
@@ -4224,7 +4236,7 @@ test textDisp-33.3 {one line longer than fits in the widget} {
# Each line should have been recalculated just once
.tt debug 0
expr {[llength $tk_textHeightCalc] == [.tt count -displaylines 1.0 end]}
-} {1}
+} 1
test textDisp-33.4 {one line longer than fits in the widget} {
destroy .tt
pack [text .tt -wrap char]
diff --git a/tests/textIndex.test b/tests/textIndex.test
index 310db6a..646c0a3 100644
--- a/tests/textIndex.test
+++ b/tests/textIndex.test
@@ -809,7 +809,7 @@ test textIndex-19.12.1 {Display lines} {
test textIndex-19.12.2 {Display lines} {
.t compare [.t index "2.50 + 100 displaylines"] == "end - 1 c"
-} {1}
+} 1
test textIndex-19.13 {Display lines} {
destroy {*}[pack slaves .]
diff --git a/tests/textMark.test b/tests/textMark.test
index 043ff82..2fa13b8 100644
--- a/tests/textMark.test
+++ b/tests/textMark.test
@@ -52,7 +52,7 @@ test textMark-1.4 {TkTextMarkCmd - "gravity" option} -body {
} -result {right 1.4}
test textMark-1.5 {TkTextMarkCmd - "gravity" option} -body {
.t mark set x 1.3
- .t mark g x left
+ .t mark gr x left
.t insert 1.3 x
list [.t mark gravity x] [.t index x]
} -result {left 1.3}
@@ -177,7 +177,7 @@ test textMark-6.4 {TkTextMarkNameToIndex, with mark outside -startline/-endline
} -result {1 {bad text index "mymark"} 1.0 1.0 1 {bad text index "mymark"} L 1 {bad text index "mymark"}}
test textMark-6.5 {insert and current marks in an empty peer - bug 3487407} -body {
.t mark set insert 1.0
- .t configure -start 5 -end 5
+ .t configure -startline 5 -endline 5
set res [.t index insert]
} -cleanup {
.t configure -startline {} -endline {}
diff --git a/tests/textWind.test b/tests/textWind.test
index 934b386..82d3269 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -13,7 +13,7 @@ tcltest::loadTestedCommands
deleteWindows
-set fixedFont {"Courier New" -12}
+set fixedFont {"Courier" -12}
set fixedHeight [font metrics $fixedFont -linespace]
set fixedWidth [font measure $fixedFont m]
set fixedAscent [font metrics $fixedFont -ascent]
diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test
index 2573e57..4bdabee 100644
--- a/tests/ttk/spinbox.test
+++ b/tests/ttk/spinbox.test
@@ -204,16 +204,19 @@ test spinbox-3.0 "textarea should expand to fill widget" -setup {
set ::spinbox_test {}
ttk::spinbox .sb -from 0 -to 10 -textvariable SBV
} -body {
- grid .sb -sticky ew
grid columnconfigure . 0 -weight 1
+ update idletasks
+ set timer [after 500 {set ::spinbox_test timedout}]
bind . <Map> {
after idle {
wm geometry . "210x80"
- after 100 {set ::spinbox_test [.sb identify element 5 5]}
+ update idletasks
+ set ::spinbox_test [.sb identify element 25 5]
}
bind . <Map> {}
}
- after 500 {set ::spinbox_wait 1} ; vwait ::spinbox_wait
+ grid .sb -sticky ew
+ vwait ::spinbox_test
set ::spinbox_test
} -cleanup {
destroy .sb
diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test
index b322ef7..2496c43 100644
--- a/tests/unixEmbed.test
+++ b/tests/unixEmbed.test
@@ -1238,13 +1238,12 @@ test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -con
deleteWindows
} -body {
frame .f1 -container 1 -width 200 -height 50
- update
pack .f1
- update
+ update idletasks
toplevel .t1 -use [winfo id .f1] -width 150 -height 80
- update
+ update idletasks
wm geometry .t1 +40+50
- update
+ update idletasks
wm geometry .t1
} -cleanup {
deleteWindows
@@ -1256,10 +1255,11 @@ test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -con
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
+ update idletasks
toplevel .t1 -use [winfo id .f1] -width 150 -height 80
- update
+ update idletasks
wm geometry .t1 70x300+10+20
- update
+ update idletasks
wm geometry .t1
} -cleanup {
deleteWindows
diff --git a/tests/unixFont.test b/tests/unixFont.test
index 177dab5..d7a989a 100644
--- a/tests/unixFont.test
+++ b/tests/unixFont.test
@@ -71,7 +71,7 @@ test unixfont-1.1 {TkpGetNativeFont procedure: not native} {x11 noExceed} {
} {1 {font "" doesn't exist}}
test unixfont-1.2 {TkpGetNativeFont procedure: native} x11 {
font measure fixed 0
-} {6}
+} 6
test unixfont-2.1 {TkpGetFontFromAttributes procedure: no family} x11 {
font actual {-size 10}
@@ -116,7 +116,7 @@ test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {
} {courier}
test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} x11 {
lindex [font actual {-family courier -size 37}] 3
-} {37}
+} 37
test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 {
# On Linux, XListFonts() was returning names for fonts that do not
# actually exist, causing the subsequent XLoadQueryFont() to fail
@@ -174,7 +174,7 @@ test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} x11 {
.b.c dchars $t 0 end
.b.c insert $t 0 "0000"
.b.c index $t @[expr int($ax*2.5)],1
-} {2}
+} 2
test unixfont-5.10 {Tk_MeasureChars procedure: TK_AT_LEAST_ONE} x11 {
.b.l config -text "000000000000"
getsize
@@ -243,7 +243,7 @@ test unixfont-8.1 {AllocFont procedure: use old font} x11 {
} {}
test unixfont-8.2 {AllocFont procedure: parse information from XLFD} x11 {
expr {[lindex [font actual {-family times -size 0}] 3] == 0}
-} {0}
+} 0
test unixfont-8.3 {AllocFont procedure: can't parse info from name} x11 {
catch {unset fontArray}
# check that font actual returns the correct attributes.
@@ -263,7 +263,7 @@ test unixfont-8.4 {AllocFont procedure: classify characters} x11 {
} [expr $cx*13]
test unixfont-8.5 {AllocFont procedure: setup widths of normal chars} x11 {
font metrics $courier -fixed
-} {1}
+} 1
test unixfont-8.6 {AllocFont procedure: setup widths of special chars} x11 {
set x 0
incr x [font measure $courier "\001"] ;# 4
diff --git a/tests/unixWm.test b/tests/unixWm.test
index 28c8159..3c9e46e 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -19,16 +19,6 @@ proc sleep ms {
vwait x
}
-# The macOS window manager shows an animation when a window is deiconified.
-# Tests which check the geometry of a window after deiconifying it should
-# wait for the animation to finish.
-
- proc animationDelay {} {
- if {[tk windowingsystem] == "aqua"} {
- sleep 250
- }
- }
-
# Procedure to set up a collection of top-level windows
proc makeToplevels {} {
@@ -46,9 +36,10 @@ proc makeToplevels {} {
# larger than the height of the menubar (normally 23 pixels).
if {[tk windowingsystem] eq "aqua"} {
- set Y0 23
- set Y2 25
- set Y5 28
+ set mb [expr [menubarheight] + 1]
+ set Y0 $mb
+ set Y2 [expr $mb + 2]
+ set Y5 [expr $mb + 5]
} else {
set Y0 0
set Y2 2
@@ -56,7 +47,7 @@ if {[tk windowingsystem] eq "aqua"} {
}
set i 1
-foreach geom "+23+80 +80+23 +0+$Y0" {
+foreach geom "+$Y0+80 +80+$Y0 +0+$Y0" {
destroy .t
test unixWm-1.$i {initial window position} unix {
toplevel .t -width 200 -height 150
@@ -82,7 +73,7 @@ update
scan [wm geom .t] %dx%d+%d+%d width height x y
set xerr [expr 150-$x]
set yerr [expr 150-$y]
-foreach geom "+20+80 +80+23 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
+foreach geom "+20+80 +80+$Y0 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
test unixWm-2.$i {moving window while mapped} unix {
wm geom .t $geom
update
@@ -94,14 +85,14 @@ foreach geom "+20+80 +80+23 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
}
set i 1
-foreach geom "+20+80 +80+23 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
+foreach geom "+20+80 +80+$Y0 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
test unixWm-3.$i {moving window while iconified} unix {
wm iconify .t
- sleep 200
+ update idletasks
wm geom .t $geom
- update
+ update idletasks
wm deiconify .t
- animationDelay
+ update idletasks
scan [wm geom .t] %dx%d%1s%d%1s%d width height xsign x ysign y
format "%s%d%s%d" $xsign [eval expr $x$xsign$xerr] $ysign \
[eval expr $y$ysign$yerr]
@@ -113,11 +104,11 @@ set i 1
foreach geom "+20+80 +100+40 +0+$Y0" {
test unixWm-4.$i {moving window while withdrawn} unix {
wm withdraw .t
- sleep 200
+ update idletasks
wm geom .t $geom
- update
+ update idletasks
wm deiconify .t
- animationDelay
+ update idletasks
wm geom .t
} 100x150$geom
incr i
@@ -194,27 +185,27 @@ test unixWm-5.7 {compounded state changes} {unix nonPortable} {
destroy .t
toplevel .t -width 200 -height 100
-wm geom .t +10+23
+wm geom .t +10+$Y0
wm minsize .t 1 1
update
test unixWm-6.1 {size changes} unix {
.t config -width 180 -height 150
update
wm geom .t
-} 180x150+10+23
+} 180x150+10+$Y0
test unixWm-6.2 {size changes} unix {
wm geom .t 250x60
.t config -width 170 -height 140
update
wm geom .t
-} 250x60+10+23
+} 250x60+10+$Y0
test unixWm-6.3 {size changes} unix {
wm geom .t 250x60
.t config -width 170 -height 140
wm geom .t {}
update
wm geom .t
-} 170x140+10+23
+} 170x140+10+$Y0
test unixWm-6.4 {size changes} {unix nonPortable userInteraction} {
wm minsize .t 1 1
update
@@ -301,6 +292,7 @@ test unixWm-8.4 {icon windows} unix {
destroy .icon
toplevel .t -width 100 -height 30
wm geom .t +0+0
+ update idletasks
set result [wm iconwindow .t]
toplevel .icon -width 50 -height 50 -bg red
wm iconwindow .t .icon
@@ -310,7 +302,7 @@ test unixWm-8.4 {icon windows} unix {
update
lappend result [winfo ismapped .t] [winfo ismapped .icon]
wm iconify .t
- update
+ update idletasks
lappend result [winfo ismapped .t] [winfo ismapped .icon]
} {.icon icon {} withdrawn 1 0 0 0}
test unixWm-8.5 {icon windows} unix {
@@ -348,7 +340,6 @@ test unixWm-8.8 {icon windows} unix {
wm geom .t +0+0
tkwait visibility .t ;# Needed to keep tvtwm happy.
wm iconwindow .t .icon
- sleep 500
lappend result [winfo ismapped .t] [winfo ismapped .icon]
} {1 1 0}
test unixWm-8.9 {icon windows} {unix nonPortable} {
@@ -420,25 +411,23 @@ test unixWm-9.3 {TkWmMapWindow procedure, iconic windows} unix {
toplevel .t -width 100 -height 300 -bg blue
wm geom .t +0+0
wm iconify .t
- sleep 500
winfo ismapped .t
-} {0}
+} 0
test unixWm-9.4 {TkWmMapWindow procedure, icon windows} unix {
destroy .t
- sleep 500
toplevel .t -width 100 -height 50 -bg blue
tkwait visibility .t
wm iconwindow . .t
update
set result [winfo ismapped .t]
-} {0}
+} 0
test unixWm-9.5 {TkWmMapWindow procedure, normal windows} unix {
destroy .t
toplevel .t -width 200 -height 20
wm geom .t +0+0
update
winfo ismapped .t
-} {1}
+} 1
test unixWm-10.1 {TkWmDeadWindow procedure, canceling UpdateGeometry idle handler} unix {
destroy .t
@@ -672,7 +661,7 @@ test unixWm-18.1 {Tk_WmCmd procedure, "frame" option} unix {
} {1 {wrong # args: should be "wm frame window"}}
test unixWm-18.2 {Tk_WmCmd procedure, "frame" option} {unix nonPortable} {
expr [wm frame .t] == [winfo id .t]
-} {0}
+} 0
test unixWm-18.3 {Tk_WmCmd procedure, "frame" option} {unix nonPortable} {
destroy .t2
toplevel .t2
@@ -682,7 +671,7 @@ test unixWm-18.3 {Tk_WmCmd procedure, "frame" option} {unix nonPortable} {
set result [expr [wm frame .t2] == [winfo id .t2]]
destroy .t2
set result
-} {1}
+} 1
test unixWm-19.1 {Tk_WmCmd procedure, "geometry" option} unix {
list [catch {wm geometry .t 12 13} msg] $msg
@@ -793,7 +782,7 @@ test unixWm-21.4 {Tk_WmCmd procedure, "group" option, make window exist} {unix t
set result [expr [testwrapper .t2] - [lindex $hints 8]]
destroy .t2
set result
-} {0}
+} 0
test unixWm-21.5 {Tk_WmCmd procedure, "group" option, create leader wrapper} {unix testwrapper} {
destroy .t2
destroy .t3
@@ -866,21 +855,21 @@ test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} unix {
destroy .t2
toplevel .t2
wm geom .t2 +0+0
- update
+ update idletasks
wm iconify .t2
- update
+ update idletasks
set result [winfo ismapped .t2]
destroy .t2
set result
-} {0}
+} 0
test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} unix {
destroy .t2
toplevel .t2
wm geom .t2 -0+0
- update
+ update idletasks
set result [winfo ismapped .t2]
wm iconify .t2
- update
+ update idletasks
lappend result [winfo ismapped .t2]
destroy .t2
set result
@@ -1384,12 +1373,13 @@ test unixWm-40.2 {Tk_SetGrid procedure, turning on grid when dimensions already
test unixWm-41.1 {ConfigureEvent procedure, internally generated size changes} unix {
destroy .t
toplevel .t -width 400 -height 150
- wm geometry .t +0+0
tkwait visibility .t
+ wm geometry .t +0+0
+ update idletasks
set result {}
lappend result [winfo width .t] [winfo height .t]
.t configure -width 200 -height 300
- sleep 500
+ update idletasks
lappend result [winfo width .t] [winfo height .t]
} {400 150 200 300}
test unixWm-41.2 {ConfigureEvent procedure, menubars} {nonPortable testmenubar} {
@@ -1453,11 +1443,11 @@ test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} unix {
bind .t <Unmap> {set x "unmapped"}
set x {no event}
wm iconify .t
- animationDelay
+ update idletasks
lappend result $x [winfo ismapped .t]
set x {no event}
wm deiconify .t
- animationDelay
+ update idletasks
lappend result $x [winfo ismapped .t]
} {unmapped 0 mapped 1}
@@ -1744,10 +1734,10 @@ test unixWm-48.10 {ParseGeometry procedure} unix {
} {1 {bad geometry specifier "+20+10z"}}
test unixWm-48.11 {ParseGeometry procedure} unix {
catch {wm geometry .t +-10+20}
-} {0}
+} 0
test unixWm-48.12 {ParseGeometry procedure} unix {
catch {wm geometry .t +30+-10}
-} {0}
+} 0
test unixWm-48.13 {ParseGeometry procedure, resize causes window to move} unix {
destroy .t
toplevel .t -width 200 -height 200
@@ -1953,13 +1943,13 @@ test unixWm-50.7 {Tk_CoordsToWindow procedure, more basics} unix {
test unixWm-50.8 {Tk_CoordsToWindow procedure, more basics} unix {
destroy .t
toplevel .t -width 400 -height 300 -bg green
- wm geom .t +0+0
+ wm geom .t +0+30
frame .t.f -width 200 -height 100 -bd 2 -relief raised
place .t.f -x 100 -y 100
frame .t.f.f -width 200 -height 100 -bd 2 -relief raised
place .t.f.f -x 100 -y 0
update
- set x [winfo rooty .t]
+ set x [winfo rootx .t]
set y [expr [winfo rooty .t] + 150]
list [winfo containing [expr $x + 50] $y] \
[winfo containing [expr $x + 150] $y] \
@@ -1970,7 +1960,6 @@ test unixWm-50.8 {Tk_CoordsToWindow procedure, more basics} unix {
test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} unix {
destroy .t
destroy .t2
- sleep 500 ;# Give window manager time to catch up.
toplevel .t -width 200 -height 200 -bg green
wm geometry .t +0+0
tkwait visibility .t
@@ -1979,7 +1968,7 @@ test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} unix {
tkwait visibility .t2
set result [list [winfo containing 100 100]]
wm iconify .t2
- animationDelay
+ update idletasks
lappend result [winfo containing 100 100]
} {.t2 .t}
test unixWm-50.10 {Tk_CoordsToWindow procedure, unmapped windows} unix {
@@ -1989,9 +1978,10 @@ test unixWm-50.10 {Tk_CoordsToWindow procedure, unmapped windows} unix {
frame .t.f -width 150 -height 150 -bd 2 -relief raised
place .t.f -x 25 -y 25
tkwait visibility .t.f
+ update idletasks
set result [list [winfo containing 100 100]]
place forget .t.f
- update
+ update idletasks
lappend result [winfo containing 100 100]
} {.t.f .t}
deleteWindows
@@ -2021,7 +2011,6 @@ test unixWm-51.3 {TkWmRestackToplevel procedure, basic tests} {unix nonPortable}
set result [winfo containing [winfo rootx .raise1] \
[winfo rooty .raise1]]
destroy .raise2
- sleep 500
list $result [winfo containing [winfo rootx .raise1] \
[winfo rooty .raise1]]
} {.raise2 .raise1}
@@ -2032,7 +2021,6 @@ test unixWm-51.4 {TkWmRestackToplevel procedure, basic tests} {unix nonPortable}
lower .raise3 .raise1
set result [winfo containing 100 100]
destroy .raise1
- sleep 500
lappend result [winfo containing 100 100]
} {.raise1 .raise3}
test unixWm-51.5 {TkWmRestackToplevel procedure, basic tests} {unix nonPortable} {
@@ -2047,7 +2035,6 @@ test unixWm-51.5 {TkWmRestackToplevel procedure, basic tests} {unix nonPortable}
set result [winfo containing [winfo rootx .raise1] \
[winfo rooty .raise1]]
destroy .raise1
- sleep 500
list $result [winfo containing [winfo rootx .raise2] \
[winfo rooty .raise2]]
} {.raise1 .raise3}
@@ -2070,11 +2057,9 @@ test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} unix
wm geometry $w +0+0
}
raise .t .t2
- sleep 2000
update
set result [list [winfo containing 100 100]]
lower .t3
- sleep 2000
lappend result [winfo containing 100 100]
} {.t3 .t}
test unixWm-51.8 {TkWmRestackToplevel procedure, overrideredirect windows} unix {
@@ -2250,7 +2235,7 @@ test unixWm-54.2 {TkpMakeMenuWindow procedure, setting override_redirect} {unix
set result [wm overrideredirect .m]
destroy .m
set result
-} {1}
+} 1
# No tests for TkGetPointerCoords, CreateWrapper, or GetMaxSize.
diff --git a/tests/winSend.test b/tests/winSend.test
index 31c800e..9286884 100644
--- a/tests/winSend.test
+++ b/tests/winSend.test
@@ -152,7 +152,7 @@ test winSend-3.1 {TkGetInterpNames} winSend {
set origLength [llength $currentInterps]
set newLength [llength [winfo interps]]
expr {($newLength - 2) == $origLength}
-} {1}
+} 1
test winSend-4.1 {DeleteProc - changing name of app} winSend {
newApp a
@@ -171,7 +171,7 @@ test winSend-5.1 {ExecuteRemoteObject - no error} winSend {
}
}
list [send $interp {send [tk appname] {expr {2 / 1}}}]
-} {2}
+} 2
test winSend-5.2 {ExecuteRemoteObject - error} winSend {
set newInterps [winfo interps]
foreach interp $newInterps {
@@ -268,7 +268,7 @@ test winSend-6.8 {SendDDEServer - XTYP_WILDCONNECT} winSend {
}
set command "dde services Tk {}"
list [catch "send \{$interp\} \{$command\}"]
-} {0}
+} 0
test winSend-7.1 {DDEExitProc} winSend {
newApp testApp
@@ -312,10 +312,10 @@ test winSend-10.7 {Tk_DDEObjCmd - services wrong num args} winSend {
} {1 {wrong # args: should be "dde services serviceName topicName"}}
test winSend-10.8 {Tk_DDEObjCmd - null service name} winSend {
list [catch {dde services {} {tktest #2}}]
-} {0}
+} 0
test winSend-10.9 {Tk_DDEObjCmd - null topic name} winSend {
list [catch {dde services {Tk} {}}]
-} {0}
+} 0
test winSend-10.10 {Tk_DDEObjCmd - execute - nothing to execute} winSend {
set newInterps [winfo interps]
foreach interp $newInterps {
diff --git a/tests/wm.test b/tests/wm.test
index 310e2db..99ba84a 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -33,7 +33,9 @@ proc stdWindow {} {
#
proc raiseDelay {} {
- after 100; update
+ after 100;
+ update
+ update idletasks
}
# How to carry out a small delay while processing events
@@ -808,10 +810,10 @@ test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup {
test wm-iconify-3.1 {iconify behavior} -body {
toplevel .t2
wm geom .t2 -0+0
- update
+ update idletasks
set result [winfo ismapped .t2]
wm iconify .t2
- update
+ update idletasks
lappend result [winfo ismapped .t2]
} -cleanup {
destroy .t2
@@ -1738,11 +1740,11 @@ test wm-transient-4.2 {already mapped transient toplevel
toplevel .master
raiseDelay
wm iconify .master
- update
+ update idletasks
toplevel .subject
- update
+ update idletasks
wm transient .subject .master
- update
+ update idletasks
list [wm state .subject] [winfo ismapped .subject]
} -cleanup {
deleteWindows
@@ -1753,13 +1755,13 @@ test wm-transient-4.3 {iconify/deiconify on the master
} -body {
toplevel .master
toplevel .subject
- update
+ update idletasks
wm transient .subject .master
wm iconify .master
- update
+ update idletasks
lappend results [wm state .subject] [winfo ismapped .subject]
wm deiconify .master
- update
+ update idletasks
lappend results [wm state .subject] [winfo ismapped .subject]
} -cleanup {
deleteWindows
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index cf864c0..7824470 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -1084,7 +1084,7 @@ GetTearoffEntryGeometry(
{
(void)mePtr;
- if (menuPtr->menuType != MASTER_MENU) {
+ if (menuPtr->menuType != MAIN_MENU) {
*heightPtr = 0;
*widthPtr = 0;
} else {
@@ -1312,7 +1312,7 @@ DrawTearoffEntry(
(void)tkfont;
(void)fmPtr;
- if (menuPtr->menuType != MASTER_MENU) {
+ if (menuPtr->menuType != MAIN_MENU) {
return;
}
@@ -1407,16 +1407,16 @@ SetHelpMenu(
cascadeEntryPtr != NULL;
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
if ((cascadeEntryPtr->menuPtr->menuType == MENUBAR)
- && (cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin != NULL)
- && (menuPtr->masterMenuPtr->tkwin != NULL)) {
- TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr;
+ && (cascadeEntryPtr->menuPtr->mainMenuPtr->tkwin != NULL)
+ && (menuPtr->mainMenuPtr->tkwin != NULL)) {
+ TkMenu *mainMenuPtr = cascadeEntryPtr->menuPtr->mainMenuPtr;
char *helpMenuName = (char *)ckalloc(strlen(Tk_PathName(
- masterMenuPtr->tkwin)) + strlen(".help") + 1);
+ mainMenuPtr->tkwin)) + strlen(".help") + 1);
- strcpy(helpMenuName, Tk_PathName(masterMenuPtr->tkwin));
+ strcpy(helpMenuName, Tk_PathName(mainMenuPtr->tkwin));
strcat(helpMenuName, ".help");
if (strcmp(helpMenuName,
- Tk_PathName(menuPtr->masterMenuPtr->tkwin)) == 0) {
+ Tk_PathName(menuPtr->mainMenuPtr->tkwin)) == 0) {
cascadeEntryPtr->entryFlags |= ENTRY_HELP_MENU;
} else {
cascadeEntryPtr->entryFlags &= ~ENTRY_HELP_MENU;
diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h
index a72c0fe..da38710 100644
--- a/unix/tkUnixPort.h
+++ b/unix/tkUnixPort.h
@@ -149,7 +149,7 @@
#define TkpButtonSetDefaults() {}
#define TkpDestroyButton(butPtr) {}
-#define TkpWillDrawWidget(tkwin) 1
+#define TkpWillDrawWidget(tkwin) 0
#define TkpRedrawWidget(tkwin)
#define TkSelUpdateClipboard(a,b) {}
#ifndef __CYGWIN__
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 0b6efcf..c64bd9c 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -685,7 +685,7 @@ ReconfigureWindowsMenu(
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds,
- Tk_PathName(menuPtr->masterMenuPtr->tkwin), -1);
+ Tk_PathName(menuPtr->mainMenuPtr->tkwin), -1);
Tcl_DStringAppend(&ds, ".system", 7);
menuRefPtr = TkFindMenuReferences(menuPtr->interp,
@@ -696,7 +696,7 @@ ReconfigureWindowsMenu(
if ((menuRefPtr != NULL)
&& (menuRefPtr->menuPtr != NULL)
&& (menuPtr->parentTopLevelPtr != NULL)
- && (systemMenuPtr->masterMenuPtr
+ && (systemMenuPtr->mainMenuPtr
== menuRefPtr->menuPtr)) {
HMENU systemMenuHdl = (HMENU) systemMenuPtr->platformData;
HWND wrapper = TkWinGetWrapperWindow(menuPtr
@@ -1689,7 +1689,7 @@ GetTearoffEntryGeometry(
(void)mePtr;
(void)tkfont;
- if (menuPtr->menuType != MASTER_MENU) {
+ if (menuPtr->menuType != MAIN_MENU) {
*heightPtr = 0;
} else {
*heightPtr = fmPtr->linespace;
@@ -2597,7 +2597,7 @@ DrawTearoffEntry(
(void)tkfont;
(void)fmPtr;
- if (menuPtr->menuType != MASTER_MENU) {
+ if (menuPtr->menuType != MAIN_MENU) {
return;
}
@@ -3229,7 +3229,7 @@ TkpMenuNotifyToplevelCreate(
if ((menuName != NULL) && (menuName[0] != '\0')) {
menuRefPtr = TkFindMenuReferences(interp, menuName);
if ((menuRefPtr != NULL) && (menuRefPtr->menuPtr != NULL)) {
- for (menuPtr = menuRefPtr->menuPtr->masterMenuPtr; menuPtr != NULL;
+ for (menuPtr = menuRefPtr->menuPtr->mainMenuPtr; menuPtr != NULL;
menuPtr = menuPtr->nextInstancePtr) {
if (menuPtr->menuType == MENUBAR) {
ScheduleMenuReconfigure(menuPtr);
diff --git a/win/tkWinPort.h b/win/tkWinPort.h
index 880c952..72ca0e0 100644
--- a/win/tkWinPort.h
+++ b/win/tkWinPort.h
@@ -133,7 +133,7 @@
* Other functions not used under Windows
*/
-#define TkpWillDrawWidget(tkwin) 1
+#define TkpWillDrawWidget(tkwin) 0
#define TkpRedrawWidget(tkwin)
#endif /* _WINPORT */
diff --git a/xlib/xgc.c b/xlib/xgc.c
index ed12f4b..22f4b4e 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -81,7 +81,7 @@ static void FreeClipMask(GC gc) {
TkpReleaseRegion(((TkpClipMask*) gc->clip_mask)->value.region);
}
#endif
- ckfree((char *) gc->clip_mask);
+ ckfree((char *)gc->clip_mask);
gc->clip_mask = None;
}
}
@@ -847,7 +847,7 @@ XCreateGlyphCursor(
(void)foreground_color;
(void)background_color;
- return 1;
+ return (Cursor) NULL;
}
XFontSet
@@ -970,8 +970,7 @@ XSetIMValues(
return NULL;
}
-
-
+
/*
* Local Variables:
* mode: c