Browse Source

Fix for modal loops in a mouseUp callback.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
032aae78ea
4 changed files with 18 additions and 8 deletions
  1. +8
    -3
      juce_amalgamated.cpp
  2. +1
    -1
      juce_amalgamated.h
  3. +1
    -1
      src/core/juce_StandardHeader.h
  4. +8
    -3
      src/gui/components/mouse/juce_MouseInputSource.cpp

+ 8
- 3
juce_amalgamated.cpp View File

@@ -73865,10 +73865,10 @@ public:
comp->internalMouseDrag (source, comp->getLocalPoint (nullptr, screenPos), time);
}

void sendMouseUp (Component* const comp, const Point<int>& screenPos, const Time& time)
void sendMouseUp (Component* const comp, const Point<int>& screenPos, const Time& time, const ModifierKeys& oldMods)
{
//DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseUp (source, comp->getLocalPoint (nullptr, screenPos), time, getCurrentModifiers());
comp->internalMouseUp (source, comp->getLocalPoint (nullptr, screenPos), time, oldMods);
}

void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const Time& time, float x, float y)
@@ -73899,7 +73899,12 @@ public:
Component* const current = getComponentUnderMouse();

if (current != nullptr)
sendMouseUp (current, screenPos + unboundedMouseOffset, time);
{
const ModifierKeys oldMods (getCurrentModifiers());
buttonState = newButtonState; // must change this before calling sendMouseUp, in case it runs a modal loop

sendMouseUp (current, screenPos + unboundedMouseOffset, time, oldMods);
}

enableUnboundedMouseMovement (false, false);
}


+ 1
- 1
juce_amalgamated.h View File

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

/** Current Juce version number.



+ 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 25
#define JUCE_BUILDNUMBER 27
/** Current Juce version number.


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

@@ -128,10 +128,10 @@ public:
comp->internalMouseDrag (source, comp->getLocalPoint (nullptr, screenPos), time);
}
void sendMouseUp (Component* const comp, const Point<int>& screenPos, const Time& time)
void sendMouseUp (Component* const comp, const Point<int>& screenPos, const Time& time, const ModifierKeys& oldMods)
{
//DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseUp (source, comp->getLocalPoint (nullptr, screenPos), time, getCurrentModifiers());
comp->internalMouseUp (source, comp->getLocalPoint (nullptr, screenPos), time, oldMods);
}
void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const Time& time, float x, float y)
@@ -163,7 +163,12 @@ public:
Component* const current = getComponentUnderMouse();
if (current != nullptr)
sendMouseUp (current, screenPos + unboundedMouseOffset, time);
{
const ModifierKeys oldMods (getCurrentModifiers());
buttonState = newButtonState; // must change this before calling sendMouseUp, in case it runs a modal loop
sendMouseUp (current, screenPos + unboundedMouseOffset, time, oldMods);
}
enableUnboundedMouseMovement (false, false);
}


Loading…
Cancel
Save