Browse Source

Fixed call to ComponentPeer::handleMouseEvent() in FakeMouseMoveGenerator. Added isPen() and isMouse() methods to MouseInputSource.

tags/2021-05-28
ed 8 years ago
parent
commit
8ca0bc6791
3 changed files with 13 additions and 4 deletions
  1. +2
    -2
      modules/juce_audio_plugin_client/utility/juce_FakeMouseMoveGenerator.h
  2. +2
    -0
      modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp
  3. +9
    -2
      modules/juce_gui_basics/mouse/juce_MouseInputSource.h

+ 2
- 2
modules/juce_audio_plugin_client/utility/juce_FakeMouseMoveGenerator.h View File

@@ -50,8 +50,8 @@ public:
if (Component* const comp = Desktop::getInstance().findComponentAt (screenPos.roundToInt()))
if (ComponentPeer* const peer = comp->getPeer())
if (! peer->isFocused())
peer->handleMouseEvent (0, peer->globalToLocal (screenPos), mods,
MouseInputSource::invalidPressure, Time::currentTimeMillis());
peer->handleMouseEvent (MouseInputSource::InputSourceType::mouse, peer->globalToLocal (screenPos), mods,
MouseInputSource::invalidPressure, MouseInputSource::invalidOrientation, Time::currentTimeMillis());
}
}


+ 2
- 0
modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp View File

@@ -574,7 +574,9 @@ MouseInputSource& MouseInputSource::operator= (const MouseInputSource& other) no
}
MouseInputSource::InputSourceType MouseInputSource::getType() const noexcept { return pimpl->inputType; }
bool MouseInputSource::isMouse() const noexcept { return (getType() == MouseInputSource::InputSourceType::mouse); }
bool MouseInputSource::isTouch() const noexcept { return (getType() == MouseInputSource::InputSourceType::touch); }
bool MouseInputSource::isPen() const noexcept { return (getType() == MouseInputSource::InputSourceType::pen); }
bool MouseInputSource::canHover() const noexcept { return ! isTouch(); }
bool MouseInputSource::hasMouseWheel() const noexcept { return ! isTouch(); }
int MouseInputSource::getIndex() const noexcept { return pimpl->index; }


+ 9
- 2
modules/juce_gui_basics/mouse/juce_MouseInputSource.h View File

@@ -48,7 +48,7 @@
class JUCE_API MouseInputSource
{
public:
/** Possible mouse input sources */
/** Possible mouse input sources. */
enum InputSourceType
{
mouse,
@@ -66,11 +66,18 @@ public:
bool operator!= (const MouseInputSource& other) const noexcept { return pimpl != other.pimpl; }
//==============================================================================
/** Returns the type of input source that this object represents */
/** Returns the type of input source that this object represents. */
MouseInputSource::InputSourceType getType() const noexcept;
/** Returns true if this object represents a normal desk-based mouse device. */
bool isMouse() const noexcept;
/** Returns true if this object represents a source of touch events. */
bool isTouch() const noexcept;
/** Returns true if this object represents a pen device. */
bool isPen() const noexcept;
/** Returns true if this source has an on-screen pointer that can hover over
items without clicking them.
*/


Loading…
Cancel
Save