Interesting WebView/NSRunLoop issue
Interesting WebView/NSRunLoop issue
- Subject: Interesting WebView/NSRunLoop issue
- From: "David Springer" <email@hidden>
- Date: Thu, 24 Apr 2008 11:35:36 -0600
Folks,
I need help figuring out this problem. Basically, I want to run a
WebView in a modal dialog, but WebView's don't work in
NSModalPanelRunLoopMode. So, I have been trying unsuccessfully to
fake a modal run loop while running it in NSDefaultRunLoopMode. This
is my latest attempt:
// Leave all appkit defined and system events on the queue. This will make
// sure the app activates correctly when running this loop from within
// -applicationDidFinishLaunching.
unsigned int eventMask = NSAnyEventMask &
~(NSAppKitDefinedMask|NSSystemDefinedMask|
NSApplicationDefinedMask|NSPeriodicMask);
while (inModalLoop_) {
NSEvent *event = [NSApp nextEventMatchingMask:eventMask
untilDate:[NSDate distantFuture]
inMode:NSDefaultRunLoopMode
dequeue:YES];
if (event != nil && [event window] == window_) {
[NSApp sendEvent:event];
}
}
|inModalLoop_| is set to FALSE when the "modal" panel is dismissed.
Several problems arise with this method:
1. I want my app to effectively stall - that is, don't process any
events - while this modal window is up.
2. The modal window is ordered onscreen during
-applicationDidFinishLaunching:, so even though I want event
processing to appear modal to the window, I still need to let certain
events through so that the app will continue to activate correctly,
etc. once the panel is dismissed.
3. On Tiger, my method produces all kids of odd behavior, such as
button clicks in the window not causing notifications to get sent
(windowDidClose: in particular).
Basically, it appears that my method screws up the event system pretty badly.
Clearly my approach is bogus. Should I be using a runloop for this?
If so, what mode do I run it in?
Help?
Thanks!
- Dave.S
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden