1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-17 00:44:19 +00:00

Fix for modal loops in a mouseUp callback.

This commit is contained in:
Julian Storer 2011-07-15 14:14:25 +01:00
parent f89fa9456a
commit 032aae78ea
4 changed files with 18 additions and 8 deletions

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);
}