Vuo  2.4.1
Functions | Variables
VuoApp.m File Reference

Description

VuoApp implementation.

Definition in file VuoApp.m.

Go to the source code of this file.

Functions

bool VuoApp_isMainThread (void)
 Is the current thread the main thread? More...
 
void VuoApp_executeOnMainThread (void(^block)(void))
 Executes the specified block on the main thread, then returns. More...
 
char * VuoApp_getName (void)
 Returns the composition's name. More...
 
static void VuoApp_initNSApplication (bool requiresDockIcon)
 Helper for VuoApp_init. More...
 
void VuoApp_init (bool requiresDockIcon)
 Creates an NSApplication instance (if one doesn't already exist). More...
 
static void VuoApp_finiWindows (uint64_t compositionUid)
 Helper for VuoApp_fini. More...
 
void VuoApp_fini (void)
 Cleanly shuts the application down. More...
 

Variables

const double VuoApp_windowFadeSeconds = 0.45
 The duration of the window fade in/out animation. More...
 
static bool VuoApp_initialized = false
 True if VuoApp_init() has initialized an NSApplication. More...
 

Function Documentation

◆ VuoApp_executeOnMainThread()

void VuoApp_executeOnMainThread ( void(^)(void)  block)

Executes the specified block on the main thread, then returns.

Can be called from any thread, including the main thread (avoids deadlock).

Don't call this from __attribute__((constructor)) functions, since this function depends on initialization which might not happen before your constructor is called.

Definition at line 74 of file VuoApp.m.

◆ VuoApp_fini()

void VuoApp_fini ( void  )

Cleanly shuts the application down.

Should only be called from within vuoStopComposition().

This function may be called from any thread.

Definition at line 273 of file VuoApp.m.

◆ VuoApp_finiWindows()

static void VuoApp_finiWindows ( uint64_t  compositionUid)
static

Helper for VuoApp_fini.

This function may only be called on the main thread.

Definition at line 239 of file VuoApp.m.

◆ VuoApp_getName()

char * VuoApp_getName ( void  )

Returns the composition's name.

If the composition is running in Vuo Editor (via VuoCompositionLoader), it extracts the name from the most-recently-loaded dylib's path. If the composition has been saved, this matches the composition's source filename. If not, it returns the text "Vuo Composition".

If the composition is running via VuoRunner (but not via VuoCompositionLoader), it returns the name of the VuoRunner process.

If the composition is running standalone, it tries the following Info.plist keys:

  • CFBundleDisplayName
  • CFBundleName
  • CFBundleExecutable

If none of those keys exist, it uses the composition executable's filename.

The caller is responsible for freeing the returned string.

Definition at line 112 of file VuoApp.m.

◆ VuoApp_init()

void VuoApp_init ( bool  requiresDockIcon)

Creates an NSApplication instance (if one doesn't already exist).

VuoWindow methods call this automatically as needed, so you only need to call this if you need an NSApplication instance without using VuoWindow (such as when using certain Cocoa/AppKit services — like, for example, VuoAudioFile and VuoScreen_getName do).

If requiresDockIcon is true, the app will show up in the dock. If requiresDockIcon is false, the app won't necessarily show up in the dock (if VuoApp_init was previously called with requiresDockIcon=true, the icon will remain).

This function may be called from any thread.

Changed in Vuo 2.0.0:
Added requiresDockIcon parameter.

Definition at line 212 of file VuoApp.m.

◆ VuoApp_initNSApplication()

static void VuoApp_initNSApplication ( bool  requiresDockIcon)
static

Helper for VuoApp_init.

This function may only be called on the main thread.

Definition at line 163 of file VuoApp.m.

◆ VuoApp_isMainThread()

bool VuoApp_isMainThread ( void  )

Is the current thread the main thread?

Definition at line 38 of file VuoApp.m.

Variable Documentation

◆ VuoApp_initialized

bool VuoApp_initialized = false
static

True if VuoApp_init() has initialized an NSApplication.

Definition at line 194 of file VuoApp.m.

◆ VuoApp_windowFadeSeconds

const double VuoApp_windowFadeSeconds = 0.45

The duration of the window fade in/out animation.

Changed in Vuo 2.0.0:
New.

Definition at line 33 of file VuoApp.m.