Bug in getNumDraggingMouseSources

9 posts / 0 new
Last post
siedschl
Offline
Last seen: 4 months 3 days ago
Joined: 7 Nov 2007 - 09:56
Bug in getNumDraggingMouseSources

On iPhone and iPad, Desktop::getInstance().getNumDraggingMouseSources() returns 1 when I drag with one finger, 2 when I add a second finger etc., so far so good. But when I go back to dragging with one finger only it still returns 2 (or 3, or how many fingers I used before).

jules
Online
Last seen: 2 sec ago
Joined: 29 Apr 2013 - 18:37
Re: Bug in getNumDraggingMouseSources

Can't try it right now, but can't see any obvious mistakes in the code.. Are you sure iOS is actually sending a touchesEnded: or touchesCancelled: event?

siedschl
Offline
Last seen: 4 months 3 days ago
Joined: 7 Nov 2007 - 09:56
Re: Bug in getNumDraggingMouseSources

Well, mouseDown and mouseUp work as expected (so if I introduce a variable numFingersDown and increase it by 1 with each mouseDown and decrease by 1 with each mouseUp, the result is always correct). Also, when I first use my index finger, then my middle finger, then lift my index finger and then lift my middle finger, the results are correct as well. It's only when I do "index down" -> "middle down" -> "middle up" that I still get two dragging sources, so it must be something in the internal enumeration of the sources...

jules
Online
Last seen: 2 sec ago
Joined: 29 Apr 2013 - 18:37
Re: Bug in getNumDraggingMouseSources

It sounds more likely to me that iOS is using some kind of heuristic that means it doesn't send the mouse-up when you do things in a certain order. If I had time to try it now, I'd first stick some DBGs in those low-level callback routines and double-check what events the OS is sending before assuming it's a bug in the juce code..

siedschl
Offline
Last seen: 4 months 3 days ago
Joined: 7 Nov 2007 - 09:56
Re: Bug in getNumDraggingMouseSources

Well, I'll just keep counting them myself then... whatever works.

jules
Online
Last seen: 2 sec ago
Joined: 29 Apr 2013 - 18:37
Re: Bug in getNumDraggingMouseSources

Sorry, I didn't notice that you'd said that mouse up/down was working ok... Very odd. I'm really puzzled that I can't see anything wrong with the code, but have done a bit of minor refactoring in MouseInputSource that should probably fix the problem.

alexdlabs
Offline
Last seen: 1 month 4 weeks ago
Joined: 8 Mar 2011 - 09:12
Re: Bug in getNumDraggingMouseSources

I think juce_MouseInputSource.cpp refactoring broke something, on draggable component with contextual menu:
(Win7-64 / Visual Studio 2008)

- 1: right click on the component to display the contextual menu.
- 2: left click on the same component to cancel contextual menu usage.

None of mouse buttons are down, but the component is dragged:
Component Image follow the mouse cursor and no click are possible (a kind of modal state)
Impossible do return to a non dragging state except by quitting application with keyboard shortcut.

If mouse was moved over an AlertWindow in this state, ComponentDragger::dragComponent assert at line 43:

jassert (e.mods.isAnyMouseButtonDown()); // The event has to be a drag event!

Not all draggable component with contextual menu have this issue, It's hard understand why.
Any Idea ?

Thanks.

jules
Online
Last seen: 2 sec ago
Joined: 29 Apr 2013 - 18:37
Re: Bug in getNumDraggingMouseSources

Damn, I just can't seem to get it quite right! Try again now..

alexdlabs
Offline
Last seen: 1 month 4 weeks ago
Joined: 8 Mar 2011 - 09:12
Re: Bug in getNumDraggingMouseSources

This fix the mouseDrag problem.

Thanks