Mouse dragging on the Mac with 1.42


I’m having problems with jumps in the vertical mouse position while dragging.

I did lots of debug prints and came up with this new bit of code in juce_mac_Windowing.cpp:

HIPoint p; p.x = where.h; p.y = where.v; HIPointConvert (&p, kHICoordSpaceScreenPixel, 0, kHICoordSpaceWindow, juce_currentMouseTrackingPeer->getNativeHandle()); const int x = p.x; const int y = p.y;

The values being fed into HIPointConvert are OK; they behave as expected. The y values coming out of HIPointConvert sometimes jump by 20 or 30 pixels.

So I’m a little stumped.


Hmm. I’ve always suspected that HIPointConvert is buggy, but have never proved anything…

Is it happening when the window is being moved? Is there an easy way I could see the problem here?


No, the window isn’t being moved - I’m simply dragging the mouse over a component.

I’ll see if I can reproduce it using the demo app.


Turns out it’s easy to reproduce with the JUCE demo - just turn on the native title bar on the Mac. Move one of the vertical sliders up and down - you’ll see it jump back and forth.


Agh… you’re right. Ok, this is what it should have been:

HIPointConvert (&p, kHICoordSpaceScreenPixel, 0, kHICoordSpaceView, ((HIViewComponentPeer*) juce_currentMouseTrackingPeer)->viewRef);


Looks like that took care of it - thanks, Jules.