porting fix for non-bundled apps to 3.0.1
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75201 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -276,6 +276,24 @@ void wxBell()
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) transformToForegroundApplication {
|
||||
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||
|
||||
if ( UMAGetSystemVersion() < 0x1090 )
|
||||
{
|
||||
[self deactivate];
|
||||
[self activateIgnoringOtherApps:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[NSRunningApplication currentApplication] activateWithOptions:
|
||||
(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* This is needed because otherwise we don't receive any key-up events for command-key
|
||||
combinations (an AppKit bug, apparently) */
|
||||
- (void)sendEvent:(NSEvent *)anEvent
|
||||
@@ -312,6 +330,20 @@ bool wxApp::DoInitGui()
|
||||
{
|
||||
[wxNSApplication sharedApplication];
|
||||
|
||||
if ( OSXIsGUIApplication() )
|
||||
{
|
||||
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle() ) ;
|
||||
CFStringRef path = CFURLCopyFileSystemPath ( url , kCFURLPOSIXPathStyle ) ;
|
||||
CFRelease( url ) ;
|
||||
wxString app = wxCFStringRef(path).AsString(wxLocale::GetSystemEncoding());
|
||||
|
||||
// workaround is only needed for non-bundled apps
|
||||
if ( !app.EndsWith(".app") )
|
||||
{
|
||||
[(wxNSApplication*) [wxNSApplication sharedApplication] transformToForegroundApplication];
|
||||
}
|
||||
}
|
||||
|
||||
appcontroller = OSXCreateAppController();
|
||||
[NSApp setDelegate:appcontroller];
|
||||
[NSColor setIgnoresAlpha:NO];
|
||||
|
Reference in New Issue
Block a user