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

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

This commit is contained in:
ed 2017-03-16 08:53:46 +00:00
parent 5920bcd20b
commit 8ca0bc6791
3 changed files with 13 additions and 4 deletions

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

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

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.
*/