diff options
| author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-12 03:59:23 +0000 |
|---|---|---|
| committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-12 03:59:23 +0000 |
| commit | bf1200045054a3efa84e2029180697adb412795b (patch) | |
| tree | 372f2501305c99359daa93e3a2586176519c2d4a | |
| parent | 3c4bc1dd1f9acd5e0dead47158e7837fcb948635 (diff) | |
* ext/tk/lib/tk/wm.rb: Wm#overrideredirect overwrites arguemnt to
an invalid value.
* ext/tk/sample/ttk_wrapper.rb: support "if __FILE__ == $0" idiom.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ext/tk/lib/tk.rb | 2 | ||||
| -rw-r--r-- | ext/tk/lib/tk/wm.rb | 2 | ||||
| -rw-r--r-- | ext/tk/sample/ttk_wrapper.rb | 24 |
3 files changed, 25 insertions, 3 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 0467e6a642..f1b74503b2 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -5359,7 +5359,7 @@ TkWidget = TkWindow #Tk.freeze module Tk - RELEASE_DATE = '2008-05-11'.freeze + RELEASE_DATE = '2008-05-12'.freeze autoload :AUTO_PATH, 'tk/variable' autoload :TCL_PACKAGE_PATH, 'tk/variable' diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb index 96aa96d2f8..0394296189 100644 --- a/ext/tk/lib/tk/wm.rb +++ b/ext/tk/lib/tk/wm.rb @@ -362,7 +362,7 @@ module Tk end end def overrideredirect(mode=TkComm::None) - Wm.overrideredirect(self, mode=TkComm::None) + Wm.overrideredirect(self, mode) end alias wm_overrideredirect overrideredirect TOPLEVEL_METHODCALL_OPTKEYS['overrideredirect'] = 'overrideredirect' diff --git a/ext/tk/sample/ttk_wrapper.rb b/ext/tk/sample/ttk_wrapper.rb index 58af79aea3..1580668994 100644 --- a/ext/tk/sample/ttk_wrapper.rb +++ b/ext/tk/sample/ttk_wrapper.rb @@ -4,7 +4,7 @@ # # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # -version = '0.1.2' +version = '0.1.3' # ########################################################################## # parse commandline arguments @@ -120,10 +120,32 @@ Tk::Tile.set_theme(OPTS[:theme]) if OPTS[:theme] ########################################################################## +# replace $0 and $RPAGRAM_NAME +########################################################################## +# When the expand_path of the target script is long, ruby sometimes +# fails to set the path to $0 (the path string is trimmed). +# The following replaces $0 and $PROGNAME to avoid such trouble. +progname_obj = $0.dup +$program_name = progname_obj + +alias $REAL_PROGRAM_NAME $0 +alias $PROGRAM_NAME $program_name +alias $0 $program_name + +trace_var(:$program_name){|val| + unless progname_obj.object_id == val.object_id + progname_obj.replace(val.to_s) + $program_name = progname_obj + end +} + + +########################################################################## # load script ########################################################################## if (path = ARGV.shift) && (script = File.expand_path(path)) print "load script \"#{script}\"\n" if OPTS[:verbose] + $0 = script load(script) else print "Error: no script is given.\n" |
