Browse Source

Improved Wine detection on Windows. Removed mouse event throttling for WinVista and later.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
6cddcc2407
10 changed files with 70 additions and 102 deletions
  1. +1
    -1
      src/audio/plugin_client/RTAS/juce_RTAS_DigiCode3.cpp
  2. +48
    -84
      src/audio/plugin_client/RTAS/juce_RTAS_Wrapper.cpp
  3. +3
    -0
      src/containers/juce_DynamicObject.h
  4. +1
    -1
      src/containers/juce_NamedValueSet.cpp
  5. +1
    -1
      src/containers/juce_NamedValueSet.h
  6. +2
    -8
      src/native/windows/juce_win32_PlatformUtils.cpp
  7. +2
    -2
      src/native/windows/juce_win32_SystemStats.cpp
  8. +10
    -3
      src/native/windows/juce_win32_Windowing.cpp
  9. +1
    -1
      src/text/juce_Identifier.cpp
  10. +1
    -1
      src/text/juce_Identifier.h

+ 1
- 1
src/audio/plugin_client/RTAS/juce_RTAS_DigiCode3.cpp View File

@@ -60,7 +60,7 @@
// This overloaded DllMain can work as either an RTAS or a VST..
extern "C" BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD ul_reason_for_call, LPVOID lpReserved)
{
if (GetModuleHandle ("DAE.DLL") != 0)
if (GetModuleHandle (_T("DAE.DLL")) != 0)
return DllMainRTAS (hInstance, ul_reason_for_call, lpReserved);
else
return DllMainVST (hInstance, ul_reason_for_call, lpReserved);


+ 48
- 84
src/audio/plugin_client/RTAS/juce_RTAS_Wrapper.cpp View File

@@ -246,11 +246,11 @@ public:
JUCE_AUTORELEASEPOOL
updateSize();
#if JUCE_WINDOWS
#if JUCE_WINDOWS
void* const hostWindow = (void*) ASI_GethWnd ((WindowPtr) port);
#else
#else
void* const hostWindow = (void*) GetWindowFromPort (port);
#endif
#endif
wrapper = nullptr;
wrapper = new EditorCompWrapper (hostWindow, editorComp, this);
@@ -264,7 +264,7 @@ public:
void DrawContents (Rect*)
{
#if JUCE_WINDOWS
#if JUCE_WINDOWS
if (wrapper != nullptr)
{
ComponentPeer* const peer = wrapper->getPeer();
@@ -275,7 +275,7 @@ public:
peer->repaint (wrapper->getLocalBounds());
}
}
#endif
#endif
}
void DrawBackground (Rect*) {}
@@ -309,9 +309,9 @@ public:
// A component to hold the AudioProcessorEditor, and cope with some housekeeping
// chores when it changes or repaints.
class EditorCompWrapper : public JUCE_NAMESPACE::Component
#if ! JUCE_MAC
#if ! JUCE_MAC
, public FocusChangeListener
#endif
#endif
{
public:
EditorCompWrapper (void* const hostWindow_,
@@ -322,37 +322,37 @@ public:
titleW (0),
titleH (0)
{
#if ! JucePlugin_EditorRequiresKeyboardFocus
#if ! JucePlugin_EditorRequiresKeyboardFocus
setMouseClickGrabsKeyboardFocus (false);
setWantsKeyboardFocus (false);
#endif
#endif
setOpaque (true);
setBroughtToFrontOnMouseClick (true);
setBounds (editorComp->getBounds());
editorComp->setTopLeftPosition (0, 0);
addAndMakeVisible (editorComp);
#if JUCE_WINDOWS
#if JUCE_WINDOWS
attachSubWindow (hostWindow, titleW, titleH, this);
#else
#else
nsWindow = attachSubWindow (hostWindow, this);
#endif
#endif
setVisible (true);
#if JUCE_WINDOWS && ! JucePlugin_EditorRequiresKeyboardFocus
#if JUCE_WINDOWS && ! JucePlugin_EditorRequiresKeyboardFocus
Desktop::getInstance().addFocusChangeListener (this);
#endif
#endif
}
~EditorCompWrapper()
{
#if JUCE_WINDOWS && ! JucePlugin_EditorRequiresKeyboardFocus
#if JUCE_WINDOWS && ! JucePlugin_EditorRequiresKeyboardFocus
Desktop::getInstance().removeFocusChangeListener (this);
#endif
#endif
#if JUCE_MAC
#if JUCE_MAC
removeSubWindow (nsWindow, this);
#endif
#endif
}
void paint (Graphics&)
@@ -369,24 +369,24 @@ public:
repaint();
}
#if JUCE_WINDOWS
#if JUCE_WINDOWS
void globalFocusChanged (JUCE_NAMESPACE::Component*)
{
#if ! JucePlugin_EditorRequiresKeyboardFocus
#if ! JucePlugin_EditorRequiresKeyboardFocus
if (hasKeyboardFocus (true))
passFocusToHostWindow (hostWindow);
#endif
#endif
}
#endif
#endif
void childBoundsChanged (JUCE_NAMESPACE::Component* child)
{
setSize (child->getWidth(), child->getHeight());
child->setTopLeftPosition (0, 0);
#if JUCE_WINDOWS
#if JUCE_WINDOWS
resizeHostWindow (hostWindow, titleW, titleH, this);
#endif
#endif
owner->updateSize();
}
@@ -394,14 +394,14 @@ public:
{
}
#if JUCE_MAC && JucePlugin_EditorRequiresKeyboardFocus
#if JUCE_MAC && JucePlugin_EditorRequiresKeyboardFocus
bool keyPressed (const KeyPress& kp)
{
owner->updateSize();
forwardCurrentKeyEventToHostWindow();
return true;
}
#endif
#endif
private:
//==============================================================================
@@ -469,7 +469,7 @@ protected:
// the plugin actually uses midi...
if (MIDILogIn() == noErr)
{
#if JucePlugin_WantsMidiInput
#if JucePlugin_WantsMidiInput
CEffectType* const type = dynamic_cast <CEffectType*> (this->GetProcessType());
if (type != nullptr)
@@ -486,7 +486,7 @@ protected:
midiBufferNode->Initialize (1, true);
}
#endif
#endif
}
midiTransport = new CEffectMIDITransport (&mMIDIWorld);
@@ -532,7 +532,7 @@ protected:
return;
}
#if JucePlugin_WantsMidiInput
#if JucePlugin_WantsMidiInput
midiEvents.clear();
const Cmn_UInt32 bufferSize = mRTGlobals->mHWBufferSizeInSamples;
@@ -558,12 +558,12 @@ protected:
}
}
}
#endif
#endif
#if defined (JUCE_DEBUG) || JUCE_LOG_ASSERTIONS
#if JUCE_DEBUG || JUCE_LOG_ASSERTIONS
const int numMidiEventsComingIn = midiEvents.getNumEvents();
(void) numMidiEventsComingIn;
#endif
#endif
{
const ScopedLock sl (juceFilter->getCallbackLock());
@@ -601,23 +601,21 @@ protected:
if (! midiEvents.isEmpty())
{
#if JucePlugin_ProducesMidiOutput
#if JucePlugin_ProducesMidiOutput
const JUCE_NAMESPACE::uint8* midiEventData;
int midiEventSize, midiEventPosition;
MidiBuffer::Iterator i (midiEvents);
while (i.getNextEvent (midiEventData, midiEventSize, midiEventPosition))
{
// jassert (midiEventPosition >= 0 && midiEventPosition < (int) numSamples);
//xxx
//jassert (midiEventPosition >= 0 && midiEventPosition < (int) numSamples);
}
#else
#else
// if your plugin creates midi messages, you'll need to set
// the JucePlugin_ProducesMidiOutput macro to 1 in your
// JucePluginCharacteristics.h file
jassert (midiEvents.getNumEvents() <= numMidiEventsComingIn);
#endif
#endif
midiEvents.clear();
}
@@ -729,44 +727,14 @@ protected:
switch (fTimeCodeInfo.mFrameRate)
{
case ficFrameRate_24Frame:
info.frameRate = AudioPlayHead::fps24;
break;
case ficFrameRate_25Frame:
info.frameRate = AudioPlayHead::fps25;
framesPerSec = 25.0;
break;
case ficFrameRate_2997NonDrop:
info.frameRate = AudioPlayHead::fps2997;
framesPerSec = 29.97002997;
break;
case ficFrameRate_2997DropFrame:
info.frameRate = AudioPlayHead::fps2997drop;
framesPerSec = 29.97002997;
break;
case ficFrameRate_30NonDrop:
info.frameRate = AudioPlayHead::fps30;
framesPerSec = 30.0;
break;
case ficFrameRate_30DropFrame:
info.frameRate = AudioPlayHead::fps30drop;
framesPerSec = 30.0;
break;
case ficFrameRate_23976:
// xxx not strictly true..
info.frameRate = AudioPlayHead::fps24;
framesPerSec = 23.976;
break;
default:
info.frameRate = AudioPlayHead::fpsUnknown;
break;
case ficFrameRate_24Frame: info.frameRate = AudioPlayHead::fps24; break;
case ficFrameRate_25Frame: info.frameRate = AudioPlayHead::fps25; framesPerSec = 25.0; break;
case ficFrameRate_2997NonDrop: info.frameRate = AudioPlayHead::fps2997; framesPerSec = 29.97002997; break;
case ficFrameRate_2997DropFrame: info.frameRate = AudioPlayHead::fps2997drop; framesPerSec = 29.97002997; break;
case ficFrameRate_30NonDrop: info.frameRate = AudioPlayHead::fps30; framesPerSec = 30.0; break;
case ficFrameRate_30DropFrame: info.frameRate = AudioPlayHead::fps30drop; framesPerSec = 30.0; break;
case ficFrameRate_23976: info.frameRate = AudioPlayHead::fps24; framesPerSec = 23.976; break;
default: info.frameRate = AudioPlayHead::fpsUnknown; break;
}
info.editOriginTime = fTimeCodeInfo.mFrameOffset / framesPerSec;
@@ -865,10 +833,6 @@ private:
{
}
~JucePluginControl()
{
}
//==============================================================================
OSType GetID() const { return index + 1; }
long GetDefaultValue() const { return floatToLong (0); }
@@ -976,9 +940,9 @@ public:
private:
static CEffectProcess* createNewProcess()
{
#if JUCE_WINDOWS
#if JUCE_WINDOWS
PlatformUtilities::setCurrentModuleInstanceHandle (gThisModule);
#endif
#endif
initialiseJuce_GUI();
@@ -1016,9 +980,9 @@ void initialiseMacRTAS();
CProcessGroupInterface* CProcessGroup::CreateProcessGroup()
{
#if JUCE_MAC
#if JUCE_MAC
initialiseMacRTAS();
#endif
#endif
return new JucePlugInGroup();
}


+ 3
- 0
src/containers/juce_DynamicObject.h View File

@@ -107,6 +107,9 @@ public:
/** Removes all properties and methods from the object. */
void clear();
/** Returns the NamedValueSet that holds the object's properties. */
NamedValueSet& getProperties() noexcept { return properties; }
private:
//==============================================================================
NamedValueSet properties;


+ 1
- 1
src/containers/juce_NamedValueSet.cpp View File

@@ -195,7 +195,7 @@ const Identifier NamedValueSet::getName (const int index) const
return v->name;
}
var NamedValueSet::getValueAt (const int index) const
const var& NamedValueSet::getValueAt (const int index) const
{
const NamedValue* const v = values[index];
jassert (v != nullptr);


+ 1
- 1
src/containers/juce_NamedValueSet.h View File

@@ -93,7 +93,7 @@ public:
/** Returns the value of the item at a given index.
The index must be between 0 and size() - 1.
*/
var getValueAt (int index) const;
const var& getValueAt (int index) const;
/** Removes all values. */
void clear();


+ 2
- 8
src/native/windows/juce_win32_PlatformUtils.cpp View File

@@ -179,14 +179,8 @@ void PlatformUtilities::registerFileAssociation (const String& fileExtension,
//==============================================================================
bool juce_IsRunningInWine()
{
HKEY key;
if (RegOpenKeyEx (HKEY_CURRENT_USER, _T("Software\\Wine"), 0, KEY_READ, &key) == ERROR_SUCCESS)
{
RegCloseKey (key);
return true;
}
return false;
HMODULE ntdll = GetModuleHandle (_T("ntdll.dll"));
return ntdll != 0 && GetProcAddress (ntdll, "wine_get_version") != 0;
}
//==============================================================================


+ 2
- 2
src/native/windows/juce_win32_SystemStats.cpp View File

@@ -185,11 +185,11 @@ bool SystemStats::isOperatingSystem64Bit()
#else
typedef BOOL (WINAPI* LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle (L"kernel32"), "IsWow64Process");
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle (_T("kernel32")), "IsWow64Process");
BOOL isWow64 = FALSE;
return (fnIsWow64Process != 0)
return fnIsWow64Process != 0
&& fnIsWow64Process (GetCurrentProcess(), &isWow64)
&& (isWow64 != FALSE);
#endif


+ 10
- 3
src/native/windows/juce_win32_Windowing.cpp View File

@@ -1427,6 +1427,14 @@ private:
#endif
}
static int getMinTimeBetweenMouseMoves()
{
if (SystemStats::getOperatingSystemType() >= SystemStats::WinVista)
return 0;
return 1000 / 60; // Throttling the incoming mouse-events seems to still be needed in XP..
}
void doMouseMove (const Point<int>& position)
{
if (! isMouseOver)
@@ -1451,12 +1459,11 @@ private:
return;
}
// (Throttling the incoming queue of mouse-events seems to still be required in XP..)
static uint32 lastMouseTime = 0;
static int minTimeBetweenMouses = getMinTimeBetweenMouseMoves();
const uint32 now = Time::getMillisecondCounter();
const int maxMouseMovesPerSecond = 60;
if (now > lastMouseTime + 1000 / maxMouseMovesPerSecond)
if (now >= lastMouseTime + minTimeBetweenMouses)
{
lastMouseTime = now;
doMouseEvent (position);


+ 1
- 1
src/text/juce_Identifier.cpp View File

@@ -77,7 +77,7 @@ Identifier::~Identifier()
bool Identifier::isValidIdentifier (const String& possibleIdentifier) noexcept
{
return possibleIdentifier.isNotEmpty()
&& possibleIdentifier.containsOnly ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_");
&& possibleIdentifier.containsOnly ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-:");
}
END_JUCE_NAMESPACE

+ 1
- 1
src/text/juce_Identifier.h View File

@@ -80,7 +80,7 @@ public:
/** Checks a given string for characters that might not be valid in an Identifier.
Since Identifiers are used as a script variables and XML attributes, they should only contain
alphanumeric characters and underscores.
alphanumeric characters, underscores, or the '-' and ':' characters.
*/
static bool isValidIdentifier (const String& possibleIdentifier) noexcept;


Loading…
Cancel
Save