Bug in getNumDraggingMouseSources


#1

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).


#2

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?


#3

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…


#4

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…


#5

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


#6

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.


#7

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:

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

Thanks.


#8

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


#9

This fix the mouseDrag problem.

Thanks