Browse Source

mouseUp behaviour fix when components are modal.

tags/2021-05-28
jules 13 years ago
parent
commit
ba0cb5f2a9
2 changed files with 8 additions and 5 deletions
  1. +7
    -5
      modules/juce_gui_basics/components/juce_Component.cpp
  2. +1
    -0
      modules/juce_gui_basics/components/juce_Component.h

+ 7
- 5
modules/juce_gui_basics/components/juce_Component.cpp View File

@@ -2286,11 +2286,11 @@ void Component::internalMouseExit (MouseInputSource& source, const Point<int>& r
void Component::internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time) void Component::internalMouseDown (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
{ {
Desktop& desktop = Desktop::getInstance(); Desktop& desktop = Desktop::getInstance();
BailOutChecker checker (this); BailOutChecker checker (this);
if (isCurrentlyBlockedByAnotherModalComponent()) if (isCurrentlyBlockedByAnotherModalComponent())
{ {
flags.mouseDownWasBlocked = true;
internalModalInputAttempt(); internalModalInputAttempt();
if (checker.shouldBailOut()) if (checker.shouldBailOut())
@@ -2310,6 +2310,8 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
} }
} }
flags.mouseDownWasBlocked = false;
for (Component* c = this; c != nullptr; c = c->parentComponent) for (Component* c = this; c != nullptr; c = c->parentComponent)
{ {
if (c->isBroughtToFrontOnMouseClick()) if (c->isBroughtToFrontOnMouseClick())
@@ -2345,11 +2347,11 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
MouseListenerList::sendMouseEvent (*this, 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)
void Component::internalMouseUp (MouseInputSource& source, const Point<int>& relativePos,
const Time& time, const ModifierKeys& oldModifiers)
{ {
// NB: don't check whether there's a modal comp blocking this one, because if there is, it
// must have been created during a mouse-drag on this component, and if so, this comp will
// still want to get the corresponding mouse-up.
if (flags.mouseDownWasBlocked && isCurrentlyBlockedByAnotherModalComponent())
return;
BailOutChecker checker (this); BailOutChecker checker (this);


+ 1
- 0
modules/juce_gui_basics/components/juce_Component.h View File

@@ -2255,6 +2255,7 @@ private:
bool isDisabledFlag : 1; bool isDisabledFlag : 1;
bool childCompFocusedFlag : 1; bool childCompFocusedFlag : 1;
bool dontClipGraphicsFlag : 1; bool dontClipGraphicsFlag : 1;
bool mouseDownWasBlocked : 1;
#if JUCE_DEBUG #if JUCE_DEBUG
bool isInsidePaintCall : 1; bool isInsidePaintCall : 1;
#endif #endif


Loading…
Cancel
Save