[IOS] touch vs. mouse handling bug


#1

Hey Jules,

I created a full screen OpenGL Window for the iPad. No declaration at all. It’s just 2048x1536 in size.
The touch handling and the mouse emulation afterwards is working perfectly :slight_smile: I found a small bug when I use my full hand on the screen, then I am creating more than 10 touch points :wink: Internally you have defined maximum ten mouse pointers. That’s means the assertion in ComponentPeer occours.

//==============================================================================
void ComponentPeer::handleMouseEvent (const int touchIndex, const Point<int>& positionWithinPeer,
                                      const ModifierKeys& newMods, const int64 time)
{
    MouseInputSource* const mouse = Desktop::getInstance().getMouseSource (touchIndex);

    jassert (mouse != nullptr); // not enough sources!

    mouse->handleEvent (this, positionWithinPeer, time, newMods);
}

What I do for now is:

//==============================================================================
void ComponentPeer::handleMouseEvent (const int touchIndex, const Point<int>& positionWithinPeer,
                                      const ModifierKeys& newMods, const int64 time)
{
    MouseInputSource* const mouse = Desktop::getInstance().getMouseSource (touchIndex);

    if (mouse==nullptr)
        return;

    jassert (mouse != nullptr); // not enough sources!

    mouse->handleEvent (this, positionWithinPeer, time, newMods);
}

Maybe you go a better idea?

kind regards
Matthias


#2

Thanks! What I’ve done now is to make it create as many of those as it needs, so it should cope with any number of fingers or hands… Haven’t tried it on iOS, let me know if it works!