Optimization?


#1

On mac at least when I click and hold over a stretchableLayoutResizerBar and move just one pixel, i’m called repeatably(maybe that’s another issue in and of itself), but how about this(don’t bother unless the value has actually changed)

void StretchableLayoutResizerBar::mouseDrag (const MouseEvent& e)
{
const int desiredPos = mouseDownPos + (isVertical ? e.getDistanceFromDragStartX()
: e.getDistanceFromDragStartY());

if (layout->getItemCurrentPosition(itemIndex)!= desiredPos)
{
	layout->setItemPosition (itemIndex, desiredPos);
	
	hasBeenMoved();
	
}

}


#2

Hmmm, maybe related to this

http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=6080&start=0

MouseInputSource.cpp
void handleAsyncUpdate()
{
setScreenPos (lastScreenPos, jmax (lastTime, Time::currentTimeMillis()), true);
}

forceupdate is true…should it be?


#3

Thanks, that does seem like a sensible optimisation. Re: the forcedupdate flag, yes it should be true - it’s required when doing a fake mouse move, because they need to be sent regardless of whether the mouse has moved or not. If you’re getting a stream of unnecessary events, I guess the thing to look for would be whatever’s sending all the fake mouse moves.