From 48d36d84da43edda59be1a5d12734a121b31c0de Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 28 Mar 2008 17:57:02 +0000 Subject: merge updates from HEAD --- ChangeLog | 9 ++++++ changes | 6 +++- library/safetk.tcl | 81 +++++++++++++++++++++--------------------------------- 3 files changed, 46 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index a15ced6..a779bd6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-03-28 Don Porter + + * changes: Updates for 8.5.2 release. + +2008-03-27 Jeff Hobbs + + * library/safetk.tcl (::safe::tkInterpInit): make sure tk_library + and its subdirs (eg, ttk) are on the "safe" access path. + 2008-03-27 Daniel Steffen * unix/tcl.m4 (SunOS-5.1x): fix 64bit support for Sun cc. [Bug 1921166] diff --git a/changes b/changes index 4eb35aa..31bf414 100644 --- a/changes +++ b/changes @@ -2,7 +2,7 @@ This file summarizes all changes made to Tk since version 1.0 was released on March 13, 1991. Changes that aren't backward compatible are marked specially. -RCS: @(#) $Id: changes,v 1.107.2.12 2008/03/26 20:09:30 dgp Exp $ +RCS: @(#) $Id: changes,v 1.107.2.13 2008/03/28 17:57:03 dgp Exp $ 3/16/91 (bug fix) Modified tkWindow.c to remove Tk's Tcl commands from the interpreter when the main window is deleted (otherwise there will @@ -6496,4 +6496,8 @@ Several documentation and release notes improvements 2008-03-26 (bug fix)[1922466] crash in [. configure -cursor] (gavilán) +2008-03-27 (platform support)[1921166] Solaris 64bit build fixes (steffen) + +2008-03-27 (bug fix) restored [::safe::loadTk] (hobbs) + --- Released 8.5.2, March 28, 2008 --- See ChangeLog for details --- diff --git a/library/safetk.tcl b/library/safetk.tcl index 4ad1418..14ae316 100644 --- a/library/safetk.tcl +++ b/library/safetk.tcl @@ -2,7 +2,7 @@ # # Support procs to use Tk in safe interpreters. # -# RCS: @(#) $Id: safetk.tcl,v 1.10 2006/11/03 15:58:51 patthoyts Exp $ +# RCS: @(#) $Id: safetk.tcl,v 1.10.2.1 2008/03/28 17:57:04 dgp Exp $ # # Copyright (c) 1997 Sun Microsystems, Inc. # @@ -27,57 +27,51 @@ package require opt 0.4.1; namespace eval ::safe { # counter for safe toplevels - variable tkSafeId 0; - - # - # tkInterpInit : prepare the slave interpreter for tk loading - # most of the real job is done by loadTk - # returns the slave name (tkInterpInit does) - # - proc ::safe::tkInterpInit {slave argv} { - global env tk_library - - # We have to make sure that the tk_library variable uses a file - # pathname that works better in Tk (of the style returned by - # [file join], ie C:/path/to/tk/lib, not C:\path\to\tk\lib - set tk_library [file join $tk_library] - - # Clear Tk's access for that interp (path). - allowTk $slave $argv - - # there seems to be an obscure case where the tk_library - # variable value is changed to point to a sym link destination - # dir instead of the sym link itself, and thus where the $tk_library - # would then not be anymore one of the auto_path dir, so we use - # the addToAccessPath which adds if it's not already in instead - # of the more conventional findInAccessPath. - # Might be usefull for masters without Tk really loaded too. - ::interp eval $slave [list set tk_library [::safe::interpAddToAccessPath $slave $tk_library]] - return $slave + variable tkSafeId 0 +} + +# +# tkInterpInit : prepare the slave interpreter for tk loading +# most of the real job is done by loadTk +# returns the slave name (tkInterpInit does) +# +proc ::safe::tkInterpInit {slave argv} { + global env tk_library + + # We have to make sure that the tk_library variable is normalized. + set tk_library [file normalize $tk_library] + + # Clear Tk's access for that interp (path). + allowTk $slave $argv + + # Ensure tk_library and subdirs (eg, ttk) are on the access path + ::interp eval $slave [list set tk_library [::safe::interpAddToAccessPath $slave $tk_library]] + foreach subdir [::safe::AddSubDirs [list $tk_library]] { + ::safe::interpAddToAccessPath $slave $subdir } + return $slave +} -# tkInterpLoadTk : -# Do additional configuration as needed (calling tkInterpInit) +# tkInterpLoadTk: +# Do additional configuration as needed (calling tkInterpInit) # and actually load Tk into the slave. -# +# # Either contained in the specified windowId (-use) or # creating a decorated toplevel for it. # empty definition for auto_mkIndex proc ::safe::loadTk {} {} - -::tcl::OptProc loadTk { + +::tcl::OptProc ::safe::loadTk { {slave -interp "name of the slave interpreter"} {-use -windowId {} "window Id to use (new toplevel otherwise)"} {-display -displayName {} "display name to use (current one otherwise)"} } { set displayGiven [::tcl::OptProcArgGiven "-display"] if {!$displayGiven} { - # Try to get the current display from "." # (which might not exist if the master is tk-less) - if {[catch {set display [winfo screen .]}]} { if {[info exists ::env(DISPLAY)]} { set display $::env(DISPLAY) @@ -88,9 +82,7 @@ proc ::safe::loadTk {} {} } } if {![::tcl::OptProcArgGiven "-use"]} { - # create a decorated toplevel - ::tcl::Lassign [tkTopLevel $slave $display] w use # set our delete hook (slave arg is added by interpDelete) @@ -101,28 +93,22 @@ proc ::safe::loadTk {} {} # set our delete hook (slave arg is added by interpDelete) # to clean up tkInit(slave) - Set [DeleteHookName $slave] [list disallowTk] # Let's be nice and also accept tk window names instead of ids - if {[string match ".*" $use]} { set windowName $use set use [winfo id $windowName] set nDisplay [winfo screen $windowName] } else { - # Check for a better -display value # (works only for multi screens on single host, but not # cross hosts, for that a tk window name would be better # but embeding is also usefull for non tk names) - if {![catch {winfo pathname $use} name]} { set nDisplay [winfo screen $name] } else { - # Can't have a better one - set nDisplay $display } } @@ -137,9 +123,8 @@ proc ::safe::loadTk {} {} } # Prepares the slave for tk with those parameters - tkInterpInit $slave [list "-use" $use "-display" $display] - + load {} Tk $slave return $slave @@ -223,7 +208,7 @@ proc ::safe::tkDelete {W window slave} { Log $slave "Destroy toplevel $window" NOTICE destroy $window } - + # clean up tkInit(slave) disallowTk $slave return @@ -271,9 +256,7 @@ proc ::safe::tkTopLevel {slave display} { # Container frame frame $w.c -container 1 pack $w.c -fill both -expand 1 - + # return both the toplevel window name and the id to use for embedding list $w [winfo id $w.c] } - -} \ No newline at end of file -- cgit v0.12