summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-11-30 20:54:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-11-30 20:54:37 (GMT)
commit682e78d50eff346d5f0d3914c3913c6cb0c92c5a (patch)
tree0d6fa67a20f44bbbcd9b3aa41c603ed38b6e1654
parent3f351dd65a460eed8c85334493d901b90275ffc5 (diff)
parent4138204f761f61153be0a1bab6a1fe917029eaf9 (diff)
downloadtk-682e78d50eff346d5f0d3914c3913c6cb0c92c5a.zip
tk-682e78d50eff346d5f0d3914c3913c6cb0c92c5a.tar.gz
tk-682e78d50eff346d5f0d3914c3913c6cb0c92c5a.tar.bz2
Merge 8.7
-rw-r--r--changes61
-rw-r--r--doc/bind.n6
-rw-r--r--doc/menu.n4
-rw-r--r--doc/ttk_widget.n2
-rw-r--r--doc/wm.n4
-rw-r--r--generic/tkButton.c2
-rw-r--r--generic/tkDecls.h3
-rw-r--r--generic/tkEvent.c2
-rw-r--r--generic/tkGrab.c2
-rw-r--r--generic/tkInt.h2
-rw-r--r--generic/tkWindow.c2
-rw-r--r--library/console.tcl44
-rw-r--r--library/demos/pendulum.tcl2
-rw-r--r--library/optMenu.tcl2
-rw-r--r--library/tearoff.tcl12
-rw-r--r--library/tk.tcl4
-rw-r--r--library/ttk/button.tcl4
-rw-r--r--library/ttk/clamTheme.tcl2
-rw-r--r--library/ttk/combobox.tcl4
-rw-r--r--library/ttk/entry.tcl16
-rw-r--r--library/ttk/menubutton.tcl2
-rw-r--r--library/ttk/panedwindow.tcl10
-rw-r--r--library/ttk/progress.tcl4
-rw-r--r--library/ttk/scrollbar.tcl2
-rw-r--r--library/ttk/sizegrip.tcl2
-rw-r--r--library/ttk/treeview.tcl16
-rw-r--r--library/ttk/utils.tcl6
-rw-r--r--library/ttk/vistaTheme.tcl2
-rw-r--r--library/ttk/winTheme.tcl6
-rw-r--r--library/ttk/xpTheme.tcl2
-rw-r--r--macosx/README2
-rw-r--r--macosx/tkMacOSXButton.c10
-rw-r--r--macosx/tkMacOSXColor.c17
-rw-r--r--macosx/tkMacOSXColor.h4
-rw-r--r--macosx/tkMacOSXConstants.h6
-rw-r--r--macosx/tkMacOSXDefault.h7
-rw-r--r--macosx/tkMacOSXDialog.c1
-rw-r--r--macosx/tkMacOSXHLEvents.c8
-rw-r--r--macosx/tkMacOSXImage.c19
-rw-r--r--macosx/tkMacOSXInit.c39
-rw-r--r--macosx/tkMacOSXMouseEvent.c361
-rw-r--r--macosx/tkMacOSXPrint.c4
-rw-r--r--macosx/tkMacOSXPrivate.h13
-rw-r--r--macosx/tkMacOSXSubwindows.c49
-rw-r--r--macosx/tkMacOSXTest.c28
-rw-r--r--macosx/tkMacOSXWindowEvent.c68
-rw-r--r--macosx/tkMacOSXWm.c5
-rw-r--r--macosx/ttkMacOSXTheme.c58
-rw-r--r--tests/bind.test26
-rw-r--r--tests/color.test2
-rw-r--r--tests/ttk/combobox.test2
-rw-r--r--tests/ttk/entry.test6
-rw-r--r--tests/ttk/labelframe.test4
-rw-r--r--tests/ttk/notebook.test4
-rw-r--r--tests/ttk/panedwindow.test4
-rw-r--r--tests/ttk/radiobutton.test2
-rw-r--r--tests/ttk/scrollbar.test2
-rw-r--r--tests/ttk/treetags.test4
-rw-r--r--tests/ttk/treeview.test2
-rw-r--r--tests/ttk/ttk.test12
-rw-r--r--tests/ttk/validate.test2
-rw-r--r--tests/unixWm.test2
-rw-r--r--unix/Makefile.in13
-rwxr-xr-xunix/configure48
-rw-r--r--unix/configure.ac1
-rw-r--r--unix/tcl.m456
-rw-r--r--unix/tkUnix3d.c4
-rw-r--r--unix/tkUnixColor.c1
-rw-r--r--unix/tkUnixDefault.h1
-rw-r--r--unix/tkUnixEvent.c1
-rw-r--r--win/Makefile.in9
-rwxr-xr-xwin/configure35
-rw-r--r--win/tcl.m413
-rwxr-xr-xwin/tkUuid.h.in1
-rw-r--r--win/tkWinDefault.h1
75 files changed, 730 insertions, 459 deletions
diff --git a/changes b/changes
index 144dee7..cd6cea3 100644
--- a/changes
+++ b/changes
@@ -7866,6 +7866,67 @@ in this changeset (new minor version) rather than bug fixes:
- Released 8.6.11, Dec 31, 2020 - https://core.tcl-lang.org/tk/ for details
+2021-01-04 (bug)[19fb7a] Mac: [tk_messageBox] use proper icons (ericwb,culler)
+
+2021-01-11 (bug)[7beaed] ttk::bindMouseWheel syntax error (nemethi)
+
+2021-01-15 (new) support 4 new keycodes: CodeInput, SingleCandidate,
+ MultipleCandidate, PreviousCandidate (nijtmans)
+
+2021-01-18 (new) Portable keycodes: OE, oe, Ydiaeresis (nijtmans)
+
+2021-01-27 (bug)[bdcab8] Mac crash on non-BMP menu label (nab,culler)
+
+2021-02-07 (bug)[9e1312] <Enter> to parent after child destroyed (leunissen)
+
+2021-02-10 (bug)[d3cd4c] more robust notebook processing (nemethi)
+
+2021-02-25 (bug)[234ee4] crash in [clipboard get] invalid encoding (nijtmans)
+
+2021-02-25 (bug)[be9cad] Poor trace housekeeping -> tkwait segfault (michael)
+
+2021-03-02 (bug)[1626ed] Mac: crash with dead key as menu accelerator (culler)
+
+2021-03-22 (bug)[9b6065] restore Tcl [update], see window-2.12 (leunissen)
+
+2021-04-07 (bug)[58222c] Mac: entry and spinbox bg colors (chavez,culler)
+
+2021-04-18 (bug)[34db75,ea876b] cursor motion in peer text (vogel)
+
+2021-04-26 (bug)[c97464] memleak in TkpDrawAngledChars (nab,culler)
+
+2021-04-29 Mac: explicit backing CALayer to fix rendering issues (culler)
+
+2021-05-02 Mac: respect key repeat system setting (culler)
+
+2021-05-10 (bug)[171ba7] crash when grab and focus are not coordinated (culler)
+
+2021-05-24 crash due to failed transient record housekeeping (culler)
+
+2021-05-25 (bug)[7bda98] Mac: <Double-1> bindings fire twice on app activation
+
+2021-06-03 (bug)[4401d3] Mac: improved support of pixel formats (chavez,culler)
+
+2021-06-03 (bug)[8ecc3e] Mac: window exposed by Mission Control (chavez,culler)
+
+2021-06-04 (bug)[099109] segfault reusing a container toplevel (culler)
+
+2021-06-22 (bug)[4efbfe] static package init order in wish (werner)
+
+2021-09-21 (bug)[033886] Win: hang in font loading (e-paine,vogel)
+
+2021-10-14 (bug)[8ebed3] multi-thread safety in Xft use (werner)
+
+2021-10-22 (new)[TIP 608] New virtual event <<TkWorldChanged>> (griffin)
+
+2021-10-27 (bug) file dialog compatibility with Mac OS 12 (culler)
+
+2021-10-29 (bug) Mac: stop crash when non-Tk windows go full screen (werner)
+
+2021-10-30 (bug)[6ea0b3] Mac: grab from menu makes dead window (culler)
+
+- Released 8.6.12, Nov 5, 2021 - https://core.tcl-lang.org/tk/ for details
+
Changes to 8.7a3 include all changes to the 8.6 line through 8.6.10,
plus the following, which focuses on the high-level feature changes
in this changeset (new minor version) rather than bug fixes:
diff --git a/doc/bind.n b/doc/bind.n
index fc1427e..9fa97e5 100644
--- a/doc/bind.n
+++ b/doc/bind.n
@@ -54,12 +54,12 @@ tags provide the following behavior:
If a tag is the name of an internal window the binding applies
to that window.
.IP \(bu 3
+If the tag is the name of a class of widgets, such as \fBButton\fR,
+the binding applies to all widgets in that class.
+.IP \(bu 3
If the tag is the name of a toplevel window the binding applies
to the toplevel window and all its internal windows.
.IP \(bu 3
-If the tag is the name of a class of widgets, such as \fBButton\fR,
-the binding applies to all widgets in that class;
-.IP \(bu 3
If \fItag\fR has the value \fBall\fR,
the binding applies to all windows in the application.
.SH "EVENT PATTERNS"
diff --git a/doc/menu.n b/doc/menu.n
index 41054a4..df8614b 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -375,7 +375,7 @@ The following widget commands are possible for menu widgets:
Change the state of the entry indicated by \fIindex\fR to \fBactive\fR
and redisplay it using its active colors.
Any previously-active entry is deactivated. If \fIindex\fR
-is specified as \fBnone\fR or \fB{}\fR, or if the specified entry is
+is specified as \fB{}\fR or \fBnone\fR, or if the specified entry is
disabled, then the menu ends up with no active entry.
Returns an empty string.
.TP
@@ -451,7 +451,7 @@ information on the format of this list).
\fIpathName \fBindex \fIindex\fR
.
Returns the numerical index corresponding to \fIindex\fR, or
-\fBnone\fR if \fIindex\fR was specified as \fBnone\fR or \fB{}\fR.
+\fB{}\fR if \fIindex\fR was specified as \fB{}\fR or \fBnone\fR.
.TP
\fIpathName \fBinsert \fIindex type \fR?\fIoption value option value ...\fR?
.
diff --git a/doc/ttk_widget.n b/doc/ttk_widget.n
index 06cb83c..23f2118 100644
--- a/doc/ttk_widget.n
+++ b/doc/ttk_widget.n
@@ -83,7 +83,7 @@ in the case both \fB\-text\fR and \fB\-image\fR are present.
If set to the empty string (the default), the rules described in the
"Elements" section of \fIttk::intro(n)\fR explain which value is actually
used.
-Valid values are:
+The other valid values are:
.RS
.IP text
Display text only.
diff --git a/doc/wm.n b/doc/wm.n
index 7fa93e7..9762e4f 100644
--- a/doc/wm.n
+++ b/doc/wm.n
@@ -670,6 +670,10 @@ If a \fBWM_DELETE_WINDOW\fR message arrives when you have not defined
a handler, then Tk handles the message by destroying the window for
which it was received.
.RE
+.RS
+.PP
+On the Windows platform, the protocol handler \fBWM_SAVE_YOURSELF\fR is called on user logout or system restart.
+.RE
.TP
\fBwm resizable \fIwindow\fR ?\fIwidth height\fR?
.
diff --git a/generic/tkButton.c b/generic/tkButton.c
index bf16489..057b11c 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -105,7 +105,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = {
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_BUTTON_FONT, TCL_INDEX_NONE, offsetof(TkButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_BUTTON_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0},
+ DEF_LABEL_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0},
{TK_OPTION_STRING, "-height", "height", "Height",
DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
diff --git a/generic/tkDecls.h b/generic/tkDecls.h
index b7b0c14..f2fe64c 100644
--- a/generic/tkDecls.h
+++ b/generic/tkDecls.h
@@ -1188,8 +1188,7 @@ typedef struct TkStubs {
Tcl_Obj * (*tk_NewWindowObj) (Tk_Window tkwin); /* 277 */
void (*tk_SendVirtualEvent) (Tk_Window tkwin, const char *eventName, Tcl_Obj *detail); /* 278 */
Tcl_Obj * (*tk_FontGetDescription) (Tk_Font tkfont); /* 279 */
- void (*tk_CreatePhotoImageFormatVersion3) (
- const Tk_PhotoImageFormatVersion3 *formatPtr); /* 280 */
+ void (*tk_CreatePhotoImageFormatVersion3) (const Tk_PhotoImageFormatVersion3 *formatPtr); /* 280 */
} TkStubs;
extern const TkStubs *tkStubsPtr;
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 698e9e1..0b37119 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -1842,7 +1842,7 @@ DelayedMotionProc(
void
TkCreateExitHandler(
Tcl_ExitProc *proc, /* Function to invoke. */
- ClientData clientData) /* Arbitrary value to pass to proc. */
+ void *clientData) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index c1955a0..24bfd83 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -16,6 +16,8 @@
#include "tkWinInt.h"
#elif !defined(MAC_OSX_TK)
#include "tkUnixInt.h"
+#else
+#include "tkMacOSXInt.h"
#endif
/*
diff --git a/generic/tkInt.h b/generic/tkInt.h
index d7c4b12..031630b 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -1327,7 +1327,7 @@ MODULE_SCOPE const char *TkCanvasTagsPrintProc(ClientData clientData, Tk_Window
MODULE_SCOPE void TkMapTopFrame(Tk_Window tkwin);
MODULE_SCOPE XEvent * TkpGetBindingXEvent(Tcl_Interp *interp);
MODULE_SCOPE void TkCreateExitHandler(Tcl_ExitProc *proc,
- ClientData clientData);
+ void *clientData);
MODULE_SCOPE void TkDeleteExitHandler(Tcl_ExitProc *proc,
ClientData clientData);
MODULE_SCOPE Tcl_ExitProc TkFinalize;
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index dcaaf69..917eadd 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -2863,7 +2863,7 @@ TkCygwinMainEx(
void (*tkmainex)(int, char **, Tcl_AppInitProc *, Tcl_Interp *);
/* construct "<path>/libtk8.?.dll", from "<path>/tk8?.dll" */
- len = GetModuleFileNameW(Tk_GetHINSTANCE(), name, MAX_PATH);
+ len = GetModuleFileNameW((HINSTANCE)Tk_GetHINSTANCE(), name, MAX_PATH);
name[len-2] = '.';
name[len-1] = name[len-5];
wcscpy(name+len, L".dll");
diff --git a/library/console.tcl b/library/console.tcl
index f88cfc1..07b199e 100644
--- a/library/console.tcl
+++ b/library/console.tcl
@@ -215,7 +215,7 @@ proc ::tk::ConsoleSource {} {
[list [mc "Tcl Scripts"] .tcl] \
[list [mc "All Files"] *]]]
if {$filename ne ""} {
- set cmd [list source -encoding utf-8 $filename]
+ set cmd [list source -encoding utf-8 $filename]
if {[catch {consoleinterp eval $cmd} result]} {
ConsoleOutput stderr "$result\n"
}
@@ -273,22 +273,22 @@ proc ::tk::ConsoleHistory {cmd} {
variable HistNum
switch $cmd {
- prev {
+ prev {
incr HistNum -1
if {$HistNum == 0} {
set cmd {history event [expr {[history nextid] -1}]}
} else {
set cmd "history event $HistNum"
}
- if {[catch {consoleinterp eval $cmd} cmd]} {
- incr HistNum
- return
- }
+ if {[catch {consoleinterp eval $cmd} cmd]} {
+ incr HistNum
+ return
+ }
.console delete promptEnd end
- .console insert promptEnd $cmd {input stdin}
+ .console insert promptEnd $cmd {input stdin}
.console see end
- }
- next {
+ }
+ next {
incr HistNum
if {$HistNum == 0} {
set cmd {history event [expr {[history nextid] -1}]}
@@ -304,10 +304,10 @@ proc ::tk::ConsoleHistory {cmd} {
.console delete promptEnd end
.console insert promptEnd $cmd {input stdin}
.console see end
- }
- reset {
- set HistNum 1
- }
+ }
+ reset {
+ set HistNum 1
+ }
}
}
@@ -324,19 +324,19 @@ proc ::tk::ConsolePrompt {{partial normal}} {
if {$partial eq "normal"} {
set temp [$w index "end - 1 char"]
$w mark set output end
- if {[consoleinterp eval "info exists tcl_prompt1"]} {
- consoleinterp eval "eval \[set tcl_prompt1\]"
- } else {
- puts -nonewline [EvalAttached $::tk::console::defaultPrompt]
- }
+ if {[consoleinterp eval "info exists tcl_prompt1"]} {
+ consoleinterp eval "eval \[set tcl_prompt1\]"
+ } else {
+ puts -nonewline [EvalAttached $::tk::console::defaultPrompt]
+ }
} else {
set temp [$w index output]
$w mark set output end
- if {[consoleinterp eval "info exists tcl_prompt2"]} {
- consoleinterp eval "eval \[set tcl_prompt2\]"
- } else {
+ if {[consoleinterp eval "info exists tcl_prompt2"]} {
+ consoleinterp eval "eval \[set tcl_prompt2\]"
+ } else {
puts -nonewline "> "
- }
+ }
}
flush stdout
$w mark set output $temp
diff --git a/library/demos/pendulum.tcl b/library/demos/pendulum.tcl
index 04f276b..50760c1 100644
--- a/library/demos/pendulum.tcl
+++ b/library/demos/pendulum.tcl
@@ -94,7 +94,7 @@ proc showPhase {canvas} {
global Theta dTheta points psw psh
lappend points [expr {$Theta+$psw}] [expr {-20*$dTheta+$psh}]
if {[llength $points] > 100} {
- set points [lrange $points end-99 end]
+ set points [lrange $points end-99 end]
}
for {set i 0} {$i<100} {incr i 10} {
set list [lrange $points end-[expr {$i-1}] end-[expr {$i-12}]]
diff --git a/library/optMenu.tcl b/library/optMenu.tcl
index 4beb3c7..aeddc01 100644
--- a/library/optMenu.tcl
+++ b/library/optMenu.tcl
@@ -37,7 +37,7 @@ proc ::tk_optionMenu {w varName firstValue args} {
menu $w.menu -tearoff 0
$w.menu add radiobutton -label $firstValue -variable $varName
foreach i $args {
- $w.menu add radiobutton -label $i -variable $varName
+ $w.menu add radiobutton -label $i -variable $varName
}
return $w.menu
}
diff --git a/library/tearoff.tcl b/library/tearoff.tcl
index c368da2..45f7dcb 100644
--- a/library/tearoff.tcl
+++ b/library/tearoff.tcl
@@ -31,10 +31,10 @@ proc ::tk::TearOffMenu {w {x 0} {y 0}} {
# away when the toplevel goes away.
if {$x == 0} {
- set x [winfo rootx $w]
+ set x [winfo rootx $w]
}
if {$y == 0} {
- set y [winfo rooty $w]
+ set y [winfo rooty $w]
if {[tk windowingsystem] eq "aqua"} {
# Shift by height of tearoff entry minus height of window titlebar
catch {incr y [expr {[$w yposition 1] - 16}]}
@@ -66,14 +66,14 @@ proc ::tk::TearOffMenu {w {x 0} {y 0}} {
set parent [winfo parent $w]
if {[$menu cget -title] ne ""} {
- wm title $menu [$menu cget -title]
+ wm title $menu [$menu cget -title]
} else {
- switch -- [winfo class $parent] {
+ switch -- [winfo class $parent] {
Menubutton {
- wm title $menu [$parent cget -text]
+ wm title $menu [$parent cget -text]
}
Menu {
- wm title $menu [$parent entrycget active -label]
+ wm title $menu [$parent entrycget active -label]
}
}
}
diff --git a/library/tk.tcl b/library/tk.tcl
index 2531e6a..7a70f21 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -695,11 +695,11 @@ if {[tk windowingsystem] eq "aqua"} {
#stub procedures to respond to "do script" Apple Events
proc ::tk::mac::DoScriptFile {file} {
uplevel #0 $file
- source -encoding utf-8 $file
+ source -encoding utf-8 $file
}
proc ::tk::mac::DoScriptText {script} {
uplevel #0 $script
- eval $script
+ eval $script
}
#This procedure is required to silence warnings generated
#by inline AppleScript execution.
diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl
index 14460a2..a14a53b 100644
--- a/library/ttk/button.tcl
+++ b/library/ttk/button.tcl
@@ -66,7 +66,7 @@ proc ttk::button::activate {w} {
proc ttk::button::RadioTraverse {w dir} {
set group [list]
foreach sibling [winfo children [winfo parent $w]] {
- if { [winfo class $sibling] eq "TRadiobutton"
+ if { [winfo class $sibling] eq "TRadiobutton"
&& [$sibling cget -variable] eq [$w cget -variable]
&& ![$sibling instate disabled]
} {
@@ -75,7 +75,7 @@ proc ttk::button::RadioTraverse {w dir} {
}
if {![llength $group]} { # Shouldn't happen, but can.
- return
+ return
}
set pos [expr {([lsearch -exact $group $w] + $dir) % [llength $group]}]
diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl
index bfcb194..3a20316 100644
--- a/library/ttk/clamTheme.tcl
+++ b/library/ttk/clamTheme.tcl
@@ -136,7 +136,7 @@ namespace eval ttk::theme::clam {
-foreground [list disabled $colors(-disabledfg) \
selected $colors(-selectfg)]
- ttk::style configure TLabelframe \
+ ttk::style configure TLabelframe \
-labeloutside true -labelmargins {0 0 0 4} \
-borderwidth 2 -relief raised
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
index 4dd566b..7ea5f75 100644
--- a/library/ttk/combobox.tcl
+++ b/library/ttk/combobox.tcl
@@ -352,7 +352,7 @@ proc ttk::combobox::ConfigureListbox {cb} {
set height [llength $values]
if {$height > [$cb cget -height]} {
set height [$cb cget -height]
- grid $popdown.sb
+ grid $popdown.sb
grid configure $popdown.l -padx {1 0}
} else {
grid remove $popdown.sb
@@ -395,7 +395,7 @@ proc ttk::combobox::PlacePopdown {cb popdown} {
}
set postoffset [ttk::style lookup $style -postoffset {} {0 0 0 0}]
foreach var {x y w h} delta $postoffset {
- incr $var $delta
+ incr $var $delta
}
set H [winfo reqheight $popdown]
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index f10c194..486b556 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -282,7 +282,7 @@ proc ttk::entry::PrevWord {w start} {
proc ttk::entry::RelIndex {w where {index insert}} {
switch -- $where {
prevchar { expr {[$w index $index] - 1} }
- nextchar { expr {[$w index $index] + 1} }
+ nextchar { expr {[$w index $index] + 1} }
prevword { PrevWord $w $index }
nextword { NextWord $w $index }
home { return 0 }
@@ -323,9 +323,9 @@ proc ttk::entry::ExtendTo {w index} {
# Figure out selection anchor:
if {![$w selection present]} {
- set anchor $insert
+ set anchor $insert
} else {
- set selfirst [$w index sel.first]
+ set selfirst [$w index sel.first]
set sellast [$w index sel.last]
if { ($index < $selfirst)
@@ -341,7 +341,7 @@ proc ttk::entry::ExtendTo {w index} {
if {$anchor < $index} {
$w selection range $anchor $index
} else {
- $w selection range $index $anchor
+ $w selection range $index $anchor
}
$w icursor $index
@@ -401,8 +401,8 @@ proc ttk::entry::Select {w x mode} {
set cur [ClosestGap $w $x]
switch -- $mode {
- word { WordSelect $w $cur $cur }
- line { LineSelect $w $cur $cur }
+ word { WordSelect $w $cur $cur }
+ line { LineSelect $w $cur $cur }
char { # no-op }
}
@@ -550,7 +550,7 @@ proc ttk::entry::ScanDrag {w x} {
$w xview $left
if {$left != [set newLeft [$w index @0]]} {
- # We've scanned past one end of the entry;
+ # We've scanned past one end of the entry;
# reset the mark so that the text will start dragging again
# as soon as the mouse reverses direction.
#
@@ -607,7 +607,7 @@ proc ttk::entry::Insert {w s} {
#
proc ttk::entry::Backspace {w} {
if {[PendingDelete $w]} {
- See $w
+ See $w
return
}
set x [expr {[$w index insert] - 1}]
diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl
index 39b04fc..4cdc032 100644
--- a/library/ttk/menubutton.tcl
+++ b/library/ttk/menubutton.tcl
@@ -219,7 +219,7 @@ proc ttk::menubutton::TransferGrab {mb} {
set menu [$mb cget -menu]
foreach {x y entry} [PostPosition $mb $menu] { break }
- tk_popup $menu [winfo rootx $menu] [winfo rooty $menu]
+ tk_popup $menu [winfo rootx $menu] [winfo rooty $menu]
}
}
diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl
index 0fd9bd7..b3e1702 100644
--- a/library/ttk/panedwindow.tcl
+++ b/library/ttk/panedwindow.tcl
@@ -6,7 +6,7 @@ namespace eval ttk::panedwindow {
variable State
array set State {
pressed 0
- pressX -
+ pressX -
pressY -
sash -
sashPos -
@@ -32,7 +32,7 @@ proc ttk::panedwindow::Press {w x y} {
set sash [$w identify $x $y]
if {$sash eq ""} {
- set State(pressed) 0
+ set State(pressed) 0
return
}
set State(pressed) 1
@@ -46,8 +46,8 @@ proc ttk::panedwindow::Drag {w x y} {
variable State
if {!$State(pressed)} { return }
switch -- [$w cget -orient] {
- horizontal { set delta [expr {$x - $State(pressX)}] }
- vertical { set delta [expr {$y - $State(pressY)}] }
+ horizontal { set delta [expr {$x - $State(pressX)}] }
+ vertical { set delta [expr {$y - $State(pressY)}] }
}
$w sashpos $State(sash) [expr {$State(sashPos) + $delta}]
}
@@ -79,7 +79,7 @@ proc ttk::panedwindow::SetCursor {w x y} {
set cursor $State(userConfCursor)
if {[llength [$w identify $x $y]]} {
- # Assume we're over a sash.
+ # Assume we're over a sash.
switch -- [$w cget -orient] {
horizontal { set cursor hresize }
vertical { set cursor vresize }
diff --git a/library/ttk/progress.tcl b/library/ttk/progress.tcl
index 4b10b87..929f0e6 100644
--- a/library/ttk/progress.tcl
+++ b/library/ttk/progress.tcl
@@ -13,13 +13,13 @@ proc ttk::progressbar::Autoincrement {pb steptime stepsize} {
variable Timers
if {![winfo exists $pb]} {
- # widget has been destroyed -- cancel timer
+ # widget has been destroyed -- cancel timer
unset -nocomplain Timers($pb)
return
}
set Timers($pb) [after $steptime \
- [list ttk::progressbar::Autoincrement $pb $steptime $stepsize] ]
+ [list ttk::progressbar::Autoincrement $pb $steptime $stepsize] ]
$pb step $stepsize
}
diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl
index 8f6cf64..6ad6e15 100644
--- a/library/ttk/scrollbar.tcl
+++ b/library/ttk/scrollbar.tcl
@@ -74,7 +74,7 @@ proc ttk::scrollbar::Press {w x y} {
proc ttk::scrollbar::Drag {w x y} {
variable State
if {![info exists State(first)]} {
- # Initial buttonpress was not on the thumb,
+ # Initial buttonpress was not on the thumb,
# or something screwy has happened. In either case, ignore:
return;
}
diff --git a/library/ttk/sizegrip.tcl b/library/ttk/sizegrip.tcl
index 080ab2d..2a49451 100644
--- a/library/ttk/sizegrip.tcl
+++ b/library/ttk/sizegrip.tcl
@@ -12,7 +12,7 @@ switch -- [tk windowingsystem] {
option add *TSizegrip.cursor [ttk::cursor seresize] widgetDefault
}
aqua {
- # Aqua sizegrips use default Arrow cursor.
+ # Aqua sizegrips use default Arrow cursor.
}
}
diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl
index 62fc630..c747dc2 100644
--- a/library/ttk/treeview.tcl
+++ b/library/ttk/treeview.tcl
@@ -83,9 +83,9 @@ proc ttk::treeview::Keynav {w dir} {
}
left {
if {[$w item $focus -open] && [llength [$w children $focus]]} {
- CloseItem $w $focus
+ CloseItem $w $focus
} else {
- set focus [$w parent $focus]
+ set focus [$w parent $focus]
}
}
right {
@@ -238,9 +238,9 @@ proc ttk::treeview::heading.drag {w x y} {
if { [$w identify region $x $y] eq "heading"
&& [$w identify column $x $y] eq $State(heading)
} {
- $w heading $State(heading) state pressed
+ $w heading $State(heading) state pressed
} else {
- $w heading $State(heading) state !pressed
+ $w heading $State(heading) state !pressed
}
}
@@ -287,7 +287,7 @@ proc ttk::treeview::select.extend.extended {w item} {
if {[set anchor [$w focus]] ne ""} {
$w selection set [between $w $anchor $item]
} else {
- BrowseTo $w $item
+ BrowseTo $w $item
}
}
@@ -319,10 +319,10 @@ proc ttk::treeview::ScanBetween {tv item1 item2 item} {
variable selectingBetween
if {$item eq $item1 || $item eq $item2} {
- lappend between $item
+ lappend between $item
set selectingBetween [expr {!$selectingBetween}]
} elseif {$selectingBetween} {
- lappend between $item
+ lappend between $item
}
foreach child [$tv children $item] {
ScanBetween $tv $item1 $item2 $child
@@ -368,7 +368,7 @@ proc ttk::treeview::Toggle {w item} {
proc ttk::treeview::ToggleFocus {w} {
set item [$w focus]
if {$item ne ""} {
- Toggle $w $item
+ Toggle $w $item
}
}
diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl
index d95f6b9..f8f1117 100644
--- a/library/ttk/utils.tcl
+++ b/library/ttk/utils.tcl
@@ -73,7 +73,7 @@ proc ttk::clickToFocus {w} {
#
proc ttk::takesFocus {w} {
if {![winfo viewable $w]} {
- return 0
+ return 0
} elseif {[catch {$w cget -takefocus} takefocus]} {
return [GuessTakeFocus $w]
} else {
@@ -144,7 +144,7 @@ proc ttk::SaveGrab {w} {
set grabbed [grab current $w]
if {[winfo exists $grabbed]} {
- switch [grab status $grabbed] {
+ switch [grab status $grabbed] {
global { set restoreGrab [list grab -global $grabbed] }
local { set restoreGrab [list grab $grabbed] }
none { ;# grab window is really in a different interp }
@@ -153,7 +153,7 @@ proc ttk::SaveGrab {w} {
set focus [focus]
if {$focus ne ""} {
- set restoreFocus [list focus -force $focus]
+ set restoreFocus [list focus -force $focus]
}
set Grab($w) [list $restoreGrab $restoreFocus]
diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl
index d841962..eb0e5db 100644
--- a/library/ttk/vistaTheme.tcl
+++ b/library/ttk/vistaTheme.tcl
@@ -91,7 +91,7 @@ namespace eval ttk::theme::vista {
-selectforeground [list !focus SystemWindowText] \
-foreground [list \
disabled SystemGrayText \
- {readonly focus} SystemHighlightText \
+ {readonly focus} SystemHighlightText \
] \
-focusfill [list {readonly focus} SystemHighlight] \
;
diff --git a/library/ttk/winTheme.tcl b/library/ttk/winTheme.tcl
index db05b45..fc95175 100644
--- a/library/ttk/winTheme.tcl
+++ b/library/ttk/winTheme.tcl
@@ -32,7 +32,7 @@ namespace eval ttk::theme::winnative {
-padding 2 -selectborderwidth 0 -insertwidth 1
ttk::style map TEntry \
-fieldbackground \
- [list readonly SystemButtonFace disabled SystemButtonFace] \
+ [list readonly SystemButtonFace disabled SystemButtonFace] \
-selectbackground [list !focus SystemWindow] \
-selectforeground [list !focus SystemWindowText] \
;
@@ -42,11 +42,11 @@ namespace eval ttk::theme::winnative {
-selectbackground [list !focus SystemWindow] \
-selectforeground [list !focus SystemWindowText] \
-fieldbackground [list \
- readonly SystemButtonFace \
+ readonly SystemButtonFace \
disabled SystemButtonFace] \
-foreground [list \
disabled SystemGrayText \
- {readonly focus} SystemHighlightText \
+ {readonly focus} SystemHighlightText \
] \
-focusfill [list {readonly focus} SystemHighlight] \
;
diff --git a/library/ttk/xpTheme.tcl b/library/ttk/xpTheme.tcl
index da7b422..5a80954 100644
--- a/library/ttk/xpTheme.tcl
+++ b/library/ttk/xpTheme.tcl
@@ -42,7 +42,7 @@ namespace eval ttk::theme::xpnative {
-selectforeground [list !focus SystemWindowText] \
-foreground [list \
disabled SystemGrayText \
- {readonly focus} SystemHighlightText \
+ {readonly focus} SystemHighlightText \
] \
-focusfill [list {readonly focus} SystemHighlight] \
;
diff --git a/macosx/README b/macosx/README
index ac641b1..d5ee192 100644
--- a/macosx/README
+++ b/macosx/README
@@ -685,7 +685,7 @@ conditional code which is only used for macOS.
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>>,
+dark colors. Tk 8.6 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
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index 40743f6..09ff17b 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -765,10 +765,12 @@ TkMacOSXDrawButton(
* Using a ttk::button would be a much better choice, however.
*/
- if (TkMacOSXInDarkMode(butPtr->tkwin) &&
- mbPtr->drawinfo.state != kThemeStatePressed &&
- !(mbPtr->drawinfo.adornment & kThemeAdornmentDefault)) {
- hiinfo.state = kThemeStateInactive;
+ if ([NSApp macOSVersion] < 101500) {
+ if (TkMacOSXInDarkMode(butPtr->tkwin) &&
+ mbPtr->drawinfo.state != kThemeStatePressed &&
+ !(mbPtr->drawinfo.adornment & kThemeAdornmentDefault)) {
+ hiinfo.state = kThemeStateInactive;
+ }
}
HIThemeDrawButton(&cntrRect, &hiinfo, dc.context,
kHIThemeOrientationNormal, &contHIRec);
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 1e1fc4e..135003d 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -24,6 +24,7 @@ static int numSystemColors;
static int rgbColorIndex;
static int controlAccentIndex;
static int selectedTabTextIndex;
+static int pressedButtonTextIndex;
static Bool useFakeAccentColor = NO;
static SystemColorDatum **systemColorIndex;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
@@ -67,7 +68,8 @@ void initColorTable()
if (![NSColor respondsToSelector:colorSelector]) {
if ([colorName isEqualToString:@"controlAccentColor"]) {
useFakeAccentColor = YES;
- } else if (![colorName isEqualToString:@"selectedTabTextColor"]) {
+ } else if ( ![colorName isEqualToString:@"selectedTabTextColor"]
+ && ![colorName isEqualToString:@"pressedButtonTextColor"]) {
/* Uncomment to print all unsupported colors: */
/* printf("Unsupported color %s\n", colorName.UTF8String); */
continue;
@@ -147,6 +149,9 @@ void initColorTable()
hPtr = Tcl_FindHashEntry(&systemColors, "SelectedTabTextColor");
entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
selectedTabTextIndex = entry->index;
+ hPtr = Tcl_FindHashEntry(&systemColors, "PressedButtonTextColor");
+ entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ pressedButtonTextIndex = entry->index;
[pool drain];
}
@@ -278,6 +283,7 @@ GetRGBA(
CGFloat *rgba)
{
NSColor *bgColor, *color = nil;
+ int OSVersion = [NSApp macOSVersion];
if (!sRGB) {
sRGB = [NSColorSpace sRGBColorSpace];
@@ -325,12 +331,17 @@ GetRGBA(
colorUsingColorSpace:sRGB];
#endif
} else if (entry->index == selectedTabTextIndex) {
- int OSVersion = [NSApp macOSVersion];
- if (OSVersion > 100600 && OSVersion < 101600) {
+ if (OSVersion > 100600 && OSVersion < 110000) {
color = [[NSColor whiteColor] colorUsingColorSpace:sRGB];
} else {
color = [[NSColor textColor] colorUsingColorSpace:sRGB];
}
+ } else if (entry->index == pressedButtonTextIndex) {
+ if (OSVersion < 120000) {
+ color = [[NSColor whiteColor] colorUsingColorSpace:sRGB];
+ } else {
+ color = [[NSColor blackColor] colorUsingColorSpace:sRGB];
+ }
} else {
color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB];
}
diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h
index 8fa400b..7e82cbd 100644
--- a/macosx/tkMacOSXColor.h
+++ b/macosx/tkMacOSXColor.h
@@ -175,8 +175,10 @@ static SystemColorDatum systemColorData[] = {
{"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 -- depends on OS version. */
+/* Color to use for notebook tab label text -- depends on OS version. */
{"SelectedTabTextColor", semantic, 0, "textColor", 0, NULL },
+/* Color to use for selected button labels -- depends on OS version. */
+{"PressedButtonTextColor", semantic, 0, "textColor", 0, NULL },
/* 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 },
diff --git a/macosx/tkMacOSXConstants.h b/macosx/tkMacOSXConstants.h
index 6fdc552..29bc391 100644
--- a/macosx/tkMacOSXConstants.h
+++ b/macosx/tkMacOSXConstants.h
@@ -86,7 +86,6 @@ typedef NSInteger NSModalResponse;
#define NSInformationalAlertStyle NSAlertStyleInformational
#define NSCriticalAlertStyle NSAlertStyleCritical
#define NSCenterTextAlignment NSTextAlignmentCenter
-#define NSAnyEventMask NSEventMaskAny
#define NSApplicationDefinedMask NSEventMaskApplicationDefined
#define NSUtilityWindowMask NSWindowStyleMaskUtilityWindow
#define NSNonactivatingPanelMask NSWindowStyleMaskNonactivatingPanel
@@ -99,6 +98,11 @@ typedef NSInteger NSModalResponse;
#define NSMiniaturizableWindowMask NSWindowStyleMaskMiniaturizable
#define NSBorderlessWindowMask NSWindowStyleMaskBorderless
#define NSFullScreenWindowMask NSWindowStyleMaskFullScreen
+#define NSAlphaFirstBitmapFormat NSBitmapFormatAlphaFirst
+#define NSAnyEventMask NSEventMaskAny
+#define NSLeftMouseDownMask NSEventMaskLeftMouseDown
+#define NSMouseMovedMask NSEventMaskMouseMoved
+#define NSLeftMouseDraggedMask NSEventMaskLeftMouseDragged
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h
index d258118..a20d85b 100644
--- a/macosx/tkMacOSXDefault.h
+++ b/macosx/tkMacOSXDefault.h
@@ -55,7 +55,7 @@
#define DEF_BUTTON_ANCHOR "center"
#define DEF_BUTTON_ACTIVE_BG_COLOR ACTIVE_BG
#define DEF_BUTTON_ACTIVE_BG_MONO BLACK
-#define DEF_BUTTON_ACTIVE_FG_COLOR WHITE
+#define DEF_BUTTON_ACTIVE_FG_COLOR "systemPressedButtonTextColor"
#define DEF_CHKRAD_ACTIVE_FG_COLOR ACTIVE_FG
#define DEF_BUTTON_ACTIVE_FG_MONO WHITE
#define DEF_BUTTON_BG_COLOR NORMAL_BG
@@ -68,8 +68,9 @@
#define DEF_BUTTON_DEFAULT "disabled"
#define DEF_BUTTON_DISABLED_FG_COLOR DISABLED
#define DEF_BUTTON_DISABLED_FG_MONO ""
-#define DEF_BUTTON_FG NORMAL_FG
-#define DEF_CHKRAD_FG DEF_BUTTON_FG
+#define DEF_BUTTON_FG BLACK
+#define DEF_LABEL_FG NORMAL_FG
+#define DEF_CHKRAD_FG DEF_LABEL_FG
#define DEF_BUTTON_FONT "TkDefaultFont"
#define DEF_BUTTON_HEIGHT "0"
#define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 9445b0c..528b0f2 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -379,6 +379,7 @@ static NSInteger showOpenSavePanel(
[NSApp tkFilePanelDidEnd:panel
returnCode:modalReturnCode
contextInfo:callbackInfo ];
+ [parent endSheet:panel];
}
} else {
modalReturnCode = [panel runModal];
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index aefc63c..e781dff 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.c
@@ -237,9 +237,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
AEInfo->interp = _eventInterp;
AEInfo->procedure = openDocumentProc;
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
AEInfo->retryCount = 0;
-
if (Tcl_FindCommand(_eventInterp, "::tk::mac::OpenDocuments", NULL, 0)){
ProcessAppleEvent((ClientData)AEInfo);
} else {
@@ -263,7 +261,6 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
AEInfo->interp = _eventInterp;
AEInfo->procedure = printDocProc;
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
AEInfo->retryCount = 0;
ProcessAppleEvent((ClientData)AEInfo);
}
@@ -326,7 +323,6 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
AEInfo->interp = _eventInterp;
AEInfo->procedure = scriptFileProc;
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
AEInfo->retryCount = 0;
ProcessAppleEvent((ClientData)AEInfo);
}
@@ -358,7 +354,6 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
ProcessAppleEvent(AEInfo);
} else {
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, AEInfo);
ProcessAppleEvent(AEInfo);
}
}
@@ -382,7 +377,6 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
AEInfo->interp = _eventInterp;
AEInfo->procedure = launchURLProc;
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
AEInfo->retryCount = 0;
ProcessAppleEvent((ClientData)AEInfo);
}
@@ -390,6 +384,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
- (void)handleGetSDEFEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
Tcl_DString *sdefCommand = &AEInfo->command;
+ (void)event;
(void)replyEvent;
Tcl_DStringInit(sdefCommand);
@@ -397,7 +392,6 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
AEInfo->interp = _eventInterp;
AEInfo->procedure = getSdefProc;
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
AEInfo->retryCount = 0;
ProcessAppleEvent((ClientData)AEInfo);
diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c
index 41d513e..ad317b1 100644
--- a/macosx/tkMacOSXImage.c
+++ b/macosx/tkMacOSXImage.c
@@ -70,7 +70,7 @@ typedef struct RGBA32pixel_t {
/*
* ARGB32 0xAARRGGBB (Byte order is ARGB on big-endian systems.)
* This is used by Aqua Tk for XImages and by NSBitmapImageReps whose
- * bitmapFormat property is NSBitmapFormatAlphaFirst.
+ * bitmapFormat property is NSAlphaFirstBitmapFormat.
*/
typedef struct ARGB32pixel_t {
@@ -633,14 +633,9 @@ CreateCGImageFromDrawableRect(
{
MacDrawable *mac_drawable = (MacDrawable *)drawable;
CGContextRef cg_context = NULL;
- CGRect image_rect = CGRectMake(x, y, width, height);
CGImageRef cg_image = NULL, result = NULL;
- unsigned char *imageData = NULL;
if (mac_drawable->flags & TK_IS_PIXMAP) {
cg_context = TkMacOSXGetCGContextForDrawable(drawable);
- if (cg_context) {
- cg_image = CGBitmapContextCreateImage((CGContextRef) cg_context);
- }
} else {
NSView *view = TkMacOSXGetNSViewForDrawable(mac_drawable);
if (view == nil) {
@@ -652,9 +647,8 @@ CreateCGImageFromDrawableRect(
NSUInteger bytesPerPixel = 4,
bytesPerRow = bytesPerPixel * view_width,
bitsPerComponent = 8;
- imageData = ckalloc(view_height * bytesPerRow);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
- cg_context = CGBitmapContextCreate(imageData, view_width, view_height,
+ cg_context = CGBitmapContextCreate(NULL, view_width, view_height,
bitsPerComponent, bytesPerRow, colorSpace,
kCGImageAlphaPremultipliedLast |
kCGBitmapByteOrder32Big);
@@ -666,10 +660,11 @@ CreateCGImageFromDrawableRect(
CGContextRelease(cg_context);
}
if (cg_image) {
- result = CGImageCreateWithImageInRect(cg_image, image_rect);
+ CGRect rect = CGRectMake(x + mac_drawable->xOff, y + mac_drawable->yOff,
+ width, height);
+ result = CGImageCreateWithImageInRect(cg_image, rect);
CGImageRelease(cg_image);
}
- ckfree(imageData);
return result;
}
@@ -762,7 +757,7 @@ XGetImage(
size = [bitmapRep bytesPerPlane];
bytes_per_row = [bitmapRep bytesPerRow];
bitmap = (char *)ckalloc(size);
- if ((bitmap_fmt != 0 && bitmap_fmt != NSBitmapFormatAlphaFirst)
+ if ((bitmap_fmt != 0 && bitmap_fmt != NSAlphaFirstBitmapFormat)
|| [bitmapRep samplesPerPixel] != 4
|| [bitmapRep isPlanar] != 0
|| bytes_per_row < 4 * width
@@ -789,7 +784,7 @@ XGetImage(
flipped.rgba.blue = pixel.argb.blue;
flipped.rgba.alpha = pixel.argb.alpha;
*((pixel32 *)(bitmap + m)) = flipped;
- } else { // bitmap_fmt = NSBitmapFormatAlphaFirst
+ } else { // bitmap_fmt = NSAlphaFirstBitmapFormat
*((pixel32 *)(bitmap + m)) = pixel;
}
}
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index a1de785..375d20e 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -14,9 +14,11 @@
*/
#include "tkMacOSXPrivate.h"
+#include "tkMacOSXConstants.h"
#include <dlfcn.h>
#include <objc/objc-auto.h>
#include <sys/stat.h>
+#include <sys/utsname.h>
static char tkLibPath[PATH_MAX + 1] = "";
@@ -43,6 +45,10 @@ static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip,
@synthesize macOSVersion = _macOSVersion;
@synthesize isDrawing = _isDrawing;
@synthesize isSigned = _isSigned;
+@synthesize tkLiveResizeEnded = _tkLiveResizeEnded;
+@synthesize tkPointerWindow = _tkPointerWindow;
+@synthesize tkEventTarget = _tkEventTarget;
+@synthesize tkButtonState = _tkButtonState;
@end
/*
@@ -170,6 +176,20 @@ static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip,
[NSApp activateIgnoringOtherApps: YES];
/*
+ * Add an event monitor so we continue to receive NSMouseMoved and
+ * NSMouseDragged events when the mouse moves outside of the key
+ * window. The handler simply returns the events it receives, so
+ * they can be processed in the same way as for other events.
+ */
+
+ [NSEvent addLocalMonitorForEventsMatchingMask:(NSMouseMovedMask |
+ NSLeftMouseDraggedMask)
+ handler:^NSEvent *(NSEvent *event)
+ {
+ return event;
+ }];
+
+ /*
* Process events to ensure that the root window is fully initialized. See
* ticket 56a1823c73.
*/
@@ -197,6 +217,7 @@ static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip,
*/
int minorVersion, majorVersion;
+
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101000
Gestalt(gestaltSystemVersionMinor, (SInt32*)&minorVersion);
majorVersion = 10;
@@ -206,6 +227,24 @@ static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip,
majorVersion = systemVersion.majorVersion;
minorVersion = systemVersion.minorVersion;
#endif
+
+ if (majorVersion == 10 && minorVersion == 16) {
+
+ /*
+ * If a program compiled with a macOS 10.XX SDK is run on macOS 11.0 or
+ * later then it will report majorVersion 10 and minorVersion 16, no
+ * matter what the actual OS version of the host may be. And of course
+ * Apple never released macOS 10.16. To work around this we guess the
+ * OS version from the kernel release number, as reported by uname.
+ */
+
+ struct utsname name;
+ char *endptr;
+ if (uname(&name) == 0) {
+ majorVersion = strtol(name.release, &endptr, 10) - 9;
+ minorVersion = 0;
+ }
+ }
[NSApp setMacOSVersion: 10000*majorVersion + 100*minorVersion];
/*
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 4790549..cfcface 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -36,8 +36,6 @@ static Tk_Window captureWinPtr = NULL; /* Current capture window; may be
* NULL. */
static int GenerateButtonEvent(MouseEventData *medPtr);
-static unsigned int ButtonModifiers2State(UInt32 buttonState,
- UInt32 keyModifiers);
#pragma mark TKApplication(TKMouseEvent)
@@ -47,54 +45,91 @@ enum {
/*
* In OS X 10.6 an NSEvent of type NSMouseMoved would always have a non-Nil
- * window attribute pointing to the active window. As of 10.8 this behavior
- * had changed. The new behavior was that if the mouse were ever moved outside
- * of a window, all subsequent NSMouseMoved NSEvents would have a Nil window
+ * window attribute pointing to the key window. As of 10.8 this behavior had
+ * changed. The new behavior was that if the mouse were ever moved outside of
+ * a window, all subsequent NSMouseMoved NSEvents would have a Nil window
* attribute until the mouse returned to the window. In 11.1 it changed again.
* The window attribute can be non-nil, but referencing a window which does not
* belong to the application.
*/
+/* The basic job of tkProcessMouseEvent is to generate a call to
+ * TkUpdatePointer. That function receives a Tk_Window which (ignoring cases
+ * when a grab is in effect) should be the highest window within the focused
+ * toplevel that contains the pointer, as well as the pointer location in
+ * screen coordinates and the current button state. Tk maintains a cache of
+ * these three values. A change in any of these values causes TkUpdatePointer
+ * to generate, respectively, Enter/Leave events, or Motion events, or
+ * button Press/Release events. The Tk_Window value is allowed to be NULL,
+ * which indicates that the pointer is not in the focused toplevel.
+ *
+ * Enter or Leave events for toplevel windows are generated when the Tk_Window
+ * value changes to or from NULL. This is problematic on macOS due to the fact
+ * that TkUpdatePointer does not generate Motion events when the Tk_Window
+ * value is NULL. A consequence of this is that TkUpdatePointer will either
+ * fail to generate correct Enter/Leave events for toplevels or else be unable
+ * to generate Motion events when the pointer is outside of the focus window.
+ * It is important to be able to generate such events because otherwise a
+ * scrollbar on the edge of a toplevel becomes unusable. Any time that the
+ * pointer wanders out of the window during a scroll, the scroll will stop.
+ * That is an extremely annoying and unexpected behavior. Much of the code in
+ * this module, including the trickiest parts, is devoted to working around
+ * this problem. The other tricky parts are related to transcribing Apple's
+ * NSMouseEntered, NSMouseExited, and NSLeftMouseDragged events into a form
+ * that makes sense to Tk.
+ */
+
+
@implementation TKApplication(TKMouseEvent)
+
- (NSEvent *) tkProcessMouseEvent: (NSEvent *) theEvent
{
NSWindow *eventWindow = [theEvent window];
NSEventType eventType = [theEvent type];
- NSRect viewFrame = [[eventWindow contentView] frame];
+ TKContentView *contentView = [eventWindow contentView];
NSPoint location = [theEvent locationInWindow];
+ NSPoint viewLocation = [contentView convertPoint:location fromView:nil];
TkWindow *winPtr = NULL, *grabWinPtr;
- Tk_Window tkwin = NULL, capture, target;
+ Tk_Window tkwin = NULL, capture;
+ static Tk_Window target = NULL, dragTarget = NULL;
NSPoint local, global;
NSInteger button;
- Bool inTitleBar = NO;
int win_x, win_y;
unsigned int buttonState = 0;
- static int validPresses = 0, ignoredPresses = 0;
+ Bool isTestingEvent = NO;
+ Bool isMotionEvent = NO;
+ Bool isOutside = NO;
+ static Bool isDragging = NO;
#ifdef TK_MAC_DEBUG_EVENTS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
#endif
/*
- * If this event is not for a Tk toplevel, it should just be passed up the
- * responder chain. However, there is an exception for synthesized events,
- * which are used in testing. Those events are recognized by having their
- * both the windowNumber and the eventNumber set to -1.
+ * If this event is not for a Tk toplevel, it should normally just be
+ * passed up the responder chain. However, there is are two exceptions.
+ * One is for synthesized events, which are used in testing. Those events
+ * are recognized by having their timestamp set to 0. The other is for
+ * motion events sent by the local event monitor, which will have their
+ * window attribute set to nil.
*/
- if (eventWindow && ![eventWindow isMemberOfClass:[TKWindow class]]) {
- if ([theEvent windowNumber] != -1 || [theEvent eventNumber] != -1)
+ if (![eventWindow isMemberOfClass:[TKWindow class]]) {
+ if ([theEvent timestamp] == 0) {
+ isTestingEvent = YES;
+ eventWindow = [NSApp keyWindow];
+ }
+ if (eventType == NSLeftMouseDragged ||
+ eventType == NSMouseMoved) {
+ eventWindow = [NSApp keyWindow];
+ isMotionEvent = YES;
+ }
+ if (!isTestingEvent && !isMotionEvent) {
return theEvent;
+ }
+ } else if (!NSPointInRect(viewLocation, [contentView bounds])) {
+ isOutside = YES;
}
-
- /*
- * Check if the event is located in the titlebar.
- */
-
- if (eventWindow) {
- inTitleBar = viewFrame.size.height < location.y;
- }
-
button = [theEvent buttonNumber] + Button1;
if ((button & -2) == Button2) {
button ^= 1; /* Swap buttons 2/3 */
@@ -105,37 +140,50 @@ enum {
buttonState &= ~Tk_GetButtonMask(button);
break;
case NSLeftMouseDragged:
+ isDragging = YES;
+ dragTarget = target;
case NSRightMouseDragged:
case NSOtherMouseDragged:
+ isMotionEvent = YES;
case NSRightMouseDown:
case NSOtherMouseDown:
buttonState |= Tk_GetButtonMask(button);
break;
case NSMouseEntered:
- if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] &&
- !inTitleBar) {
- [(TKWindow *)eventWindow setMouseInResizeArea:YES];
+ if (![eventWindow isKeyWindow] || isOutside) {
+ return theEvent;
}
+ [NSApp setTkLiveResizeEnded:NO];
+ [NSApp setTkPointerWindow:[NSApp tkEventTarget]];
break;
case NSMouseExited:
- if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)]) {
- [(TKWindow *)eventWindow setMouseInResizeArea:NO];
- break;
+ if (![eventWindow isKeyWindow] || !isOutside) {
+ return theEvent;
}
+ [NSApp setTkPointerWindow:nil];
+ break;
case NSLeftMouseUp:
+ isDragging = NO;
case NSLeftMouseDown:
/*
- * Ignore mouse button events which arrive while the app is inactive.
- * These events will be resent after activation, causing duplicate
- * actions when an app is activated by a bound mouse event. See ticket
- * [7bda9882cb].
+ * Ignore left mouse button events which arrive while the app is
+ * inactive. These events will be resent after activation, causing
+ * duplicate actions when an app is activated by a bound mouse event
+ * (see ticket [7bda9882cb]. Also, ignore left mouse button events in
+ * the titlebar (see tickets [d72abe6b54] and [39cbacb9e8]).
*/
- if (! [NSApp isActive]) {
+ if (![NSApp isActive] || isOutside) {
return theEvent;
}
+ break;
case NSMouseMoved:
+ if (eventWindow && eventWindow != [NSApp keyWindow]) {
+ return theEvent;
+ }
+ isMotionEvent = YES;
+ break;
case NSScrollWheel:
#if 0
case NSCursorUpdate:
@@ -148,46 +196,35 @@ enum {
}
/*
- * Update the button state. We ignore left button presses that start a
- * resize or occur in the title bar. See tickets [d72abe6b54] and
- * [39cbacb9e8].
+ * Update the button state. We ignore left button presses that occur
+ * outside of the ContentView. We also ignore the first left button press
+ * after a live resize ends. (Apple sends the button press event that
+ * started the resize after the resize ends. It should not be seen by Tk.)
+ * See tickets [d72abe6b54] and [39cbacb9e8].
*/
if (eventType == NSLeftMouseDown) {
- if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] &&
- [(TKWindow *) eventWindow mouseInResizeArea]) {
-
- /*
- * When the left button is pressed in the resize area, we receive
- * NSMouseDown, but when it is released we do not receive
- * NSMouseUp. So ignore the event and clear the button state but
- * do not change the ignoredPresses count.
- */
-
- buttonState &= ~Tk_GetButtonMask(Button1);
- return theEvent;
- }
- if (inTitleBar) {
- ignoredPresses++;
- return theEvent;
+ if (!isTestingEvent) {
+ NSRect bounds = [contentView bounds];
+ NSRect grip = NSMakeRect(bounds.size.width - 10, 0, 10, 10);
+ bounds = NSInsetRect(bounds, 2.0, 2.0);
+ if (!NSPointInRect(viewLocation, bounds)) {
+ return theEvent;
+ }
+ if (NSPointInRect(viewLocation, grip)) {
+ return theEvent;
+ }
+ if ([NSApp tkLiveResizeEnded]) {
+ [NSApp setTkLiveResizeEnded:NO];
+ return theEvent;
+ }
}
- validPresses++;
buttonState |= Tk_GetButtonMask(Button1);
}
- if (eventType == NSLeftMouseUp) {
- if (ignoredPresses > 0) {
- ignoredPresses--;
- } else if (validPresses > 0) {
- validPresses--;
- }
- if (validPresses == 0) {
- buttonState &= ~Tk_GetButtonMask(Button1);
- }
- }
/*
- * Find an appropriate NSWindow to attach to this event, and its
- * associated Tk window.
+ * Find the toplevel window for the event. If a capture has been
+ * set this may involve redirecting the event.
*/
capture = TkpGetCapture();
@@ -198,29 +235,29 @@ enum {
return theEvent;
}
} else {
- if (eventWindow) {
- winPtr = TkMacOSXGetTkWindow(eventWindow);
- }
- if (!winPtr) {
- eventWindow = [NSApp mainWindow];
- winPtr = TkMacOSXGetTkWindow(eventWindow);
+ if (isDragging) {
+ winPtr = TkMacOSXGetHostToplevel((TkWindow *)dragTarget)->winPtr;
+ } else {
+ winPtr = [NSApp tkEventTarget];
}
}
if (!winPtr) {
/*
- * We couldn't find a Tk window for this event. We have to ignore it.
+ * If we couldn't find a toplevel for this event we have to ignore it.
+ * (But this should never happen.)
*/
#ifdef TK_MAC_DEBUG_EVENTS
TkMacOSXDbgMsg("Event received with no Tk window.");
#endif
+
return theEvent;
}
tkwin = (Tk_Window) winPtr;
/*
- * Compute the mouse position in local (window) and global (screen)
+ * Compute the mouse position in local (toplevel) and global (screen)
* coordinates. These are Tk coordinates, meaning that the local origin is
* at the top left corner of the containing toplevel and the global origin
* is at top left corner of the primary screen.
@@ -242,19 +279,36 @@ enum {
local.x -= (topPtr->wmInfoPtr->xInParent + contPtr->changes.x);
local.y -= (topPtr->wmInfoPtr->yInParent + contPtr->changes.y);
}
- } else {
- local.x -= winPtr->wmInfoPtr->xInParent;
- local.y -= winPtr->wmInfoPtr->yInParent;
+ }
+ else {
+ if (winPtr && winPtr->wmInfoPtr) {
+ local.x -= winPtr->wmInfoPtr->xInParent;
+ local.y -= winPtr->wmInfoPtr->yInParent;
+ } else {
+ return theEvent;
+ }
}
/*
- * Use the local coordinates to find the Tk window which should receive
- * this event. Also convert local into the coordinates of that window.
- * (The converted local coordinates are only needed for scrollwheel
- * events.)
+ * Use the toplevel coordinates to decide which Tk window should receive
+ * this event. Also convert the toplevel coordinates into the coordinate
+ * system of that window. These converted coordinates are needed for
+ * XEvents that we generate, namely ScrollWheel events and Motion events
+ * when the mouse is outside of the focused toplevel.
*/
- target = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y);
+ if (isDragging) {
+ TkWindow *w = (TkWindow *) dragTarget;
+ win_x = global.x;
+ win_y = global.y;
+ for (; w != NULL; w = w->parentPtr) {
+ win_x -= Tk_X(w);
+ win_y -= Tk_Y(w);
+ }
+ target = dragTarget;
+ } else {
+ target = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y);
+ }
/*
* Ignore the event if a local grab is in effect and the Tk window is
@@ -282,7 +336,7 @@ enum {
}
/*
- * Generate an XEvent for this mouse event.
+ * Translate the current button state into Tk's format.
*/
unsigned int state = buttonState;
@@ -309,31 +363,64 @@ enum {
if (modifiers & NSFunctionKeyMask) {
state |= Mod4Mask;
}
+ [NSApp setTkButtonState:state];
- if (eventType != NSScrollWheel) {
+ /*
+ * Send XEvents. We do this here for Motion events outside of the focused
+ * toplevel and for MouseWheel events. In other cases the XEvents will be
+ * sent when we call TkUpdatePointer.
+ */
- /*
- * For normal mouse events, Tk_UpdatePointer will send the appropriate
- * XEvents using its cached state information. Unfortunately, it will
- * also recompute the local coordinates.
- */
+ if (eventType != NSScrollWheel) {
+ if (isDragging) {
-#ifdef TK_MAC_DEBUG_EVENTS
- TKLog(@"UpdatePointer %p x %.1f y %.1f %d",
- target, global.x, global.y, state);
-#endif
+ /*
+ * When dragging the mouse into the resize area Apple shows the
+ * left button to be up, which confuses TkUpdatePointer. So
+ * we make sure that the button state appears the way that Tk
+ * expects.
+ */
- Tk_UpdatePointer(target, global.x, global.y, state);
+ state |= Tk_GetButtonMask(Button1);
+ }
+ if (eventType == NSMouseEntered) {
+ Tk_UpdatePointer((Tk_Window) [NSApp tkPointerWindow],
+ global.x, global.y, state);
+ } else if (eventType == NSMouseExited) {
+ if (isDragging) {
+ Tk_UpdatePointer((Tk_Window) [NSApp tkPointerWindow],
+ global.x, global.y, state);
+ } else {
+ Tk_UpdatePointer(NULL, global.x, global.y, state);
+ }
+ } else if (eventType == NSMouseMoved ||
+ eventType == NSLeftMouseDragged) {
+ if ([NSApp tkPointerWindow]) {
+ Tk_UpdatePointer(target, global.x, global.y, state);
+ } else {
+ XEvent xEvent = {0};
+
+ xEvent.type = MotionNotify;
+ xEvent.xany.send_event = false;
+ xEvent.xany.display = Tk_Display(target);
+ xEvent.xany.window = Tk_WindowId(target);
+ xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
+ xEvent.xmotion.x = win_x;
+ xEvent.xmotion.y = win_y;
+ xEvent.xmotion.x_root = global.x;
+ xEvent.xmotion.y_root = global.y;
+ xEvent.xmotion.state = state;
+ Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
+ }
+ } else {
+ Tk_UpdatePointer(target, global.x, global.y, state);
+ }
} else {
CGFloat delta;
- XEvent xEvent;
+ XEvent xEvent = {0};
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- /*
- * For scroll wheel events we need to send the XEvent here.
- */
-
xEvent.type = MouseWheelEvent;
xEvent.xbutton.x = win_x;
xEvent.xbutton.y = win_y;
@@ -408,79 +495,7 @@ enum {
unsigned int
TkMacOSXButtonKeyState(void)
{
- UInt32 buttonState = 0, keyModifiers;
- int isFrontProcess = (GetCurrentEvent() && Tk_MacOSXIsAppInFront());
-
- buttonState = isFrontProcess ? GetCurrentEventButtonState() :
- GetCurrentButtonState();
- keyModifiers = isFrontProcess ? GetCurrentEventKeyModifiers() :
- GetCurrentKeyModifiers();
-
- return ButtonModifiers2State(buttonState, keyModifiers);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ButtonModifiers2State --
- *
- * Converts Carbon mouse button state and modifier values into a Tk
- * button/modifier state.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static unsigned int
-ButtonModifiers2State(
- UInt32 buttonState,
- UInt32 keyModifiers)
-{
- unsigned int state;
-
- /*
- * Tk on OSX supports at most 9 buttons.
- */
-
- state = (buttonState & 0x079) * Button1Mask;
- /* Handle swapped buttons 2/3 */
- if (buttonState & 0x02) {
- state |= Button3Mask;
- }
- if (buttonState & 0x04) {
- state |= Button2Mask;
- }
- /* Handle buttons 8/9 */
- state |= (buttonState & 0x180) * (Button8Mask >> 7);
-
- if (keyModifiers & alphaLock) {
- state |= LockMask;
- }
- if (keyModifiers & shiftKey) {
- state |= ShiftMask;
- }
- if (keyModifiers & controlKey) {
- state |= ControlMask;
- }
- if (keyModifiers & cmdKey) {
- state |= Mod1Mask; /* command key */
- }
- if (keyModifiers & optionKey) {
- state |= Mod2Mask; /* option key */
- }
- if (keyModifiers & kEventKeyModifierNumLockMask) {
- state |= Mod3Mask;
- }
- if (keyModifiers & kEventKeyModifierFnMask) {
- state |= Mod4Mask;
- }
-
- return state;
+ return [NSApp tkButtonState];
}
/*
diff --git a/macosx/tkMacOSXPrint.c b/macosx/tkMacOSXPrint.c
index 38cd1ca..ffaa972 100644
--- a/macosx/tkMacOSXPrint.c
+++ b/macosx/tkMacOSXPrint.c
@@ -48,10 +48,14 @@ int MacPrint_Init(Tcl_Interp * interp);
- (void) printPanelDidEnd: (NSPrintPanel *) printPanel
returnCode: (int) returnCode
contextInfo: (void *) contextInfo {
+ (void) printPanel;
+ (void) contextInfo;
+
/*
* Pass returnCode to FinishPrint function to determine how to
* handle.
*/
+
FinishPrint(fileName, returnCode);
}
@end
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index bab722f..03bbdb6 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -333,6 +333,7 @@ VISIBILITY_HIDDEN
NSArray *_defaultHelpMenuItems, *_defaultFileMenuItems;
NSAutoreleasePool *_mainPool;
NSThread *_backgoundLoop;
+ Bool _tkLiveResizeEnded;
#ifdef __i386__
@@ -342,7 +343,10 @@ VISIBILITY_HIDDEN
Bool _isDrawing;
Bool _needsToDraw;
Bool _isSigned;
-
+ Bool _tkLiveResizeEnded;
+ TkWindow *_tkPointerWindow;
+ TkWindow *_tkEventTarget;
+ unsigned int _tkButtonState;
#endif
}
@@ -351,6 +355,10 @@ VISIBILITY_HIDDEN
@property Bool isDrawing;
@property Bool needsToDraw;
@property Bool isSigned;
+@property Bool tkLiveResizeEnded;
+@property TkWindow *tkPointerWindow;
+@property TkWindow *tkEventTarget;
+@property unsigned int tkButtonState;
@end
@interface TKApplication(TKInit)
@@ -425,6 +433,7 @@ VISIBILITY_HIDDEN
NSString *privateWorkingText;
Bool _tkNeedsDisplay;
NSRect _tkDirtyRect;
+ NSTrackingArea *trackingArea;
}
@property Bool tkNeedsDisplay;
@property NSRect tkDirtyRect;
@@ -452,11 +461,9 @@ VISIBILITY_HIDDEN
{
#ifdef __i386__
/* The Objective C runtime used on i386 requires this. */
- Bool _mouseInResizeArea;
Window _tkWindow;
#endif
}
-@property Bool mouseInResizeArea;
@property Window tkWindow;
@end
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 36d0b9d..afadb32 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -148,6 +148,8 @@ XMapWindow(
TkWindow *winPtr = macWin->winPtr;
NSWindow *win = TkMacOSXGetNSWindowForDrawable(window);
static Bool initialized = NO;
+ NSPoint mouse = [NSEvent mouseLocation];
+ int x = mouse.x, y = TkMacOSXZeroScreenHeight() - mouse.y;
/*
* Under certain situations it's possible for this function to be called
@@ -185,6 +187,16 @@ XMapWindow(
[win orderFrontRegardless];
}
}
+
+ /*
+ * Call Tk_UpdatePointer to tell Tk whether the pointer is in the
+ * new window.
+ */
+
+ NSPoint viewLocation = [view convertPoint:mouse fromView:nil];
+ if (NSPointInRect(viewLocation, NSInsetRect([view bounds], 2, 2))) {
+ Tk_UpdatePointer((Tk_Window) winPtr, x, y, [NSApp tkButtonState]);
+ }
} else {
TkWindow *contWinPtr = TkpGetOtherWindow(winPtr);
@@ -296,6 +308,9 @@ XUnmapWindow(
TkWindow *winPtr = macWin->winPtr;
TkWindow *parentPtr = winPtr->parentPtr;
NSWindow *win = TkMacOSXGetNSWindowForDrawable(window);
+ NSPoint mouse = [NSEvent mouseLocation];
+ int x = mouse.x, y = TkMacOSXZeroScreenHeight() - mouse.y;
+ int state = TkMacOSXButtonKeyState();
if (!window) {
return BadWindow;
@@ -303,12 +318,41 @@ XUnmapWindow(
display->request++;
if (Tk_IsTopLevel(winPtr)) {
if (!Tk_IsEmbedded(winPtr) &&
- winPtr->wmInfoPtr->hints.initial_state!=IconicState) {
- [win orderOut:nil];
+ winPtr->wmInfoPtr->hints.initial_state!=IconicState) {
[win setExcludedFromWindowsMenu:YES];
+ [win orderOut:NSApp];
+ if ([win isKeyWindow]) {
+
+ /*
+ * If we are unmapping the key window then we need to make sure
+ * that a new key window is assigned, if possible. This is
+ * supposed to happen when a key window is ordered out, but as
+ * noted in tkMacOSXWm.c this does not happen, in spite of
+ * Apple's claims to the contrary.
+ */
+
+ for (NSWindow *w in [NSApp orderedWindows]) {
+ TkWindow *winPtr2 = TkMacOSXGetTkWindow(w);
+ WmInfo *wmInfoPtr;
+
+ BOOL isOnScreen;
+
+ if (!winPtr2 || !winPtr2->wmInfoPtr) {
+ continue;
+ }
+ wmInfoPtr = winPtr2->wmInfoPtr;
+ isOnScreen = (wmInfoPtr->hints.initial_state != IconicState &&
+ wmInfoPtr->hints.initial_state != WithdrawnState);
+ if (w != win && isOnScreen && [w canBecomeKeyWindow]) {
+ [w makeKeyAndOrderFront:NSApp];
+ break;
+ }
+ }
+ }
}
TkMacOSXInvalClipRgns((Tk_Window)winPtr);
} else {
+
/*
* Rebuild the visRgn clip region for the parent so it will be allowed
* to draw in the space from which this subwindow was removed and then
@@ -327,6 +371,7 @@ XUnmapWindow(
if (view != [NSView focusView]) {
[view addTkDirtyRect:[view bounds]];
}
+ Tk_UpdatePointer(NULL, x, y, state);
return Success;
}
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 60167ca..26d68d9 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -198,7 +198,6 @@ PressButtonObjCmd(
Tcl_Obj *const objv[])
{
int x = 0, y = 0, i, value;
- NSInteger signal = -1;
CGPoint pt;
NSPoint loc;
NSEvent *motion, *press, *release;
@@ -234,40 +233,39 @@ PressButtonObjCmd(
loc.y = ScreenHeight - y;
/*
- * We set the window number and the eventNumber to -1 as a signal to
- * processMouseEvent.
+ * We set the timestamp to 0 as a signal to processMouseEvent.
*/
CGWarpMouseCursorPosition(pt);
motion = [NSEvent mouseEventWithType:NSMouseMoved
location:loc
modifierFlags:0
- timestamp:GetCurrentEventTime()
- windowNumber:signal
+ timestamp:0
+ windowNumber:0
context:nil
- eventNumber:signal
+ eventNumber:0
clickCount:1
- pressure:0.0];
+ pressure:0];
[NSApp postEvent:motion atStart:NO];
press = [NSEvent mouseEventWithType:NSLeftMouseDown
location:loc
modifierFlags:0
- timestamp:GetCurrentEventTime()
- windowNumber:signal
+ timestamp:0
+ windowNumber:0
context:nil
- eventNumber:signal
+ eventNumber:0
clickCount:1
- pressure:0.0];
+ pressure:0];
[NSApp postEvent:press atStart:NO];
release = [NSEvent mouseEventWithType:NSLeftMouseUp
location:loc
modifierFlags:0
- timestamp:GetCurrentEventTime()
- windowNumber:signal
+ timestamp:0
+ windowNumber:0
context:nil
- eventNumber:signal
+ eventNumber:0
clickCount:1
- pressure:-1.0];
+ pressure:0];
[NSApp postEvent:release atStart:NO];
return TCL_OK;
}
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 68d913e..56d69b2 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -52,13 +52,33 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
#endif
- BOOL activate = [[notification name]
- isEqualToString:NSWindowDidBecomeKeyNotification];
NSWindow *w = [notification object];
TkWindow *winPtr = TkMacOSXGetTkWindow(w);
+ NSString *name = [notification name];
+ Bool flag = [name isEqualToString:NSWindowDidBecomeKeyNotification];
+ if (winPtr && flag) {
+ NSPoint location = [NSEvent mouseLocation];
+ int x = location.x;
+ int y = floor(TkMacOSXZeroScreenHeight() - location.y);
+ /*
+ * The Tk event target persists when there is no key window but
+ * gets reset when a new window becomes the key window.
+ */
+ [NSApp setTkEventTarget: winPtr];
+
+ /*
+ * Call Tk_UpdatePointer if the pointer is in the window.
+ */
+
+ NSView *view = [w contentView];
+ NSPoint viewLocation = [view convertPoint:location fromView:nil];
+ if (NSPointInRect(viewLocation, NSInsetRect([view bounds], 2, 2))) {
+ Tk_UpdatePointer((Tk_Window) winPtr, x, y, [NSApp tkButtonState]);
+ }
+ }
if (winPtr && Tk_IsMapped(winPtr)) {
- GenerateActivateEvents(winPtr, activate);
+ GenerateActivateEvents(winPtr, flag);
}
}
@@ -162,6 +182,9 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
#endif
+ if (![[notification object] respondsToSelector: @selector (tkLayoutChanged)]) {
+ return;
+ }
[(TKWindow *)[notification object] tkLayoutChanged];
}
@@ -170,6 +193,9 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
#endif
+ if (![[notification object] respondsToSelector: @selector (tkLayoutChanged)]) {
+ return;
+ }
[(TKWindow *)[notification object] tkLayoutChanged];
}
@@ -182,6 +208,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
TkWindow *winPtr = TkMacOSXGetTkWindow(w);
if (winPtr) {
+ winPtr->wmInfoPtr->hints.initial_state = IconicState;
Tk_UnmapWindow((Tk_Window)winPtr);
}
}
@@ -233,17 +260,22 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
}
}
-#ifdef TK_MAC_DEBUG_NOTIFICATIONS
-
-- (void) windowDragStart: (NSNotification *) notification
+- (void) windowLiveResize: (NSNotification *) notification
{
- TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
+ NSString *name = [notification name];
+ if ([name isEqualToString:NSWindowWillStartLiveResizeNotification]) {
+ // printf("Starting live resize.\n");
+ } else if ([name isEqualToString:NSWindowDidEndLiveResizeNotification]) {
+ [self setTkLiveResizeEnded:YES];
+ // printf("Ending live resize\n");
+ }
}
-- (void) windowLiveResize: (NSNotification *) notification
+#ifdef TK_MAC_DEBUG_NOTIFICATIONS
+
+- (void) windowDragStart: (NSNotification *) notification
{
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
- //BOOL start = [[notification name] isEqualToString:NSWindowWillStartLiveResizeNotification];
}
- (void) windowUnmapped: (NSNotification *) notification
@@ -274,6 +306,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
observe(NSWindowDidMiniaturizeNotification, windowCollapsed:);
observe(NSWindowWillOrderOnScreenNotification, windowMapped:);
observe(NSWindowDidOrderOnScreenNotification, windowBecameVisible:);
+ observe(NSWindowWillStartLiveResizeNotification, windowLiveResize:);
+ observe(NSWindowDidEndLiveResizeNotification, windowLiveResize:);
#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070)
observe(NSWindowDidEnterFullScreenNotification, windowEnteredFullScreen:);
@@ -282,8 +316,6 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
observe(NSWindowWillMoveNotification, windowDragStart:);
- observe(NSWindowWillStartLiveResizeNotification, windowLiveResize:);
- observe(NSWindowDidEndLiveResizeNotification, windowLiveResize:);
observe(NSWindowDidOrderOffScreenNotification, windowUnmapped:);
#endif
#undef observe
@@ -330,7 +362,7 @@ static void RefocusGrabWindow(void *data) {
continue;
}
if (winPtr->wmInfoPtr->hints.initial_state == WithdrawnState) {
- [win orderOut:nil];
+ [win orderOut:NSApp];
}
if (winPtr->dispPtr->grabWinPtr == winPtr) {
Tcl_DoWhenIdle(RefocusGrabWindow, winPtr);
@@ -954,6 +986,16 @@ ConfigureRestrictProc(
*/
self.layer.delegate = (id) self;
+ trackingArea = [[NSTrackingArea alloc]
+ initWithRect:[self bounds]
+ options:(NSTrackingMouseEnteredAndExited |
+ NSTrackingMouseMoved |
+ NSTrackingEnabledDuringMouseDrag |
+ NSTrackingInVisibleRect |
+ NSTrackingActiveAlways)
+ owner:self
+ userInfo:nil];
+ [self addTrackingArea:trackingArea];
}
return self;
}
@@ -1235,6 +1277,8 @@ static const char *const accentNames[] = {
change:(NSDictionary *)change
context:(void *)context
{
+ (void) change;
+ (void) context;
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
if (object == preferences && [keyPath isEqualToString:@"AppleHighlightColor"]) {
if (@available(macOS 10.14, *)) {
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 69d9e70..b8b4b2f 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -365,7 +365,6 @@ static void RemoveTransient(TkWindow *winPtr);
@end
@implementation TKWindow: NSWindow
-@synthesize mouseInResizeArea = _mouseInResizeArea;
@synthesize tkWindow = _tkWindow;
@end
@@ -2900,7 +2899,7 @@ WmIconwindowCmd(
*/
TkpWmSetState(oldIcon, WithdrawnState);
- [win orderOut:nil];
+ [win orderOut:NSApp];
[win setExcludedFromWindowsMenu:YES];
wmPtr3->iconFor = NULL;
}
@@ -6305,7 +6304,7 @@ TkMacOSXMakeRealWindowExist(
[window setContentView:contentView];
[contentView release];
[window setDelegate:NSApp];
- [window setAcceptsMouseMovedEvents:YES];
+ [window setAcceptsMouseMovedEvents:NO];
[window setReleasedWhenClosed:NO];
if (styleMask & NSUtilityWindowMask) {
[(TKPanel*)window setFloatingPanel:YES];
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 5159c8c..7c8628b 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -6,9 +6,9 @@
* Copyright (c) 2004 Joe English
* Copyright (c) 2005 Neil Madden
* Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2008-2009, Apple Inc.
- * Copyright 2009 Kevin Walzer/WordTech Communications LLC.
- * Copyright 2019 Marc Culler
+ * Copyright (c) 2008-2009 Apple Inc.
+ * Copyright (c) 2009 Kevin Walzer/WordTech Communications LLC.
+ * Copyright (c) 2019 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -2083,9 +2083,9 @@ typedef struct {
static Ttk_ElementOptionSpec EntryElementOptions[] = {
{"-background", TK_OPTION_BORDER,
- Tk_Offset(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND},
+ offsetof(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND},
{"-fieldbackground", TK_OPTION_BORDER,
- Tk_Offset(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND},
+ offsetof(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND},
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
@@ -2298,7 +2298,7 @@ static void SpinButtonElementSize(
TCL_UNUSED(Tk_Window), /* tkwin */
int *minWidth,
int *minHeight,
- TCL_UNUSED(Ttk_Padding*)) /* PaddingPtr */
+ TCL_UNUSED(Ttk_Padding *)) /* PaddingPtr */
{
SInt32 s;
@@ -2411,7 +2411,7 @@ static Ttk_StateTable ThemeTrackEnableTable[] = {
{kThemeTrackDisabled, TTK_STATE_DISABLED, 0},
{kThemeTrackActive, TTK_STATE_BACKGROUND, 0},
{kThemeTrackActive, 0, 0}
- /* { kThemeTrackNothingToScroll, ?, ? , 0}, */
+ /* { kThemeTrackNothingToScroll, ?, ? }, */
};
typedef struct { /* TrackElement client data */
@@ -2445,7 +2445,7 @@ static void TrackElementSize(
int *minHeight,
TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
- TrackElementData *data = clientData;
+ TrackElementData *data = (TrackElementData *)clientData;
SInt32 size = 24; /* reasonable default ... */
ChkErr(GetThemeMetric, data->thicknessMetric, &size);
@@ -2462,11 +2462,11 @@ static void TrackElementDraw(
{
TrackElementData *data = (TrackElementData *)clientData;
TrackElement *elem = (TrackElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
double from = 0, to = 100, value = 0, fraction, max;
CGRect bounds = BoxToRect(d, b);
- Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, elem->orientObj, &orientation);
Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from);
Tcl_GetDoubleFromObj(NULL, elem->toObj, &to);
Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value);
@@ -2567,15 +2567,15 @@ typedef struct {
static Ttk_ElementOptionSpec PbarElementOptions[] = {
{"-orient", TK_OPTION_STRING,
- Tk_Offset(PbarElement, orientObj), "horizontal"},
+ offsetof(PbarElement, orientObj), "horizontal"},
{"-value", TK_OPTION_DOUBLE,
- Tk_Offset(PbarElement, valueObj), "0"},
+ offsetof(PbarElement, valueObj), "0"},
{"-maximum", TK_OPTION_DOUBLE,
- Tk_Offset(PbarElement, maximumObj), "100"},
+ offsetof(PbarElement, maximumObj), "100"},
{"-phase", TK_OPTION_INT,
- Tk_Offset(PbarElement, phaseObj), "0"},
+ offsetof(PbarElement, phaseObj), "0"},
{"-mode", TK_OPTION_STRING,
- Tk_Offset(PbarElement, modeObj), "determinate"},
+ offsetof(PbarElement, modeObj), "determinate"},
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void PbarElementSize(
@@ -2601,13 +2601,14 @@ static void PbarElementDraw(
Ttk_State state)
{
PbarElement *pbar = (PbarElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL, phase;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
+ int phase;
double value = 0, maximum = 100, factor;
CGRect bounds = BoxToRect(d, b);
int isIndeterminate = !strcmp("indeterminate",
Tcl_GetString(pbar->modeObj));
- Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, pbar->orientObj, &orientation);
Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value);
Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum);
Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase);
@@ -2667,7 +2668,7 @@ typedef struct
static Ttk_ElementOptionSpec ScrollbarElementOptions[] = {
{"-orient", TK_OPTION_STRING,
- Tk_Offset(ScrollbarElement, orientObj), "horizontal"},
+ offsetof(ScrollbarElement, orientObj), "horizontal"},
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void TroughElementSize(
@@ -2679,10 +2680,10 @@ static void TroughElementSize(
Ttk_Padding *paddingPtr)
{
ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
SInt32 thickness = 15;
- Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &thickness);
if (orientation == TTK_ORIENT_HORIZONTAL) {
*minHeight = thickness;
@@ -2706,11 +2707,11 @@ static void TroughElementDraw(
TCL_UNUSED(Ttk_State)) /* state */
{
ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
CGRect bounds = BoxToRect(d, b);
GrayColor bgGray;
- Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
if (orientation == TTK_ORIENT_HORIZONTAL) {
bounds = CGRectInset(bounds, 0, 1);
} else {
@@ -2744,9 +2745,9 @@ static void ThumbElementSize(
TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */
{
ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
- Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
if (orientation == TTK_ORIENT_VERTICAL) {
*minHeight = 18;
*minWidth = 8;
@@ -2765,9 +2766,9 @@ static void ThumbElementDraw(
Ttk_State state)
{
ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord;
- int orientation = TTK_ORIENT_HORIZONTAL;
+ Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
- Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
+ TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
/*
* In order to make ttk scrollbars work correctly it is necessary to be
@@ -3064,6 +3065,7 @@ static void FillElementDraw(
Ttk_State state)
{
CGRect bounds = BoxToRect(d, b);
+
if ([NSApp macOSVersion] > 100800) {
CGColorRef bgColor;
BEGIN_DRAWING(d)
@@ -3153,7 +3155,7 @@ static Ttk_ElementSpec ToolbarBackgroundElementSpec = {
* +++ Field elements --
*
* Used for the Treeview widget. This is like the BackgroundElement
- * except that the fieldbackground color is configureable.
+ * except that the fieldbackground color is configurable.
*/
typedef struct {
@@ -3162,7 +3164,7 @@ typedef struct {
static Ttk_ElementOptionSpec FieldElementOptions[] = {
{"-fieldbackground", TK_OPTION_BORDER,
- Tk_Offset(FieldElement, backgroundObj), "white"},
+ offsetof(FieldElement, backgroundObj), "white"},
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
diff --git a/tests/bind.test b/tests/bind.test
index 58d5799..9b2f5e1 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -6510,7 +6510,7 @@ test bind-33.2 {prefer most specific event} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {Double}
+} -result Double
test bind-33.3 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6526,7 +6526,7 @@ test bind-33.3 {prefer most specific event} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {Double}
+} -result Double
test bind-33.4 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6618,7 +6618,7 @@ test bind-33.9 {prefer last in case of homogeneous equal patterns} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {last}
+} -result last
test bind-33.10 {prefer last in case of homogeneous equal patterns} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6635,7 +6635,7 @@ test bind-33.10 {prefer last in case of homogeneous equal patterns} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {last}
+} -result last
test bind-33.11 {should prefer most specific} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6656,7 +6656,7 @@ test bind-33.11 {should prefer most specific} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {first}
+} -result first
test bind-33.12 {prefer last in case of homogeneous equal patterns} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6670,15 +6670,15 @@ test bind-33.12 {prefer last in case of homogeneous equal patterns} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {last}
+} -result last
test bind-33.13 {prefer last in case of homogeneous equal patterns} -setup {
pack [frame .t.f]
focus -force .t.f
update
set x {}
} -body {
- bind .t.f <Button-1><Control-1> { lappend x "first" }
- bind .t.f <Control-1><Button-1> { lappend x "last" }
+ bind .t.f <Button-1><Control-Button-1> { lappend x "first" }
+ bind .t.f <Control-Button-1><Button-1> { lappend x "last" }
event generate .t.f <Control-Button-1>
event generate .t.f <Control-Button-1>
set x
@@ -6687,7 +6687,7 @@ test bind-33.13 {prefer last in case of homogeneous equal patterns} -setup {
# Old implementation failed, and returned "first", but this was wrong,
# because both bindings are homogeneous equal, so the most recently defined
# must be preferred.
-} -result {last}
+} -result last
test bind-33.14 {prefer last in case of homogeneous equal patterns} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6703,7 +6703,7 @@ test bind-33.14 {prefer last in case of homogeneous equal patterns} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {last}
+} -result last
test bind-33.15 {prefer last in case of homogeneous equal patterns} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6722,7 +6722,7 @@ test bind-33.15 {prefer last in case of homogeneous equal patterns} -setup {
# Old implementation failed, and returned "first", but this was wrong,
# because both bindings are homogeneous equal, so the most recently defined
# must be preferred.
-} -result {last}
+} -result last
test bind-33.16 {simulate use of the keyboard to trigger a pattern sequence with modifier - bug [16ef161925]} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -7001,8 +7001,8 @@ test bind-35.3 {Events agree for modifier keys} -constraints {aqua} -setup {
global keyInfo numericalKeysym
set result {}
bind . <Key> {
- set keyInfo [format "%K,0x%%X,0x%%X,%A" %N %k]
- set numericalKeysym [format "0x%x" %N]
+ set keyInfo [format "%K,0x%%X,0x%%X,%A" %N %k]
+ set numericalKeysym [format "0x%x" %N]
}
foreach event {
{<Control_L> -control}
diff --git a/tests/color.test b/tests/color.test
index 798e6b9..c3ae066 100644
--- a/tests/color.test
+++ b/tests/color.test
@@ -163,7 +163,7 @@ test color-1.5 {Color table} nonPortable {
set fd [open ../xlib/rgb.txt]
set result {}
while {[gets $fd line] >= 0} {
- if {[string index $line 0] == "!"} continue
+ if {[string index $line 0] == "!"} continue
set rgb [c255 [winfo rgb . [lrange $line 3 end]]]
if {$rgb != [lrange $line 0 2] } {
append result $line\n
diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test
index 251d589..b609234 100644
--- a/tests/ttk/combobox.test
+++ b/tests/ttk/combobox.test
@@ -74,7 +74,7 @@ test combobox-1890211 "ComboboxSelected event after listbox unposted" -body {
update idletasks
set result [list]
bind .cb <<ComboboxSelected>> {
- lappend result Event [winfo ismapped .cb.popdown] [.cb get]
+ lappend result Event [winfo ismapped .cb.popdown] [.cb get]
}
lappend result Start 0 [.cb get]
ttk::combobox::Post .cb
diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test
index 5bd85cb..1832cba 100644
--- a/tests/ttk/entry.test
+++ b/tests/ttk/entry.test
@@ -81,7 +81,7 @@ test entry-2.1 "Create entry before scrollbar" -body {
pack [ttk::entry .te -xscrollcommand [list .tsb set]] \
-expand true -fill both
pack [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \
- -expand false -fill x
+ -expand false -fill x
} -cleanup {destroy .te .tsb}
test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -constraints {failsOnUbuntu failsOnXQuarz} -body {
@@ -91,7 +91,7 @@ test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -constra
catch {update} ; # error triggers because the -xscrollcommand callback
# errors out: invalid command name ".tsb"
pack [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \
- -expand false -fill x
+ -expand false -fill x
update ; # no error
set res [expr [lindex [.tsb get] 1] < 1] ; # scrollbar did update
} -result 1 -cleanup {destroy .te .tsb}
@@ -316,7 +316,7 @@ test entry-8.2a "Followup to test 8.2" -body {
test entry-9.1 "Index range invariants" -setup {
# See bug#1721532 for discussion
proc entry-9.1-trace {n1 n2 op} {
- set ::V NO!
+ set ::V NO!
}
variable V
trace add variable V write entry-9.1-trace
diff --git a/tests/ttk/labelframe.test b/tests/ttk/labelframe.test
index d81d33d..f7cb8ef 100644
--- a/tests/ttk/labelframe.test
+++ b/tests/ttk/labelframe.test
@@ -96,14 +96,14 @@ test labelframe-4.3 "Re-add nonchild content" -body {
test labelframe-4.4 "Re-manage nonchild content" -body {
pack .cb -side right
list [update; winfo viewable .cb] \
- [winfo manager .cb] \
+ [winfo manager .cb] \
[.lf cget -labelwidget]
} -result [list 1 pack {}]
test labelframe-4.5 "Re-add nonchild content" -body {
.lf configure -labelwidget .cb
list [update; winfo viewable .cb] \
- [winfo manager .cb] \
+ [winfo manager .cb] \
[.lf cget -labelwidget]
} -result [list 1 labelframe .cb]
diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test
index b3c4afa..e5d2a99 100644
--- a/tests/ttk/notebook.test
+++ b/tests/ttk/notebook.test
@@ -398,7 +398,7 @@ test notebook-7.7d "insert - current tab undisturbed" -body {
test notebook-7.8a "move tabs - current tab undisturbed - exhaustive" -body {
.nb select .nb.f0
foreach i {0 1 2 3 4} {
- .nb insert $i .nb.f$i
+ .nb insert $i .nb.f$i
}
foreach i {0 1 2 3 4} {
@@ -455,7 +455,7 @@ test notebook-1817596-2 "error in insert should have no effect" -body {
.nb insert end [ttk::label .nb.l1]
.nb insert end [ttk::label .nb.l2]
list \
- [catch { .nb insert .l2 0 -badoption badvalue } err] \
+ [catch { .nb insert .l2 0 -badoption badvalue } err] \
[.nb tabs] \
} -result [list 1 [list .nb.l1 .nb.l2]] -cleanup { destroy .nb }
diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test
index d9909c0..baf6b9c 100644
--- a/tests/ttk/panedwindow.test
+++ b/tests/ttk/panedwindow.test
@@ -156,7 +156,7 @@ proc checkorder {winlist} {
set pos -1
set positions [list]
foreach win $winlist {
- lappend positions [set nextpos [winfo y $win]]
+ lappend positions [set nextpos [winfo y $win]]
if {$nextpos <= $pos} {
error "window $win out of order ($positions)"
}
@@ -203,7 +203,7 @@ proc sashpositions {pw} {
set positions [list]
set npanes [llength [winfo children $pw]]
for {set i 0} {$i < $npanes - 1} {incr i} {
- lappend positions [$pw sashpos $i]
+ lappend positions [$pw sashpos $i]
}
return $positions
}
diff --git a/tests/ttk/radiobutton.test b/tests/ttk/radiobutton.test
index 6de5b5e..29321c7 100644
--- a/tests/ttk/radiobutton.test
+++ b/tests/ttk/radiobutton.test
@@ -9,7 +9,7 @@ loadTestedCommands
test radiobutton-1.1 "Radiobutton check" -body {
pack \
- [ttk::radiobutton .rb1 -text "One" -variable choice -value 1] \
+ [ttk::radiobutton .rb1 -text "One" -variable choice -value 1] \
[ttk::radiobutton .rb2 -text "Two" -variable choice -value 2] \
[ttk::radiobutton .rb3 -text "Three" -variable choice -value 3] \
;
diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test
index 6d35bea..c65bb4a 100644
--- a/tests/ttk/scrollbar.test
+++ b/tests/ttk/scrollbar.test
@@ -28,7 +28,7 @@ test scrollbar-swapout-2 "... regardless of whether -style ..." \
coreScrollbar
} -body {
ttk::style layout Vertical.Custom.TScrollbar \
- [ttk::style layout Vertical.TScrollbar] ; # See #1833339
+ [ttk::style layout Vertical.TScrollbar] ; # See #1833339
ttk::scrollbar .sb -command "yadda" -style Custom.TScrollbar
list [winfo class .sb] [.sb cget -command] [.sb cget -style]
} -result [list TScrollbar yadda Custom.TScrollbar] -cleanup {
diff --git a/tests/ttk/treetags.test b/tests/ttk/treetags.test
index 428212b..5cd2998 100644
--- a/tests/ttk/treetags.test
+++ b/tests/ttk/treetags.test
@@ -62,7 +62,7 @@ test treetags-1.3 "tag has - test" -body {
$tv insert {} end -id item2 -text "Item 2" -tags tag2
set result [list]
foreach item {item1 item2} {
- foreach tag {tag1 tag2 tag3} {
+ foreach tag {tag1 tag2 tag3} {
lappend result $item $tag [$tv tag has $tag $item]
}
}
@@ -207,7 +207,7 @@ test treetags-3.4 "stomp tags in tag binding procedure" -body {
set result [list]
$tv tag bind rm1 <<Remove>> { lappend ::result rm1 [%W focus] <<Remove>> }
$tv tag bind rm2 <<Remove>> {
- lappend ::result rm2 [%W focus] <<Remove>>
+ lappend ::result rm2 [%W focus] <<Remove>>
%W item [%W focus] -tags {tag1}
}
$tv tag bind rm3 <<Remove>> { lappend ::result rm3 [%W focus] <<Remove>> }
diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test
index 3d186e1..8b9f1e7 100644
--- a/tests/ttk/treeview.test
+++ b/tests/ttk/treeview.test
@@ -28,7 +28,7 @@ proc consistencyCheck {tv {item {}}} {
proc assert {expr {message ""}} {
if {![uplevel 1 [list expr $expr]]} {
set error "PANIC! PANIC! PANIC: $message ($expr failed)"
- puts stderr $error
+ puts stderr $error
error $error
}
}
diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test
index e8093a9..a08fbb5 100644
--- a/tests/ttk/ttk.test
+++ b/tests/ttk/ttk.test
@@ -87,7 +87,7 @@ test ttk-6.8 "Button command removes itself" -body {
test ttk-6.9 "Bad font spec in styles" -setup {
ttk::style theme create badfont -settings {
- ttk::style configure . -font {Helvetica 12 Bogus}
+ ttk::style configure . -font {Helvetica 12 Bogus}
}
ttk::style theme use badfont
} -cleanup {
@@ -119,7 +119,7 @@ test ttk-construction-failure-2 "Destroy widget in constructor" -setup {
list \
[catch { ttk::checkbutton .b -variable OUCH } msg] \
$msg \
- [winfo exists .b] \
+ [winfo exists .b] \
[info commands .b] \
;
} -result [list 1 "widget has been destroyed" 0 {}]
@@ -158,10 +158,10 @@ proc checkstate {w} {
{!active disabled}
{active !disabled}
{active disabled}
- active
+ active
disabled
} {
- lappend result [$w instate $statespec]
+ lappend result [$w instate $statespec]
}
set result
}
@@ -297,7 +297,7 @@ test ttk-4.4 "Bad resource specifications" -body {
update;
# As long as we haven't crashed, everything's OK
ttk::style theme settings alt {
- ttk::style configure TButton -font TkDefaultFont
+ ttk::style configure TButton -font TkDefaultFont
}
ttk::style theme use default
destroy .tb1
@@ -559,7 +559,7 @@ test ttk-13.4 "Custom styles -- bad -style option" -body {
test ttk-13.5 "Custom layouts -- missing element definition" -body {
ttk::style layout badstyle {
- NoSuchElement
+ NoSuchElement
}
ttk::button .tb1 -style badstyle
} -cleanup {
diff --git a/tests/ttk/validate.test b/tests/ttk/validate.test
index 90b09f7..89c3207 100644
--- a/tests/ttk/validate.test
+++ b/tests/ttk/validate.test
@@ -238,7 +238,7 @@ test validate-2.2 "configure in -validatecommand" -body {
test validate-3.0 "Setup" -body {
set ::E "123"
ttk::entry .e \
- -validatecommand {string is integer -strict %P} \
+ -validatecommand {string is integer -strict %P} \
-validate all \
-textvariable ::E \
;
diff --git a/tests/unixWm.test b/tests/unixWm.test
index d67a024..8c87cb5 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -1866,7 +1866,7 @@ test unixWm-50.3 {
set y [winfo rooty .x]
}
set result [list [child eval {winfo containing [expr $x - 1] [expr $y + 50]}] \
- [child eval {winfo containing $x [expr $y + 50]}]]
+ [child eval {winfo containing $x [expr $y + 50]}]]
interp delete child
set x [winfo rootx .t]
set y [winfo rooty .t]
diff --git a/unix/Makefile.in b/unix/Makefile.in
index b4cca52..0451422 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -1244,7 +1244,7 @@ tkImgPhInstance.o: $(GENERIC_DIR)/tkImgPhInstance.c $(GENERIC_DIR)/tkImgPhoto.h
tkOldTest.o: $(GENERIC_DIR)/tkOldTest.c
$(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tkOldTest.c
-tkTest.o: $(GENERIC_DIR)/tkTest.c
+tkTest.o: $(GENERIC_DIR)/tkTest.c tkUuid.h
$(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tkTest.c
tkText.o: $(GENERIC_DIR)/tkText.c
@@ -1583,6 +1583,11 @@ ttkWidget.o: $(TTK_DIR)/ttkWidget.c
ttkMacOSXTheme.o: $(MAC_OSX_DIR)/ttkMacOSXTheme.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/ttkMacOSXTheme.c
+tkUuid.h: $(TOP_DIR)/manifest.uuid
+ echo "#define TK_VERSION_UUID \\" >$@
+ cat $(TOP_DIR)/manifest.uuid >>$@
+ echo "" >>$@
+
.c.o:
$(CC) -c $(CC_SWITCHES) $<
@@ -1678,10 +1683,10 @@ $(UNIX_DIR)/tkConfig.h.in: $(MAC_OSX_DIR)/configure
cd $(MAC_OSX_DIR); autoheader; touch $@
$(TOP_DIR)/manifest.uuid:
- printf "git." >$(TOP_DIR)/manifest.uuid
- git rev-parse HEAD >>$(TOP_DIR)/manifest.uuid
+ printf "git-" >$(TOP_DIR)/manifest.uuid
+ (cd $(TOP_DIR); git rev-parse HEAD >>$(TOP_DIR)/manifest.uuid || printf "unknown" >$(TOP_DIR)/manifest.uuid)
-dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure $(TOP_DIR)/doc/man.macros $(TOP_DIR)/manifest.uuid
+dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure $(TOP_DIR)/doc/man.macros $(TOP_DIR)/manifest.uuid
rm -rf $(DISTDIR)
$(INSTALL_DATA_DIR) $(DISTDIR)/unix
$(DIST_INSTALL_DATA) $(TOP_DIR)/manifest.uuid $(DISTDIR)
diff --git a/unix/configure b/unix/configure
index bd4b7d8..3d91901 100755
--- a/unix/configure
+++ b/unix/configure
@@ -4739,9 +4739,9 @@ printf "%s\n" "$ac_cv_cygwin" >&6; }
fi
do64bit_ok=yes
if test "x${SHARED_BUILD}" = "x1"; then
- echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args"
+ echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32"
# The eval makes quoting arguments work.
- if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args; cd ../unix
+ if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32; cd ../unix
then :
else
{ echo "configure: error: configure failed for ../win" 1>&2; exit 1; }
@@ -5087,7 +5087,7 @@ fi
fi
;;
- Linux*|GNU*|NetBSD-Debian)
+ Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*)
SHLIB_CFLAGS="-fPIC -fno-common"
SHLIB_SUFFIX=".so"
@@ -5101,6 +5101,20 @@ fi
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+
+ case $system in
+ DragonFly-*|FreeBSD-*)
+ if test "${TCL_THREADS}" = "1"
+then :
+
+ # The -pthread needs to go in the LDFLAGS, not LIBS
+ LIBS=`echo $LIBS | sed s/-pthread//`
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
+fi
+ ;;
+ esac
+
if test $doRpath = yes
then :
@@ -5232,33 +5246,6 @@ fi
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
;;
- DragonFly-*|FreeBSD-*)
- # This configuration from FreeBSD Ports.
- SHLIB_LD="${CC} -shared"
- SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$@"
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- if test $doRpath = yes
-then :
-
- CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
- LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
-fi
- # The -pthread needs to go in the LDFLAGS, not LIBS
- LIBS=`echo $LIBS | sed s/-pthread//`
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
- case $system in
- FreeBSD-3.*)
- # Version numbers are dot-stripped by system policy.
- TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
- esac
- ;;
Darwin-*)
CFLAGS_OPTIMIZE="-Os"
SHLIB_CFLAGS="-fno-common"
@@ -8635,7 +8622,6 @@ printf "%s\n" "static library" >&6; }
if test "${SHARED_BUILD}" = "0"; then
EXTRA_WISH_LIBS=${EXTRA_WISH_LIBS}' -ObjC'
fi
- EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic'
ac_config_files="$ac_config_files Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in Credits.html:../macosx/Credits.html.in"
for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done
diff --git a/unix/configure.ac b/unix/configure.ac
index 58edbce..7c12fe7 100644
--- a/unix/configure.ac
+++ b/unix/configure.ac
@@ -592,7 +592,6 @@ if test "`uname -s`" = "Darwin" ; then
if test "${SHARED_BUILD}" = "0"; then
EXTRA_WISH_LIBS=${EXTRA_WISH_LIBS}' -ObjC'
fi
- EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic'
AC_CONFIG_FILES([Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in Credits.html:../macosx/Credits.html.in])
for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done
TK_YEAR="`date +%Y`"
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 9cfec6b..a5a4884 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1105,9 +1105,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
fi
do64bit_ok=yes
if test "x${SHARED_BUILD}" = "x1"; then
- echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args"
+ echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32"
# The eval makes quoting arguments work.
- if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args; cd ../unix
+ if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32; cd ../unix
then :
else
{ echo "configure: error: configure failed for ../win" 1>&2; exit 1; }
@@ -1262,7 +1262,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
])
])
;;
- Linux*|GNU*|NetBSD-Debian)
+ Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*)
SHLIB_CFLAGS="-fPIC -fno-common"
SHLIB_SUFFIX=".so"
@@ -1276,6 +1276,17 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+
+ case $system in
+ DragonFly-*|FreeBSD-*)
+ AS_IF([test "${TCL_THREADS}" = "1"], [
+ # The -pthread needs to go in the LDFLAGS, not LIBS
+ LIBS=`echo $LIBS | sed s/-pthread//`
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
+ ;;
+ esac
+
AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
@@ -1284,7 +1295,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -m64"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+ [tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no])
CFLAGS=$hold_cflags])
AS_IF([test $tcl_cv_cc_m64 = yes], [
CFLAGS="$CFLAGS -m64"
@@ -1356,30 +1368,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
;;
- DragonFly-*|FreeBSD-*)
- # This configuration from FreeBSD Ports.
- SHLIB_LD="${CC} -shared"
- SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$[@]"
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- AS_IF([test $doRpath = yes], [
- CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
- LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
- # The -pthread needs to go in the LDFLAGS, not LIBS
- LIBS=`echo $LIBS | sed s/-pthread//`
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
- case $system in
- FreeBSD-3.*)
- # Version numbers are dot-stripped by system policy.
- TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
- esac
- ;;
Darwin-*)
CFLAGS_OPTIMIZE="-Os"
SHLIB_CFLAGS="-fno-common"
@@ -1400,8 +1388,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
- [tcl_cv_cc_arch_ppc64=yes],
- [tcl_cv_cc_arch_ppc64=no])
+ [tcl_cv_cc_arch_ppc64=yes],[tcl_cv_cc_arch_ppc64=no])
CFLAGS=$hold_cflags])
AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
@@ -1413,8 +1400,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -arch x86_64"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
- [tcl_cv_cc_arch_x86_64=yes],
- [tcl_cv_cc_arch_x86_64=no])
+ [tcl_cv_cc_arch_x86_64=yes],[tcl_cv_cc_arch_x86_64=no])
CFLAGS=$hold_cflags])
AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
CFLAGS="$CFLAGS -arch x86_64"
@@ -2164,7 +2150,8 @@ AC_DEFUN([SC_TIME_HANDLER], [
# (like convex) have timezone functions, etc.
#
AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
+#include <stdlib.h>]],
[[extern long timezone;
timezone += 1;
exit (0);]])],
@@ -2176,7 +2163,8 @@ AC_DEFUN([SC_TIME_HANDLER], [
# On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
#
AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
+#include <stdlib.h>]],
[[extern time_t timezone;
timezone += 1;
exit (0);]])],
diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c
index 13bbf06..f977624 100644
--- a/unix/tkUnix3d.c
+++ b/unix/tkUnix3d.c
@@ -13,7 +13,9 @@
#include "tkInt.h"
#include "tk3d.h"
-#if !(defined(_WIN32) || defined(MAC_OSX_TK))
+#if defined(MAC_OSX_TK)
+#include "tkMacOSXInt.h"
+#else
#include "tkUnixInt.h"
#endif
diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c
index 9bcba0e..eccec3b 100644
--- a/unix/tkUnixColor.c
+++ b/unix/tkUnixColor.c
@@ -423,6 +423,7 @@ DeleteStressedCmap(
*----------------------------------------------------------------------
*/
+#undef TkpCmapStressed
int
TkpCmapStressed(
Tk_Window tkwin, /* Window that identifies the display
diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h
index 3cae17b..8d91293 100644
--- a/unix/tkUnixDefault.h
+++ b/unix/tkUnixDefault.h
@@ -56,6 +56,7 @@
#define DEF_BUTTON_DEFAULT "disabled"
#define DEF_BUTTON_DISABLED_FG_COLOR DISABLED
#define DEF_BUTTON_DISABLED_FG_MONO ""
+#define DEF_LABEL_FG BLACK
#define DEF_BUTTON_FG BLACK
#define DEF_CHKRAD_FG DEF_BUTTON_FG
#define DEF_BUTTON_FONT "TkDefaultFont"
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index 5c0f311..59ba9de 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -663,6 +663,7 @@ TkUnixDoOneXEvent(
*----------------------------------------------------------------------
*/
+#undef TkpSync
void
TkpSync(
Display *display) /* Display to sync. */
diff --git a/win/Makefile.in b/win/Makefile.in
index c95c5a4..94ac2aa 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -688,6 +688,15 @@ $(TKTEST): testMain.$(OBJEXT) $(TEST_DLL_FILE) @LIBRARIES@ $(TK_STUB_LIB_FILE) w
${TEST_DLL_FILE}: ${TKTEST_OBJS} ${TK_STUB_LIB_FILE}
@MAKE_DLL@ ${TKTEST_OBJS} $(TK_STUB_LIB_FILE) $(SHLIB_LD_LIBS)
+$(TOP_DIR)/manifest.uuid:
+ printf "git-" >$(TOP_DIR)/manifest.uuid
+ (cd $(TOP_DIR); git rev-parse HEAD >>$(TOP_DIR)/manifest.uuid || printf "unknown" >$(TOP_DIR)/manifest.uuid)
+
+tkUuid.h: $(TOP_DIR)/manifest.uuid
+ echo "#define TK_VERSION_UUID \\" >$@
+ cat $(TOP_DIR)/manifest.uuid >>$@
+ echo "" >>$@
+
# Msys make requires this next rule for some reason.
$(TCL_SRC_DIR)/win/cat.c:
diff --git a/win/configure b/win/configure
index 1b38323..e3f642d 100755
--- a/win/configure
+++ b/win/configure
@@ -4392,6 +4392,7 @@ printf "%s\n" "$ac_cv_municode" >&6; }
else
extra_cflags="$extra_cflags -DTCL_BROKEN_MAINARGS"
fi
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -fno-lto" >&5
printf %s "checking for working -fno-lto... " >&6; }
if test ${ac_cv_nolto+y}
@@ -4461,6 +4462,40 @@ printf "%s\n" "$tcl_cv_cc_input_charset" >&6; }
fi
fi
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Wl,--enable-auto-image-base"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working --enable-auto-image-base" >&5
+printf %s "checking for working --enable-auto-image-base... " >&6; }
+if test ${ac_cv_enable_auto_image_base+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_enable_auto_image_base=yes
+else $as_nop
+ ac_cv_enable_auto_image_base=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_auto_image_base" >&5
+printf "%s\n" "$ac_cv_enable_auto_image_base" >&6; }
+ CFLAGS=$hold_cflags
+ if test "$ac_cv_enable_auto_image_base" == "yes" ; then
+ extra_ldflags="$extra_ldflags -Wl,--enable-auto-image-base"
+ fi
+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking compiler flags" >&5
printf %s "checking compiler flags... " >&6; }
if test "${GCC}" = "yes" ; then
diff --git a/win/tcl.m4 b/win/tcl.m4
index ee2256d..5d28012 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -603,6 +603,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
else
extra_cflags="$extra_cflags -DTCL_BROKEN_MAINARGS"
fi
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto"
AC_CACHE_CHECK(for working -fno-lto,
ac_cv_nolto,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
@@ -625,6 +626,18 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
fi
fi
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Wl,--enable-auto-image-base"
+ AC_CACHE_CHECK(for working --enable-auto-image-base,
+ ac_cv_enable_auto_image_base,
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [ac_cv_enable_auto_image_base=yes],
+ [ac_cv_enable_auto_image_base=no])
+ )
+ CFLAGS=$hold_cflags
+ if test "$ac_cv_enable_auto_image_base" == "yes" ; then
+ extra_ldflags="$extra_ldflags -Wl,--enable-auto-image-base"
+ fi
+
AC_MSG_CHECKING([compiler flags])
if test "${GCC}" = "yes" ; then
SHLIB_LD=""
diff --git a/win/tkUuid.h.in b/win/tkUuid.h.in
new file mode 100755
index 0000000..5a70a8f
--- /dev/null
+++ b/win/tkUuid.h.in
@@ -0,0 +1 @@
+#define TK_VERSION_UUID \
diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h
index 0a747d9..992c7cc 100644
--- a/win/tkWinDefault.h
+++ b/win/tkWinDefault.h
@@ -59,6 +59,7 @@
#define DEF_BUTTON_DEFAULT "disabled"
#define DEF_BUTTON_DISABLED_FG_COLOR DISABLED
#define DEF_BUTTON_DISABLED_FG_MONO ""
+#define DEF_LABEL_FG NORMAL_FG
#define DEF_BUTTON_FG NORMAL_FG
#define DEF_CHKRAD_FG TEXT_FG
#define DEF_BUTTON_FONT "TkDefaultFont"