mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Windows: Removed Desktop::clearAllTouchSources() method and cleaned up some Windows touch input code
This commit is contained in:
parent
8e4c187451
commit
ca9c8f22d7
4 changed files with 20 additions and 37 deletions
|
|
@ -183,7 +183,6 @@ MouseInputSource* Desktop::getMouseSource (int index) const noexcept
|
|||
MouseInputSource* Desktop::getDraggingMouseSource (int index) const noexcept { return mouseSources->getDraggingMouseSource (index); }
|
||||
MouseInputSource Desktop::getMainMouseSource() const noexcept { return MouseInputSource (mouseSources->sources.getUnchecked(0)); }
|
||||
void Desktop::beginDragAutoRepeat (int interval) { mouseSources->beginDragAutoRepeat (interval); }
|
||||
void Desktop::clearAllTouchSources() { mouseSources->clearTouches(); }
|
||||
|
||||
//==============================================================================
|
||||
void Desktop::addFocusChangeListener (FocusChangeListener* const listener) { focusListeners.add (listener); }
|
||||
|
|
|
|||
|
|
@ -288,8 +288,6 @@ public:
|
|||
*/
|
||||
void beginDragAutoRepeat (int millisecondsBetweenCallbacks);
|
||||
|
||||
/** Removes all touch input sources from the mouse sources array. */
|
||||
void clearAllTouchSources();
|
||||
//==============================================================================
|
||||
/** In a tablet device which can be turned around, this is used to inidicate the orientation. */
|
||||
enum DisplayOrientation
|
||||
|
|
|
|||
|
|
@ -684,21 +684,6 @@ struct MouseInputSource::SourceList : public Timer
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void clearTouches()
|
||||
{
|
||||
for (auto i = sourceArray.size(); --i >= 0;)
|
||||
{
|
||||
if (sourceArray.getUnchecked (i).getType() == MouseInputSource::InputSourceType::touch)
|
||||
sourceArray.remove (i);
|
||||
}
|
||||
|
||||
for (auto i = sources.size(); --i >= 0;)
|
||||
{
|
||||
if (sources.getUnchecked (i)->inputType == MouseInputSource::InputSourceType::touch)
|
||||
sources.remove (i);
|
||||
}
|
||||
}
|
||||
|
||||
int getNumDraggingMouseSources() const noexcept
|
||||
{
|
||||
int num = 0;
|
||||
|
|
|
|||
|
|
@ -2290,14 +2290,13 @@ private:
|
|||
const float touchPressure = MouseInputSource::invalidPressure,
|
||||
const float orientation = 0.0f)
|
||||
{
|
||||
bool isCancel = false;
|
||||
auto isCancel = false;
|
||||
|
||||
const int touchIndex = currentTouches.getIndexOfTouch (touch.dwID);
|
||||
auto time = getMouseEventTime();
|
||||
auto pos = globalToLocal (Point<float> (touch.x / 100.0f,
|
||||
touch.y / 100.0f));
|
||||
const float pressure = touchPressure;
|
||||
ModifierKeys modsToSend (currentModifiers);
|
||||
const auto touchIndex = currentTouches.getIndexOfTouch (touch.dwID);
|
||||
const auto time = getMouseEventTime();
|
||||
const auto pos = globalToLocal ({ touch.x / 100.0f, touch.y / 100.0f });
|
||||
const auto pressure = touchPressure;
|
||||
auto modsToSend = currentModifiers;
|
||||
|
||||
if (isDown)
|
||||
{
|
||||
|
|
@ -2305,7 +2304,8 @@ private:
|
|||
modsToSend = currentModifiers;
|
||||
|
||||
// this forces a mouse-enter/up event, in case for some reason we didn't get a mouse-up before.
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, pos, modsToSend.withoutMouseButtons(), pressure, orientation, time, PenDetails(), touchIndex);
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, pos, modsToSend.withoutMouseButtons(),
|
||||
pressure, orientation, time, {}, touchIndex);
|
||||
|
||||
if (! isValidPeer (this)) // (in case this component was deleted by the event)
|
||||
return false;
|
||||
|
|
@ -2323,24 +2323,25 @@ private:
|
|||
modsToSend = currentModifiers.withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
|
||||
}
|
||||
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, pos, modsToSend, pressure, orientation, time, PenDetails(), touchIndex);
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, pos, modsToSend,
|
||||
pressure, orientation, time, {}, touchIndex);
|
||||
|
||||
if (isCancel)
|
||||
{
|
||||
currentTouches.clear();
|
||||
Desktop::getInstance().clearAllTouchSources();
|
||||
currentModifiers = currentModifiers.withoutMouseButtons();
|
||||
}
|
||||
|
||||
if (! isValidPeer (this)) // (in case this component was deleted by the event)
|
||||
if (! isValidPeer (this))
|
||||
return false;
|
||||
|
||||
if (isUp || isCancel)
|
||||
if (isUp)
|
||||
{
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, Point<float> (-10.0f, -10.0f), currentModifiers, pressure, orientation, time, PenDetails(), touchIndex);
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, { -10.0f, -10.0f }, currentModifiers.withoutMouseButtons(),
|
||||
pressure, orientation, time, {}, touchIndex);
|
||||
|
||||
if (! isValidPeer (this))
|
||||
return false;
|
||||
|
||||
if (isCancel)
|
||||
{
|
||||
currentTouches.clear();
|
||||
currentModifiers = currentModifiers.withoutMouseButtons();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue