* ext/tk/lib/tk.rb: temporary patch for trouble on TkAqua (> Tk8.4.9).
* ext/tk/sample/demos-jp/widget: set encoding to a demo-code string to avoid garbled text on the Code Window. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
39c4d6928b
commit
6c650f35f9
@ -1,3 +1,10 @@
|
|||||||
|
Mon Dec 22 02:54:56 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
* ext/tk/lib/tk.rb: temporary patch for trouble on TkAqua (> Tk8.4.9).
|
||||||
|
|
||||||
|
* ext/tk/sample/demos-jp/widget: set encoding to a demo-code string to
|
||||||
|
avoid garbled text on the Code Window.
|
||||||
|
|
||||||
Sun Dec 21 14:55:18 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Dec 21 14:55:18 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/optparse.rb (SPLAT_PROC): splat values by hand.
|
* lib/optparse.rb (SPLAT_PROC): splat values by hand.
|
||||||
|
@ -1112,19 +1112,6 @@ module TkCore
|
|||||||
WITH_RUBY_VM = Object.const_defined?(:RubyVM) && ::RubyVM.class == Class
|
WITH_RUBY_VM = Object.const_defined?(:RubyVM) && ::RubyVM.class == Class
|
||||||
WITH_ENCODING = defined?(::Encoding.default_external) && true
|
WITH_ENCODING = defined?(::Encoding.default_external) && true
|
||||||
#WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class
|
#WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class
|
||||||
#if TclTkLib::WINDOWING_SYSTEM == 'aqua'
|
|
||||||
# if (TclTkLib.get_version <=> [8, 4, TclTkLib::RELEASE_TYPE::FINAL, 9]) > 0
|
|
||||||
# # *** KNOWN BUG ***
|
|
||||||
# # Main event loop thread of TkAqua (> Tk8.4.9) must be the main
|
|
||||||
# # application thread. So, ruby1.9 users must call Tk.mainloop on
|
|
||||||
# # the main application thread.
|
|
||||||
# RUN_EVENTLOOP_ON_MAIN_THREAD = true
|
|
||||||
# end
|
|
||||||
#end
|
|
||||||
unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
|
|
||||||
### Ruby 1.9 !!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
RUN_EVENTLOOP_ON_MAIN_THREAD = false
|
|
||||||
end
|
|
||||||
|
|
||||||
unless self.const_defined? :INTERP
|
unless self.const_defined? :INTERP
|
||||||
if self.const_defined? :IP_NAME
|
if self.const_defined? :IP_NAME
|
||||||
@ -1143,8 +1130,36 @@ module TkCore
|
|||||||
opts = ''
|
opts = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if WITH_RUBY_VM ### check Ruby 1.9 !!!!!!!
|
||||||
|
# *** NEED TO FIX ***
|
||||||
|
ip = TclTkIp.new(name, opts)
|
||||||
|
if ip._invoke_without_enc('tk', 'windowingsystem') == 'aqua' &&
|
||||||
|
(TclTkLib.get_version <=> [8,4,TclTkLib::RELEASE_TYPE::FINAL,9]) > 0
|
||||||
|
# *** KNOWN BUG ***
|
||||||
|
# Main event loop thread of TkAqua (> Tk8.4.9) must be the main
|
||||||
|
# application thread. So, ruby1.9 users must call Tk.mainloop on
|
||||||
|
# the main application thread.
|
||||||
|
RUN_EVENTLOOP_ON_MAIN_THREAD = true
|
||||||
|
INTERP = ip
|
||||||
|
else
|
||||||
|
unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
|
||||||
|
RUN_EVENTLOOP_ON_MAIN_THREAD = false
|
||||||
|
end
|
||||||
|
if RUN_EVENTLOOP_ON_MAIN_THREAD
|
||||||
|
INTERP = ip
|
||||||
|
else
|
||||||
|
ip.delete
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ip = nil
|
||||||
|
else
|
||||||
|
unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
|
||||||
|
RUN_EVENTLOOP_ON_MAIN_THREAD = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if !WITH_RUBY_VM || RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
|
if !WITH_RUBY_VM || RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
|
||||||
INTERP = TclTkIp.new(name, opts)
|
INTERP = TclTkIp.new(name, opts) unless self.const_defined? :INTERP
|
||||||
else
|
else
|
||||||
INTERP_MUTEX = Mutex.new
|
INTERP_MUTEX = Mutex.new
|
||||||
INTERP_ROOT_CHECK = ConditionVariable.new
|
INTERP_ROOT_CHECK = ConditionVariable.new
|
||||||
@ -1316,6 +1331,11 @@ module TkCore
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
|
||||||
|
### Ruby 1.9 !!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
RUN_EVENTLOOP_ON_MAIN_THREAD = false
|
||||||
|
end
|
||||||
|
|
||||||
WIDGET_DESTROY_HOOK = '<WIDGET_DESTROY_HOOK>'
|
WIDGET_DESTROY_HOOK = '<WIDGET_DESTROY_HOOK>'
|
||||||
INTERP._invoke_without_enc('event', 'add',
|
INTERP._invoke_without_enc('event', 'add',
|
||||||
"<#{WIDGET_DESTROY_HOOK}>", '<Destroy>')
|
"<#{WIDGET_DESTROY_HOOK}>", '<Destroy>')
|
||||||
@ -1683,12 +1703,13 @@ module TkCore
|
|||||||
TclTkLib.mainloop(check_root)
|
TclTkLib.mainloop(check_root)
|
||||||
|
|
||||||
elsif TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD
|
elsif TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD
|
||||||
#if TclTkLib::WINDOWING_SYSTEM == 'aqua' &&
|
# if TclTkLib::WINDOWING_SYSTEM == 'aqua' &&
|
||||||
# Thread.current != Thread.main &&
|
if TkCore::INTERP._invoke_without_enc('tk','windowingsystem')=='aqua' &&
|
||||||
# (TclTkLib.get_version <=> [8,4,TclTkLib::RELEASE_TYPE::FINAL,9]) > 0
|
Thread.current != Thread.main &&
|
||||||
# raise RuntimeError,
|
(TclTkLib.get_version <=> [8,4,TclTkLib::RELEASE_TYPE::FINAL,9]) > 0
|
||||||
# "eventloop on TkAqua ( > Tk8.4.9 ) works on the main thread only"
|
raise RuntimeError,
|
||||||
#end
|
"eventloop on TkAqua ( > Tk8.4.9 ) works on the main thread only"
|
||||||
|
end
|
||||||
TclTkLib.mainloop(check_root)
|
TclTkLib.mainloop(check_root)
|
||||||
|
|
||||||
else ### Ruby 1.9 !!!!!
|
else ### Ruby 1.9 !!!!!
|
||||||
@ -5529,7 +5550,7 @@ TkWidget = TkWindow
|
|||||||
#Tk.freeze
|
#Tk.freeze
|
||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
RELEASE_DATE = '2008-12-04'.freeze
|
RELEASE_DATE = '2008-12-21'.freeze
|
||||||
|
|
||||||
autoload :AUTO_PATH, 'tk/variable'
|
autoload :AUTO_PATH, 'tk/variable'
|
||||||
autoload :TCL_PACKAGE_PATH, 'tk/variable'
|
autoload :TCL_PACKAGE_PATH, 'tk/variable'
|
||||||
|
@ -882,18 +882,12 @@ def showCode1(demo)
|
|||||||
|
|
||||||
$code_window.title("Demo code: #{file}")
|
$code_window.title("Demo code: #{file}")
|
||||||
$code_window.iconname(file)
|
$code_window.iconname(file)
|
||||||
# fid = open(file, 'r')
|
code = open([$demo_dir, file].join(File::Separator), 'r'){|fid| fid.read }
|
||||||
fid = open([$demo_dir, file].join(File::Separator), 'r')
|
|
||||||
$code_text.delete('1.0', 'end')
|
$code_text.delete('1.0', 'end')
|
||||||
#$code_text.insert('1.0', `cat #{file}`)
|
code.force_encoding('EUC-JP') if defined?(::Encoding.default_external)
|
||||||
$code_text.insert('1.0', fid.read)
|
$code_text.insert('1.0', code)
|
||||||
#$code_mark = TkTextMark.new($code_text, '1.0')
|
|
||||||
#$code_text.set_insert('1.0')
|
|
||||||
TkTextMarkInsert.new($code_text,'1.0')
|
TkTextMarkInsert.new($code_text,'1.0')
|
||||||
|
|
||||||
$set_linenum.call($code_text)
|
$set_linenum.call($code_text)
|
||||||
|
|
||||||
fid.close
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def showCode2(demo)
|
def showCode2(demo)
|
||||||
@ -974,14 +968,12 @@ def showCode2(demo)
|
|||||||
|
|
||||||
$code_window.title("Demo code: #{file}")
|
$code_window.title("Demo code: #{file}")
|
||||||
$code_window.iconname(file)
|
$code_window.iconname(file)
|
||||||
fid = open([$demo_dir, file].join(File::Separator), 'r')
|
code = open([$demo_dir, file].join(File::Separator), 'r'){|fid| fid.read }
|
||||||
$code_text.delete('1.0', 'end')
|
$code_text.delete('1.0', 'end')
|
||||||
$code_text.insert('1.0', fid.read)
|
code.force_encoding('EUC-JP') if defined?(::Encoding.default_external)
|
||||||
|
$code_text.insert('1.0', code)
|
||||||
TkTextMarkInsert.new($code_text,'1.0')
|
TkTextMarkInsert.new($code_text,'1.0')
|
||||||
|
|
||||||
$set_linenum.call($code_text)
|
$set_linenum.call($code_text)
|
||||||
|
|
||||||
fid.close
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if $tk_major_ver < 8
|
if $tk_major_ver < 8
|
||||||
|
Loading…
x
Reference in New Issue
Block a user