From 478859681251ff152fcf528ddde13b8d0cdccc13 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Fri, 5 Sep 2003 02:48:49 +0000 Subject: [PATCH] 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 --- src/cocoa/dialog.mm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/cocoa/dialog.mm b/src/cocoa/dialog.mm index a73f22e244..0b4e1a8406 100644 --- a/src/cocoa/dialog.mm +++ b/src/cocoa/dialog.mm @@ -21,6 +21,8 @@ #import #import +#import +#import // Lists to keep track of windows, so we can disable/enable them // for modal dialogs @@ -120,6 +122,21 @@ bool wxDialog::Show(bool show) wxAutoNSAutoreleasePool pool; wxModalDialogs.Append(this); 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]; wxLogDebug("runModal END"); } -- 2.45.2