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

Prevented some mouse-events bypassing modal components.

This commit is contained in:
jules 2012-04-11 18:03:05 +01:00
parent 46ae142d8a
commit a4b83d313c
2 changed files with 48 additions and 42 deletions

View file

@ -2384,61 +2384,67 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
void Component::internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers)
{
BailOutChecker checker (this);
if (flags.repaintOnMouseActivityFlag)
repaint();
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;
Desktop& desktop = Desktop::getInstance();
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseUp, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseUp, me);
if (checker.shouldBailOut())
return;
// check for double-click
if (me.getNumberOfClicks() >= 2)
if (! isCurrentlyBlockedByAnotherModalComponent())
{
mouseDoubleClick (me);
BailOutChecker checker (this);
if (flags.repaintOnMouseActivityFlag)
repaint();
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;
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDoubleClick, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDoubleClick, me);
Desktop& desktop = Desktop::getInstance();
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseUp, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseUp, 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);
}
}
}
void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
{
BailOutChecker checker (this);
if (! isCurrentlyBlockedByAnotherModalComponent())
{
BailOutChecker checker (this);
const MouseEvent me (source, relativePos,
source.getCurrentModifiers(), this, this, time,
getLocalPoint (nullptr, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed());
mouseDrag (me);
const MouseEvent me (source, relativePos,
source.getCurrentModifiers(), this, this, time,
getLocalPoint (nullptr, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed());
mouseDrag (me);
if (checker.shouldBailOut())
return;
if (checker.shouldBailOut())
return;
Desktop::getInstance().getMouseListeners().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)

View file

@ -59,7 +59,7 @@ public:
windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass
through it (may not be possible on some platforms). */
windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific
title bar and frame\. if not specified, the window will be
title bar and frame. if not specified, the window will be
borderless. */
windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */
windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a