diff --git a/src/audio/plugin_host/formats/juce_AudioUnitPluginFormat.mm b/src/audio/plugin_host/formats/juce_AudioUnitPluginFormat.mm index b810e738b0..660b858d44 100644 --- a/src/audio/plugin_host/formats/juce_AudioUnitPluginFormat.mm +++ b/src/audio/plugin_host/formats/juce_AudioUnitPluginFormat.mm @@ -72,10 +72,10 @@ namespace AudioUnitFormatHelpers const String osTypeToString (OSType type) { - const juce_wchar s[4] = { (juce_wchar) (((uint32) type) >> 24), - (juce_wchar) (((uint32) type) >> 16), - (juce_wchar) (((uint32) type) >> 8), - (juce_wchar) ((uint32) type) }; + const juce_wchar s[4] = { (juce_wchar) ((type >> 24) & 0xff), + (juce_wchar) ((type >> 16) & 0xff), + (juce_wchar) ((type >> 8) & 0xff), + (juce_wchar) (type & 0xff) }; return String (s, 4); } diff --git a/src/native/mac/juce_ios_UIViewComponentPeer.mm b/src/native/mac/juce_ios_UIViewComponentPeer.mm index 5062dc85a5..f2ed60e0de 100644 --- a/src/native/mac/juce_ios_UIViewComponentPeer.mm +++ b/src/native/mac/juce_ios_UIViewComponentPeer.mm @@ -745,8 +745,11 @@ void UIViewComponentPeer::handleTouches (UIEvent* event, const bool isDown, cons if (touchIndex < 0) { - touchIndex = currentTouches.size(); - currentTouches.add (touch); + for (touchIndex = 0; touchIndex < currentTouches.size(); ++touchIndex) + if (currentTouches.getUnchecked (touchIndex) == nil) + break; + + currentTouches.set (touchIndex, touch); } if (isDown) @@ -757,14 +760,22 @@ void UIViewComponentPeer::handleTouches (UIEvent* event, const bool isDown, cons } else if (isUp) { - currentTouches.remove (touchIndex); - - if (currentTouches.size() == 0) - currentModifiers = currentModifiers.withoutMouseButtons(); + currentTouches.set (touchIndex, nil); + + int totalActiveTouches = 0; + for (int j = currentTouches.size(); --j >= 0;) + if (currentTouches.getUnchecked(j) != nil) + ++totalActiveTouches; + + if (totalActiveTouches == 0) + isCancel = true; } if (isCancel) + { currentTouches.clear(); + currentModifiers = currentModifiers.withoutMouseButtons(); + } handleMouseEvent (touchIndex, pos, currentModifiers, time); }