|
From: Shirai,Kaoru <sh...@ko...> - 2003-02-05 09:41:14
|
Hi.
I wrote a patch for ruby_thread_switcher_start that provides Ruby thread
scheduling even in modal session(NSModalPanelRunLoopMode) or event
tracking(NSEventTrackingRunLoopMode).
There are several cases where we do somthing within modal session
started from NSApplication.runModalForWindow, so I wrote that. Please
accept if it causes no problem.
--
Simple script that works by this patch:
require "osx/cocoa"
nsapp = OSX::NSApplication.sharedApplication
window = OSX::NSWindow.alloc
window.initWithContentRect(OSX::NSRect.new(50, 50, 160, 160),
:styleMask, OSX::NSTitledWindowMask,
:backing, OSX::NSBackingStoreBuffered,
:defer, false)
window.makeKeyAndOrderFront(nil)
window.orderFrontRegardless
thread = Thread.start {
p "After 5 seconds, makes modal session to abort."
sleep 5
p "Making modal to abort."
nsapp.abortModal
}
p "Starting modal."
nsapp.runModalForWindow(window)
p "Exiting modal."
exit
--
P.S.
We -- Korinkan,Ltd would like to support RubyCocoa project. If you are
thinking about migrating Japanese ML from FreeML, we will please to
provide one on korinkan.co.jp.
(Some developer may not want to give his address to FreeML.)
--
sh...@ko...
Shirai,Kaoru
Korinkan Ltd.
|