[113110] trunk/dports/graphics/wxWidgets-3.0/files/ patch-upstream-nonbundled.diff
mojca at macports.org
mojca at macports.org
Sat Nov 9 00:52:26 PST 2013
Revision: 113110
https://trac.macports.org/changeset/113110
Author: mojca at macports.org
Date: 2013-11-09 00:52:26 -0800 (Sat, 09 Nov 2013)
Log Message:
-----------
wxWidgets-3.0: upstream patch for starting non-bundled apps like gnuplot
Added Paths:
-----------
trunk/dports/graphics/wxWidgets-3.0/files/patch-upstream-nonbundled.diff
Added: trunk/dports/graphics/wxWidgets-3.0/files/patch-upstream-nonbundled.diff
===================================================================
--- trunk/dports/graphics/wxWidgets-3.0/files/patch-upstream-nonbundled.diff (rev 0)
+++ trunk/dports/graphics/wxWidgets-3.0/files/patch-upstream-nonbundled.diff 2013-11-09 08:52:26 UTC (rev 113110)
@@ -0,0 +1,114 @@
+http://trac.wxwidgets.org/changeset/75142
+
+--- include/wx/osx/app.h.orig
++++ include/wx/osx/app.h
+@@ -143,6 +143,10 @@ public:
+ virtual void MacNewFile() ;
+ // in response of a reopen-application apple event
+ virtual void MacReopenApp() ;
++
++ // override this to return false from a non-bundled console app in order to stay in background ...
++ virtual bool OSXIsGUIApplication() { return true; }
++
+ #if wxOSX_USE_COCOA_OR_IPHONE
+ // immediately before the native event loop launches
+ virtual void OSXOnWillFinishLaunching();
+--- src/osx/cocoa/utils.mm.orig
++++ src/osx/cocoa/utils.mm
+@@ -255,6 +255,50 @@ void wxBell()
+ }
+ @end
+
++
++// more on bringing non-bundled apps to the foreground
++// https://devforums.apple.com/thread/203753
++
++#if 0
++
++// one possible solution is also quoted here
++// from http://stackoverflow.com/questions/7596643/when-calling-transformprocesstype-the-app-menu-doesnt-show-up
++
++ at interface wxNSNonBundledAppHelper : NSObject {
++
++}
++
+++ (void)transformToForegroundApplication;
++
++ at end
++
++ at implementation wxNSNonBundledAppHelper
++
+++ (void)transformToForegroundApplication {
++ for (NSRunningApplication * app in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.finder"]) {
++ [app activateWithOptions:NSApplicationActivateIgnoringOtherApps];
++ break;
++ }
++ [self performSelector:@selector(transformStep2) withObject:nil afterDelay:0.1];
++}
++
+++ (void)transformStep2
++{
++ ProcessSerialNumber psn = { 0, kCurrentProcess };
++ (void) TransformProcessType(&psn, kProcessTransformToForegroundApplication);
++
++ [self performSelector:@selector(transformStep3) withObject:nil afterDelay:0.1];
++}
++
+++ (void)transformStep3
++{
++ [[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateIgnoringOtherApps];
++}
++
++ at end
++
++#endif
++
+ // here we subclass NSApplication, for the purpose of being able to override sendEvent.
+ @interface wxNSApplication : NSApplication
+ {
+@@ -276,6 +320,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
+@@ -311,6 +373,20 @@ bool wxApp::DoInitGui()
+ if (!sm_isEmbedded)
+ {
+ [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];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20131109/0878b11b/attachment.html>
More information about the macports-changes
mailing list