15 #import <AppKit/AppKit.h>
20 #include <mach-o/dyld.h>
41 static dispatch_once_t once = 0;
42 dispatch_once(&once, ^{
49 VUserLog(
"Error: Couldn't find VuoApp_mainThread.");
56 VUserLog(
"Error: VuoApp_mainThread isn't set.");
84 dispatch_sync(dispatch_get_main_queue(), ^{
114 char **dylibPath = (
char **)dlsym(RTLD_SELF,
"VuoApp_dylibPath");
116 dylibPath = (
char **)dlsym(RTLD_DEFAULT,
"VuoApp_dylibPath");
119 char *filename = strrchr(*dylibPath,
'/');
122 char *name = strdup(filename + 1);
123 name[strlen(name) - strlen("-XXXXXX.dylib")] = 0;
125 if (strcmp(name,
"VuoComposition") == 0)
128 return strdup(
"Vuo Composition");
138 char *runnerName = (
char *)malloc(2*MAXCOMLEN);
139 proc_name(
runnerPid, runnerName, 2*MAXCOMLEN);
143 NSBundle *mainBundle = [NSBundle mainBundle];
144 NSString *name = [mainBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"];
146 name = [mainBundle objectForInfoDictionaryKey:@"CFBundleName"];
148 name = [mainBundle objectForInfoDictionaryKey:@"CFBundleExecutable"];
150 name = [[[mainBundle executablePath] stringByDeletingPathExtension] lastPathComponent];
153 return strdup([name UTF8String]);
165 NSAutoreleasePool *pool = [NSAutoreleasePool new];
168 NSApplication *app = [NSApplication sharedApplication];
178 [app setActivationPolicy:requiresDockIcon ? NSApplicationActivationPolicyRegular : NSApplicationActivationPolicyAccessory];
181 [app finishLaunching];
218 && NSApplication.sharedApplication.activationPolicy != NSApplicationActivationPolicyRegular)
219 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
224 static dispatch_once_t once = 0;
225 dispatch_once(&once, ^{
240 SEL stopRecording =
@selector(stopRecording);
241 SEL compositionUidSel =
@selector(compositionUid);
242 for (NSWindow *window in [NSApp windows])
246 if ([window respondsToSelector:stopRecording]
247 && [window respondsToSelector:compositionUidSel]
248 && (uint64_t)[window performSelector:compositionUidSel] == compositionUid)
249 [window performSelector:stopRecording];
251 if ([NSApp windows].count)
254 [NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
257 [NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:VuoApp_windowFadeSeconds + fudge]];
279 free(compositionState);
286 dispatch_sync(dispatch_get_main_queue(), ^{