Browse Source

Prevented some mouse-events bypassing modal components.

tags/2021-05-28
jules 13 years ago
parent
commit
a4b83d313c
2 changed files with 44 additions and 38 deletions
  1. +43
    -37
      modules/juce_gui_basics/components/juce_Component.cpp
  2. +1
    -1
      modules/juce_gui_basics/windows/juce_ComponentPeer.h

+ 43
- 37
modules/juce_gui_basics/components/juce_Component.cpp 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) 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 (! isCurrentlyBlockedByAnotherModalComponent())
{
BailOutChecker checker (this);
if (checker.shouldBailOut())
return;
if (flags.repaintOnMouseActivityFlag)
repaint();
Desktop& desktop = Desktop::getInstance();
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseUp, me);
const MouseEvent me (source, relativePos,
oldModifiers, this, this, time,
getLocalPoint (nullptr, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed());
mouseUp (me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseUp, me);
if (checker.shouldBailOut())
return;
if (checker.shouldBailOut())
return;
Desktop& desktop = Desktop::getInstance();
desktop.getMouseListeners().callChecked (checker, &MouseListener::mouseUp, me);
// check for double-click
if (me.getNumberOfClicks() >= 2)
{
mouseDoubleClick (me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseUp, me);
if (checker.shouldBailOut()) if (checker.shouldBailOut())
return; return;
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseDoubleClick, me);
MouseListenerList::sendMouseEvent (*this, checker, &MouseListener::mouseDoubleClick, me);
// 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) 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) void Component::internalMouseMove (MouseInputSource& source, const Point<int>& relativePos, const Time& time)


+ 1
- 1
modules/juce_gui_basics/windows/juce_ComponentPeer.h View File

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


Loading…
Cancel
Save