1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-27 02:20:05 +00:00

Fix for iOS launching. Tweak for win32 font rendering. Added a File::hostApplicationPath flag.

This commit is contained in:
Julian Storer 2010-07-23 12:33:27 -05:00
parent 280b966ff6
commit ccd8566e96
26 changed files with 200 additions and 130 deletions

View file

@ -166,6 +166,16 @@ const File File::getSpecialLocation (const SpecialLocationType type)
case currentApplicationFile:
return juce_getExecutableFile();
case hostApplicationPath:
{
unsigned int size = 8192;
HeapBlock<char> buffer;
buffer.calloc (size + 8);
readlink ("/proc/self/exe", buffer.getData(), size);
return String::fromUTF8 (buffer, size);
}
default:
jassertfalse; // unknown type?
break;

View file

@ -253,7 +253,7 @@ namespace LinuxErrorHandling
{
DBG ("ERROR: connection to X server broken.. terminating.");
if (JUCEApplication::isStandaloneApp)
if (JUCEApplication::isStandaloneApp())
MessageManager::getInstance()->stopDispatchLoop();
errorOccurred = true;
@ -322,7 +322,7 @@ void MessageManager::doPlatformSpecificInitialisation()
// This is fatal! Print error and closedown
Logger::outputDebugString ("Failed to initialise xlib thread support.");
if (JUCEApplication::isStandaloneApp)
if (JUCEApplication::isStandaloneApp())
Process::terminate();
return;
@ -424,7 +424,7 @@ bool juce_dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages)
{
LinuxErrorHandling::errorOccurred = true;
if (JUCEApplication::isStandaloneApp)
if (JUCEApplication::isStandaloneApp())
Process::terminate();
break;

View file

@ -80,6 +80,7 @@ void MessageManager::runDispatchLoop()
void MessageManager::stopDispatchLoop()
{
[[[UIApplication sharedApplication] delegate] applicationWillTerminate: [UIApplication sharedApplication]];
exit (0); // iPhone apps get no mercy..
}

View file

@ -44,17 +44,17 @@ END_JUCE_NAMESPACE
- (void) applicationDidFinishLaunching: (UIApplication*) application
{
String dummy;
initialiseJuce_GUI();
if (! JUCEApplication::getInstance()->initialiseApp (dummy))
if (! JUCEApplication::createInstance()->initialiseApp (String::empty))
exit (0);
}
- (void) applicationWillTerminate: (UIApplication*) application
{
jassert (JUCEApplication::getInstance() != 0);
JUCEApplication::getInstance()->shutdownApp();
// need to do this stuff because the OS kills the process before our scope-based cleanup code gets executed..
delete JUCEApplication::getInstance();
shutdownJuce_GUI();
}

View file

@ -200,6 +200,16 @@ const File File::getSpecialLocation (const SpecialLocationType type)
: exe;
}
case hostApplicationPath:
{
unsigned int size = 8192;
HeapBlock<char> buffer;
buffer.calloc (size + 8);
_NSGetExecutablePath (buffer.getData(), &size);
return String::fromUTF8 (buffer, size);
}
default:
jassertfalse; // unknown type?
break;

View file

@ -485,7 +485,7 @@ static NSMenu* createStandardAppMenu (NSMenu* menu, const String& appName,
static void rebuildMainMenu (const PopupMenu* extraItems)
{
// this can't be used in a plugin!
jassert (JUCEApplication::isStandaloneApp);
jassert (JUCEApplication::isStandaloneApp());
if (JUCEApplication::getInstance() != 0)
{

View file

@ -204,7 +204,7 @@ using namespace JUCE_NAMESPACE;
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
if (JUCEApplication::isStandaloneApp)
if (JUCEApplication::isStandaloneApp())
{
oldDelegate = [NSApp delegate];
[NSApp setDelegate: self];

View file

@ -59,15 +59,6 @@ void PlatformUtilities::addItemToDock (const File& file)
}
}
int PlatformUtilities::getOSXMinorVersionNumber()
{
SInt32 versionMinor = 0;
OSErr err = Gestalt (gestaltSystemVersionMinor, &versionMinor);
(void) err;
jassert (err == noErr);
return (int) versionMinor;
}
//==============================================================================
#if ! JUCE_ONLY_BUILD_CORE_LIBRARY

View file

@ -328,7 +328,7 @@ END_JUCE_NAMESPACE
//==============================================================================
- (void) mouseDown: (NSEvent*) ev
{
if (JUCEApplication::isStandaloneApp)
if (JUCEApplication::isStandaloneApp())
[self asyncMouseDown: ev];
else
// In some host situations, the host will stop modal loops from working
@ -347,7 +347,7 @@ END_JUCE_NAMESPACE
- (void) mouseUp: (NSEvent*) ev
{
if (! JUCEApplication::isStandaloneApp)
if (! JUCEApplication::isStandaloneApp())
[self asyncMouseUp: ev];
else
// In some host situations, the host will stop modal loops from working

View file

@ -78,6 +78,7 @@
#include <ifaddrs.h>
#include <net/if_dl.h>
#include <mach/mach_time.h>
#include <mach-o/dyld.h>
#if MACOS_10_4_OR_EARLIER
#include <GLUT/glut.h>

View file

@ -317,7 +317,7 @@ void OpenGLPixelFormat::getAvailablePixelFormats (Component* /*component*/,
p = aglNextPixelFormat (p);
}*/
//jassertfalse //xxx can't see how you do this in cocoa!
//jassertfalse // can't see how you do this in cocoa!
}
#else

View file

@ -132,13 +132,25 @@ const String SystemStats::getOperatingSystemName()
return "Mac OS X";
}
#if ! JUCE_IOS
int PlatformUtilities::getOSXMinorVersionNumber()
{
SInt32 versionMinor = 0;
OSErr err = Gestalt (gestaltSystemVersionMinor, &versionMinor);
(void) err;
jassert (err == noErr);
return (int) versionMinor;
}
#endif
bool SystemStats::isOperatingSystem64Bit()
{
#if JUCE_64BIT
#if JUCE_IOS
return false;
#elif JUCE_64BIT
return true;
#else
//xxx not sure how to find this out?..
return false;
return PlatformUtilities::getOSXMinorVersionNumber() >= 6;
#endif
}

View file

@ -439,7 +439,14 @@ const File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType typ
GetModuleFileName (moduleHandle, dest, numElementsInArray (dest));
return File (String (dest));
}
break;
case hostApplicationPath:
{
WCHAR dest [MAX_PATH + 256];
dest[0] = 0;
GetModuleFileName (0, dest, numElementsInArray (dest));
return File (String (dest));
}
default:
jassertfalse; // unknown type?