| @@ -79,6 +79,8 @@ struct MessageThreadFuncCall | |||||
| }; | }; | ||||
| static bool errorCondition = false; | static bool errorCondition = false; | ||||
| static XErrorHandler oldErrorHandler = (XErrorHandler) 0; | |||||
| static XIOErrorHandler oldIOErrorHandler = (XIOErrorHandler) 0; | |||||
| // (defined in another file to avoid problems including certain headers in this one) | // (defined in another file to avoid problems including certain headers in this one) | ||||
| extern bool juce_isRunningAsApplication(); | extern bool juce_isRunningAsApplication(); | ||||
| @@ -90,7 +92,7 @@ static int ioErrorHandler (Display* display) | |||||
| errorCondition = true; | errorCondition = true; | ||||
| if (! juce_isRunningAsApplication()) | |||||
| if (juce_isRunningAsApplication()) | |||||
| Process::terminate(); | Process::terminate(); | ||||
| return 0; | return 0; | ||||
| @@ -151,25 +153,33 @@ static void sig_handler (int sig) | |||||
| } | } | ||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| void MessageManager::doPlatformSpecificInitialisation() | void MessageManager::doPlatformSpecificInitialisation() | ||||
| { | { | ||||
| // Initialise xlib for multiple thread support | // Initialise xlib for multiple thread support | ||||
| if (! XInitThreads()) | |||||
| static bool initThreadCalled = false; | |||||
| if (! initThreadCalled) | |||||
| { | { | ||||
| // This is fatal! Print error and closedown | |||||
| Logger::outputDebugString ("Failed to initialise xlib thread support."); | |||||
| if (! XInitThreads()) | |||||
| { | |||||
| // This is fatal! Print error and closedown | |||||
| Logger::outputDebugString ("Failed to initialise xlib thread support."); | |||||
| if (juce_isRunningAsApplication()) | |||||
| Process::terminate(); | |||||
| if (juce_isRunningAsApplication()) | |||||
| Process::terminate(); | |||||
| return; | |||||
| } | |||||
| initThreadCalled = true; | |||||
| } | } | ||||
| // This is called if the client/server connection is broken | // This is called if the client/server connection is broken | ||||
| XSetIOErrorHandler (ioErrorHandler); | |||||
| oldIOErrorHandler = XSetIOErrorHandler (ioErrorHandler); | |||||
| // This is called if a protocol error occurs | // This is called if a protocol error occurs | ||||
| XSetErrorHandler (errorHandler); | |||||
| oldErrorHandler = XSetErrorHandler (errorHandler); | |||||
| // Install signal handler for break-in | // Install signal handler for break-in | ||||
| struct sigaction saction; | struct sigaction saction; | ||||
| @@ -202,6 +212,8 @@ void MessageManager::doPlatformSpecificInitialisation() | |||||
| if (juce_isRunningAsApplication()) | if (juce_isRunningAsApplication()) | ||||
| Process::terminate(); | Process::terminate(); | ||||
| return; | |||||
| } | } | ||||
| // Get defaults for various properties | // Get defaults for various properties | ||||
| @@ -235,6 +247,16 @@ void MessageManager::doPlatformSpecificShutdown() | |||||
| { | { | ||||
| XDestroyWindow (display, juce_messageWindowHandle); | XDestroyWindow (display, juce_messageWindowHandle); | ||||
| XCloseDisplay (display); | XCloseDisplay (display); | ||||
| // reset pointers | |||||
| juce_messageWindowHandle = 0; | |||||
| display = 0; | |||||
| // Restore original error handlers | |||||
| XSetIOErrorHandler (oldIOErrorHandler); | |||||
| oldIOErrorHandler = 0; | |||||
| XSetErrorHandler (oldErrorHandler); | |||||
| oldErrorHandler = 0; | |||||
| } | } | ||||
| } | } | ||||
| @@ -328,6 +350,8 @@ bool juce_dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages) | |||||
| if (juce_isRunningAsApplication()) | if (juce_isRunningAsApplication()) | ||||
| Process::terminate(); | Process::terminate(); | ||||
| return false; | |||||
| } | } | ||||
| if (returnIfNoPendingMessages && ! XPending (display)) | if (returnIfNoPendingMessages && ! XPending (display)) | ||||
| @@ -188,7 +188,12 @@ bool juce_IsRunningInWine() throw() | |||||
| //============================================================================== | //============================================================================== | ||||
| const String JUCE_CALLTYPE PlatformUtilities::getCurrentCommandLineParams() throw() | const String JUCE_CALLTYPE PlatformUtilities::getCurrentCommandLineParams() throw() | ||||
| { | { | ||||
| return String (::GetCommandLineW()); | |||||
| String s (::GetCommandLineW()); | |||||
| StringArray tokens; | |||||
| tokens.addTokens (s, true); // tokenise so that we can remove the initial filename argument | |||||
| return tokens.joinIntoString (T(" "), 1); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -43,8 +43,8 @@ Image* juce_createIconForFile (const File& file); | |||||
| //============================================================================== | //============================================================================== | ||||
| FileListComponent::FileListComponent (DirectoryContentsList& listToShow) | FileListComponent::FileListComponent (DirectoryContentsList& listToShow) | ||||
| : DirectoryContentsDisplayComponent (listToShow), | |||||
| ListBox (String::empty, 0) | |||||
| : ListBox (String::empty, 0), | |||||
| DirectoryContentsDisplayComponent (listToShow) | |||||
| { | { | ||||
| setModel (this); | setModel (this); | ||||
| fileList.addChangeListener (this); | fileList.addChangeListener (this); | ||||
| @@ -50,8 +50,8 @@ | |||||
| @see DirectoryContentsList, FileTreeComponent | @see DirectoryContentsList, FileTreeComponent | ||||
| */ | */ | ||||
| class JUCE_API FileListComponent : public DirectoryContentsDisplayComponent, | |||||
| public ListBox, | |||||
| class JUCE_API FileListComponent : public ListBox, | |||||
| public DirectoryContentsDisplayComponent, | |||||
| private ListBoxModel, | private ListBoxModel, | ||||
| private ChangeListener | private ChangeListener | ||||
| { | { | ||||
| @@ -48,8 +48,8 @@ | |||||
| @see DirectoryContentsList, FileListComponent | @see DirectoryContentsList, FileListComponent | ||||
| */ | */ | ||||
| class JUCE_API FileTreeComponent : public DirectoryContentsDisplayComponent, | |||||
| public TreeView | |||||
| class JUCE_API FileTreeComponent : public TreeView, | |||||
| public DirectoryContentsDisplayComponent | |||||
| { | { | ||||
| public: | public: | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -134,14 +134,16 @@ Time::Time (const int year, | |||||
| const int hours, | const int hours, | ||||
| const int minutes, | const int minutes, | ||||
| const int seconds, | const int seconds, | ||||
| const int milliseconds) throw() | |||||
| const int milliseconds, | |||||
| const bool useLocalTime) throw() | |||||
| { | { | ||||
| jassert (year > 100); // year must be a 4-digit version | jassert (year > 100); // year must be a 4-digit version | ||||
| if (year < 1971 || year >= 2038) | |||||
| if (year < 1971 || year >= 2038 || ! useLocalTime) | |||||
| { | { | ||||
| // use extended maths for dates beyond 1970 to 2037.. | // use extended maths for dates beyond 1970 to 2037.. | ||||
| const int timeZoneAdjustment = 31536000 - (int) (Time (1971, 0, 1, 0, 0).toMilliseconds() / 1000); | |||||
| const int timeZoneAdjustment = useLocalTime ? (31536000 - (int) (Time (1971, 0, 1, 0, 0).toMilliseconds() / 1000)) | |||||
| : 0; | |||||
| const int a = (13 - month) / 12; | const int a = (13 - month) / 12; | ||||
| const int y = year + 4800 - a; | const int y = year + 4800 - a; | ||||
| const int jd = day + (153 * (month + 12 * a - 2) + 2) / 5 | const int jd = day + (153 * (month + 12 * a - 2) + 2) / 5 | ||||
| @@ -83,6 +83,8 @@ public: | |||||
| @param minutes minutes 0 to 59 | @param minutes minutes 0 to 59 | ||||
| @param seconds seconds 0 to 59 | @param seconds seconds 0 to 59 | ||||
| @param milliseconds milliseconds 0 to 999 | @param milliseconds milliseconds 0 to 999 | ||||
| @param useLocalTime if true, encode using the current machine's local time; if | |||||
| false, it will always work in GMT. | |||||
| */ | */ | ||||
| Time (const int year, | Time (const int year, | ||||
| const int month, | const int month, | ||||
| @@ -90,7 +92,8 @@ public: | |||||
| const int hours, | const int hours, | ||||
| const int minutes, | const int minutes, | ||||
| const int seconds = 0, | const int seconds = 0, | ||||
| const int milliseconds = 0) throw(); | |||||
| const int milliseconds = 0, | |||||
| const bool useLocalTime = true) throw(); | |||||
| /** Destructor. */ | /** Destructor. */ | ||||
| ~Time() throw(); | ~Time() throw(); | ||||
| @@ -93,7 +93,7 @@ public: | |||||
| ~ZipInputStream() throw() | ~ZipInputStream() throw() | ||||
| { | { | ||||
| #ifdef JUCE_DEBUG | |||||
| #ifdef JUCE_DEBUG | |||||
| if (inputStream != 0 && inputStream == file.inputStream) | if (inputStream != 0 && inputStream == file.inputStream) | ||||
| file.numOpenStreams--; | file.numOpenStreams--; | ||||
| #endif | #endif | ||||