summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/onefiledist.yml2
-rw-r--r--README.md2
-rw-r--r--changes81
-rw-r--r--doc/grid.n2
-rw-r--r--doc/pack.n2
-rw-r--r--doc/place.n2
-rw-r--r--doc/sysnotify.n8
-rw-r--r--generic/tk.h4
-rw-r--r--generic/tkCanvas.c54
-rw-r--r--library/menu.tcl100
-rw-r--r--library/print.tcl56
-rw-r--r--library/tearoff.tcl10
-rw-r--r--library/tk.tcl2
-rw-r--r--library/ttk/menubutton.tcl2
-rw-r--r--macosx/tkMacOSXEmbed.c3
-rw-r--r--macosx/tkMacOSXImage.c259
-rw-r--r--macosx/tkMacOSXPort.h6
-rw-r--r--macosx/tkMacOSXWindowEvent.c4
-rw-r--r--macosx/tkMacOSXWm.c2
-rwxr-xr-xunix/configure8
-rw-r--r--unix/configure.ac2
-rw-r--r--unix/tcl.m46
-rw-r--r--unix/tk.spec2
-rw-r--r--unix/tkUnixEmbed.c1
-rw-r--r--win/Makefile.in5
-rwxr-xr-xwin/configure8
-rw-r--r--win/configure.ac4
-rw-r--r--win/rules.vc2
-rw-r--r--win/tcl.m42
-rw-r--r--win/tkWinEmbed.c2
30 files changed, 425 insertions, 218 deletions
diff --git a/.github/workflows/onefiledist.yml b/.github/workflows/onefiledist.yml
index f32e8ed..37f34b1 100644
--- a/.github/workflows/onefiledist.yml
+++ b/.github/workflows/onefiledist.yml
@@ -3,7 +3,7 @@ on: [push]
jobs:
linux:
name: Linux
- runs-on: ubuntu-16.04
+ runs-on: ubuntu-18.04
defaults:
run:
shell: bash
diff --git a/README.md b/README.md
index 2c68e9d..5e8ad56 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# README: Tk
-This is the **Tk 8.7a4** source distribution.
+This is the **Tk 8.7a6** source distribution.
You can get any source release of Tk from [our distribution
site](https://sourceforge.net/projects/tcl/files/Tcl/).
diff --git a/changes b/changes
index 96ecfb9..9fd9245 100644
--- a/changes
+++ b/changes
@@ -7806,7 +7806,7 @@ in this changeset (new minor version) rather than bug fixes:
2020-07-02 (bug)[2d2459] default style for combobox (bll)
-2020-07-06 (bug)[40c4bf] double free, entry-19.21 (vogel)
+2020-07-06 (bug)[40e4bf] double free, entry-19.21 (vogel)
2020-07-06 (bug)[e3888d] grab & warp, bind-36.1 (vogel)
@@ -7885,7 +7885,7 @@ in this changeset (new minor version) rather than bug fixes:
2018-11-06 [TIP 415] New option -height for [$canvas create arc] (geard)
-2018-11-06 [TIP 518] New event <<NoMangedChild>> (oehlmann)
+2018-11-06 [TIP 518] New event <<NoManagedChild>> (oehlmann)
2019-04-14 [TIP 164] New subcommand [$canvas rotate] (fellows)
@@ -7902,3 +7902,80 @@ in this changeset (new minor version) rather than bug fixes:
2019-08-19 [TIP 545] Revised options for photo image format 'svg' (oehlmann)
--- Released 8.7a3, November 25, 2019 --- http://core.tcl.tk/tk/ for details
+
+Changes to 8.7a5 include all changes to the 8.6 line through 8.6.11,
+plus the following, which focuses on the high-level feature changes
+in this changeset (new minor version) rather than bug fixes:
+
+2020-02-22 [TIP 565] Gracefully ignore non-existent tags in canvas raise/lower
+
+2020-02-22 [TIP 564] Specify ttk font sizes in points on X11
+
+2020-02-24 [TIP 563] Scrollwheel on Horizontal Scrollbar Scrolls Without Shift too
+
+2020-02-28 [TIP 557] C++ support
+
+2020-03-12 (bug)[355180] solve XKeycodeToKeysym deprecation
+ *** POTENTIAL INCOMPATIBILITY -- Tk 8.7 now requires X11R6 ***
+
+2020-03-18 [TIP 569] Eliminate comments that serve lint
+
+2020-05-17 [d87dc2] Remove TkMacOSXGetStringObjFromCFString()
+
+2020-05-24 [TIP 574] Add a 'tag delete' command to the ttk::treeview widget
+
+2020-06-27 (bug)[50ed1e] spinbox with duplicate values
+
+2020-07-03 [TIP 578] Death to TCL_DBGX
+
+2020-08-23 (bug)[bb85d2] valgrind on TIP 489
+
+2020-08024 (bug)[d30c21] default colors for TIP 496
+
+2020-09-02 [TIP 580] Export Tk_GetDoublePixelsFromObj and 5 more
+
+2020-10-21 [TIP 474] Uniform mouse wheel events
+
+2020-11-15 [TIP 584] Better introspection for ttk
+
+2020-11-16 [TIP 588] Unicode for (X11) keysyms
+
+2020-12-03 [TIP 590] Recommend lowercase package names
+
+2020-12-09 (bug)[d6e9b4] SVG memory overflow
+
+2020-12-11 [TIP 591] Rotate ttk::notebook window with mousewheel on tab
+
+2020-12-12 [TIP 325] System tray and system notification
+
+2021-01-08 [TIP 592] End support: Windows XP, Server 2003, Vista, Server 2008
+
+2021-01-08 (bug)[822330] Prevent buffer overflow in SVG image.
+
+2021-01-28 (bug)[237971] 'end' argument to [$canvas insert]
+
+2021-02-25 (bug)[be9cad] crash in [tkwait]
+
+2021-02-27 [TIP 529] Add metadata dictionary property to tk photo image
+
+2021-03-02 (bug)[1626ed] Aqua crash: dead keys as meny accelerator
+
+2021-03-29 (bug)[9b6065] Restore Tcl [update] when Tk is destroyed
+
+2021-04-08 (bug)[58222c] background colors
+
+2021-04-09 [TIP 595] Unicode-aware/case-sensitive Loadable Library handling
+
+2021-04-21 (bug)[cde766] update scrollbars on treeview
+
+2021-04-26 (bug)[c97464] memleak in aqua fonts
+
+2021-05-02 (bug)[2ecb09] Follow Mac OSX Key-repeat setting
+
+2021-05-03 (bug)[8a5086] ttk::entry issue
+
+2021-05-22 (bug)[3e3360] bind substitution %S
+
+2021-05-25 (bug)[7bda98] aqua: double click bind with changing focus
+
+- Released 8.7a5, Jun 18, 2021 --- http://core.tcl-lang.org/tcl/ for details -
diff --git a/doc/grid.n b/doc/grid.n
index 684474b..90f80cd 100644
--- a/doc/grid.n
+++ b/doc/grid.n
@@ -311,7 +311,7 @@ to be returned.
.TP
\fBgrid slaves \fIwindow\fR ?\fI\-option value\fR?
.
-Synonym for . \fBgrid content \fIwindow\fR ?\fI\-option value\fR?
+Synonym for \fBgrid content \fIwindow\fR ?\fI\-option value\fR?.
.SH "RELATIVE PLACEMENT"
.PP
The \fBgrid\fR command contains a limited set of capabilities that
diff --git a/doc/pack.n b/doc/pack.n
index da09a6d..cdcfeb8 100644
--- a/doc/pack.n
+++ b/doc/pack.n
@@ -166,7 +166,7 @@ If \fIwindow\fR has no content then an empty string is returned.
.TP
\fBpack slaves \fIwindow\fR
.
-Synonym for . \fBpack content \fIwindow\fR
+Synonym for \fBpack content \fIwindow\fR.
.SH "THE PACKER ALGORITHM"
.PP
For each container the packer maintains an ordered list of content
diff --git a/doc/place.n b/doc/place.n
index d887ee7..b56ad58 100644
--- a/doc/place.n
+++ b/doc/place.n
@@ -197,7 +197,7 @@ If there is no content for \fIwindow\fR then an empty string is returned.
.TP
\fBplace slaves \fIwindow\fR
.
-Synonym for . \fBplace content \fIwindow\fR
+Synonym for \fBplace content \fIwindow\fR.
.PP
If the configuration of a window has been retrieved with
\fBplace info\fR, that configuration can be restored later by
diff --git a/doc/sysnotify.n b/doc/sysnotify.n
index be26ba4..25f2a41 100644
--- a/doc/sysnotify.n
+++ b/doc/sysnotify.n
@@ -52,10 +52,10 @@ is no removal button, so this is done by selecting the application and
pressing the Delete key.)
.
-If deploying an application using the standalone version of Wish.app,
-setting the bundle ID in the applications Info.plist file to begin with
-"com" seems necessary for notifications to work. Using a different prefix
-for the bundle ID, such as something like "tk.tcl.tkchat," will cause
+If deploying an application using the standalone version of Wish.app,
+setting the bundle ID in the applications Info.plist file to begin with
+"com" seems necessary for notifications to work. Using a different prefix
+for the bundle ID, such as something like "tk.tcl.tkchat," will cause
notifications to silently fail.
.TP
\fBWindows\fR
diff --git a/generic/tk.h b/generic/tk.h
index 3f4c92a..ec54701 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -68,10 +68,10 @@ extern "C" {
#define TK_MAJOR_VERSION 8
#define TK_MINOR_VERSION 7
#define TK_RELEASE_LEVEL TCL_ALPHA_RELEASE
-#define TK_RELEASE_SERIAL 4
+#define TK_RELEASE_SERIAL 6
#define TK_VERSION "8.7"
-#define TK_PATCH_LEVEL "8.7a4"
+#define TK_PATCH_LEVEL "8.7a6"
/*
* A special definition used to allow this header file to be included from
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index fd65796..829d65a 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -16,11 +16,10 @@
#include "tkInt.h"
#include "tkCanvas.h"
#include "default.h"
-#ifdef TK_NO_DOUBLE_BUFFERING
+#include "tkPort.h"
#ifdef MAC_OSX_TK
#include "tkMacOSXInt.h"
#endif
-#endif /* TK_NO_DOUBLE_BUFFERING */
/*
* See tkCanvas.h for key data structures used to implement canvases.
@@ -2808,10 +2807,19 @@ DrawCanvas(
blockPtr.height = cHeight;
blockPtr.pixelSize = 4;
blockPtr.pitch = blockPtr.pixelSize * blockPtr.width;
+
+#ifdef TK_XGETIMAGE_USES_ABGR32
+ blockPtr.offset[0] = 1;
+ blockPtr.offset[1] = 2;
+ blockPtr.offset[2] = 3;
+ blockPtr.offset[3] = 0;
+#else
blockPtr.offset[0] = 0;
blockPtr.offset[1] = 1;
blockPtr.offset[2] = 2;
blockPtr.offset[3] = 3;
+#endif
+
blockPtr.pixelPtr = (unsigned char *)ckalloc(blockPtr.pixelSize * blockPtr.height * blockPtr.width);
/*
@@ -2848,7 +2856,7 @@ DrawCanvas(
for(x = 0; x < blockPtr.width; ++x) {
unsigned int pixel = 0;
-
+ int pixel_offset = blockPtr.pitch * y + blockPtr.pixelSize * x;
switch (ximagePtr->bits_per_pixel) {
/*
@@ -2901,21 +2909,45 @@ DrawCanvas(
*/
#ifdef _WIN32
-#define R_OFFSET 2
-#define B_OFFSET 0
+#define R_OFFSET blockPtr.offset[2]
+#define G_OFFSET blockPtr.offset[1]
+#define B_OFFSET blockPtr.offset[0]
+#define A_OFFSET blockPtr.offset[3]
#else
-#define R_OFFSET 0
-#define B_OFFSET 2
+#define R_OFFSET blockPtr.offset[0]
+#define G_OFFSET blockPtr.offset[1]
+#define B_OFFSET blockPtr.offset[2]
+#define A_OFFSET blockPtr.offset[3]
#endif
- blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + R_OFFSET] =
+#ifdef TK_XGETIMAGE_USES_ABGR32
+#define COPY_PIXEL (ximagePtr->bits_per_pixel == 32)
+#else
+#define COPY_PIXEL 0
+#endif
+
+ if (COPY_PIXEL) {
+ /*
+ * This platform packs pixels in RGBA byte order, as expected
+ * by Tk_PhotoPutBlock() so we can just copy the pixel as an int.
+ */
+ *((unsigned int *) (blockPtr.pixelPtr + pixel_offset)) = pixel;
+ } else {
+ blockPtr.pixelPtr[pixel_offset + R_OFFSET] =
(unsigned char)((pixel & visualPtr->red_mask) >> rshift);
- blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x +1] =
+ blockPtr.pixelPtr[pixel_offset + G_OFFSET] =
(unsigned char)((pixel & visualPtr->green_mask) >> gshift);
- blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + B_OFFSET] =
+ blockPtr.pixelPtr[pixel_offset + B_OFFSET] =
(unsigned char)((pixel & visualPtr->blue_mask) >> bshift);
- blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x +3] = 0xFF;
+ blockPtr.pixelPtr[pixel_offset + A_OFFSET] = 0xFF;
+ }
#ifdef DEBUG_DRAWCANVAS
+ fprintf(stderr, "Converted pixel %x to %hhx %hhx %hhx %hhx \n",
+ pixel,
+ blockPtr.pixelPtr[pixel_offset + 0],
+ blockPtr.pixelPtr[pixel_offset + 1],
+ blockPtr.pixelPtr[pixel_offset + 2],
+ blockPtr.pixelPtr[pixel_offset + 3]);
{
int ix;
if (x > 0)
diff --git a/library/menu.tcl b/library/menu.tcl
index a80e0a2..75e173d 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -269,8 +269,8 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
MenuUnpost {}
}
if {$::tk_strictMotif} {
- set Priv(cursor) [$w cget -cursor]
- $w configure -cursor arrow
+ set Priv(cursor) [$w cget -cursor]
+ $w configure -cursor arrow
}
if {[tk windowingsystem] ne "aqua"} {
set Priv(relief) [$w cget -relief]
@@ -343,7 +343,7 @@ proc ::tk::MenuUnpost menu {
$menu unpost
set Priv(postedMb) {}
if {$::tk_strictMotif} {
- $mb configure -cursor $Priv(cursor)
+ $mb configure -cursor $Priv(cursor)
}
if {[tk windowingsystem] ne "aqua"} {
$mb configure -relief $Priv(relief)
@@ -475,7 +475,7 @@ proc ::tk::MbButtonUp w {
proc ::tk::MenuMotion {menu x y state} {
variable ::tk::Priv
if {$menu eq $Priv(window)} {
- set activeindex [$menu index active]
+ set active [$menu index active]
if {[$menu cget -type] eq "menubar"} {
if {[info exists Priv(focus)] && $menu ne $Priv(focus)} {
$menu activate @$x,$y
@@ -485,24 +485,25 @@ proc ::tk::MenuMotion {menu x y state} {
$menu activate @$x,$y
GenerateMenuSelect $menu
}
- set index [$menu index @$x,$y]
- if {[info exists Priv(menuActivated)] \
- && $index ne "none" \
- && $index ne $activeindex} {
- set mode [option get $menu clickToFocus ClickToFocus]
- if {[string is false $mode]} {
- set delay [expr {[$menu cget -type] eq "menubar" ? 0 : 50}]
- if {[$menu type $index] eq "cascade"} {
- # Catch these postcascade commands since the menu could be
- # destroyed before they run.
- set Priv(menuActivatedTimer) \
- [after $delay "catch {$menu postcascade active}"]
- } else {
- set Priv(menuDeactivatedTimer) \
- [after $delay "catch {$menu postcascade none}"]
- }
- }
- }
+ set index [$menu index @$x,$y]
+ if {[info exists Priv(menuActivated)] \
+ && $index ne "none" \
+ && $index >= 0 \
+ && $index ne $active} {
+ set mode [option get $menu clickToFocus ClickToFocus]
+ if {[string is false $mode]} {
+ set delay [expr {[$menu cget -type] eq "menubar" ? 0 : 50}]
+ if {[$menu type $index] eq "cascade"} {
+ # Catch these postcascade commands since the menu could be
+ # destroyed before they run.
+ set Priv(menuActivatedTimer) \
+ [after $delay "catch {$menu postcascade active}"]
+ } else {
+ set Priv(menuDeactivatedTimer) \
+ [after $delay "catch {$menu postcascade none}"]
+ }
+ }
+ }
}
}
@@ -525,13 +526,14 @@ proc ::tk::MenuButtonDown menu {
variable ::tk::Priv
if {![winfo viewable $menu]} {
- return
+ return
}
- if {[$menu index active] eq "none"} {
- if {[$menu cget -type] ne "menubar" } {
- set Priv(window) {}
- }
- return
+ set active [$menu index active]
+ if {$active eq "none" || $active < 0} {
+ if {[$menu cget -type] ne "menubar" } {
+ set Priv(window) {}
+ }
+ return
}
$menu postcascade active
if {$Priv(postedMb) ne "" && [winfo viewable $Priv(postedMb)]} {
@@ -552,7 +554,7 @@ proc ::tk::MenuButtonDown menu {
if {[$menu type active] eq "cascade"} {
set Priv(menuActivated) 1
}
- }
+ }
# Don't update grab information if the grab window isn't changing.
# Otherwise, we'll get an error when we unpost the menus and
@@ -585,7 +587,8 @@ proc ::tk::MenuButtonDown menu {
proc ::tk::MenuLeave {menu rootx rooty state} {
variable ::tk::Priv
set Priv(window) {}
- if {[$menu index active] eq "none"} {
+ set active [$menu index active]
+ if {$active eq "none" || $active < 0} {
return
}
if {[$menu type active] eq "cascade" \
@@ -653,7 +656,7 @@ proc ::tk::MenuInvoke {w buttonRelease} {
}
} else {
set active [$w index active]
- if {$Priv(popup) eq "" || $active ne "none"} {
+ if {$Priv(popup) eq "" || ($active ne "none" && $active >= 0)} {
MenuUnpost $w
}
uplevel #0 [list $w invoke active]
@@ -797,7 +800,8 @@ proc ::tk::MenuNextMenu {menu direction} {
if {[winfo class $mb] eq "Menubutton" \
&& [$mb cget -state] ne "disabled" \
&& [$mb cget -menu] ne "" \
- && [[$mb cget -menu] index last] ne "none"} {
+ && [[$mb cget -menu] index last] ne "none" \
+ && [[$mb cget -menu] index last] >= 0} {
break
}
if {$mb eq $w} {
@@ -819,13 +823,14 @@ proc ::tk::MenuNextMenu {menu direction} {
# -1 means go to the next higher entry.
proc ::tk::MenuNextEntry {menu count} {
- if {[$menu index last] eq "none"} {
+ set last [$menu index last]
+ if {$last eq "none" || $last < 0} {
return
}
set length [expr {[$menu index last]+1}]
set quitAfter $length
set active [$menu index active]
- if {$active eq "none"} {
+ if {$active eq "none" || $active < 0} {
set i 0
} else {
set i [expr {$active + $count}]
@@ -893,7 +898,7 @@ proc ::tk::MenuFind {w char} {
foreach child $windowlist {
# Don't descend into other toplevels.
- if {[winfo toplevel $w] ne [winfo toplevel $child]} {
+ if {[winfo toplevel $w] ne [winfo toplevel $child]} {
continue
}
if {[winfo class $child] eq "Menu" && \
@@ -919,7 +924,7 @@ proc ::tk::MenuFind {w char} {
foreach child $windowlist {
# Don't descend into other toplevels.
- if {[winfo toplevel $w] ne [winfo toplevel $child]} {
+ if {[winfo toplevel $w] ne [winfo toplevel $child]} {
continue
}
switch -- [winfo class $child] {
@@ -941,7 +946,7 @@ proc ::tk::MenuFind {w char} {
}
}
}
- return {}
+ return ""
}
# ::tk::TraverseToMenu --
@@ -1068,7 +1073,8 @@ proc ::tk::MenuFirstEntry menu {
return
}
tk_menuSetFocus $menu
- if {[$menu index active] ne "none"} {
+ set active [$menu index active]
+ if {$active ne "none" && $active >= 0} {
return
}
set last [$menu index last]
@@ -1115,7 +1121,7 @@ proc ::tk::MenuFindName {menu s} {
}
set last [$menu index last]
if {$last eq "none"} {
- return
+ return ""
}
for {set i 0} {$i <= $last} {incr i} {
if {![catch {$menu entrycget $i -label} label]} {
@@ -1186,7 +1192,7 @@ if {[tk windowingsystem] eq "aqua"} {
# if we go offscreen to the top, show as 'below'
if {$y < [winfo vrooty $button]} {
set y [expr {[winfo vrooty $button] + [winfo rooty $button]\
- + [winfo reqheight $button]}]
+ + [winfo reqheight $button]}]
}
set entry {}
}
@@ -1340,14 +1346,12 @@ proc ::tk_menuSetFocus {menu} {
proc ::tk::GenerateMenuSelect {menu} {
variable ::tk::Priv
- if {$Priv(activeMenu) eq $menu \
- && $Priv(activeItem) eq [$menu index active]} {
- return
+ if {$Priv(activeMenu) ne $menu \
+ || $Priv(activeItem) ne [$menu index active]} {
+ set Priv(activeMenu) $menu
+ set Priv(activeItem) [$menu index active]
+ event generate $menu <<MenuSelect>>
}
-
- set Priv(activeMenu) $menu
- set Priv(activeItem) [$menu index active]
- event generate $menu <<MenuSelect>>
}
# ::tk_popup --
@@ -1369,7 +1373,7 @@ proc ::tk_popup {menu x y {entry {}}} {
}
tk::PostOverPoint $menu $x $y $entry
if {[tk windowingsystem] eq "x11" && [winfo viewable $menu]} {
- tk::SaveGrabInfo $menu
+ tk::SaveGrabInfo $menu
grab -global $menu
set Priv(popup) $menu
set Priv(window) $menu
diff --git a/library/print.tcl b/library/print.tcl
index cfdfa64..e39619d 100644
--- a/library/print.tcl
+++ b/library/print.tcl
@@ -693,11 +693,11 @@ namespace eval ::tk::print {
if {[tk windowingsystem] eq "x11"} {
- variable printcmd
+ variable printcmd
variable printlist
variable choosepaper
variable p
-
+
set printmcd ""
set chooseprinter ""
set printlist {}
@@ -706,11 +706,11 @@ namespace eval ::tk::print {
# Set the print environtment - print command, and list of printers.
# Arguments:
# none.
-
+
proc _setprintenv {} {
- variable printcmd
+ variable printcmd
variable printlist
-
+
#Select print command. We prefer lpr, but will fall back to lp if necessary.
if {[file exists "/usr/bin/lpr"]} {
set printcmd lpr
@@ -731,7 +731,7 @@ namespace eval ::tk::print {
# Arguments:
# w - widget with contents to print.
#
-
+
proc _print {w} {
variable printlist
@@ -742,7 +742,7 @@ namespace eval ::tk::print {
variable color
variable p
-
+
_setprintenv
set chooseprinter [lindex $printlist 0]
@@ -750,7 +750,7 @@ namespace eval ::tk::print {
set p ._print
catch {destroy $p}
-
+
toplevel $p
wm title $p "Print"
wm resizable $p 0 0
@@ -761,11 +761,11 @@ namespace eval ::tk::print {
#The main dialog
frame $p.frame.printframe -padx 5 -pady 5
pack $p.frame.printframe -side top -fill x -expand no
-
- label $p.frame.printframe.printlabel -text "Printer:"
+
+ label $p.frame.printframe.printlabel -text "Printer:"
ttk::combobox $p.frame.printframe.mb -textvariable chooseprinter -state readonly -values [lsort -unique $printlist]
pack $p.frame.printframe.printlabel $p.frame.printframe.mb -side left -fill x -expand no
-
+
bind $p.frame.printframe.mb <<ComboboxSelected>> { set chooseprinter}
set paperlist {Letter Legal A4}
@@ -776,7 +776,7 @@ namespace eval ::tk::print {
#to the ::tk::print namespace. To minimize name collision, we have
#given them similar names to the current namespace. And wherever
#possible, we are using namespaced variables.
-
+
set printcopies 1
set ::tkprint_choosepaper A4
set ::tkprint_color RGB
@@ -786,7 +786,7 @@ namespace eval ::tk::print {
#Base widgets to load.
labelframe $p.frame.copyframe -text Options -padx 5 -pady 5
- pack $p.frame.copyframe -fill x -expand no
+ pack $p.frame.copyframe -fill x -expand no
frame $p.frame.copyframe.l -padx 5 -pady 5
pack $p.frame.copyframe.l -side top -fill x -expand no
@@ -797,13 +797,13 @@ namespace eval ::tk::print {
pack $p.frame.copyframe.l.copylabel $p.frame.copyframe.l.field -side left -fill x -expand no
set printcopies [$p.frame.copyframe.l.field get]
-
+
frame $p.frame.copyframe.r -padx 5 -pady 5
pack $p.frame.copyframe.r -fill x -expand no
- label $p.frame.copyframe.r.paper -text "Paper:"
+ label $p.frame.copyframe.r.paper -text "Paper:"
tk_optionMenu $p.frame.copyframe.r.menu ::tkprint_choosepaper {*}$paperlist
-
+
pack $p.frame.copyframe.r.paper $p.frame.copyframe.r.menu -side left -fill x -expand no
#Widgets with additional options for canvas output.
@@ -811,35 +811,35 @@ namespace eval ::tk::print {
frame $p.frame.copyframe.z -padx 5 -pady 5
pack $p.frame.copyframe.z -fill x -expand no
-
+
label $p.frame.copyframe.z.zlabel -text "Scale %:"
tk_optionMenu $p.frame.copyframe.z.zentry ::tkprint_zoomnumber {*}$percentlist
-
+
pack $p.frame.copyframe.z.zlabel $p.frame.copyframe.z.zentry -side left -fill x -expand no
frame $p.frame.copyframe.orient -padx 5 -pady 5
pack $p.frame.copyframe.orient -fill x -expand no
- label $p.frame.copyframe.orient.text -text "Orientation:"
- radiobutton $p.frame.copyframe.orient.v -text "Portrait" -value portrait -variable ::tkprint_printorientation -compound left
- radiobutton $p.frame.copyframe.orient.h -text "Landscape" -value landscape -variable ::tkprint_printorientation -compound left
-
+ label $p.frame.copyframe.orient.text -text "Orientation:"
+ radiobutton $p.frame.copyframe.orient.v -text "Portrait" -value portrait -variable ::tkprint_printorientation -compound left
+ radiobutton $p.frame.copyframe.orient.h -text "Landscape" -value landscape -variable ::tkprint_printorientation -compound left
+
pack $p.frame.copyframe.orient.text $p.frame.copyframe.orient.v $p.frame.copyframe.orient.h -side left -fill x -expand no
frame $p.frame.copyframe.c -padx 5 -pady 5
- pack $p.frame.copyframe.c -fill x -expand no
+ pack $p.frame.copyframe.c -fill x -expand no
- label $p.frame.copyframe.c.l -text "Output:"
+ label $p.frame.copyframe.c.l -text "Output:"
tk_optionMenu $p.frame.copyframe.c.c ::tkprint_color {*}$colorlist
pack $p.frame.copyframe.c.l $p.frame.copyframe.c.c -side left -fill x -expand no
}
#Build rest of GUI.
- frame $p.frame.buttonframe
+ frame $p.frame.buttonframe
pack $p.frame.buttonframe -fill x -expand no -side bottom
button $p.frame.buttonframe.printbutton -text "Print" -command "::tk::print::_runprint $w"
- button $p.frame.buttonframe.cancel -text "Cancel" -command {destroy ._print}
+ button $p.frame.buttonframe.cancel -text "Cancel" -command {destroy ._print}
pack $p.frame.buttonframe.printbutton $p.frame.buttonframe.cancel -side right -fill x -expand no
@@ -861,7 +861,7 @@ namespace eval ::tk::print {
#First, generate print file.
-
+
if {[winfo class $w] eq "Text"} {
set txt [$w get 1.0 end]
set file /tmp/tk_text.txt
@@ -895,7 +895,7 @@ namespace eval ::tk::print {
set printargs {}
set printcopies [$p.frame.copyframe.l.field get]
-
+
if {$printcmd eq "lpr"} {
lappend printargs "-P $chooseprinter -# $printcopies"
} else {
diff --git a/library/tearoff.tcl b/library/tearoff.tcl
index 1c1e5dd..6df8b72 100644
--- a/library/tearoff.tcl
+++ b/library/tearoff.tcl
@@ -79,11 +79,11 @@ proc ::tk::TearOffMenu {w {x 0} {y 0}} {
}
if {[tk windowingsystem] eq "win32"} {
- # [Bug 3181181]: Find the toplevel window for the menu
- set parent [winfo toplevel $parent]
- while {[winfo class $parent] eq "Menu"} {
- set parent [winfo toplevel [winfo parent $parent]]
- }
+ # [Bug 3181181]: Find the toplevel window for the menu
+ set parent [winfo toplevel $parent]
+ while {[winfo class $parent] eq "Menu"} {
+ set parent [winfo toplevel [winfo parent $parent]]
+ }
wm transient $menu [winfo toplevel $parent]
wm attributes $menu -toolwindow 1
}
diff --git a/library/tk.tcl b/library/tk.tcl
index e5e3632..b648f9f 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -11,7 +11,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
# Verify that we have Tk binary and script components from the same release
-package require -exact tk 8.7a4
+package require -exact tk 8.7a6
# Create a ::tk namespace
namespace eval ::tk {
diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl
index e82b7c0..a0f70c9 100644
--- a/library/ttk/menubutton.tcl
+++ b/library/ttk/menubutton.tcl
@@ -136,7 +136,7 @@ if {[tk windowingsystem] eq "aqua"} {
# if we go offscreen to the top, show as 'below'
if {$y < [winfo vrooty $mb]} {
set y [expr {[winfo vrooty $mb] + [winfo rooty $mb]\
- + [winfo reqheight $mb]}]
+ + [winfo reqheight $mb]}]
}
}
below {
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index 832f404..029624d 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -1082,6 +1082,9 @@ EmbedWindowDeleted(
prevPtr = NULL;
containerPtr = firstContainerPtr;
while (1) {
+ if (containerPtr == NULL) {
+ return;
+ }
if (containerPtr->embeddedPtr == winPtr) {
/*
* We also have to destroy our parent, to clean up the container.
diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c
index 6b0a8c6..7eadb39 100644
--- a/macosx/tkMacOSXImage.c
+++ b/macosx/tkMacOSXImage.c
@@ -3,10 +3,10 @@
*
* The code in this file provides an interface for XImages,
*
- * Copyright © 1995-1997 Sun Microsystems, Inc.
- * Copyright © 2001-2009, Apple Inc.
- * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright © 2017-2020 Marc Culler.
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright (c) 2001-2009, Apple Inc.
+ * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2017-2021 Marc Culler.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -19,6 +19,71 @@ static CGImageRef CreateCGImageFromPixmap(Drawable pixmap);
static CGImageRef CreateCGImageFromDrawableRect( Drawable drawable,
int x, int y, unsigned int width, unsigned int height);
+/* Pixel formats
+ *
+ * Tk uses the XImage structure defined in Xlib.h for storing images. The
+ * image data in an XImage is a 32-bit aligned array of bytes. Interpretation
+ * of that data is not specified, but the structure includes parameters which
+ * provide interpretation hints so that an application can use a family of
+ * different data structures.
+ *
+ * The possible values for the XImage format field are XYBitmap, XYPixmap and
+ * ZPixmap. The macOS port does not support the XYPixmap format. This means
+ * that bitmap images are stored as a single bit plane (XYBitmap) and that
+ * color images are stored as a sequence of pixel values (ZPixmap).
+ *
+ * For a ZPixmap, the number of bits allocated to each pixel is specified by
+ * the bits_per_pixel field of the XImage structure. The functions in this
+ * module which convert between XImage and native CGImage or NSImage structures
+ * only support XImages with 32 bits per pixel. The ImageGetPixel and PutPixel
+ * implementations in this file allow 1, 4, 8, 16 or 32 bits per pixel, however.
+ *
+ * In tkImgPhInstance.c the layout used for pixels is determined by the values
+ * of the red_mask, blue_mask and green_mask fields in the XImage structure.
+ * The Aqua port always sets red_mask = 0xFF0000, green_mask = 0xFF00, and
+ * blue_mask = 0xFF. This means that a 32bpp ZPixmap XImage uses ARGB32 pixels,
+ * with small-endian byte order BGRA. The data array for such an XImage can be
+ * passed directly to construct a CGBitmapImageRep if one specifies the
+ * bitmapInfo as kCGBitmapByteOrder32Big | kCGImageAlphaLast.
+ *
+ * The structures below describe the bitfields in two common 32 bpp pixel
+ * layouts. Note that bit field layouts are compiler dependent. The layouts
+ * shown in the comments are those produced by clang and gcc. Also note
+ * that kCGBitmapByteOrder32Big is consistently set when creating CGImages or
+ * CGImageBitmapReps.
+ */
+
+/* RGBA32 0xRRGGBBAA (Byte order is RGBA on big-endian systems.)
+ * This is used by NSBitmapImageRep when the bitmapFormat property is 0,
+ * the default value.
+ */
+
+typedef struct RGBA32pixel_t {
+ unsigned red: 8;
+ unsigned green: 8;
+ unsigned blue: 8;
+ unsigned alpha: 8;
+} RGBA32pixel;
+
+/*
+ * 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.
+ */
+
+typedef struct ARGB32pixel_t {
+ unsigned blue: 8;
+ unsigned green: 8;
+ unsigned red: 8;
+ unsigned alpha: 8;
+} ARGB32pixel;
+
+typedef union pixel32_t {
+ unsigned int uint;
+ RGBA32pixel rgba;
+ ARGB32pixel argb;
+} pixel32;
+
#pragma mark XImage handling
int
@@ -116,9 +181,7 @@ TkMacOSXCreateCGImageWithXImage(
}
bitsPerComponent = 8;
bitsPerPixel = 32;
- bitmapInfo = (image->byte_order == MSBFirst ?
- kCGBitmapByteOrder32Little : kCGBitmapByteOrder32Big);
- bitmapInfo |= alphaInfo;
+ bitmapInfo = kCGBitmapByteOrder32Big | alphaInfo;
data = (char *)memcpy(ckalloc(len), image->data + image->xoffset, len);
if (data) {
provider = CGDataProviderCreateWithData(data, data, len,
@@ -208,14 +271,12 @@ ImageGetPixel(
switch (image->bits_per_pixel) {
case 32: /* 8 bits per channel */
- r = (*((unsigned int*) srcPtr) >> 16) & 0xff;
- g = (*((unsigned int*) srcPtr) >> 8) & 0xff;
- b = (*((unsigned int*) srcPtr) ) & 0xff;
- /*if (image->byte_order == LSBFirst) {
- r = srcPtr[2]; g = srcPtr[1]; b = srcPtr[0];
- } else {
- r = srcPtr[1]; g = srcPtr[2]; b = srcPtr[3];
- }*/
+ {
+ ARGB32pixel *pixel = (ARGB32pixel *)srcPtr;
+ r = pixel->red;
+ g = pixel->green;
+ b = pixel->blue;
+ }
break;
case 16: /* 5 bits per channel */
r = (*((unsigned short*) srcPtr) >> 7) & 0xf8;
@@ -252,7 +313,10 @@ ImageGetPixel(
*
* ImagePutPixel --
*
- * Set a single pixel in an image.
+ * Set a single pixel in an image. The pixel is provided as an unsigned
+ * 32-bit integer. The value of that integer is interpreted by assuming
+ * that its low-order N bits have the format specified by the XImage,
+ * where N is equal to the bits_per_pixel field of the XImage.
*
* Results:
* None.
@@ -278,27 +342,20 @@ ImagePutPixel(
if (image->bits_per_pixel == 32) {
*((unsigned int*) dstPtr) = pixel;
} else {
- unsigned char r = ((pixel & image->red_mask) >> 16) & 0xff;
- unsigned char g = ((pixel & image->green_mask) >> 8) & 0xff;
- unsigned char b = ((pixel & image->blue_mask) ) & 0xff;
switch (image->bits_per_pixel) {
case 16:
- *((unsigned short*) dstPtr) = ((r & 0xf8) << 7) |
- ((g & 0xf8) << 2) | ((b & 0xf8) >> 3);
+ *((unsigned short*) dstPtr) = pixel & 0xffff;
break;
case 8:
- *dstPtr = ((r & 0xc0) >> 2) | ((g & 0xc0) >> 4) |
- ((b & 0xc0) >> 6);
+ *dstPtr = pixel & 0xff;
break;
case 4: {
- unsigned char c = ((r & 0x80) >> 5) | ((g & 0x80) >> 6) |
- ((b & 0x80) >> 7);
- *dstPtr = (x % 2) ? ((*dstPtr & 0xf0) | (c & 0x0f)) :
- ((*dstPtr & 0x0f) | ((c << 4) & 0xf0));
+ *dstPtr = (x % 2) ? ((*dstPtr & 0xf0) | (pixel & 0x0f)) :
+ ((*dstPtr & 0x0f) | ((pixel << 4) & 0xf0));
break;
}
case 1:
- *dstPtr = ((r|g|b) & 0x80) ? (*dstPtr | (0x80 >> (x % 8))) :
+ *dstPtr = pixel ? (*dstPtr | (0x80 >> (x % 8))) :
(*dstPtr & ~(0x80 >> (x % 8)));
break;
}
@@ -422,10 +479,8 @@ XCreateImage(
*----------------------------------------------------------------------
*/
-#define PIXEL_RGBA kCGImageAlphaLast
-#define PIXEL_ARGB kCGImageAlphaFirst
-#define PIXEL_XRGB kCGImageAlphaNoneSkipFirst
-#define PIXEL_RGBX kCGImageAlphaNoneSkipLast
+#define USE_ALPHA kCGImageAlphaLast
+#define IGNORE_ALPHA kCGImageAlphaNoneSkipLast
static int
TkMacOSXPutImage(
@@ -480,19 +535,34 @@ TkMacOSXPutImage(
return result;
}
-int XPutImage(Display* display, Drawable drawable, GC gc, XImage* image,
- int src_x, int src_y, int dest_x, int dest_y,
- unsigned int width, unsigned int height) {
- return TkMacOSXPutImage(PIXEL_RGBX, display, drawable, gc, image,
+int XPutImage(
+ Display* display,
+ Drawable drawable,
+ GC gc,
+ XImage* image,
+ int src_x,
+ int src_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height) {
+ return TkMacOSXPutImage(IGNORE_ALPHA, display, drawable, gc, image,
src_x, src_y, dest_x, dest_y, width, height);
}
-int TkpPutRGBAImage(Display* display,
- Drawable drawable, GC gc, XImage* image,
- int src_x, int src_y, int dest_x, int dest_y,
- unsigned int width, unsigned int height) {
- return TkMacOSXPutImage(PIXEL_RGBA, display, drawable, gc, image,
- src_x, src_y, dest_x, dest_y, width, height);
+int TkpPutRGBAImage(
+ Display* display,
+ Drawable drawable,
+ GC gc,
+ XImage* image,
+ int src_x,
+ int src_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height) {
+ return TkMacOSXPutImage(USE_ALPHA, display, drawable, gc, image,
+ src_x, src_y, dest_x, dest_y, width, height);
}
@@ -501,33 +571,40 @@ int TkpPutRGBAImage(Display* display,
*
* CreateCGImageFromDrawableRect
*
- * Extract image data from a MacOSX drawable as a CGImage.
- *
- * This is only called by XGetImage and XCopyArea. The Tk core uses
- * these functions on some platforms, but on macOS the core does not
- * call them with a source drawable which is a window. Such calls are
- * used only for double-buffered drawing. Since macOS defines the
- * macro TK_NO_DOUBLE_BUFFERING, the generic code never calls XGetImage
- * or XCopyArea on macOS. Nonetheless, these function are in the stubs
- * table and therefore could be used by extensions.
- *
- * This implementation does not work correctly. Originally it relied on
+ * Extract image data from a MacOSX drawable as a CGImage. The drawable
+ * may be either a pixmap or a window, but there issues in the case of
+ * a window.
+ *
+ * CreateCGImageFromDrawableRect is called by XGetImage and XCopyArea.
+ * The Tk core uses these two functions on some platforms in order to
+ * implement explicit double-buffered drawing -- a pixmap is copied from a
+ * window, modified using CPU-based graphics composition, and then copied
+ * back to the window. Platforms, such as macOS, on which the system
+ * provides double-buffered drawing and GPU-based composition operations
+ * can avoid calls to XGetImage and XCopyArea from the core by defining
+ * the compile-time variable TK_NO_DOUBLE_BUFFERING. Nonetheless, these
+ * two functions are in the stubs table and therefore could be used by
+ * extensions.
+ *
+ * The implementation here does not always work correctly when the source
+ * is a window. The original version of this function relied on
* [NSBitmapImageRep initWithFocusedViewRect:view_rect] which was
* deprecated by Apple in OSX 10.14 and also required the use of other
* deprecated functions such as [NSView lockFocus]. Apple's suggested
* replacement is [NSView cacheDisplayInRect: toBitmapImageRep:] and that
- * is what is being used here. However, that method only works when the
- * view has a valid CGContext, and a view is only guaranteed to have a
- * valid context during a call to [NSView drawRect]. To further complicate
- * matters, cacheDisplayInRect calls [NSView drawRect]. Essentially it is
- * asking the view to draw a subrectangle of itself using a special
- * graphics context which is linked to the BitmapImageRep. But our
- * implementation of [NSView drawRect] does not allow recursive calls. If
- * called recursively it returns immediately without doing any drawing.
- * So the bottom line is that this function either returns a NULL pointer
- * or a black image. To make it useful would require a significant amount
- * of rewriting of the drawRect method. Perhaps the next release of OSX
- * will include some more helpful ways of doing this.
+ * is being used here. However, cacheDisplayInRect works by calling
+ * [NSView drawRect] after setting the current graphics context to be one
+ * which draws to a bitmap. There are situations in which this can be
+ * used, e.g. when taking a screenshot of a window. But it cannot be used
+ * as part of a normal display procedure, using the copy-modify-paste
+ * paradigm that is the basis of the explicit double-buffering. Since the
+ * copy operation will call the same display procedure that is calling
+ * this function via XGetImage or XCopyArea, this would create an infinite
+ * recursion.
+ *
+ * An alternative to the copy-modify-paste paradigm is to use GPU-based
+ * graphics composition, clipping to the specified rectangle. That is
+ * the approach that must be followed by display procedures on macOS.
*
* Results:
* Returns an NSBitmapRep representing the image of the given rectangle of
@@ -577,7 +654,8 @@ CreateCGImageFromDrawableRect(
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
cg_context = CGBitmapContextCreate(imageData, view_width, view_height,
bitsPerComponent, bytesPerRow, colorSpace,
- kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
+ kCGImageAlphaPremultipliedLast |
+ kCGBitmapByteOrder32Big);
CFRelease(colorSpace);
[view.layer renderInContext:cg_context];
}
@@ -644,9 +722,6 @@ CreateCGImageFromPixmap(
*
*----------------------------------------------------------------------
*/
-struct pixel_fmt {int r; int g; int b; int a;};
-static const struct pixel_fmt bgra = {2, 1, 0, 3};
-static const struct pixel_fmt abgr = {3, 2, 1, 0};
XImage *
XGetImage(
@@ -663,7 +738,6 @@ XGetImage(
NSUInteger bitmap_fmt = 0;
XImage* imagePtr = NULL;
char *bitmap = NULL;
- char R, G, B, A;
int depth = 32, offset = 0, bitmap_pad = 0;
unsigned int bytes_per_row, size, row, n, m;
@@ -686,12 +760,11 @@ XGetImage(
size = [bitmapRep bytesPerPlane];
bytes_per_row = [bitmapRep bytesPerRow];
bitmap = (char *)ckalloc(size);
- if (!bitmap
- || (bitmap_fmt != 0 && bitmap_fmt != 1)
- || [bitmapRep samplesPerPixel] != 4
- || [bitmapRep isPlanar] != 0
- || bytes_per_row < 4 * width
- || size != bytes_per_row * height) {
+ if ((bitmap_fmt != 0 && bitmap_fmt != NSBitmapFormatAlphaFirst)
+ || [bitmapRep samplesPerPixel] != 4
+ || [bitmapRep isPlanar] != 0
+ || bytes_per_row < 4 * width
+ || size != bytes_per_row * height) {
TkMacOSXDbgMsg("XGetImage: Unrecognized bitmap format");
[bitmapRep release];
return NULL;
@@ -699,35 +772,37 @@ XGetImage(
memcpy(bitmap, (char *)[bitmapRep bitmapData], size);
[bitmapRep release];
- /*
- * When Apple extracts a bitmap from an NSView, it may be in either
- * BGRA or ABGR format. For an XImage we need RGBA.
- */
-
- struct pixel_fmt pixel = bitmap_fmt == 0 ? bgra : abgr;
-
for (row = 0, n = 0; row < height; row++, n += bytes_per_row) {
for (m = n; m < n + 4*width; m += 4) {
- R = *(bitmap + m + pixel.r);
- G = *(bitmap + m + pixel.g);
- B = *(bitmap + m + pixel.b);
- A = *(bitmap + m + pixel.a);
-
- *(bitmap + m) = R;
- *(bitmap + m + 1) = G;
- *(bitmap + m + 2) = B;
- *(bitmap + m + 3) = A;
+ pixel32 pixel = *((pixel32 *)(bitmap + m));
+ if (bitmap_fmt == 0) { // default format
+
+ /*
+ * This pixel is in ARGB32 format. We need RGBA32.
+ */
+
+ pixel32 flipped;
+ flipped.rgba.red = pixel.argb.red;
+ flipped.rgba.green = pixel.argb.green;
+ flipped.rgba.blue = pixel.argb.blue;
+ flipped.rgba.alpha = pixel.argb.alpha;
+ *((pixel32 *)(bitmap + m)) = flipped;
+ } else { // bitmap_fmt = NSBitmapFormatAlphaFirst
+ *((pixel32 *)(bitmap + m)) = pixel;
+ }
}
}
imagePtr = XCreateImage(display, NULL, depth, format, offset,
(char*) bitmap, width, height,
bitmap_pad, bytes_per_row);
} else {
+
/*
* There are some calls to XGetImage in the generic Tk code which pass
* an XYPixmap rather than a ZPixmap. XYPixmaps should be handled
* here.
*/
+
TkMacOSXDbgMsg("XGetImage does not handle XYPixmaps at the moment.");
}
return imagePtr;
diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h
index b977610..cf8f615 100644
--- a/macosx/tkMacOSXPort.h
+++ b/macosx/tkMacOSXPort.h
@@ -141,6 +141,12 @@ MODULE_SCOPE int TkpPutRGBAImage(
unsigned int width, unsigned int height);
/*
+ * Inform tkCanvas.c that our XGetImage returns a 32pp pixmap packed as 0xAABBGGRR
+ */
+
+#define TK_XGETIMAGE_USES_ABGR32
+
+/*
* Used by xcolor.c
*/
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index eb4f95a..68d913e 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -321,7 +321,7 @@ static void RefocusGrabWindow(void *data) {
* If one of the windows is the grab window for its display we focus
* it. This is done as at idle, in case the app was reactivated by
* clicking a different window. In that case we need to wait until the
- * mouse event has been processed before focussing the grab window.
+ * mouse event has been processed before focusing the grab window.
*/
for (NSWindow *win in [NSApp windows]) {
@@ -334,6 +334,8 @@ static void RefocusGrabWindow(void *data) {
}
if (winPtr->dispPtr->grabWinPtr == winPtr) {
Tcl_DoWhenIdle(RefocusGrabWindow, winPtr);
+ } else {
+ [[self keyWindow] orderFront: self];
}
}
}
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 80515fd..c59950b 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1942,6 +1942,8 @@ WmDeiconifyCmd(
}
}
+ [[win contentView] setNeedsDisplay:YES];
+ Tcl_DoWhenIdle(TkMacOSXDrawAllViews, NULL);
return TCL_OK;
}
diff --git a/unix/configure b/unix/configure
index c05d9b4..34a1968 100755
--- a/unix/configure
+++ b/unix/configure
@@ -2584,7 +2584,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
TK_VERSION=8.7
TK_MAJOR_VERSION=8
TK_MINOR_VERSION=7
-TK_PATCH_LEVEL="a4"
+TK_PATCH_LEVEL="a6"
VERSION=${TK_VERSION}
LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
@@ -6026,12 +6026,12 @@ then :
AIX-*) ;;
BSD/OS*) ;;
CYGWIN_*|MINGW32_*|MSYS_*) ;;
- HP_UX*) ;;
+ HP-UX*) ;;
Darwin-*) ;;
IRIX*) ;;
Linux*|GNU*) ;;
- NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;;
- OSF1-V*) ;;
+ NetBSD-*|OpenBSD-*) ;;
+ OSF1-*) ;;
SCO_SV-3.2*) ;;
*) SHLIB_CFLAGS="-fPIC" ;;
esac
diff --git a/unix/configure.ac b/unix/configure.ac
index adbf461..58edbce 100644
--- a/unix/configure.ac
+++ b/unix/configure.ac
@@ -26,7 +26,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [
TK_VERSION=8.7
TK_MAJOR_VERSION=8
TK_MINOR_VERSION=7
-TK_PATCH_LEVEL="a4"
+TK_PATCH_LEVEL="a6"
VERSION=${TK_VERSION}
LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 7fc696e..9cfec6b 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1782,12 +1782,12 @@ dnl # preprocessing tests use only CPPFLAGS.
AIX-*) ;;
BSD/OS*) ;;
CYGWIN_*|MINGW32_*|MSYS_*) ;;
- HP_UX*) ;;
+ HP-UX*) ;;
Darwin-*) ;;
IRIX*) ;;
Linux*|GNU*) ;;
- NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;;
- OSF1-V*) ;;
+ NetBSD-*|OpenBSD-*) ;;
+ OSF1-*) ;;
SCO_SV-3.2*) ;;
*) SHLIB_CFLAGS="-fPIC" ;;
esac])
diff --git a/unix/tk.spec b/unix/tk.spec
index be98664..6a6924c 100644
--- a/unix/tk.spec
+++ b/unix/tk.spec
@@ -4,7 +4,7 @@
Name: tk
Summary: Tk graphical toolkit for the Tcl scripting language.
-Version: 8.7a4
+Version: 8.7a6
Release: 2
License: BSD
Group: Development/Languages
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index 231ec3d..bdb6950 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.c
@@ -981,6 +981,7 @@ EmbedWindowDeleted(
prevPtr = NULL;
containerPtr = tsdPtr->firstContainerPtr;
while (1) {
+ if (containerPtr == NULL) return;
if (containerPtr->embeddedPtr == winPtr) {
containerPtr->wrapper = None;
containerPtr->embeddedPtr = NULL;
diff --git a/win/Makefile.in b/win/Makefile.in
index f280c15..c95c5a4 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -126,6 +126,7 @@ TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)')
DLLSUFFIX = @DLLSUFFIX@
LIBSUFFIX = @LIBSUFFIX@
EXESUFFIX = @EXESUFFIX@
+TCLVER = @TCL_MAJOR_VERSION@@TCL_MINOR_VERSION@
VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@
DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@
@@ -203,8 +204,6 @@ RM = rm -f
COPY = cp
LN = ln
-BUILD_TCLSH = @BUILD_TCLSH@
-
# Tk does not used deprecated Tcl constructs so it should
# compile fine with -DTCL_NO_DEPRECATED. To remove its own
# set of deprecated code uncomment the second line.
@@ -709,7 +708,7 @@ ${TK_ZIP_FILE}: ${ZIP_INSTALL_OBJS}
)
@$(RMDIR) $(TK_VFS_PATH)/demos
-@if test "${ZIPFS_BUILD}" = "2" ; then \
- cp ${BUILD_TCLSH}${EXESUFFIX} ${TK_VFS_ROOT}/../${TK_ZIP_FILE} ; \
+ cp ${TCL_BIN_DIR}/tclsh${TCLVER}s.exe ${TK_VFS_ROOT}/../${TK_ZIP_FILE} || cp ${TCL_BIN_DIR}/../bin/tclsh${TCLVER}s.exe ${TK_VFS_ROOT}/../${TK_ZIP_FILE}; \
(zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \
(echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \
cd ${TK_VFS_ROOT} && $$zip -J ../${TK_ZIP_FILE}) \
diff --git a/win/configure b/win/configure
index d815777..4e212c5 100755
--- a/win/configure
+++ b/win/configure
@@ -698,6 +698,8 @@ TK_SRC_DIR
TK_BUILD_STUB_LIB_SPEC
TK_STUB_LIB_FLAG
TK_STUB_LIB_FILE
+TK_DLL_FILE_TCL9
+TK_DLL_FILE_TCL8
TK_DLL_FILE
TK_LIB_FILE
TK_PATCH_LEVEL
@@ -2394,7 +2396,7 @@ SHELL=/bin/sh
TK_VERSION=8.7
TK_MAJOR_VERSION=8
TK_MINOR_VERSION=7
-TK_PATCH_LEVEL="a4"
+TK_PATCH_LEVEL="a6"
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
#------------------------------------------------------------------------
@@ -5577,7 +5579,7 @@ printf "%s\n" "$result" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tclsh in Tcl build directory" >&5
printf %s "checking for tclsh in Tcl build directory... " >&6; }
- BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}
+ BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}\${EXESUFFIX}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BUILD_TCLSH" >&5
printf "%s\n" "$BUILD_TCLSH" >&6; }
@@ -5907,6 +5909,8 @@ TK_WIN_VERSION="$TK_VERSION.$TK_RELEASE_LEVEL.`echo $TK_PATCH_LEVEL | tr -d ab.`
+
+
# win/tcl.m4 doesn't set (LDFLAGS)
diff --git a/win/configure.ac b/win/configure.ac
index d7f89e6..0c5fe71 100644
--- a/win/configure.ac
+++ b/win/configure.ac
@@ -15,7 +15,7 @@ SHELL=/bin/sh
TK_VERSION=8.7
TK_MAJOR_VERSION=8
TK_MINOR_VERSION=7
-TK_PATCH_LEVEL="a4"
+TK_PATCH_LEVEL="a6"
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
#------------------------------------------------------------------------
@@ -318,6 +318,8 @@ AC_SUBST(TK_MINOR_VERSION)
AC_SUBST(TK_PATCH_LEVEL)
AC_SUBST(TK_LIB_FILE)
AC_SUBST(TK_DLL_FILE)
+AC_SUBST(TK_DLL_FILE_TCL8)
+AC_SUBST(TK_DLL_FILE_TCL9)
AC_SUBST(TK_STUB_LIB_FILE)
AC_SUBST(TK_STUB_LIB_FLAG)
AC_SUBST(TK_BUILD_STUB_LIB_SPEC)
diff --git a/win/rules.vc b/win/rules.vc
index 19f0dd8..c24fce3 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -1123,7 +1123,7 @@ STUBPREFIX = $(PROJECT)stub
# TIP 430. Unused for 8.6 but no harm defining it to allow a common rules.vc
TCLSCRIPTZIPNAME = libtcl$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)$(TCL_PATCH_LETTER)$(TCL_RELEASE_SERIAL).zip
-TKSCRIPTZIPNAME = libtk$(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)$(TK_PATCH_LETTER)$(TK_RELEASE_SERIAL).zip
+TKSCRIPTZIPNAME = libtk$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)$(TK_PATCH_LETTER)$(TK_RELEASE_SERIAL).zip
!if $(DOING_TCL)
TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe
diff --git a/win/tcl.m4 b/win/tcl.m4
index 3b3fc78..ee2256d 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -1067,7 +1067,7 @@ AC_DEFUN([SC_PROG_TCLSH], [
AC_DEFUN([SC_BUILD_TCLSH], [
AC_MSG_CHECKING([for tclsh in Tcl build directory])
- BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}
+ BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}\${EXESUFFIX}
AC_MSG_RESULT($BUILD_TCLSH)
AC_SUBST(BUILD_TCLSH)
])
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index d653713..126b6d1 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -1094,8 +1094,8 @@ EmbedWindowDeleted(
prevPtr = NULL;
containerPtr = tsdPtr->firstContainerPtr;
- if (containerPtr == NULL) return;
while (1) {
+ if (containerPtr == NULL) return;
if (containerPtr->embeddedPtr == winPtr) {
containerPtr->embeddedHWnd = NULL;
containerPtr->embeddedPtr = NULL;