Browse Source

Fixed for OpenGL, DropShadower, Linux midi, VST resizing + mouse wheel hooks.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
a9b1676028
16 changed files with 151 additions and 114 deletions
  1. +53
    -43
      juce_amalgamated.cpp
  2. +15
    -4
      juce_amalgamated.h
  3. +3
    -6
      src/audio/plugin_client/VST/juce_VST_Wrapper.cpp
  4. +10
    -12
      src/audio/plugin_client/VST/juce_VST_Wrapper.mm
  5. +1
    -1
      src/containers/juce_DynamicObject.cpp
  6. +1
    -1
      src/containers/juce_NamedValueSet.cpp
  7. +2
    -2
      src/containers/juce_ValueTree.cpp
  8. +9
    -2
      src/containers/juce_Variant.h
  9. +5
    -5
      src/core/juce_RelativeTime.cpp
  10. +1
    -1
      src/core/juce_StandardHeader.h
  11. +1
    -1
      src/gui/components/juce_Component.cpp
  12. +13
    -12
      src/gui/components/special/juce_DropShadower.cpp
  13. +4
    -1
      src/gui/components/special/juce_OpenGLComponent.cpp
  14. +23
    -16
      src/native/linux/juce_linux_Midi.cpp
  15. +5
    -6
      src/native/mac/juce_ios_UIViewComponentPeer.mm
  16. +5
    -1
      src/threads/juce_Thread.h

+ 53
- 43
juce_amalgamated.cpp View File

@@ -1540,12 +1540,12 @@ RelativeTime::~RelativeTime() noexcept
{ {
} }


const RelativeTime RelativeTime::milliseconds (const int milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); }
const RelativeTime RelativeTime::milliseconds (const int milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); }
const RelativeTime RelativeTime::milliseconds (const int64 milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); } const RelativeTime RelativeTime::milliseconds (const int64 milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); }
const RelativeTime RelativeTime::minutes (const double numberOfMinutes) noexcept { return RelativeTime (numberOfMinutes * 60.0); }
const RelativeTime RelativeTime::hours (const double numberOfHours) noexcept { return RelativeTime (numberOfHours * (60.0 * 60.0)); }
const RelativeTime RelativeTime::days (const double numberOfDays) noexcept { return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0)); }
const RelativeTime RelativeTime::weeks (const double numberOfWeeks) noexcept { return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0)); }
const RelativeTime RelativeTime::minutes (const double numberOfMinutes) noexcept { return RelativeTime (numberOfMinutes * 60.0); }
const RelativeTime RelativeTime::hours (const double numberOfHours) noexcept { return RelativeTime (numberOfHours * (60.0 * 60.0)); }
const RelativeTime RelativeTime::days (const double numberOfDays) noexcept { return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0)); }
const RelativeTime RelativeTime::weeks (const double numberOfWeeks) noexcept { return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0)); }


int64 RelativeTime::inMilliseconds() const noexcept { return (int64) (seconds * 1000.0); } int64 RelativeTime::inMilliseconds() const noexcept { return (int64) (seconds * 1000.0); }
double RelativeTime::inMinutes() const noexcept { return seconds / 60.0; } double RelativeTime::inMinutes() const noexcept { return seconds / 60.0; }
@@ -4736,7 +4736,7 @@ const var& NamedValueSet::operator[] (const Identifier& name) const


const var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultReturnValue) const const var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultReturnValue) const
{ {
const var* v = getVarPointer (name);
const var* const v = getVarPointer (name);
return v != nullptr ? *v : defaultReturnValue; return v != nullptr ? *v : defaultReturnValue;
} }


@@ -4855,7 +4855,7 @@ DynamicObject::~DynamicObject()


bool DynamicObject::hasProperty (const Identifier& propertyName) const bool DynamicObject::hasProperty (const Identifier& propertyName) const
{ {
var* const v = properties.getVarPointer (propertyName);
const var* const v = properties.getVarPointer (propertyName);
return v != nullptr && ! v->isMethod(); return v != nullptr && ! v->isMethod();
} }


@@ -17511,12 +17511,12 @@ void ValueTree::SharedObject::setProperty (const Identifier& name, const var& ne
} }
else else
{ {
var* const existingValue = properties.getVarPointer (name);
const var* const existingValue = properties.getVarPointer (name);


if (existingValue != nullptr) if (existingValue != nullptr)
{ {
if (*existingValue != newValue) if (*existingValue != newValue)
undoManager->perform (new SetPropertyAction (this, name, newValue, properties [name], false, false));
undoManager->perform (new SetPropertyAction (this, name, newValue, *existingValue, false, false));
} }
else else
{ {
@@ -42368,7 +42368,7 @@ void Component::sendLookAndFeelChange()


const Colour Component::findColour (const int colourId, const bool inheritFromParent) const const Colour Component::findColour (const int colourId, const bool inheritFromParent) const
{ {
var* const v = properties.getVarPointer (ComponentHelpers::getColourPropertyId (colourId));
const var* const v = properties.getVarPointer (ComponentHelpers::getColourPropertyId (colourId));


if (v != nullptr) if (v != nullptr)
return Colour ((int) *v); return Colour ((int) *v);
@@ -76123,21 +76123,22 @@ void DropShadower::updateShadows()
// callbacks during this loop, so use a weak ref to watch out for this.. // callbacks during this loop, so use a weak ref to watch out for this..
WeakReference<Component> sw (shadowWindows[i]); WeakReference<Component> sw (shadowWindows[i]);


if (sw == nullptr)
return;
if (sw != nullptr)
sw->setAlwaysOnTop (owner->isAlwaysOnTop());


sw->setAlwaysOnTop (owner->isAlwaysOnTop());
if (sw != nullptr)
sw->setVisible (isOwnerVisible);


if (sw == nullptr)
return;

switch (i)
if (sw != nullptr)
{ {
case 0: sw->setBounds (x - shadowEdge, y, shadowEdge, h); break;
case 1: sw->setBounds (x + w, y, shadowEdge, h); break;
case 2: sw->setBounds (x, y, w, shadowEdge); break;
case 3: sw->setBounds (x, owner->getBottom(), w, shadowEdge); break;
default: break;
switch (i)
{
case 0: sw->setBounds (x - shadowEdge, y, shadowEdge, h); break;
case 1: sw->setBounds (x + w, y, shadowEdge, h); break;
case 2: sw->setBounds (x, y, w, shadowEdge); break;
case 3: sw->setBounds (x, owner->getBottom(), w, shadowEdge); break;
default: break;
}
} }


if (sw == nullptr) if (sw == nullptr)
@@ -77268,7 +77269,8 @@ bool OpenGLComponent::makeCurrentContextActive()


if (context != nullptr) if (context != nullptr)
{ {
updateContextPosition();
if (! useThread)
updateContextPosition();


if (context->makeActive()) if (context->makeActive())
newOpenGLContextCreated(); newOpenGLContextCreated();
@@ -77389,6 +77391,8 @@ bool OpenGLComponent::renderAndSwapBuffers()


void OpenGLComponent::stopRendering() void OpenGLComponent::stopRendering()
{ {
componentWatcher->cancelPendingUpdate();

if (renderThread != nullptr) if (renderThread != nullptr)
renderThread->stopThread (5000); renderThread->stopThread (5000);


@@ -268246,13 +268250,13 @@ namespace
const int deviceIndexToOpen) const int deviceIndexToOpen)
{ {
snd_seq_t* returnedHandle = nullptr; snd_seq_t* returnedHandle = nullptr;
snd_seq_t* seqHandle;
snd_seq_t* seqHandle = nullptr;


if (snd_seq_open (&seqHandle, "default", forInput ? SND_SEQ_OPEN_INPUT if (snd_seq_open (&seqHandle, "default", forInput ? SND_SEQ_OPEN_INPUT
: SND_SEQ_OPEN_OUTPUT, 0) == 0) : SND_SEQ_OPEN_OUTPUT, 0) == 0)
{ {
snd_seq_system_info_t* systemInfo;
snd_seq_client_info_t* clientInfo;
snd_seq_system_info_t* systemInfo = nullptr;
snd_seq_client_info_t* clientInfo = nullptr;


if (snd_seq_system_info_malloc (&systemInfo) == 0) if (snd_seq_system_info_malloc (&systemInfo) == 0)
{ {
@@ -268290,19 +268294,26 @@ namespace


if (sourcePort != -1) if (sourcePort != -1)
{ {
snd_seq_set_client_name (seqHandle,
forInput ? "Juce Midi Input"
: "Juce Midi Output");
if (forInput)
{
snd_seq_set_client_name (seqHandle, "Juce Midi Input");

const int portId = snd_seq_create_simple_port (seqHandle, "Juce Midi In Port",
SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE,
SND_SEQ_PORT_TYPE_MIDI_GENERIC);


const int portId
= snd_seq_create_simple_port (seqHandle,
forInput ? "Juce Midi In Port"
: "Juce Midi Out Port",
forInput ? (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE)
: (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ),
SND_SEQ_PORT_TYPE_MIDI_GENERIC);
snd_seq_connect_from (seqHandle, portId, sourceClient, sourcePort);
}
else
{
snd_seq_set_client_name (seqHandle, "Juce Midi Output");


snd_seq_connect_from (seqHandle, portId, sourceClient, sourcePort);
const int portId = snd_seq_create_simple_port (seqHandle, "Juce Midi Out Port",
SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ,
SND_SEQ_PORT_TYPE_MIDI_GENERIC);

snd_seq_connect_to (seqHandle, portId, sourceClient, sourcePort);
}


returnedHandle = seqHandle; returnedHandle = seqHandle;
} }
@@ -274272,19 +274283,18 @@ void UIViewComponentPeer::handleTouches (UIEvent* event, const bool isDown, cons
currentTouches.add (touch); currentTouches.add (touch);
} }


if ([touch phase] == UITouchPhaseBegan
|| [touch phase] == UITouchPhaseStationary
|| [touch phase] == UITouchPhaseMoved)
if (isDown)
{ {
currentModifiers = currentModifiers.withoutMouseButtons(); currentModifiers = currentModifiers.withoutMouseButtons();
handleMouseEvent (touchIndex, pos, currentModifiers, time); handleMouseEvent (touchIndex, pos, currentModifiers, time);
currentModifiers = currentModifiers.withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier); currentModifiers = currentModifiers.withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
} }
else if ([touch phase] == UITouchPhaseEnded
|| [touch phase] == UITouchPhaseCancelled)
else if (isUp)
{ {
currentModifiers = currentModifiers.withoutMouseButtons();
currentTouches.remove (touchIndex); currentTouches.remove (touchIndex);

if (currentTouches.size() == 0)
currentModifiers = currentModifiers.withoutMouseButtons();
} }


if (isCancel) if (isCancel)


+ 15
- 4
juce_amalgamated.h View File

@@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53 #define JUCE_MINOR_VERSION 53
#define JUCE_BUILDNUMBER 81
#define JUCE_BUILDNUMBER 82


/** Current Juce version number. /** Current Juce version number.


@@ -8860,11 +8860,16 @@ public:
/** If this variant is a method pointer, this invokes it on a target object. */ /** If this variant is a method pointer, this invokes it on a target object. */
const var invoke (const var& targetObject, const var* arguments, int numArguments) const; const var invoke (const var& targetObject, const var* arguments, int numArguments) const;


/** Returns true if this var has the same value as the one supplied. */
/** Returns true if this var has the same value as the one supplied.
Note that this ignores the type, so a string var "123" and an integer var with the
value 123 are considered to be equal.
@see equalsWithSameType
*/
bool equals (const var& other) const noexcept; bool equals (const var& other) const noexcept;


/** Returns true if this var has the same value and type as the one supplied. /** Returns true if this var has the same value and type as the one supplied.
This differs from equals() because e.g. "0" and 0 will be considered different.
This differs from equals() because e.g. "123" and 123 will be considered different.
@see equals
*/ */
bool equalsWithSameType (const var& other) const noexcept; bool equalsWithSameType (const var& other) const noexcept;


@@ -8905,7 +8910,9 @@ private:
ValueUnion value; ValueUnion value;
}; };


/** Compares the values of two var objects, using the var::equals() comparison. */
bool operator== (const var& v1, const var& v2) noexcept; bool operator== (const var& v1, const var& v2) noexcept;
/** Compares the values of two var objects, using the var::equals() comparison. */
bool operator!= (const var& v1, const var& v2) noexcept; bool operator!= (const var& v1, const var& v2) noexcept;
bool operator== (const var& v1, const String& v2); bool operator== (const var& v1, const String& v2);
bool operator!= (const var& v1, const String& v2); bool operator!= (const var& v1, const String& v2);
@@ -22635,6 +22642,11 @@ public:
*/ */
const String getThreadName() const { return threadName_; } const String getThreadName() const { return threadName_; }


/** Changes the name of the caller thread.
Different OSes may place different length or content limits on this name.
*/
static void setCurrentThreadName (const String& newThreadName);

/** Returns the number of currently-running threads. /** Returns the number of currently-running threads.


@returns the number of Thread objects known to be currently running. @returns the number of Thread objects known to be currently running.
@@ -22668,7 +22680,6 @@ private:
void closeThreadHandle(); void closeThreadHandle();
void killThread(); void killThread();
void threadEntryPoint(); void threadEntryPoint();
static void setCurrentThreadName (const String& name);
static bool setThreadPriority (void* handle, int priority); static bool setThreadPriority (void* handle, int priority);


JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Thread); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Thread);


+ 3
- 6
src/audio/plugin_client/VST/juce_VST_Wrapper.cpp View File

@@ -239,13 +239,10 @@ namespace
void registerMouseWheelHook() void registerMouseWheelHook()
{ {
#ifndef WH_MOUSE_LL
#define WH_MOUSE_LL 14
#endif
if (mouseHookUsers++ == 0) if (mouseHookUsers++ == 0)
mouseWheelHook = SetWindowsHookEx (WH_MOUSE_LL, mouseWheelHookCallback,
(HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(), 0);
mouseWheelHook = SetWindowsHookEx (7 /*WH_MOUSE*/, mouseWheelHookCallback,
(HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(),
GetCurrentThreadId());
} }
void unregisterMouseWheelHook() void unregisterMouseWheelHook()


+ 10
- 12
src/audio/plugin_client/VST/juce_VST_Wrapper.mm View File

@@ -203,25 +203,23 @@ void setNativeHostWindowSize (void* nsWindow, Component* component, int newWidth
#if JUCE_64BIT #if JUCE_64BIT
NSView* hostView = (NSView*) nsWindow; NSView* hostView = (NSView*) nsWindow;
if (hostView != 0)
if (hostView != nil)
{ {
// xxx is this necessary, or do the hosts detect a change in the child view and do this automatically? // xxx is this necessary, or do the hosts detect a change in the child view and do this automatically?
[hostView setFrameSize: NSMakeSize ([hostView frame].size.width + (newWidth - component->getWidth()), [hostView setFrameSize: NSMakeSize ([hostView frame].size.width + (newWidth - component->getWidth()),
[hostView frame].size.height + (newHeight - component->getHeight()))]; [hostView frame].size.height + (newHeight - component->getHeight()))];
} }
#else #else
NSWindow* hostWindow = (NSWindow*) nsWindow;
if (hostWindow != 0)
HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int)
component->getProperties() ["dummyViewRef"].toString().getHexValue64();
if (dummyView != 0)
{ {
// Can't use the cocoa NSWindow resizing code, or it messes up in Live.
Rect r;
GetWindowBounds ((WindowRef) [hostWindow windowRef], kWindowContentRgn, &r);
r.right += newWidth - component->getWidth();
r.bottom += newHeight - component->getHeight();
SetWindowBounds ((WindowRef) [hostWindow windowRef], kWindowContentRgn, &r);
r.left = r.top = 0;
InvalWindowRect ((WindowRef) [hostWindow windowRef], &r);
HIRect frameRect;
HIViewGetFrame (dummyView, &frameRect);
frameRect.size.width = newWidth;
frameRect.size.height = newHeight;
HIViewSetFrame (dummyView, &frameRect);
} }
#endif #endif
} }


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

@@ -41,7 +41,7 @@ DynamicObject::~DynamicObject()
bool DynamicObject::hasProperty (const Identifier& propertyName) const bool DynamicObject::hasProperty (const Identifier& propertyName) const
{ {
var* const v = properties.getVarPointer (propertyName);
const var* const v = properties.getVarPointer (propertyName);
return v != nullptr && ! v->isMethod(); return v != nullptr && ! v->isMethod();
} }


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

@@ -123,7 +123,7 @@ const var& NamedValueSet::operator[] (const Identifier& name) const
const var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultReturnValue) const const var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultReturnValue) const
{ {
const var* v = getVarPointer (name);
const var* const v = getVarPointer (name);
return v != nullptr ? *v : defaultReturnValue; return v != nullptr ? *v : defaultReturnValue;
} }


+ 2
- 2
src/containers/juce_ValueTree.cpp View File

@@ -340,12 +340,12 @@ void ValueTree::SharedObject::setProperty (const Identifier& name, const var& ne
} }
else else
{ {
var* const existingValue = properties.getVarPointer (name);
const var* const existingValue = properties.getVarPointer (name);
if (existingValue != nullptr) if (existingValue != nullptr)
{ {
if (*existingValue != newValue) if (*existingValue != newValue)
undoManager->perform (new SetPropertyAction (this, name, newValue, properties [name], false, false));
undoManager->perform (new SetPropertyAction (this, name, newValue, *existingValue, false, false));
} }
else else
{ {


+ 9
- 2
src/containers/juce_Variant.h View File

@@ -143,11 +143,16 @@ public:
const var invoke (const var& targetObject, const var* arguments, int numArguments) const; const var invoke (const var& targetObject, const var* arguments, int numArguments) const;
//============================================================================== //==============================================================================
/** Returns true if this var has the same value as the one supplied. */
/** Returns true if this var has the same value as the one supplied.
Note that this ignores the type, so a string var "123" and an integer var with the
value 123 are considered to be equal.
@see equalsWithSameType
*/
bool equals (const var& other) const noexcept; bool equals (const var& other) const noexcept;
/** Returns true if this var has the same value and type as the one supplied. /** Returns true if this var has the same value and type as the one supplied.
This differs from equals() because e.g. "0" and 0 will be considered different.
This differs from equals() because e.g. "123" and 123 will be considered different.
@see equals
*/ */
bool equalsWithSameType (const var& other) const noexcept; bool equalsWithSameType (const var& other) const noexcept;
@@ -188,7 +193,9 @@ private:
ValueUnion value; ValueUnion value;
}; };
/** Compares the values of two var objects, using the var::equals() comparison. */
bool operator== (const var& v1, const var& v2) noexcept; bool operator== (const var& v1, const var& v2) noexcept;
/** Compares the values of two var objects, using the var::equals() comparison. */
bool operator!= (const var& v1, const var& v2) noexcept; bool operator!= (const var& v1, const var& v2) noexcept;
bool operator== (const var& v1, const String& v2); bool operator== (const var& v1, const String& v2);
bool operator!= (const var& v1, const String& v2); bool operator!= (const var& v1, const String& v2);


+ 5
- 5
src/core/juce_RelativeTime.cpp View File

@@ -47,12 +47,12 @@ RelativeTime::~RelativeTime() noexcept
} }
//============================================================================== //==============================================================================
const RelativeTime RelativeTime::milliseconds (const int milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); }
const RelativeTime RelativeTime::milliseconds (const int milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); }
const RelativeTime RelativeTime::milliseconds (const int64 milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); } const RelativeTime RelativeTime::milliseconds (const int64 milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); }
const RelativeTime RelativeTime::minutes (const double numberOfMinutes) noexcept { return RelativeTime (numberOfMinutes * 60.0); }
const RelativeTime RelativeTime::hours (const double numberOfHours) noexcept { return RelativeTime (numberOfHours * (60.0 * 60.0)); }
const RelativeTime RelativeTime::days (const double numberOfDays) noexcept { return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0)); }
const RelativeTime RelativeTime::weeks (const double numberOfWeeks) noexcept { return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0)); }
const RelativeTime RelativeTime::minutes (const double numberOfMinutes) noexcept { return RelativeTime (numberOfMinutes * 60.0); }
const RelativeTime RelativeTime::hours (const double numberOfHours) noexcept { return RelativeTime (numberOfHours * (60.0 * 60.0)); }
const RelativeTime RelativeTime::days (const double numberOfDays) noexcept { return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0)); }
const RelativeTime RelativeTime::weeks (const double numberOfWeeks) noexcept { return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0)); }
//============================================================================== //==============================================================================
int64 RelativeTime::inMilliseconds() const noexcept { return (int64) (seconds * 1000.0); } int64 RelativeTime::inMilliseconds() const noexcept { return (int64) (seconds * 1000.0); }


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53 #define JUCE_MINOR_VERSION 53
#define JUCE_BUILDNUMBER 81
#define JUCE_BUILDNUMBER 82
/** Current Juce version number. /** Current Juce version number.


+ 1
- 1
src/gui/components/juce_Component.cpp View File

@@ -2038,7 +2038,7 @@ void Component::sendLookAndFeelChange()
const Colour Component::findColour (const int colourId, const bool inheritFromParent) const const Colour Component::findColour (const int colourId, const bool inheritFromParent) const
{ {
var* const v = properties.getVarPointer (ComponentHelpers::getColourPropertyId (colourId));
const var* const v = properties.getVarPointer (ComponentHelpers::getColourPropertyId (colourId));
if (v != nullptr) if (v != nullptr)
return Colour ((int) *v); return Colour ((int) *v);


+ 13
- 12
src/gui/components/special/juce_DropShadower.cpp View File

@@ -260,21 +260,22 @@ void DropShadower::updateShadows()
// callbacks during this loop, so use a weak ref to watch out for this.. // callbacks during this loop, so use a weak ref to watch out for this..
WeakReference<Component> sw (shadowWindows[i]); WeakReference<Component> sw (shadowWindows[i]);
if (sw == nullptr)
return;
sw->setAlwaysOnTop (owner->isAlwaysOnTop());
if (sw != nullptr)
sw->setAlwaysOnTop (owner->isAlwaysOnTop());
if (sw == nullptr)
return;
if (sw != nullptr)
sw->setVisible (isOwnerVisible);
switch (i)
if (sw != nullptr)
{ {
case 0: sw->setBounds (x - shadowEdge, y, shadowEdge, h); break;
case 1: sw->setBounds (x + w, y, shadowEdge, h); break;
case 2: sw->setBounds (x, y, w, shadowEdge); break;
case 3: sw->setBounds (x, owner->getBottom(), w, shadowEdge); break;
default: break;
switch (i)
{
case 0: sw->setBounds (x - shadowEdge, y, shadowEdge, h); break;
case 1: sw->setBounds (x + w, y, shadowEdge, h); break;
case 2: sw->setBounds (x, y, w, shadowEdge); break;
case 3: sw->setBounds (x, owner->getBottom(), w, shadowEdge); break;
default: break;
}
} }
if (sw == nullptr) if (sw == nullptr)


+ 4
- 1
src/gui/components/special/juce_OpenGLComponent.cpp View File

@@ -295,7 +295,8 @@ bool OpenGLComponent::makeCurrentContextActive()
if (context != nullptr) if (context != nullptr)
{ {
updateContextPosition();
if (! useThread)
updateContextPosition();
if (context->makeActive()) if (context->makeActive())
newOpenGLContextCreated(); newOpenGLContextCreated();
@@ -416,6 +417,8 @@ bool OpenGLComponent::renderAndSwapBuffers()
void OpenGLComponent::stopRendering() void OpenGLComponent::stopRendering()
{ {
componentWatcher->cancelPendingUpdate();
if (renderThread != nullptr) if (renderThread != nullptr)
renderThread->stopThread (5000); renderThread->stopThread (5000);


+ 23
- 16
src/native/linux/juce_linux_Midi.cpp View File

@@ -36,13 +36,13 @@ namespace
const int deviceIndexToOpen) const int deviceIndexToOpen)
{ {
snd_seq_t* returnedHandle = nullptr; snd_seq_t* returnedHandle = nullptr;
snd_seq_t* seqHandle;
snd_seq_t* seqHandle = nullptr;
if (snd_seq_open (&seqHandle, "default", forInput ? SND_SEQ_OPEN_INPUT if (snd_seq_open (&seqHandle, "default", forInput ? SND_SEQ_OPEN_INPUT
: SND_SEQ_OPEN_OUTPUT, 0) == 0) : SND_SEQ_OPEN_OUTPUT, 0) == 0)
{ {
snd_seq_system_info_t* systemInfo;
snd_seq_client_info_t* clientInfo;
snd_seq_system_info_t* systemInfo = nullptr;
snd_seq_client_info_t* clientInfo = nullptr;
if (snd_seq_system_info_malloc (&systemInfo) == 0) if (snd_seq_system_info_malloc (&systemInfo) == 0)
{ {
@@ -80,19 +80,26 @@ namespace
if (sourcePort != -1) if (sourcePort != -1)
{ {
snd_seq_set_client_name (seqHandle,
forInput ? "Juce Midi Input"
: "Juce Midi Output");
const int portId
= snd_seq_create_simple_port (seqHandle,
forInput ? "Juce Midi In Port"
: "Juce Midi Out Port",
forInput ? (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE)
: (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ),
SND_SEQ_PORT_TYPE_MIDI_GENERIC);
snd_seq_connect_from (seqHandle, portId, sourceClient, sourcePort);
if (forInput)
{
snd_seq_set_client_name (seqHandle, "Juce Midi Input");
const int portId = snd_seq_create_simple_port (seqHandle, "Juce Midi In Port",
SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE,
SND_SEQ_PORT_TYPE_MIDI_GENERIC);
snd_seq_connect_from (seqHandle, portId, sourceClient, sourcePort);
}
else
{
snd_seq_set_client_name (seqHandle, "Juce Midi Output");
const int portId = snd_seq_create_simple_port (seqHandle, "Juce Midi Out Port",
SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ,
SND_SEQ_PORT_TYPE_MIDI_GENERIC);
snd_seq_connect_to (seqHandle, portId, sourceClient, sourcePort);
}
returnedHandle = seqHandle; returnedHandle = seqHandle;
} }


+ 5
- 6
src/native/mac/juce_ios_UIViewComponentPeer.mm View File

@@ -749,19 +749,18 @@ void UIViewComponentPeer::handleTouches (UIEvent* event, const bool isDown, cons
currentTouches.add (touch); currentTouches.add (touch);
} }
if ([touch phase] == UITouchPhaseBegan
|| [touch phase] == UITouchPhaseStationary
|| [touch phase] == UITouchPhaseMoved)
if (isDown)
{ {
currentModifiers = currentModifiers.withoutMouseButtons(); currentModifiers = currentModifiers.withoutMouseButtons();
handleMouseEvent (touchIndex, pos, currentModifiers, time); handleMouseEvent (touchIndex, pos, currentModifiers, time);
currentModifiers = currentModifiers.withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier); currentModifiers = currentModifiers.withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
} }
else if ([touch phase] == UITouchPhaseEnded
|| [touch phase] == UITouchPhaseCancelled)
else if (isUp)
{ {
currentModifiers = currentModifiers.withoutMouseButtons();
currentTouches.remove (touchIndex); currentTouches.remove (touchIndex);
if (currentTouches.size() == 0)
currentModifiers = currentModifiers.withoutMouseButtons();
} }
if (isCancel) if (isCancel)


+ 5
- 1
src/threads/juce_Thread.h View File

@@ -257,6 +257,11 @@ public:
*/ */
const String getThreadName() const { return threadName_; } const String getThreadName() const { return threadName_; }
/** Changes the name of the caller thread.
Different OSes may place different length or content limits on this name.
*/
static void setCurrentThreadName (const String& newThreadName);
//============================================================================== //==============================================================================
/** Returns the number of currently-running threads. /** Returns the number of currently-running threads.
@@ -292,7 +297,6 @@ private:
void closeThreadHandle(); void closeThreadHandle();
void killThread(); void killThread();
void threadEntryPoint(); void threadEntryPoint();
static void setCurrentThreadName (const String& name);
static bool setThreadPriority (void* handle, int priority); static bool setThreadPriority (void* handle, int priority);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Thread); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Thread);


Loading…
Cancel
Save