Browse Source

tags/2021-05-28
jules 18 years ago
parent
commit
16719685c7
16 changed files with 87 additions and 66 deletions
  1. +14
    -11
      build/linux/platform_specific_code/juce_linux_Threads.cpp
  2. +5
    -5
      build/macosx/platform_specific_code/juce_mac_Threads.cpp
  3. +8
    -1
      build/macosx/platform_specific_code/juce_mac_Windowing.cpp
  4. +1
    -1
      build/win32/platform_specific_code/juce_win32_DirectSound.cpp
  5. +2
    -0
      build/win32/platform_specific_code/juce_win32_Midi.cpp
  6. +5
    -5
      build/win32/platform_specific_code/juce_win32_Threads.cpp
  7. +14
    -2
      build/win32/platform_specific_code/juce_win32_Windowing.cpp
  8. +4
    -0
      extras/audio plugins/wrapper/formats/RTAS/juce_RTASWrapper.cpp
  9. +8
    -8
      extras/audio plugins/wrapper/formats/VST/juce_VstWrapper.cpp
  10. +1
    -1
      src/juce_appframework/application/juce_Application.cpp
  11. +2
    -2
      src/juce_appframework/gui/components/windows/juce_SplashScreen.h
  12. +1
    -1
      src/juce_core/basics/juce_SystemStats.cpp
  13. +1
    -1
      src/juce_core/io/network/juce_URL.cpp
  14. +16
    -24
      src/juce_core/text/juce_String.cpp
  15. +1
    -0
      src/juce_core/text/juce_String.h
  16. +4
    -4
      src/juce_core/threads/juce_InterProcessLock.h

+ 14
- 11
build/linux/platform_specific_code/juce_linux_Threads.cpp View File

@@ -240,7 +240,7 @@ bool WaitableEvent::wait (const int timeOutMillisecs) const throw()
bool ok = true;
pthread_mutex_lock (&es->mutex);
if (!es->triggered)
if (! es->triggered)
{
if (timeOutMillisecs < 0)
{
@@ -252,28 +252,31 @@ bool WaitableEvent::wait (const int timeOutMillisecs) const throw()
struct timeval t;
int timeout = 0;
gettimeofday(&t,NULL);
gettimeofday (&t, 0);
time.tv_sec = t.tv_sec + (timeOutMillisecs / 1000);
time.tv_nsec = (t.tv_usec + ((timeOutMillisecs % 1000)*1000)) * 1000;
while( time.tv_nsec >= 1000000000 )
time.tv_nsec = (t.tv_usec + ((timeOutMillisecs % 1000) * 1000)) * 1000;
while (time.tv_nsec >= 1000000000)
{
time.tv_nsec -= 1000000000;
time.tv_sec++;
}
while( !timeout )
while (! timeout)
{
timeout = pthread_cond_timedwait (&es->condition, &es->mutex, &time);
if( !timeout )
if (! timeout)
// Success
break;
if( timeout == EINTR )
if (timeout == EINTR)
// Go round again
timeout = 0;
}
}
ok = es->triggered;
}
@@ -377,7 +380,7 @@ void* Process::getProcedureEntryPoint (void* libraryHandle, const String& proced
//==============================================================================
InterProcessLock::InterProcessLock (const String& name_)
InterProcessLock::InterProcessLock (const String& name_) throw()
: internal (0),
name (name_),
reentrancyLevel (0)
@@ -389,7 +392,7 @@ InterProcessLock::InterProcessLock (const String& name_)
internal = (void*) open (temp.getFullPathName().toUTF8(), 'a');
}
InterProcessLock::~InterProcessLock()
InterProcessLock::~InterProcessLock() throw()
{
while (reentrancyLevel > 0)
this->exit();
@@ -401,7 +404,7 @@ InterProcessLock::~InterProcessLock()
#endif
}
bool InterProcessLock::enter (int timeOutMillisecs)
bool InterProcessLock::enter (const int timeOutMillisecs) throw()
{
if (internal == 0)
return false;
@@ -441,7 +444,7 @@ bool InterProcessLock::enter (int timeOutMillisecs)
return false;
}
void InterProcessLock::exit()
void InterProcessLock::exit() throw()
{
if (reentrancyLevel > 0 && internal != 0)
{


+ 5
- 5
build/macosx/platform_specific_code/juce_mac_Threads.cpp View File

@@ -111,7 +111,7 @@ bool WaitableEvent::wait (const int timeOutMillisecs) const throw()
bool ok = true;
pthread_mutex_lock (&es->mutex);
if (!es->triggered)
if (! es->triggered)
{
if (timeOutMillisecs < 0)
{
@@ -289,7 +289,7 @@ void* Process::getProcedureEntryPoint (void* h, const String& procedureName)
}
//==============================================================================
InterProcessLock::InterProcessLock (const String& name_)
InterProcessLock::InterProcessLock (const String& name_) throw()
: internal (0),
name (name_),
reentrancyLevel (0)
@@ -301,7 +301,7 @@ InterProcessLock::InterProcessLock (const String& name_)
internal = (void*) open (temp.getFullPathName().toUTF8(), O_NONBLOCK | O_RDONLY);
}
InterProcessLock::~InterProcessLock()
InterProcessLock::~InterProcessLock() throw()
{
while (reentrancyLevel > 0)
this->exit();
@@ -309,7 +309,7 @@ InterProcessLock::~InterProcessLock()
close ((int) internal);
}
bool InterProcessLock::enter (int timeOutMillisecs)
bool InterProcessLock::enter (const int timeOutMillisecs) throw()
{
if (internal == 0)
return false;
@@ -349,7 +349,7 @@ bool InterProcessLock::enter (int timeOutMillisecs)
return false;
}
void InterProcessLock::exit()
void InterProcessLock::exit() throw()
{
if (reentrancyLevel > 0 && internal != 0)
{


+ 8
- 1
build/macosx/platform_specific_code/juce_mac_Windowing.cpp View File

@@ -2226,8 +2226,15 @@ void Desktop::getMousePosition (int& x, int& y) throw()

void Desktop::setMousePosition (int x, int y) throw()
{
// this rubbish needs to be done around the warp call, to avoid causing a
// bizarre glitch..
CGAssociateMouseAndMouseCursorPosition (false);
CGSetLocalEventsSuppressionInterval (0);
CGPoint pos = { x, y };
CGWarpMouseCursorPosition (pos);
CGWarpMouseCursorPosition (pos);

CGAssociateMouseAndMouseCursorPosition (true);
}

const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() throw()


+ 1
- 1
build/win32/platform_specific_code/juce_win32_DirectSound.cpp View File

@@ -208,7 +208,7 @@ static const String getDSErrorMessage (HRESULT hr)
break;
default:
return T("Unknown error: ") + String ((int) hr);
return "Unknown error: " + String ((int) hr);
}
return result;


+ 2
- 0
build/win32/platform_specific_code/juce_win32_Midi.cpp View File

@@ -192,6 +192,8 @@ public:
lock.exit();
//xxx needs to figure out if blocks are broken up or not
if (len == 0)
{
wait (500);


+ 5
- 5
build/win32/platform_specific_code/juce_win32_Threads.cpp View File

@@ -91,8 +91,8 @@ void CriticalSection::exit() const throw()
//==============================================================================
WaitableEvent::WaitableEvent() throw()
: internal (CreateEvent (0, FALSE, FALSE, 0))
{
internal = CreateEvent (0, FALSE, FALSE, 0);
}
WaitableEvent::~WaitableEvent() throw()
@@ -341,19 +341,19 @@ void* Process::getProcedureEntryPoint (void* h, const String& name)
//==============================================================================
InterProcessLock::InterProcessLock (const String& name_)
InterProcessLock::InterProcessLock (const String& name_) throw()
: internal (0),
name (name_),
reentrancyLevel (0)
{
}
InterProcessLock::~InterProcessLock()
InterProcessLock::~InterProcessLock() throw()
{
exit();
}
bool InterProcessLock::enter (int timeOutMillisecs)
bool InterProcessLock::enter (const int timeOutMillisecs) throw()
{
if (reentrancyLevel++ == 0)
{
@@ -375,7 +375,7 @@ bool InterProcessLock::enter (int timeOutMillisecs)
return (internal != 0);
}
void InterProcessLock::exit()
void InterProcessLock::exit() throw()
{
if (--reentrancyLevel == 0 && internal != 0)
{


+ 14
- 2
build/win32/platform_specific_code/juce_win32_Windowing.cpp View File

@@ -420,6 +420,7 @@ long improbableWindowNumber = 0xf965aa01; // also referenced by messaging.cpp
//==============================================================================
static int currentModifiers = 0;
static int modifiersAtLastCallback = 0;
static void updateKeyModifiers() throw()
{
@@ -1549,6 +1550,15 @@ private:
}
//==============================================================================
void sendModifierKeyChangeIfNeeded()
{
if (modifiersAtLastCallback != currentModifiers)
{
modifiersAtLastCallback = currentModifiers;
handleModifierKeysChange();
}
}
bool doKeyUp (const WPARAM key)
{
updateKeyModifiers();
@@ -1570,7 +1580,7 @@ private:
case VK_LMENU:
case VK_RCONTROL:
case VK_RMENU:
handleModifierKeysChange();
sendModifierKeyChangeIfNeeded();
}
return handleKeyUpOrDown();
@@ -1598,7 +1608,7 @@ private:
case VK_NUMLOCK:
case VK_SCROLL:
case VK_APPS:
handleModifierKeysChange();
sendModifierKeyChangeIfNeeded();
break;
case VK_LEFT:
@@ -1976,11 +1986,13 @@ private:
juce_repeatLastProcessPriority();
juce_CheckCurrentlyFocusedTopLevelWindow();
modifiersAtLastCallback = -1;
return 0;
case WM_ACTIVATE:
if (LOWORD (wParam) == WA_ACTIVE || LOWORD (wParam) == WA_CLICKACTIVE)
{
modifiersAtLastCallback = -1;
updateKeyModifiers();
if (isMinimised())


+ 4
- 0
extras/audio plugins/wrapper/formats/RTAS/juce_RTASWrapper.cpp View File

@@ -244,6 +244,10 @@ public:
{
PopupMenu::dismissAllActiveMenus();
Component* const modalComponent = Component::getCurrentlyModalComponent();
if (modalComponent != 0)
modalComponent->exitModalState (0);
filter->editorBeingDeleted (editorComp);
deleteAndZero (editorComp);
deleteAndZero (wrapper);


+ 8
- 8
extras/audio plugins/wrapper/formats/VST/juce_VstWrapper.cpp View File

@@ -901,15 +901,19 @@ public:
const MessageManagerLock mml;
#endif
Component* modalComponent = Component::getCurrentlyModalComponent();
if (modalComponent != 0)
modalComponent->exitModalState (0);
if (editorComp != 0)
{
Component* const modalComponent = Component::getCurrentlyModalComponent();
if (modalComponent != 0)
modalComponent->exitModalState (0);
filter->editorBeingDeleted (editorComp->getEditorComp());
deleteAndZero (editorComp);
// there's some kind of component currently modal, but the host
// is trying to delete our plugin. You should try to avoid this happening..
jassert (Component::getCurrentlyModalComponent() == 0);
}
#if JUCE_MAC || JUCE_LINUX
@@ -917,10 +921,6 @@ public:
#endif
recursionCheck = false;
// there's some kind of component currently modal, but the host
// is trying to delete our plugin. You should try to avoid this happening..
jassert (Component::getCurrentlyModalComponent() == 0);
}
VstIntPtr dispatcher (VstInt32 opCode, VstInt32 index, VstIntPtr value, void* ptr, float opt)


+ 1
- 1
src/juce_appframework/application/juce_Application.cpp View File

@@ -181,7 +181,7 @@ int JUCEApplication::main (String& commandLine, JUCEApplication* const app)
if (! app->moreThanOneInstanceAllowed())
{
appLock = new InterProcessLock (T("juceAppLock_") + app->getApplicationName());
appLock = new InterProcessLock ("juceAppLock_" + app->getApplicationName());
if (! appLock->enter(0))
{


+ 2
- 2
src/juce_appframework/gui/components/windows/juce_SplashScreen.h View File

@@ -63,7 +63,7 @@
@endcode
*/
class JUCE_API SplashScreen : public Component,
private Timer,
public Timer,
private DeletedAtShutdown
{
public:
@@ -132,8 +132,8 @@ public:
const bool useDropShadow);
//==============================================================================
/** @internal */
void paint (Graphics& g);
/** @internal */
void timerCallback();


+ 1
- 1
src/juce_core/basics/juce_SystemStats.cpp View File

@@ -45,7 +45,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
const String SystemStats::getJUCEVersion() throw()
{
return T("JUCE v") + String (JUCE_MAJOR_VERSION) + "." + String (JUCE_MINOR_VERSION);
return "JUCE v" + String (JUCE_MAJOR_VERSION) + "." + String (JUCE_MINOR_VERSION);
}


+ 1
- 1
src/juce_core/io/network/juce_URL.cpp View File

@@ -417,7 +417,7 @@ bool URL::launchInDefaultBrowser() const
String u (toString (true));
if (u.contains (T("@")) && ! u.contains (T(":")))
u = T("mailto:") + u;
u = "mailto:" + u;
return juce_launchFile (u, String::empty);
}


+ 16
- 24
src/juce_core/text/juce_String.cpp View File

@@ -50,7 +50,7 @@ BEGIN_JUCE_NAMESPACE
#endif
//==============================================================================
static const tchar* const emptyCharString = T("\0\0\0\0JUCE");
static const char* const emptyCharString = "\0\0\0\0JUCE";
static const int safeEmptyStringRefCount = 0x3fffffff;
String::InternalRefCountedStringHolder String::emptyString = { safeEmptyStringRefCount, 0, { 0 } };
@@ -72,6 +72,15 @@ void String::createInternal (const int numChars) throw()
text->text[0] = 0;
}
void String::createInternal (const tchar* const t, const tchar* const textEnd) throw()
{
jassert (*(textEnd - 1) == 0); // must have a null terminator
const int numChars = (int) (textEnd - t);
createInternal (numChars - 1);
memcpy (text->text, t, numChars * sizeof (tchar));
}
void String::appendInternal (const tchar* const newText,
const int numExtraChars) throw()
{
@@ -322,55 +331,40 @@ String::String (const int number) throw()
{
tchar buffer [16];
tchar* const end = buffer + 16;
const tchar* const t = intToCharString (end, number);
const int numChars = (int) (end - t);
createInternal (numChars - 1);
memcpy (text->text, t, numChars * sizeof (tchar));
createInternal (intToCharString (end, number), end);
}
String::String (const unsigned int number) throw()
{
tchar buffer [16];
tchar* const end = buffer + 16;
const tchar* const t = uintToCharString (end, number);
const int numChars = (int) (end - t);
createInternal (numChars - 1);
memcpy (text->text, t, numChars * sizeof (tchar));
createInternal (uintToCharString (end, number), end);
}
String::String (const short number) throw()
{
tchar buffer [16];
tchar* const end = buffer + 16;
const tchar* const t = intToCharString (end, (int) number);
const int numChars = (int) (end - t);
createInternal (numChars - 1);
memcpy (text->text, t, numChars * sizeof (tchar));
createInternal (intToCharString (end, (int) number), end);
}
String::String (const unsigned short number) throw()
{
tchar buffer [16];
tchar* const end = buffer + 16;
const tchar* const t = uintToCharString (end, (unsigned int) number);
const int numChars = (int) (end - t);
createInternal (numChars - 1);
memcpy (text->text, t, numChars * sizeof (tchar));
createInternal (uintToCharString (end, (unsigned int) number), end);
}
String::String (const int64 number) throw()
{
tchar buffer [32];
tchar* const end = buffer + 32;
const tchar* const t = int64ToCharString (end, number);
const int numChars = (int) (end - t);
createInternal (numChars - 1);
memcpy (text->text, t, numChars * sizeof (tchar));
createInternal (int64ToCharString (end, number), end);
}
String::String (const uint64 number) throw()
@@ -389,9 +383,7 @@ String::String (const uint64 number) throw()
} while (v > 0);
const int numChars = (int) (end - t);
createInternal (numChars - 1);
memcpy (text->text, t, numChars * sizeof (tchar));
createInternal (t, end);
}
// a double-to-string routine that actually uses the number of dec. places you asked for


+ 1
- 0
src/juce_core/text/juce_String.h View File

@@ -1043,6 +1043,7 @@ private:
void deleteInternal() throw();
void createInternal (const int numChars) throw();
void createInternal (const tchar* const text, const tchar* const textEnd) throw();
void appendInternal (const tchar* const text, const int numExtraChars) throw();
void doubleToStringWithDecPlaces (double n, int numDecPlaces) throw();
void dupeInternalIfMultiplyReferenced() throw();


+ 4
- 4
src/juce_core/threads/juce_InterProcessLock.h View File

@@ -49,13 +49,13 @@ public:
@param name a name that processes will use to identify this lock object
*/
InterProcessLock (const String& name);
InterProcessLock (const String& name) throw();
/** Destructor.
This will also release the lock if it's currently held by this process.
*/
~InterProcessLock();
~InterProcessLock() throw();
//==============================================================================
/** Attempts to lock the critical section.
@@ -67,11 +67,11 @@ public:
@returns true if the lock could be gained within the timeout period, or
false if the timeout expired.
*/
bool enter (int timeOutMillisecs = -1);
bool enter (int timeOutMillisecs = -1) throw();
/** Releases the lock if it's currently held by this process.
*/
void exit();
void exit() throw();
//==============================================================================


Loading…
Cancel
Save