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:
@@ -21,6 +21,8 @@
|
||||
|
||||
#import <AppKit/NSPanel.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
|
||||
// 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");
|
||||
}
|
||||
|
Reference in New Issue
Block a user