When a modal dialog is shown and the app isn't running, run the event

loop manually until it is out of events.  This will allow the application
to let the Dock know it has completed startup.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2003-09-05 02:48:49 +00:00
parent 83901ec20c
commit 4788596812

View File

@@ -21,6 +21,8 @@
#import <AppKit/NSPanel.h> #import <AppKit/NSPanel.h>
#import <AppKit/NSApplication.h> #import <AppKit/NSApplication.h>
#import <AppKit/NSEvent.h>
#import <Foundation/NSRunLoop.h>
// Lists to keep track of windows, so we can disable/enable them // Lists to keep track of windows, so we can disable/enable them
// for modal dialogs // for modal dialogs
@@ -120,6 +122,21 @@ bool wxDialog::Show(bool show)
wxAutoNSAutoreleasePool pool; wxAutoNSAutoreleasePool pool;
wxModalDialogs.Append(this); wxModalDialogs.Append(this);
wxLogDebug("runModal"); wxLogDebug("runModal");
NSApplication *theNSApp = wxTheApp->GetNSApplication();
// If the app hasn't started, flush the event queue
// If we don't do this, the Dock doesn't get the message that
// the app has started so will refuse to activate it.
if(![theNSApp isRunning])
{
while(NSEvent *event = [theNSApp
nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantPast]
inMode:NSDefaultRunLoopMode
dequeue: YES])
{
[theNSApp sendEvent: event];
}
}
[wxTheApp->GetNSApplication() runModalForWindow:m_cocoaNSWindow]; [wxTheApp->GetNSApplication() runModalForWindow:m_cocoaNSWindow];
wxLogDebug("runModal END"); wxLogDebug("runModal END");
} }