From 58b98b039c87548dfd9156776d28e62249116719 Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Mon, 4 Nov 2013 17:31:10 +0100 Subject: iossim: bring simulator to front Change-Id: Ia52237760d36f342d6b053525ca6617a1e722aab Reviewed-by: Richard Moe Gustavsen --- src/tools/3rdparty/iossim/iossim.pro | 2 +- src/tools/3rdparty/iossim/iossim.qbs | 3 ++- src/tools/3rdparty/iossim/iphonesimulator.mm | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/tools') diff --git a/src/tools/3rdparty/iossim/iossim.pro b/src/tools/3rdparty/iossim/iossim.pro index cd153ea73c..c880da3f4e 100644 --- a/src/tools/3rdparty/iossim/iossim.pro +++ b/src/tools/3rdparty/iossim/iossim.pro @@ -19,7 +19,7 @@ LIBS += \ -framework ApplicationServices \ -framework CoreFoundation \ -F/System/Library/PrivateFrameworks \ - -framework IOKit + -framework IOKit -framework AppKit iPhoneSimulatorRemoteClientDirectLinking { LIBS += \ diff --git a/src/tools/3rdparty/iossim/iossim.qbs b/src/tools/3rdparty/iossim/iossim.qbs index d79667bb2a..ba3133b493 100644 --- a/src/tools/3rdparty/iossim/iossim.qbs +++ b/src/tools/3rdparty/iossim/iossim.qbs @@ -22,7 +22,8 @@ QtcTool { ] cpp.linkerFlags: base.concat(["-sectcreate", "__TEXT", "__info_plist", path + "/Info.plist", "-fobjc-link-runtime"]) - cpp.frameworks: base.concat(["Foundation", "CoreServices", "ApplicationServices", "IOKit"]) + cpp.frameworks: base.concat(["Foundation", "CoreServices", "ApplicationServices", "IOKit", + "AppKit"]) cpp.frameworkPaths: base.concat("/System/Library/PrivateFrameworks") toolInstallDir: project.ide_libexec_path + "/ios" diff --git a/src/tools/3rdparty/iossim/iphonesimulator.mm b/src/tools/3rdparty/iossim/iphonesimulator.mm index d7a7108fdb..c7499f777c 100644 --- a/src/tools/3rdparty/iossim/iphonesimulator.mm +++ b/src/tools/3rdparty/iossim/iphonesimulator.mm @@ -11,6 +11,7 @@ #import #import #import +#import NSString *simulatorPrefrencesName = @"com.apple.iphonesimulator"; NSString *deviceProperty = @"SimulateDevice"; @@ -123,11 +124,15 @@ NSString *deviceIpadRetina = @"iPad (Retina)"; - (void)session:(DTiPhoneSimulatorSession *)mySession didStart:(BOOL)started withError:(NSError *)error { if (startOnly && mySession) { + [NSTask launchedTaskWithLaunchPath:@"/usr/bin/osascript" + arguments:[NSArray arrayWithObjects:@"-e", @"tell application \"iPhone Simulator\" to activate", nil]]; nsprintf(@"Simulator started (no session)"); [self doExit:EXIT_SUCCESS]; return; } if (started) { + [NSTask launchedTaskWithLaunchPath:@"/usr/bin/osascript" + arguments:[NSArray arrayWithObjects:@"-e", @"tell application \"iPhone Simulator\" to activate", nil]]; if (shouldStartDebugger) { char*args[4] = { NULL, NULL, (char*)[[[mySession simulatedApplicationPID] description] UTF8String], NULL }; if (useGDB) { @@ -151,12 +156,12 @@ NSString *deviceIpadRetina = @"iPad (Retina)"; if (verbose) { nsprintf(@"Session started"); } + nsprintf(@"%@", [session simulatedApplicationPID]); + fflush(stdout); if (exitOnStartup) { [self doExit:EXIT_SUCCESS]; return; } - nsprintf(@"%@", [session simulatedApplicationPID]); - fflush(stdout); pidCheckingTimer = [[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(checkPid:) userInfo:nil repeats: TRUE] retain]; } else { -- cgit v1.2.1