Browse Source

Multi-touch handling changes for Component class. 64-bit VST keypress fix.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
b317b47533
26 changed files with 414 additions and 403 deletions
  1. +214
    -200
      juce_amalgamated.cpp
  2. +20
    -22
      juce_amalgamated.h
  3. +15
    -0
      src/audio/audio_file_formats/juce_CoreAudioFormat.cpp
  4. +3
    -4
      src/audio/plugin_client/VST/juce_VST_Wrapper.cpp
  5. +5
    -2
      src/audio/plugin_client/VST/juce_VST_Wrapper.mm
  6. +1
    -1
      src/core/juce_StandardHeader.h
  7. +97
    -123
      src/gui/components/juce_Component.cpp
  8. +2
    -5
      src/gui/components/juce_Component.h
  9. +16
    -10
      src/gui/components/juce_Desktop.cpp
  10. +1
    -0
      src/gui/components/juce_Desktop.h
  11. +1
    -1
      src/gui/components/keyboard/juce_ModifierKeys.cpp
  12. +7
    -7
      src/gui/components/keyboard/juce_ModifierKeys.h
  13. +9
    -5
      src/gui/components/mouse/juce_MouseInputSource.cpp
  14. +3
    -3
      src/gui/components/mouse/juce_MouseInputSource.h
  15. +1
    -1
      src/gui/graphics/fonts/juce_GlyphArrangement.cpp
  16. +2
    -2
      src/gui/graphics/fonts/juce_GlyphArrangement.h
  17. +4
    -4
      src/gui/graphics/geometry/juce_Rectangle.h
  18. +2
    -2
      src/native/android/juce_android_Windowing.cpp
  19. +2
    -2
      src/native/linux/juce_linux_Windowing.cpp
  20. +1
    -1
      src/native/mac/juce_ios_UIViewComponentPeer.mm
  21. +1
    -1
      src/native/mac/juce_ios_Windowing.mm
  22. +2
    -2
      src/native/mac/juce_mac_CoreGraphicsContext.mm
  23. +1
    -1
      src/native/mac/juce_mac_NSViewComponent.mm
  24. +1
    -1
      src/native/mac/juce_mac_NSViewComponentPeer.mm
  25. +1
    -1
      src/native/mac/juce_mac_Windowing.mm
  26. +2
    -2
      src/native/windows/juce_win32_Windowing.cpp

+ 214
- 200
juce_amalgamated.cpp View File

@@ -41477,7 +41477,7 @@ public:
&& comp.hitTest (localPoint.getX(), localPoint.getY());
}

static const Point<int> convertFromParentSpace (const Component& comp, const Point<int>& pointInParentSpace)
static Point<int> convertFromParentSpace (const Component& comp, const Point<int>& pointInParentSpace)
{
if (comp.affineTransform == nullptr)
return pointInParentSpace - comp.getPosition();
@@ -41485,7 +41485,7 @@ public:
return pointInParentSpace.toFloat().transformedBy (comp.affineTransform->inverted()).toInt() - comp.getPosition();
}

static const Rectangle<int> convertFromParentSpace (const Component& comp, const Rectangle<int>& areaInParentSpace)
static Rectangle<int> convertFromParentSpace (const Component& comp, const Rectangle<int>& areaInParentSpace)
{
if (comp.affineTransform == nullptr)
return areaInParentSpace - comp.getPosition();
@@ -41493,7 +41493,7 @@ public:
return areaInParentSpace.toFloat().transformed (comp.affineTransform->inverted()).getSmallestIntegerContainer() - comp.getPosition();
}

static const Point<int> convertToParentSpace (const Component& comp, const Point<int>& pointInLocalSpace)
static Point<int> convertToParentSpace (const Component& comp, const Point<int>& pointInLocalSpace)
{
if (comp.affineTransform == nullptr)
return pointInLocalSpace + comp.getPosition();
@@ -41501,7 +41501,7 @@ public:
return (pointInLocalSpace + comp.getPosition()).toFloat().transformedBy (*comp.affineTransform).toInt();
}

static const Rectangle<int> convertToParentSpace (const Component& comp, const Rectangle<int>& areaInLocalSpace)
static Rectangle<int> convertToParentSpace (const Component& comp, const Rectangle<int>& areaInLocalSpace)
{
if (comp.affineTransform == nullptr)
return areaInLocalSpace + comp.getPosition();
@@ -41510,7 +41510,7 @@ public:
}

template <typename Type>
static const Type convertFromDistantParentSpace (const Component* parent, const Component& target, Type coordInParent)
static Type convertFromDistantParentSpace (const Component* parent, const Component& target, const Type& coordInParent)
{
const Component* const directParent = target.getParentComponent();
jassert (directParent != nullptr);
@@ -41522,7 +41522,7 @@ public:
}

template <typename Type>
static const Type convertCoordinate (const Component* target, const Component* source, Type p)
static Type convertCoordinate (const Component* target, const Component* source, Type p)
{
while (source != nullptr)
{
@@ -43528,66 +43528,41 @@ void Component::internalMouseEnter (MouseInputSource& source, const Point<int>&
return;
}

if (! flags.mouseInsideFlag)
{
flags.mouseInsideFlag = true;
flags.mouseOverFlag = true;
flags.mouseDownFlag = false;

BailOutChecker checker (this);
if (flags.repaintOnMouseActivityFlag)
repaint();

if (flags.repaintOnMouseActivityFlag)
repaint();
BailOutChecker checker (this);

const MouseEvent me (source, relativePos, source.getCurrentModifiers(),
this, this, time, relativePos, time, 0, false);
mouseEnter (me);
const MouseEvent me (source, relativePos, source.getCurrentModifiers(),
this, this, time, relativePos, time, 0, false);
mouseEnter (me);

if (checker.shouldBailOut())
return;
if (checker.shouldBailOut())
return;

Desktop& desktop = Desktop::getInstance();
desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseEnter, me);
Desktop::getInstance().getMouseListeners().callChecked (checker, &MouseListener::mouseEnter, me);

MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseEnter, me);
}
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseEnter, me);
}

void Component::internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
{
BailOutChecker checker (this);

if (flags.mouseDownFlag)
{
internalMouseUp (source, relativePos, time, source.getCurrentModifiers().getRawFlags());

if (checker.shouldBailOut())
return;
}
if (flags.repaintOnMouseActivityFlag)
repaint();

if (flags.mouseInsideFlag || flags.mouseOverFlag)
{
flags.mouseInsideFlag = false;
flags.mouseOverFlag = false;
flags.mouseDownFlag = false;
BailOutChecker checker (this);

if (flags.repaintOnMouseActivityFlag)
repaint();
const MouseEvent me (source, relativePos, source.getCurrentModifiers(),
this, this, time, relativePos, time, 0, false);

const MouseEvent me (source, relativePos, source.getCurrentModifiers(),
this, this, time, relativePos, time, 0, false);
mouseExit (me);
mouseExit (me);

if (checker.shouldBailOut())
return;
if (checker.shouldBailOut())
return;

Desktop& desktop = Desktop::getInstance();
desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseExit, me);
Desktop::getInstance().getMouseListeners().callChecked (checker, &MouseListener::mouseExit, me);

MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseExit, me);
}
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseExit, me);
}

void Component::internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
@@ -43612,8 +43587,7 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
this, this, time, relativePos, time,
source.getNumberOfMultipleClicks(), false);

desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDown, me);
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseDown, me);
return;
}
}
@@ -43643,9 +43617,6 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
return;
}

flags.mouseDownFlag = true;
flags.mouseOverFlag = true;

if (flags.repaintOnMouseActivityFlag)
repaint();

@@ -43657,84 +43628,70 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
if (checker.shouldBailOut())
return;

desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDown, me);
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseDown, me);

MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDown, me);
}

void Component::internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers)
{
if (flags.mouseDownFlag)
{
flags.mouseDownFlag = false;
BailOutChecker checker (this);

BailOutChecker checker (this);
if (flags.repaintOnMouseActivityFlag)
repaint();

if (flags.repaintOnMouseActivityFlag)
repaint();
const MouseEvent me (source, relativePos,
oldModifiers, this, this, time,
getLocalPoint (nullptr, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed());

const MouseEvent me (source, relativePos,
oldModifiers, this, this, time,
getLocalPoint (nullptr, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed());
mouseUp (me);

if (checker.shouldBailOut())
return;

mouseUp (me);
Desktop& desktop = Desktop::getInstance();
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseUp, me);

if (checker.shouldBailOut())
return;
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseUp, me);

Desktop& desktop = Desktop::getInstance();
desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseUp, me);
if (checker.shouldBailOut())
return;

MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseUp, me);
// check for double-click
if (me.getNumberOfClicks() >= 2)
{
mouseDoubleClick (me);

if (checker.shouldBailOut())
return;

// check for double-click
if (me.getNumberOfClicks() >= 2)
{
mouseDoubleClick (me);

if (checker.shouldBailOut())
return;

desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDoubleClick, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDoubleClick, me);
}
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDoubleClick, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDoubleClick, me);
}
}

void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
{
if (flags.mouseDownFlag)
{
flags.mouseOverFlag = reallyContains (relativePos, false);

BailOutChecker checker (this);
BailOutChecker checker (this);

const MouseEvent me (source, relativePos,
source.getCurrentModifiers(), this, this, time,
getLocalPoint (nullptr, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed());
const MouseEvent me (source, relativePos,
source.getCurrentModifiers(), this, this, time,
getLocalPoint (nullptr, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed());

mouseDrag (me);
mouseDrag (me);

if (checker.shouldBailOut())
return;
if (checker.shouldBailOut())
return;

Desktop& desktop = Desktop::getInstance();
desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDrag, me);
Desktop::getInstance().getMouseListeners().callChecked (checker, &MouseListener::mouseDrag, me);

MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDrag, me);
}
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDrag, me);
}

void Component::internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
@@ -43752,15 +43709,12 @@ void Component::internalMouseMove (MouseInputSource& source, const Point<int>& r
}
else
{
flags.mouseOverFlag = true;

mouseMove (me);

if (checker.shouldBailOut())
return;

desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseMove, me);
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseMove, me);

MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseMove, me);
}
@@ -44138,27 +44092,47 @@ void Component::giveAwayFocus (const bool sendFocusLossEvent)

bool Component::isMouseOver (const bool includeChildren) const
{
if (flags.mouseOverFlag)
return true;
const Desktop& desktop = Desktop::getInstance();

if (includeChildren)
for (int i = desktop.getNumMouseSources(); --i >= 0;)
{
Desktop& desktop = Desktop::getInstance();
const MouseInputSource* const mi = desktop.getMouseSource(i);

for (int i = desktop.getNumMouseSources(); --i >= 0;)
{
Component* const c = desktop.getMouseSource(i)->getComponentUnderMouse();
Component* const c = mi->getComponentUnderMouse();

if (isParentOf (c) && c->flags.mouseOverFlag) // (mouseOverFlag checked in case it's being dragged outside the comp)
return true;
}
if ((c == this || (includeChildren && isParentOf (c)))
&& c->reallyContains (c->getLocalPoint (nullptr, mi->getScreenPosition()), false))
return true;
}

return false;
}

bool Component::isMouseButtonDown() const
{
const Desktop& desktop = Desktop::getInstance();

for (int i = desktop.getNumMouseSources(); --i >= 0;)
{
const MouseInputSource* const mi = desktop.getMouseSource(i);

if (mi->isDragging() && mi->getComponentUnderMouse() == this)
return true;
}

return false;
}

bool Component::isMouseButtonDown() const noexcept { return flags.mouseDownFlag; }
bool Component::isMouseOverOrDragging() const noexcept { return flags.mouseOverFlag || flags.mouseDownFlag; }
bool Component::isMouseOverOrDragging() const
{
const Desktop& desktop = Desktop::getInstance();

for (int i = desktop.getNumMouseSources(); --i >= 0;)
if (desktop.getMouseSource(i)->getComponentUnderMouse() == this)
return true;

return false;
}

bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() noexcept
{
@@ -44566,6 +44540,22 @@ void Desktop::handleAsyncUpdate()
focusListeners.call (&FocusChangeListener::globalFocusChanged, currentFocus);
}

void Desktop::resetTimer()
{
if (mouseListeners.size() == 0)
stopTimer();
else
startTimer (100);

lastFakeMouseMove = getMousePosition();
}

ListenerList <MouseListener>& Desktop::getMouseListeners()
{
resetTimer();
return mouseListeners;
}

void Desktop::addGlobalMouseListener (MouseListener* const listener)
{
mouseListeners.add (listener);
@@ -44611,16 +44601,6 @@ void Desktop::sendMouseMove()
}
}

void Desktop::resetTimer()
{
if (mouseListeners.size() == 0)
stopTimer();
else
startTimer (100);

lastFakeMouseMove = getMousePosition();
}

void Desktop::setKioskModeComponent (Component* componentToUse, const bool allowMenusAndBars)
{
if (kioskModeComponent != componentToUse)
@@ -63082,7 +63062,7 @@ ModifierKeys& ModifierKeys::operator= (const ModifierKeys& other) noexcept

ModifierKeys ModifierKeys::currentModifiers;

const ModifierKeys ModifierKeys::getCurrentModifiers() noexcept
ModifierKeys ModifierKeys::getCurrentModifiers() noexcept
{
return currentModifiers;
}
@@ -73580,7 +73560,7 @@ public:
return static_cast <Component*> (componentUnderMouse);
}

const ModifierKeys getCurrentModifiers() const
ModifierKeys getCurrentModifiers() const
{
return ModifierKeys::getCurrentModifiers().withoutMouseButtons().withFlags (buttonState.getRawFlags());
}
@@ -73610,7 +73590,7 @@ public:
return nullptr;
}

const Point<int> getScreenPosition() const
Point<int> getScreenPosition() const
{
// This needs to return the live position if possible, but it mustn't update the lastScreenPos
// value, because that can cause continuity problems.
@@ -73716,8 +73696,12 @@ public:

if (current != nullptr)
{
WeakReference<Component> safeOldComp (current);
setButtons (screenPos, time, ModifierKeys());
sendMouseExit (current, screenPos, time);

if (safeOldComp != nullptr)
sendMouseExit (current, screenPos, time);

buttonState = originalButtonState;
}

@@ -74019,8 +74003,8 @@ bool MouseInputSource::canHover() const { return isMouse(); }
bool MouseInputSource::hasMouseWheel() const { return isMouse(); }
int MouseInputSource::getIndex() const { return pimpl->index; }
bool MouseInputSource::isDragging() const { return pimpl->isDragging(); }
const Point<int> MouseInputSource::getScreenPosition() const { return pimpl->getScreenPosition(); }
const ModifierKeys MouseInputSource::getCurrentModifiers() const { return pimpl->getCurrentModifiers(); }
Point<int> MouseInputSource::getScreenPosition() const { return pimpl->getScreenPosition(); }
ModifierKeys MouseInputSource::getCurrentModifiers() const { return pimpl->getCurrentModifiers(); }
Component* MouseInputSource::getComponentUnderMouse() const { return pimpl->getComponentUnderMouse(); }
void MouseInputSource::triggerFakeMove() const { pimpl->triggerFakeMove(); }
int MouseInputSource::getNumberOfMultipleClicks() const noexcept { return pimpl->getNumberOfMultipleClicks(); }
@@ -93447,7 +93431,7 @@ void GlyphArrangement::stretchRangeOfGlyphs (int startIndex, int num,
}
}

const Rectangle<float> GlyphArrangement::getBoundingBox (int startIndex, int num, const bool includeWhitespace) const
Rectangle<float> GlyphArrangement::getBoundingBox (int startIndex, int num, const bool includeWhitespace) const
{
jassert (startIndex >= 0);

@@ -108537,6 +108521,21 @@ public:
bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
int64 startSampleInFile, int numSamples)
{
jassert (destSamples != nullptr);
const int64 samplesAvailable = lengthInSamples - startSampleInFile;

if (samplesAvailable < numSamples)
{
for (int i = numDestChannels; --i >= 0;)
if (destSamples[i] != nullptr)
zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * numSamples);

numSamples = (int) samplesAvailable;
}

if (numSamples <= 0)
return true;

OSStatus status = ExtAudioFileSeek (audioFileRef, startSampleInFile);
if (status != noErr)
return false;
@@ -251296,7 +251295,7 @@ void ModifierKeys::updateCurrentModifiers() noexcept
currentModifiers = Win32ComponentPeer::currentModifiers;
}

const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
Win32ComponentPeer::updateKeyModifiers();

@@ -251499,7 +251498,7 @@ void Desktop::createMouseInputSources()
mouseSources.add (new MouseInputSource (0, true));
}

const Point<int> MouseInputSource::getCurrentMousePosition()
Point<int> MouseInputSource::getCurrentMousePosition()
{
POINT mousePos;
GetCursorPos (&mousePos);
@@ -268009,7 +268008,7 @@ void ModifierKeys::updateCurrentModifiers() noexcept
currentModifiers = LinuxComponentPeer::currentModifiers;
}

const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
Window root, child;
int x, y, winx, winy;
@@ -268184,7 +268183,7 @@ bool Desktop::canUseSemiTransparentWindows() noexcept
&& (matchedDepth == desiredDepth);
}

const Point<int> MouseInputSource::getCurrentMousePosition()
Point<int> MouseInputSource::getCurrentMousePosition()
{
Window root, child;
int x, y, winx, winy;
@@ -271048,6 +271047,16 @@ namespace
{
return [NSString stringWithUTF8String: s.toUTF8()];
}

NSString* nsStringLiteral (const char* const s) noexcept
{
return [NSString stringWithUTF8String: s];
}

NSString* nsEmptyString() noexcept
{
return [NSString string];
}
}

#endif // __JUCE_OSX_OBJCHELPERS_JUCEHEADER__
@@ -271795,7 +271804,7 @@ private:
if (req == nil)
return nil;

[req setHTTPMethod: isPost ? @"POST" : @"GET"];
[req setHTTPMethod: nsStringLiteral (isPost ? "POST" : "GET")];
//[req setCachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData];

StringArray headerLines;
@@ -273219,7 +273228,7 @@ String File::getVersion() const

if (info != nil)
{
NSString* name = [info valueForKey: @"CFBundleShortVersionString"];
NSString* name = [info valueForKey: nsStringLiteral ("CFBundleShortVersionString")];

if (name != nil)
result = nsStringToJuce (name);
@@ -273260,7 +273269,7 @@ bool File::moveToTrash() const
return [[NSWorkspace sharedWorkspace]
performFileOperation: NSWorkspaceRecycleOperation
source: [p stringByDeletingLastPathComponent]
destination: @""
destination: nsEmptyString()
files: [NSArray arrayWithObject: [p lastPathComponent]]
tag: nil ];
#endif
@@ -273383,7 +273392,7 @@ void File::revealToUser() const
{
#if ! JUCE_IOS
if (exists())
[[NSWorkspace sharedWorkspace] selectFile: juceStringToNS (getFullPathName()) inFileViewerRootedAtPath: @""];
[[NSWorkspace sharedWorkspace] selectFile: juceStringToNS (getFullPathName()) inFileViewerRootedAtPath: nsEmptyString()];
else if (getParentDirectory().exists())
getParentDirectory().revealToUser();
#endif
@@ -274467,13 +274476,13 @@ void Font::getPlatformDefaultFontNames (String& defaultSans, String& defaultSeri
namespace
{
template <class RectType>
const Rectangle<int> convertToRectInt (const RectType& r)
Rectangle<int> convertToRectInt (const RectType& r)
{
return Rectangle<int> ((int) r.origin.x, (int) r.origin.y, (int) r.size.width, (int) r.size.height);
}

template <class RectType>
const Rectangle<float> convertToRectFloat (const RectType& r)
Rectangle<float> convertToRectFloat (const RectType& r)
{
return Rectangle<float> (r.origin.x, r.origin.y, r.size.width, r.size.height);
}
@@ -275618,7 +275627,7 @@ bool KeyPress::isKeyCurrentlyDown (const int keyCode)

ModifierKeys UIViewComponentPeer::currentModifiers;

const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
return UIViewComponentPeer::currentModifiers;
}
@@ -276558,7 +276567,7 @@ bool Desktop::canUseSemiTransparentWindows() noexcept
return true;
}

const Point<int> MouseInputSource::getCurrentMousePosition()
Point<int> MouseInputSource::getCurrentMousePosition()
{
return juce_lastMousePos;
}
@@ -277422,7 +277431,7 @@ END_JUCE_NAMESPACE
(void) request;
(void) frame;

NSURL* url = [actionInformation valueForKey: @"WebActionOriginalURLKey"];
NSURL* url = [actionInformation valueForKey: nsStringLiteral ("WebActionOriginalURLKey")];

if (ownerComponent->pageAboutToLoad (nsStringToJuce ([url absoluteString])))
[listener use];
@@ -277440,8 +277449,8 @@ public:
WebBrowserComponentInternal (WebBrowserComponent* owner)
{
webView = [[WebView alloc] initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f)
frameName: @""
groupName: @""];
frameName: nsEmptyString()
groupName: nsEmptyString()];
setView (webView);

clickListener = [[DownloadClickDetector alloc] initWithWebBrowserOwner: owner];
@@ -277466,7 +277475,7 @@ public:

if (postData != nullptr && postData->getSize() > 0)
{
[r setHTTPMethod: @"POST"];
[r setHTTPMethod: nsStringLiteral ("POST")];
[r setHTTPBody: [NSData dataWithBytes: postData->getData()
length: postData->getSize()]];
}
@@ -279051,7 +279060,7 @@ using namespace JUCE_NAMESPACE;
- (void) broadcastMessageCallback: (NSNotification*) n
{
NSDictionary* dict = (NSDictionary*) [n userInfo];
const String messageString (nsStringToJuce ((NSString*) [dict valueForKey: @"message"]));
const String messageString (nsStringToJuce ((NSString*) [dict valueForKey: nsStringLiteral ("message")]));
MessageManager::getInstance()->deliverBroadcastMessage (messageString);
}

@@ -279170,7 +279179,7 @@ bool MessageManager::postMessageToSystemQueue (Message* message)
void MessageManager::broadcastMessage (const String& message)
{
NSDictionary* info = [NSDictionary dictionaryWithObject: juceStringToNS (message)
forKey: @"message"];
forKey: nsStringLiteral ("message")];

[[NSDistributedNotificationCenter defaultCenter] postNotificationName: AppDelegateRedirector::getBroacastEventName()
object: nil
@@ -279973,13 +279982,13 @@ void Font::getPlatformDefaultFontNames (String& defaultSans, String& defaultSeri
namespace
{
template <class RectType>
const Rectangle<int> convertToRectInt (const RectType& r)
Rectangle<int> convertToRectInt (const RectType& r)
{
return Rectangle<int> ((int) r.origin.x, (int) r.origin.y, (int) r.size.width, (int) r.size.height);
}

template <class RectType>
const Rectangle<float> convertToRectFloat (const RectType& r)
Rectangle<float> convertToRectFloat (const RectType& r)
{
return Rectangle<float> (r.origin.x, r.origin.y, r.size.width, r.size.height);
}
@@ -281736,7 +281745,7 @@ void NSViewComponentPeer::updateKeysDown (NSEvent* ev, bool isKeyDown)
}
}

const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
return NSViewComponentPeer::currentModifiers;
}
@@ -282369,7 +282378,7 @@ BOOL NSViewComponentPeer::sendDragCallback (const int type, id <NSDraggingInfo>
NSPasteboard* pasteBoard = [sender draggingPasteboard];
StringArray files;

NSString* iTunesPasteboardType = @"CorePasteboardFlavorType 0x6974756E"; // 'itun'
NSString* iTunesPasteboardType = nsStringLiteral ("CorePasteboardFlavorType 0x6974756E"); // 'itun'

if (bestType == NSFilesPromisePboardType
&& [[pasteBoard types] containsObject: iTunesPasteboardType])
@@ -282379,13 +282388,13 @@ BOOL NSViewComponentPeer::sendDragCallback (const int type, id <NSDraggingInfo>
if ([list isKindOfClass: [NSDictionary class]])
{
NSDictionary* iTunesDictionary = (NSDictionary*) list;
NSArray* tracks = [iTunesDictionary valueForKey: @"Tracks"];
NSArray* tracks = [iTunesDictionary valueForKey: nsStringLiteral ("Tracks")];
NSEnumerator* enumerator = [tracks objectEnumerator];
NSDictionary* track;

while ((track = [enumerator nextObject]) != nil)
{
NSURL* url = [NSURL URLWithString: [track valueForKey: @"Location"]];
NSURL* url = [NSURL URLWithString: [track valueForKey: nsStringLiteral ("Location")]];

if ([url isFileURL])
files.add (nsStringToJuce ([url path]));
@@ -282769,7 +282778,7 @@ void JUCE_CALLTYPE NativeMessageBox::showMessageBox (AlertWindow::AlertIconType
const String& title, const String& message,
Component* associatedComponent)
{
OSXMessageBox box (iconType, title, message, @"OK", nil, nil, 0, false);
OSXMessageBox box (iconType, title, message, nsStringLiteral ("OK"), nil, nil, 0, false);
(void) box.getResult();
}

@@ -282777,7 +282786,7 @@ void JUCE_CALLTYPE NativeMessageBox::showMessageBoxAsync (AlertWindow::AlertIcon
const String& title, const String& message,
Component* associatedComponent)
{
new OSXMessageBox (iconType, title, message, @"OK", nil, nil, 0, true);
new OSXMessageBox (iconType, title, message, nsStringLiteral ("OK"), nil, nil, 0, true);
}

bool JUCE_CALLTYPE NativeMessageBox::showOkCancelBox (AlertWindow::AlertIconType iconType,
@@ -282786,7 +282795,9 @@ bool JUCE_CALLTYPE NativeMessageBox::showOkCancelBox (AlertWindow::AlertIconType
ModalComponentManager::Callback* callback)
{
ScopedPointer<OSXMessageBox> mb (new OSXMessageBox (iconType, title, message,
@"OK", @"Cancel", nil, callback, callback != nullptr));
nsStringLiteral ("OK"),
nsStringLiteral ("Cancel"),
nil, callback, callback != nullptr));
if (callback == nullptr)
return mb->getResult() == 1;

@@ -282800,7 +282811,10 @@ int JUCE_CALLTYPE NativeMessageBox::showYesNoCancelBox (AlertWindow::AlertIconTy
ModalComponentManager::Callback* callback)
{
ScopedPointer<OSXMessageBox> mb (new OSXMessageBox (iconType, title, message,
@"Yes", @"Cancel", @"No", callback, callback != nullptr));
nsStringLiteral ("Yes"),
nsStringLiteral ("Cancel"),
nsStringLiteral ("No"),
callback, callback != nullptr));
if (callback == nullptr)
return mb->getResult();

@@ -282874,7 +282888,7 @@ bool Desktop::canUseSemiTransparentWindows() noexcept
return true;
}

const Point<int> MouseInputSource::getCurrentMousePosition()
Point<int> MouseInputSource::getCurrentMousePosition()
{
JUCE_AUTORELEASEPOOL
const NSPoint p ([NSEvent mouseLocation]);
@@ -283226,7 +283240,7 @@ public:
componentPeerChanged();
}

const Rectangle<int> getViewBounds() const
Rectangle<int> getViewBounds() const
{
NSRect r = [view frame];
return Rectangle<int> (0, 0, (int) r.size.width, (int) r.size.height);
@@ -284122,7 +284136,7 @@ public:
{
NSMenuItem* item = [parent addItemWithTitle: juceStringToNS (name)
action: nil
keyEquivalent: @""];
keyEquivalent: nsEmptyString()];
[item setTag: tag];

NSMenu* sub = createMenu (child, name, menuId, tag);
@@ -284226,7 +284240,7 @@ public:
NSString* text = juceStringToNS (iter.itemName.upToFirstOccurrenceOf ("<end>", false, true));

if (text == nil)
text = @"";
text = nsEmptyString();

if (iter.isSeparator)
{
@@ -284236,7 +284250,7 @@ public:
{
NSMenuItem* item = [menuToAddTo addItemWithTitle: text
action: nil
keyEquivalent: @""];
keyEquivalent: nsEmptyString()];

[item setEnabled: false];
}
@@ -284244,7 +284258,7 @@ public:
{
NSMenuItem* item = [menuToAddTo addItemWithTitle: text
action: nil
keyEquivalent: @""];
keyEquivalent: nsEmptyString()];

[item setTag: iter.itemId];
[item setEnabled: iter.isEnabled];
@@ -284258,7 +284272,7 @@ public:
{
NSMenuItem* item = [menuToAddTo addItemWithTitle: text
action: @selector (menuItemInvoked:)
keyEquivalent: @""];
keyEquivalent: nsEmptyString()];

[item setTag: iter.itemId];
[item setEnabled: iter.isEnabled];
@@ -284341,7 +284355,7 @@ private:

static void flashMenuBar (NSMenu* menu)
{
if ([[menu title] isEqualToString: @"Apple"])
if ([[menu title] isEqualToString: nsStringLiteral ("Apple")])
return;

[menu retain];
@@ -284349,7 +284363,7 @@ private:
const unichar f35Key = NSF35FunctionKey;
NSString* f35String = [NSString stringWithCharacters: &f35Key length: 1];

NSMenuItem* item = [[NSMenuItem alloc] initWithTitle: @"x"
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle: nsStringLiteral ("x")
action: nil
keyEquivalent: f35String];
[item setTarget: nil];
@@ -284504,11 +284518,11 @@ namespace MainMenuHelpers
NSMenuItem* item;

// Services...
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (@"Services", nil)
action: nil keyEquivalent: @""];
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (nsStringLiteral ("Services"), nil)
action: nil keyEquivalent: nsEmptyString()];
[menu addItem: item];
[item release];
NSMenu* servicesMenu = [[NSMenu alloc] initWithTitle: @"Services"];
NSMenu* servicesMenu = [[NSMenu alloc] initWithTitle: nsStringLiteral ("Services")];
[menu setSubmenu: servicesMenu forItem: item];
[NSApp setServicesMenu: servicesMenu];
[servicesMenu release];
@@ -284516,20 +284530,20 @@ namespace MainMenuHelpers

// Hide + Show stuff...
item = [[NSMenuItem alloc] initWithTitle: juceStringToNS ("Hide " + appName)
action: @selector (hide:) keyEquivalent: @"h"];
action: @selector (hide:) keyEquivalent: nsStringLiteral ("h")];
[item setTarget: NSApp];
[menu addItem: item];
[item release];

item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (@"Hide Others", nil)
action: @selector (hideOtherApplications:) keyEquivalent: @"h"];
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (nsStringLiteral ("Hide Others"), nil)
action: @selector (hideOtherApplications:) keyEquivalent: nsStringLiteral ("h")];
[item setKeyEquivalentModifierMask: NSCommandKeyMask | NSAlternateKeyMask];
[item setTarget: NSApp];
[menu addItem: item];
[item release];

item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (@"Show All", nil)
action: @selector (unhideAllApplications:) keyEquivalent: @""];
item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString (nsStringLiteral ("Show All"), nil)
action: @selector (unhideAllApplications:) keyEquivalent: nsEmptyString()];
[item setTarget: NSApp];
[menu addItem: item];
[item release];
@@ -284538,7 +284552,7 @@ namespace MainMenuHelpers

// Quit item....
item = [[NSMenuItem alloc] initWithTitle: juceStringToNS ("Quit " + appName)
action: @selector (terminate:) keyEquivalent: @"q"];
action: @selector (terminate:) keyEquivalent: nsStringLiteral ("q")];

[item setTarget: NSApp];
[menu addItem: item];
@@ -284557,10 +284571,10 @@ namespace MainMenuHelpers
{
JUCE_AUTORELEASEPOOL

NSMenu* mainMenu = [[NSMenu alloc] initWithTitle: @"MainMenu"];
NSMenuItem* item = [mainMenu addItemWithTitle: @"Apple" action: nil keyEquivalent: @""];
NSMenu* mainMenu = [[NSMenu alloc] initWithTitle: nsStringLiteral ("MainMenu")];
NSMenuItem* item = [mainMenu addItemWithTitle: nsStringLiteral ("Apple") action: nil keyEquivalent: nsEmptyString()];

NSMenu* appMenu = [[NSMenu alloc] initWithTitle: @"Apple"];
NSMenu* appMenu = [[NSMenu alloc] initWithTitle: nsStringLiteral ("Apple")];

[NSApp performSelector: @selector (setAppleMenu:) withObject: appMenu];
[mainMenu setSubmenu: appMenu forItem: item];
@@ -284874,7 +284888,7 @@ static QTMovie* openMovieFromStream (InputStream* movieStream, File& movieFile)
movie = [QTMovie movieWithDataReference: [QTDataReference dataReferenceWithReferenceToData: [NSData dataWithBytes: temp.getData()
length: temp.getSize()]
name: [NSString stringWithUTF8String: suffixesToTry[i]]
MIMEType: @""]
MIMEType: nsEmptyString()]
error: nil];

if (movie != 0)
@@ -285937,7 +285951,7 @@ END_JUCE_NAMESPACE
(void) request;
(void) frame;

NSURL* url = [actionInformation valueForKey: @"WebActionOriginalURLKey"];
NSURL* url = [actionInformation valueForKey: nsStringLiteral ("WebActionOriginalURLKey")];

if (ownerComponent->pageAboutToLoad (nsStringToJuce ([url absoluteString])))
[listener use];
@@ -285955,8 +285969,8 @@ public:
WebBrowserComponentInternal (WebBrowserComponent* owner)
{
webView = [[WebView alloc] initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f)
frameName: @""
groupName: @""];
frameName: nsEmptyString()
groupName: nsEmptyString()];
setView (webView);

clickListener = [[DownloadClickDetector alloc] initWithWebBrowserOwner: owner];
@@ -285981,7 +285995,7 @@ public:

if (postData != nullptr && postData->getSize() > 0)
{
[r setHTTPMethod: @"POST"];
[r setHTTPMethod: nsStringLiteral ("POST")];
[r setHTTPBody: [NSData dataWithBytes: postData->getData()
length: postData->getSize()]];
}
@@ -288217,7 +288231,7 @@ END_JUCE_NAMESPACE
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: QTSampleBufferHostTimeAttribute];
#else
NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: @"hostTime"];
NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: nsStringLiteral ("hostTime")];
#endif

int64 presentationTime = (hosttime != nil)
@@ -288314,10 +288328,10 @@ void CameraDevice::startRecordingToFile (const File& file, int quality)

if ([mediaType isEqualToString: QTMediaTypeVideo])
options = [QTCompressionOptions compressionOptionsWithIdentifier:
quality >= 1 ? @"QTCompressionOptionsSD480SizeH264Video"
: @"QTCompressionOptions240SizeH264Video"];
quality >= 1 ? nsStringLiteral ("QTCompressionOptionsSD480SizeH264Video")_
nsStringLiteral ("QTCompressionOptions240SizeH264Video")];
else if ([mediaType isEqualToString: QTMediaTypeSound])
options = [QTCompressionOptions compressionOptionsWithIdentifier: @"QTCompressionOptionsHighQualityAACAudio"];
options = [QTCompressionOptions compressionOptionsWithIdentifier: nsStringLiteral ("QTCompressionOptionsHighQualityAACAudio")];

[d->fileOutput setCompressionOptions: options forConnection: connection];
}
@@ -292296,7 +292310,7 @@ void Desktop::createMouseInputSources()
mouseSources.add (new MouseInputSource (i, false));
}

const Point<int> MouseInputSource::getCurrentMousePosition()
Point<int> MouseInputSource::getCurrentMousePosition()
{
return AndroidComponentPeer::lastMousePos;
}
@@ -292317,7 +292331,7 @@ void ModifierKeys::updateCurrentModifiers() noexcept
currentModifiers = AndroidComponentPeer::currentModifiers;
}

const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
return AndroidComponentPeer::currentModifiers;
}


+ 20
- 22
juce_amalgamated.h View File

@@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 54
#define JUCE_BUILDNUMBER 18
#define JUCE_BUILDNUMBER 19

/** Current Juce version number.

@@ -23937,21 +23937,21 @@ public:
/** Middle mouse button flag. */
middleButtonModifier = 64,

#if JUCE_MAC
#if JUCE_MAC
/** Command key flag - on windows this is the same as the CTRL key flag. */
commandModifier = 8,

/** Popup menu flag - on windows this is the same as rightButtonModifier, on the
Mac it's the same as (rightButtonModifier | ctrlModifier). */
popupMenuClickModifier = rightButtonModifier | ctrlModifier,
#else
#else
/** Command key flag - on windows this is the same as the CTRL key flag. */
commandModifier = ctrlModifier,

/** Popup menu flag - on windows this is the same as rightButtonModifier, on the
Mac it's the same as (rightButtonModifier | ctrlModifier). */
popupMenuClickModifier = rightButtonModifier,
#endif
#endif

/** Represents a combination of all the shift, alt, ctrl and command key modifiers. */
allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
@@ -23961,10 +23961,10 @@ public:
};

/** Returns a copy of only the mouse-button flags */
const ModifierKeys withOnlyMouseButtons() const noexcept { return ModifierKeys (flags & allMouseButtonModifiers); }
ModifierKeys withOnlyMouseButtons() const noexcept { return ModifierKeys (flags & allMouseButtonModifiers); }

/** Returns a copy of only the non-mouse flags */
const ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); }
ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); }

bool operator== (const ModifierKeys& other) const noexcept { return flags == other.flags; }
bool operator!= (const ModifierKeys& other) const noexcept { return flags != other.flags; }
@@ -23986,7 +23986,7 @@ public:

@see getCurrentModifiersRealtime
*/
static const ModifierKeys getCurrentModifiers() noexcept;
static ModifierKeys getCurrentModifiers() noexcept;

/** Creates a ModifierKeys object to represent the current state of the
keyboard and mouse buttons.
@@ -24002,7 +24002,7 @@ public:
update the value returned by getCurrentModifiers(), which could cause subtle changes
in the behaviour of some components.
*/
static const ModifierKeys getCurrentModifiersRealtime() noexcept;
static ModifierKeys getCurrentModifiersRealtime() noexcept;

private:

@@ -26185,12 +26185,12 @@ public:
This is only relevent for floating-point rectangles, of course.
@see toFloat()
*/
const Rectangle<int> getSmallestIntegerContainer() const noexcept
Rectangle<int> getSmallestIntegerContainer() const noexcept
{
const int x1 = (int) std::floor (static_cast<float> (x));
const int y1 = (int) std::floor (static_cast<float> (y));
const int x2 = (int) std::ceil (static_cast<float> (x + w));
const int y2 = (int) std::ceil (static_cast<float> (y + h));
const int x2 = (int) std::ceil (static_cast<float> (x + w));
const int y2 = (int) std::ceil (static_cast<float> (y + h));

return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
}
@@ -26221,7 +26221,7 @@ public:
Obviously this is mainly useful for rectangles that use integer types.
@see getSmallestIntegerContainer
*/
const Rectangle<float> toFloat() const noexcept
Rectangle<float> toFloat() const noexcept
{
return Rectangle<float> (static_cast<float> (x), static_cast<float> (y),
static_cast<float> (w), static_cast<float> (h));
@@ -32500,7 +32500,7 @@ public:

@see isMouseButtonDownAnywhere, isMouseOver, isMouseOverOrDragging
*/
bool isMouseButtonDown() const noexcept;
bool isMouseButtonDown() const;

/** True if the mouse is over this component, or if it's being dragged in this component.

@@ -32508,7 +32508,7 @@ public:

@see isMouseOver, isMouseButtonDown, isMouseButtonDownAnywhere
*/
bool isMouseOverOrDragging() const noexcept;
bool isMouseOverOrDragging() const;

/** Returns true if a mouse button is currently down.

@@ -32989,9 +32989,6 @@ private:
bool bufferToImageFlag : 1;
bool bringToFrontOnClickFlag : 1;
bool repaintOnMouseActivityFlag : 1;
bool mouseDownFlag : 1;
bool mouseOverFlag : 1;
bool mouseInsideFlag : 1;
bool currentlyModalFlag : 1;
bool isDisabledFlag : 1;
bool childCompFocusedFlag : 1;
@@ -34462,6 +34459,7 @@ private:

void timerCallback();
void resetTimer();
ListenerList <MouseListener>& getMouseListeners();

int getNumDisplayMonitors() const noexcept;
const Rectangle<int> getDisplayMonitorCoordinates (int index, bool clippedToWorkArea) const noexcept;
@@ -57762,7 +57760,7 @@ public:
/** Returns the y position of the bottom of the glyph. */
float getBottom() const { return y + font.getDescent(); }
/** Returns the bounds of the glyph. */
const Rectangle<float> getBounds() const { return Rectangle<float> (x, getTop(), w, font.getHeight()); }
Rectangle<float> getBounds() const { return Rectangle<float> (x, getTop(), w, font.getHeight()); }

/** Shifts the glyph's position by a relative amount. */
void moveBy (float deltaX, float deltaY);
@@ -57941,7 +57939,7 @@ public:
@param includeWhitespace if true, the extent of any whitespace characters will also
be taken into account
*/
const Rectangle<float> getBoundingBox (int startIndex, int numGlyphs, bool includeWhitespace) const;
Rectangle<float> getBoundingBox (int startIndex, int numGlyphs, bool includeWhitespace) const;

/** Shifts a set of glyphs by a given amount.

@@ -62943,12 +62941,12 @@ public:
bool isDragging() const;

/** Returns the last-known screen position of this source. */
const Point<int> getScreenPosition() const;
Point<int> getScreenPosition() const;

/** Returns a set of modifiers that indicate which buttons are currently
held down on this device.
*/
const ModifierKeys getCurrentModifiers() const;
ModifierKeys getCurrentModifiers() const;

/** Returns the component that was last known to be under this pointer. */
Component* getComponentUnderMouse() const;
@@ -63025,7 +63023,7 @@ private:
friend class MouseInputSourceInternal;
ScopedPointer<MouseInputSourceInternal> pimpl;

static const Point<int> getCurrentMousePosition();
static Point<int> getCurrentMousePosition();

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MouseInputSource);
};


+ 15
- 0
src/audio/audio_file_formats/juce_CoreAudioFormat.cpp View File

@@ -135,6 +135,21 @@ public:
bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
int64 startSampleInFile, int numSamples)
{
jassert (destSamples != nullptr);
const int64 samplesAvailable = lengthInSamples - startSampleInFile;
if (samplesAvailable < numSamples)
{
for (int i = numDestChannels; --i >= 0;)
if (destSamples[i] != nullptr)
zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * numSamples);
numSamples = (int) samplesAvailable;
}
if (numSamples <= 0)
return true;
OSStatus status = ExtAudioFileSeek (audioFileRef, startSampleInFile);
if (status != noErr)
return false;


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

@@ -155,7 +155,7 @@ BEGIN_JUCE_NAMESPACE
extern void detachComponentFromWindowRef (Component* component, void* nsWindow);
extern void setNativeHostWindowSize (void* nsWindow, Component* editorComp, int newWidth, int newHeight, const PluginHostType& host);
extern void checkWindowVisibility (void* nsWindow, Component* component);
extern void forwardCurrentKeyEventToHost (Component* component);
extern bool forwardCurrentKeyEventToHost (Component* component);
#endif
#if JUCE_LINUX
@@ -1275,12 +1275,11 @@ public:
}
#if JUCE_MAC
bool keyPressed (const KeyPress& kp)
bool keyPressed (const KeyPress&)
{
// If we have an unused keypress, move the key-focus to a host window
// and re-inject the event..
forwardCurrentKeyEventToHost (this);
return true;
return forwardCurrentKeyEventToHost (this);
}
#endif


+ 5
- 2
src/audio/plugin_client/VST/juce_VST_Wrapper.mm View File

@@ -229,12 +229,15 @@ void checkWindowVisibility (void* nsWindow, Component* comp)
#endif
}
void forwardCurrentKeyEventToHost (Component* comp)
bool forwardCurrentKeyEventToHost (Component* comp)
{
#if ! JUCE_64BIT
#if JUCE_64BIT
return false;
#else
NSWindow* win = [(NSView*) comp->getWindowHandle() window];
[[win parentWindow] makeKeyWindow];
[NSApp postEvent: [NSApp currentEvent] atStart: YES];
return true;
#endif
}


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

@@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 54
#define JUCE_BUILDNUMBER 18
#define JUCE_BUILDNUMBER 19
/** Current Juce version number.


+ 97
- 123
src/gui/components/juce_Component.cpp View File

@@ -236,7 +236,7 @@ public:
&& comp.hitTest (localPoint.getX(), localPoint.getY());
}
static const Point<int> convertFromParentSpace (const Component& comp, const Point<int>& pointInParentSpace)
static Point<int> convertFromParentSpace (const Component& comp, const Point<int>& pointInParentSpace)
{
if (comp.affineTransform == nullptr)
return pointInParentSpace - comp.getPosition();
@@ -244,7 +244,7 @@ public:
return pointInParentSpace.toFloat().transformedBy (comp.affineTransform->inverted()).toInt() - comp.getPosition();
}
static const Rectangle<int> convertFromParentSpace (const Component& comp, const Rectangle<int>& areaInParentSpace)
static Rectangle<int> convertFromParentSpace (const Component& comp, const Rectangle<int>& areaInParentSpace)
{
if (comp.affineTransform == nullptr)
return areaInParentSpace - comp.getPosition();
@@ -252,7 +252,7 @@ public:
return areaInParentSpace.toFloat().transformed (comp.affineTransform->inverted()).getSmallestIntegerContainer() - comp.getPosition();
}
static const Point<int> convertToParentSpace (const Component& comp, const Point<int>& pointInLocalSpace)
static Point<int> convertToParentSpace (const Component& comp, const Point<int>& pointInLocalSpace)
{
if (comp.affineTransform == nullptr)
return pointInLocalSpace + comp.getPosition();
@@ -260,7 +260,7 @@ public:
return (pointInLocalSpace + comp.getPosition()).toFloat().transformedBy (*comp.affineTransform).toInt();
}
static const Rectangle<int> convertToParentSpace (const Component& comp, const Rectangle<int>& areaInLocalSpace)
static Rectangle<int> convertToParentSpace (const Component& comp, const Rectangle<int>& areaInLocalSpace)
{
if (comp.affineTransform == nullptr)
return areaInLocalSpace + comp.getPosition();
@@ -269,7 +269,7 @@ public:
}
template <typename Type>
static const Type convertFromDistantParentSpace (const Component* parent, const Component& target, Type coordInParent)
static Type convertFromDistantParentSpace (const Component* parent, const Component& target, const Type& coordInParent)
{
const Component* const directParent = target.getParentComponent();
jassert (directParent != nullptr);
@@ -281,7 +281,7 @@ public:
}
template <typename Type>
static const Type convertCoordinate (const Component* target, const Component* source, Type p)
static Type convertCoordinate (const Component* target, const Component* source, Type p)
{
while (source != nullptr)
{
@@ -2326,66 +2326,41 @@ void Component::internalMouseEnter (MouseInputSource& source, const Point<int>&
return;
}
if (! flags.mouseInsideFlag)
{
flags.mouseInsideFlag = true;
flags.mouseOverFlag = true;
flags.mouseDownFlag = false;
BailOutChecker checker (this);
if (flags.repaintOnMouseActivityFlag)
repaint();
if (flags.repaintOnMouseActivityFlag)
repaint();
BailOutChecker checker (this);
const MouseEvent me (source, relativePos, source.getCurrentModifiers(),
this, this, time, relativePos, time, 0, false);
mouseEnter (me);
const MouseEvent me (source, relativePos, source.getCurrentModifiers(),
this, this, time, relativePos, time, 0, false);
mouseEnter (me);
if (checker.shouldBailOut())
return;
if (checker.shouldBailOut())
return;
Desktop& desktop = Desktop::getInstance();
desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseEnter, me);
Desktop::getInstance().getMouseListeners().callChecked (checker, &MouseListener::mouseEnter, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseEnter, me);
}
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseEnter, me);
}
void Component::internalMouseExit (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
{
BailOutChecker checker (this);
if (flags.mouseDownFlag)
{
internalMouseUp (source, relativePos, time, source.getCurrentModifiers().getRawFlags());
if (checker.shouldBailOut())
return;
}
if (flags.repaintOnMouseActivityFlag)
repaint();
if (flags.mouseInsideFlag || flags.mouseOverFlag)
{
flags.mouseInsideFlag = false;
flags.mouseOverFlag = false;
flags.mouseDownFlag = false;
BailOutChecker checker (this);
if (flags.repaintOnMouseActivityFlag)
repaint();
const MouseEvent me (source, relativePos, source.getCurrentModifiers(),
this, this, time, relativePos, time, 0, false);
const MouseEvent me (source, relativePos, source.getCurrentModifiers(),
this, this, time, relativePos, time, 0, false);
mouseExit (me);
mouseExit (me);
if (checker.shouldBailOut())
return;
if (checker.shouldBailOut())
return;
Desktop& desktop = Desktop::getInstance();
desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseExit, me);
Desktop::getInstance().getMouseListeners().callChecked (checker, &MouseListener::mouseExit, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseExit, me);
}
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseExit, me);
}
//==============================================================================
@@ -2411,8 +2386,7 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
this, this, time, relativePos, time,
source.getNumberOfMultipleClicks(), false);
desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDown, me);
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseDown, me);
return;
}
}
@@ -2442,9 +2416,6 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
return;
}
flags.mouseDownFlag = true;
flags.mouseOverFlag = true;
if (flags.repaintOnMouseActivityFlag)
repaint();
@@ -2456,8 +2427,7 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
if (checker.shouldBailOut())
return;
desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDown, me);
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseDown, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDown, me);
}
@@ -2465,76 +2435,63 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
//==============================================================================
void Component::internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers)
{
if (flags.mouseDownFlag)
{
flags.mouseDownFlag = false;
BailOutChecker checker (this);
BailOutChecker checker (this);
if (flags.repaintOnMouseActivityFlag)
repaint();
if (flags.repaintOnMouseActivityFlag)
repaint();
const MouseEvent me (source, relativePos,
oldModifiers, this, this, time,
getLocalPoint (nullptr, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed());
const MouseEvent me (source, relativePos,
oldModifiers, this, this, time,
getLocalPoint (nullptr, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed());
mouseUp (me);
mouseUp (me);
if (checker.shouldBailOut())
return;
if (checker.shouldBailOut())
return;
Desktop& desktop = Desktop::getInstance();
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseUp, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseUp, me);
Desktop& desktop = Desktop::getInstance();
desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseUp, me);
if (checker.shouldBailOut())
return;
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseUp, me);
// check for double-click
if (me.getNumberOfClicks() >= 2)
{
mouseDoubleClick (me);
if (checker.shouldBailOut())
return;
// check for double-click
if (me.getNumberOfClicks() >= 2)
{
mouseDoubleClick (me);
if (checker.shouldBailOut())
return;
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDoubleClick, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDoubleClick, me);
}
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDoubleClick, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDoubleClick, me);
}
}
void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
{
if (flags.mouseDownFlag)
{
flags.mouseOverFlag = reallyContains (relativePos, false);
BailOutChecker checker (this);
BailOutChecker checker (this);
const MouseEvent me (source, relativePos,
source.getCurrentModifiers(), this, this, time,
getLocalPoint (nullptr, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed());
const MouseEvent me (source, relativePos,
source.getCurrentModifiers(), this, this, time,
getLocalPoint (nullptr, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed());
mouseDrag (me);
mouseDrag (me);
if (checker.shouldBailOut())
return;
if (checker.shouldBailOut())
return;
Desktop& desktop = Desktop::getInstance();
desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDrag, me);
Desktop::getInstance().getMouseListeners().callChecked (checker, &MouseListener::mouseDrag, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDrag, me);
}
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDrag, me);
}
void Component::internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
@@ -2552,15 +2509,12 @@ void Component::internalMouseMove (MouseInputSource& source, const Point<int>& r
}
else
{
flags.mouseOverFlag = true;
mouseMove (me);
if (checker.shouldBailOut())
return;
desktop.resetTimer();
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseMove, me);
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseMove, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseMove, me);
}
@@ -2941,27 +2895,47 @@ void Component::giveAwayFocus (const bool sendFocusLossEvent)
//==============================================================================
bool Component::isMouseOver (const bool includeChildren) const
{
if (flags.mouseOverFlag)
return true;
const Desktop& desktop = Desktop::getInstance();
if (includeChildren)
for (int i = desktop.getNumMouseSources(); --i >= 0;)
{
Desktop& desktop = Desktop::getInstance();
const MouseInputSource* const mi = desktop.getMouseSource(i);
for (int i = desktop.getNumMouseSources(); --i >= 0;)
{
Component* const c = desktop.getMouseSource(i)->getComponentUnderMouse();
Component* const c = mi->getComponentUnderMouse();
if (isParentOf (c) && c->flags.mouseOverFlag) // (mouseOverFlag checked in case it's being dragged outside the comp)
return true;
}
if ((c == this || (includeChildren && isParentOf (c)))
&& c->reallyContains (c->getLocalPoint (nullptr, mi->getScreenPosition()), false))
return true;
}
return false;
}
bool Component::isMouseButtonDown() const noexcept { return flags.mouseDownFlag; }
bool Component::isMouseOverOrDragging() const noexcept { return flags.mouseOverFlag || flags.mouseDownFlag; }
bool Component::isMouseButtonDown() const
{
const Desktop& desktop = Desktop::getInstance();
for (int i = desktop.getNumMouseSources(); --i >= 0;)
{
const MouseInputSource* const mi = desktop.getMouseSource(i);
if (mi->isDragging() && mi->getComponentUnderMouse() == this)
return true;
}
return false;
}
bool Component::isMouseOverOrDragging() const
{
const Desktop& desktop = Desktop::getInstance();
for (int i = desktop.getNumMouseSources(); --i >= 0;)
if (desktop.getMouseSource(i)->getComponentUnderMouse() == this)
return true;
return false;
}
bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() noexcept
{


+ 2
- 5
src/gui/components/juce_Component.h View File

@@ -1769,7 +1769,7 @@ public:
@see isMouseButtonDownAnywhere, isMouseOver, isMouseOverOrDragging
*/
bool isMouseButtonDown() const noexcept;
bool isMouseButtonDown() const;
/** True if the mouse is over this component, or if it's being dragged in this component.
@@ -1777,7 +1777,7 @@ public:
@see isMouseOver, isMouseButtonDown, isMouseButtonDownAnywhere
*/
bool isMouseOverOrDragging() const noexcept;
bool isMouseOverOrDragging() const;
/** Returns true if a mouse button is currently down.
@@ -2271,9 +2271,6 @@ private:
bool bufferToImageFlag : 1;
bool bringToFrontOnClickFlag : 1;
bool repaintOnMouseActivityFlag : 1;
bool mouseDownFlag : 1;
bool mouseOverFlag : 1;
bool mouseInsideFlag : 1;
bool currentlyModalFlag : 1;
bool isDisabledFlag : 1;
bool childCompFocusedFlag : 1;


+ 16
- 10
src/gui/components/juce_Desktop.cpp View File

@@ -352,6 +352,22 @@ void Desktop::handleAsyncUpdate()
}
//==============================================================================
void Desktop::resetTimer()
{
if (mouseListeners.size() == 0)
stopTimer();
else
startTimer (100);
lastFakeMouseMove = getMousePosition();
}
ListenerList <MouseListener>& Desktop::getMouseListeners()
{
resetTimer();
return mouseListeners;
}
void Desktop::addGlobalMouseListener (MouseListener* const listener)
{
mouseListeners.add (listener);
@@ -397,16 +413,6 @@ void Desktop::sendMouseMove()
}
}
void Desktop::resetTimer()
{
if (mouseListeners.size() == 0)
stopTimer();
else
startTimer (100);
lastFakeMouseMove = getMousePosition();
}
//==============================================================================
void Desktop::setKioskModeComponent (Component* componentToUse, const bool allowMenusAndBars)
{


+ 1
- 0
src/gui/components/juce_Desktop.h View File

@@ -392,6 +392,7 @@ private:
void timerCallback();
void resetTimer();
ListenerList <MouseListener>& getMouseListeners();
int getNumDisplayMonitors() const noexcept;
const Rectangle<int> getDisplayMonitorCoordinates (int index, bool clippedToWorkArea) const noexcept;


+ 1
- 1
src/gui/components/keyboard/juce_ModifierKeys.cpp View File

@@ -49,7 +49,7 @@ ModifierKeys& ModifierKeys::operator= (const ModifierKeys& other) noexcept
ModifierKeys ModifierKeys::currentModifiers;
const ModifierKeys ModifierKeys::getCurrentModifiers() noexcept
ModifierKeys ModifierKeys::getCurrentModifiers() noexcept
{
return currentModifiers;
}


+ 7
- 7
src/gui/components/keyboard/juce_ModifierKeys.h View File

@@ -128,21 +128,21 @@ public:
/** Middle mouse button flag. */
middleButtonModifier = 64,
#if JUCE_MAC
#if JUCE_MAC
/** Command key flag - on windows this is the same as the CTRL key flag. */
commandModifier = 8,
/** Popup menu flag - on windows this is the same as rightButtonModifier, on the
Mac it's the same as (rightButtonModifier | ctrlModifier). */
popupMenuClickModifier = rightButtonModifier | ctrlModifier,
#else
#else
/** Command key flag - on windows this is the same as the CTRL key flag. */
commandModifier = ctrlModifier,
/** Popup menu flag - on windows this is the same as rightButtonModifier, on the
Mac it's the same as (rightButtonModifier | ctrlModifier). */
popupMenuClickModifier = rightButtonModifier,
#endif
#endif
/** Represents a combination of all the shift, alt, ctrl and command key modifiers. */
allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier,
@@ -153,10 +153,10 @@ public:
//==============================================================================
/** Returns a copy of only the mouse-button flags */
const ModifierKeys withOnlyMouseButtons() const noexcept { return ModifierKeys (flags & allMouseButtonModifiers); }
ModifierKeys withOnlyMouseButtons() const noexcept { return ModifierKeys (flags & allMouseButtonModifiers); }
/** Returns a copy of only the non-mouse flags */
const ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); }
ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); }
bool operator== (const ModifierKeys& other) const noexcept { return flags == other.flags; }
bool operator!= (const ModifierKeys& other) const noexcept { return flags != other.flags; }
@@ -180,7 +180,7 @@ public:
@see getCurrentModifiersRealtime
*/
static const ModifierKeys getCurrentModifiers() noexcept;
static ModifierKeys getCurrentModifiers() noexcept;
/** Creates a ModifierKeys object to represent the current state of the
keyboard and mouse buttons.
@@ -196,7 +196,7 @@ public:
update the value returned by getCurrentModifiers(), which could cause subtle changes
in the behaviour of some components.
*/
static const ModifierKeys getCurrentModifiersRealtime() noexcept;
static ModifierKeys getCurrentModifiersRealtime() noexcept;
private:


+ 9
- 5
src/gui/components/mouse/juce_MouseInputSource.cpp View File

@@ -59,7 +59,7 @@ public:
return static_cast <Component*> (componentUnderMouse);
}
const ModifierKeys getCurrentModifiers() const
ModifierKeys getCurrentModifiers() const
{
return ModifierKeys::getCurrentModifiers().withoutMouseButtons().withFlags (buttonState.getRawFlags());
}
@@ -89,7 +89,7 @@ public:
return nullptr;
}
const Point<int> getScreenPosition() const
Point<int> getScreenPosition() const
{
// This needs to return the live position if possible, but it mustn't update the lastScreenPos
// value, because that can cause continuity problems.
@@ -197,8 +197,12 @@ public:
if (current != nullptr)
{
WeakReference<Component> safeOldComp (current);
setButtons (screenPos, time, ModifierKeys());
sendMouseExit (current, screenPos, time);
if (safeOldComp != nullptr)
sendMouseExit (current, screenPos, time);
buttonState = originalButtonState;
}
@@ -507,8 +511,8 @@ bool MouseInputSource::canHover() const { return
bool MouseInputSource::hasMouseWheel() const { return isMouse(); }
int MouseInputSource::getIndex() const { return pimpl->index; }
bool MouseInputSource::isDragging() const { return pimpl->isDragging(); }
const Point<int> MouseInputSource::getScreenPosition() const { return pimpl->getScreenPosition(); }
const ModifierKeys MouseInputSource::getCurrentModifiers() const { return pimpl->getCurrentModifiers(); }
Point<int> MouseInputSource::getScreenPosition() const { return pimpl->getScreenPosition(); }
ModifierKeys MouseInputSource::getCurrentModifiers() const { return pimpl->getCurrentModifiers(); }
Component* MouseInputSource::getComponentUnderMouse() const { return pimpl->getComponentUnderMouse(); }
void MouseInputSource::triggerFakeMove() const { pimpl->triggerFakeMove(); }
int MouseInputSource::getNumberOfMultipleClicks() const noexcept { return pimpl->getNumberOfMultipleClicks(); }


+ 3
- 3
src/gui/components/mouse/juce_MouseInputSource.h View File

@@ -97,12 +97,12 @@ public:
bool isDragging() const;
/** Returns the last-known screen position of this source. */
const Point<int> getScreenPosition() const;
Point<int> getScreenPosition() const;
/** Returns a set of modifiers that indicate which buttons are currently
held down on this device.
*/
const ModifierKeys getCurrentModifiers() const;
ModifierKeys getCurrentModifiers() const;
/** Returns the component that was last known to be under this pointer. */
Component* getComponentUnderMouse() const;
@@ -180,7 +180,7 @@ private:
friend class MouseInputSourceInternal;
ScopedPointer<MouseInputSourceInternal> pimpl;
static const Point<int> getCurrentMousePosition();
static Point<int> getCurrentMousePosition();
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MouseInputSource);
};


+ 1
- 1
src/gui/graphics/fonts/juce_GlyphArrangement.cpp View File

@@ -623,7 +623,7 @@ void GlyphArrangement::stretchRangeOfGlyphs (int startIndex, int num,
}
}
const Rectangle<float> GlyphArrangement::getBoundingBox (int startIndex, int num, const bool includeWhitespace) const
Rectangle<float> GlyphArrangement::getBoundingBox (int startIndex, int num, const bool includeWhitespace) const
{
jassert (startIndex >= 0);


+ 2
- 2
src/gui/graphics/fonts/juce_GlyphArrangement.h View File

@@ -67,7 +67,7 @@ public:
/** Returns the y position of the bottom of the glyph. */
float getBottom() const { return y + font.getDescent(); }
/** Returns the bounds of the glyph. */
const Rectangle<float> getBounds() const { return Rectangle<float> (x, getTop(), w, font.getHeight()); }
Rectangle<float> getBounds() const { return Rectangle<float> (x, getTop(), w, font.getHeight()); }
//==============================================================================
/** Shifts the glyph's position by a relative amount. */
@@ -255,7 +255,7 @@ public:
@param includeWhitespace if true, the extent of any whitespace characters will also
be taken into account
*/
const Rectangle<float> getBoundingBox (int startIndex, int numGlyphs, bool includeWhitespace) const;
Rectangle<float> getBoundingBox (int startIndex, int numGlyphs, bool includeWhitespace) const;
/** Shifts a set of glyphs by a given amount.


+ 4
- 4
src/gui/graphics/geometry/juce_Rectangle.h View File

@@ -620,12 +620,12 @@ public:
This is only relevent for floating-point rectangles, of course.
@see toFloat()
*/
const Rectangle<int> getSmallestIntegerContainer() const noexcept
Rectangle<int> getSmallestIntegerContainer() const noexcept
{
const int x1 = (int) std::floor (static_cast<float> (x));
const int y1 = (int) std::floor (static_cast<float> (y));
const int x2 = (int) std::ceil (static_cast<float> (x + w));
const int y2 = (int) std::ceil (static_cast<float> (y + h));
const int x2 = (int) std::ceil (static_cast<float> (x + w));
const int y2 = (int) std::ceil (static_cast<float> (y + h));
return Rectangle<int> (x1, y1, x2 - x1, y2 - y1);
}
@@ -656,7 +656,7 @@ public:
Obviously this is mainly useful for rectangles that use integer types.
@see getSmallestIntegerContainer
*/
const Rectangle<float> toFloat() const noexcept
Rectangle<float> toFloat() const noexcept
{
return Rectangle<float> (static_cast<float> (x), static_cast<float> (y),
static_cast<float> (w), static_cast<float> (h));


+ 2
- 2
src/native/android/juce_android_Windowing.cpp View File

@@ -578,7 +578,7 @@ void Desktop::createMouseInputSources()
mouseSources.add (new MouseInputSource (i, false));
}
const Point<int> MouseInputSource::getCurrentMousePosition()
Point<int> MouseInputSource::getCurrentMousePosition()
{
return AndroidComponentPeer::lastMousePos;
}
@@ -600,7 +600,7 @@ void ModifierKeys::updateCurrentModifiers() noexcept
currentModifiers = AndroidComponentPeer::currentModifiers;
}
const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
return AndroidComponentPeer::currentModifiers;
}


+ 2
- 2
src/native/linux/juce_linux_Windowing.cpp View File

@@ -2616,7 +2616,7 @@ void ModifierKeys::updateCurrentModifiers() noexcept
currentModifiers = LinuxComponentPeer::currentModifiers;
}
const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
Window root, child;
int x, y, winx, winy;
@@ -2798,7 +2798,7 @@ bool Desktop::canUseSemiTransparentWindows() noexcept
&& (matchedDepth == desiredDepth);
}
const Point<int> MouseInputSource::getCurrentMousePosition()
Point<int> MouseInputSource::getCurrentMousePosition()
{
Window root, child;
int x, y, winx, winy;


+ 1
- 1
src/native/mac/juce_ios_UIViewComponentPeer.mm View File

@@ -286,7 +286,7 @@ bool KeyPress::isKeyCurrentlyDown (const int keyCode)
ModifierKeys UIViewComponentPeer::currentModifiers;
const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
return UIViewComponentPeer::currentModifiers;
}


+ 1
- 1
src/native/mac/juce_ios_Windowing.mm View File

@@ -228,7 +228,7 @@ bool Desktop::canUseSemiTransparentWindows() noexcept
return true;
}
const Point<int> MouseInputSource::getCurrentMousePosition()
Point<int> MouseInputSource::getCurrentMousePosition()
{
return juce_lastMousePos;
}


+ 2
- 2
src/native/mac/juce_mac_CoreGraphicsContext.mm View File

@@ -32,13 +32,13 @@
namespace
{
template <class RectType>
const Rectangle<int> convertToRectInt (const RectType& r)
Rectangle<int> convertToRectInt (const RectType& r)
{
return Rectangle<int> ((int) r.origin.x, (int) r.origin.y, (int) r.size.width, (int) r.size.height);
}
template <class RectType>
const Rectangle<float> convertToRectFloat (const RectType& r)
Rectangle<float> convertToRectFloat (const RectType& r)
{
return Rectangle<float> (r.origin.x, r.origin.y, r.size.width, r.size.height);
}


+ 1
- 1
src/native/mac/juce_mac_NSViewComponent.mm View File

@@ -105,7 +105,7 @@ public:
componentPeerChanged();
}
const Rectangle<int> getViewBounds() const
Rectangle<int> getViewBounds() const
{
NSRect r = [view frame];
return Rectangle<int> (0, 0, (int) r.size.width, (int) r.size.height);


+ 1
- 1
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -905,7 +905,7 @@ void NSViewComponentPeer::updateKeysDown (NSEvent* ev, bool isKeyDown)
}
}
const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
return NSViewComponentPeer::currentModifiers;
}


+ 1
- 1
src/native/mac/juce_mac_Windowing.mm View File

@@ -217,7 +217,7 @@ bool Desktop::canUseSemiTransparentWindows() noexcept
return true;
}
const Point<int> MouseInputSource::getCurrentMousePosition()
Point<int> MouseInputSource::getCurrentMousePosition()
{
JUCE_AUTORELEASEPOOL
const NSPoint p ([NSEvent mouseLocation]);


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

@@ -2575,7 +2575,7 @@ void ModifierKeys::updateCurrentModifiers() noexcept
currentModifiers = Win32ComponentPeer::currentModifiers;
}
const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
Win32ComponentPeer::updateKeyModifiers();
@@ -2785,7 +2785,7 @@ void Desktop::createMouseInputSources()
mouseSources.add (new MouseInputSource (0, true));
}
const Point<int> MouseInputSource::getCurrentMousePosition()
Point<int> MouseInputSource::getCurrentMousePosition()
{
POINT mousePos;
GetCursorPos (&mousePos);


Loading…
Cancel
Save