Page 1 of 1

Right mouse click while rotating a knob = control stuck into permanent editing

Posted: Mon Nov 06, 2017 3:26 pm
by f.berti
Hello,

some of my plug-in testers have reported a strange issue regarding knobs and mouse clicks.
Basically, if you accidentally click the right mouse button while you're turning a knob, the knob gets stuck into editing and starts following the mouse pointer until you close the GUI.
I know that it's a weird use case, but it can be annoying.

It seems like when you click the mouse right button, the endEdit() from the previous mouse movement (ex. rotating the knob) is never called, so the editing counter never returns to zero and this causes the strange behavior.

Is this a known issue? Can anyone else confirm the problem? I can replicate it easily in both Windows and Mac (any host, so far), but I'd like to be sure it's related to VSTGUI, since I did some customizations but nothing that should interfere with knobs behavior in any way.

I'm using version 4.3.

Thanks in advance,
Federico Berti - Ignite Amps

Re: Right mouse click while rotating a knob = control stuck into permanent editing

Posted: Wed Nov 08, 2017 6:32 pm
by Arne Scheffler
Hi Federico,
you're right, it looks like that this can happen.
The fix for this is to add the following lines at the beginning of CViewContainer::onMouseDown (..) :

Code: Select all

	if (pImpl->mouseDownView)
	{
		// we ignore secondary buttons when another button is already in a pressed state
		return kMouseEventHandled;
	}
Cheers
Arne

Re: Right mouse click while rotating a knob = control stuck into permanent editing

Posted: Thu Nov 09, 2017 10:16 am
by f.berti
Thanks for the fix, Arne, but I'm afraid the problem is not completely gone yet...

This fix works if you click the right mouse button while the pointer is still inside the CViewContainer of the knob, but when moving the cursor, if you end up into another CViewContainer or outside the VSTGUI window (it can happen if you have controls on a footer or a header, like in my case), the editing gets stuck again.
Good thing is that this time if you click again the right or left mouse button while inside the knob CViewContainer, the editing stops, so there is no need to close the GUI.

Way better than before, but not perfect yet :D

Re: Right mouse click while rotating a knob = control stuck into permanent editing

Posted: Fri Nov 10, 2017 10:21 am
by Arne Scheffler
Thanks for reporting back.
I will have a look how to make a better change.

Cheers
Arne

Re: Right mouse click while rotating a knob = control stuck into permanent editing

Posted: Fri Nov 10, 2017 11:14 am
by f.berti
Anything wrong with doing the same thing, but at CFrame level?
Seems to work, but I don't know the library enough in depth to evaluate the impacts of the change...

Re: Right mouse click while rotating a knob = control stuck into permanent editing

Posted: Fri Nov 10, 2017 2:35 pm
by Arne Scheffler
So, I think the real fix is this :

Code: Select all

//-----------------------------------------------------------------------------
void CViewContainer::setMouseDownView (CView* view)
{
	if (pImpl->mouseDownView && pImpl->mouseDownView != view)
	{
		// make sure the old mouse down view get a mouse cancel or if not implemented a mouse up
		if (auto cvc = pImpl->mouseDownView->asViewContainer ())
			cvc->setMouseDownView (nullptr);
		else if (pImpl->mouseDownView->onMouseCancel () == kMouseEventNotImplemented)
		{
			CPoint p = pImpl->mouseDownView->getViewSize ().getTopLeft () - CPoint (10, 10);
			pImpl->mouseDownView->onMouseUp (p, 0);
		}
	}
	pImpl->mouseDownView = view;
}
What do you think ?

Cheers
Arne

Re: Right mouse click while rotating a knob = control stuck into permanent editing

Posted: Sat Nov 11, 2017 10:05 am
by f.berti
Ok, I couldn't test this fix on my VSTGUI version, so I've updated to the latest master version on GitHub.

I confirm that it works when moving the mouse cursor into another CViewContainer.
If you go outside the plug-in window, when the right click gets captured by the host (ex. you get a popup menu in Reaper or Logic), the editing remains stuck.
I don't know if we can do something about this, or is outside our control, honestly... thoughts?

Thanks for the quick fix

Re: Right mouse click while rotating a knob = control stuck into permanent editing

Posted: Sat Nov 11, 2017 3:03 pm
by Arne Scheffler
Is this last issue on both macOS and Windows ?

Re: Right mouse click while rotating a knob = control stuck into permanent editing

Posted: Sat Nov 11, 2017 7:13 pm
by f.berti
I've tested it on OSX, I'll report the result on Windows by monday.

Re: Right mouse click while rotating a knob = control stuck into permanent editing

Posted: Mon Nov 13, 2017 8:44 am
by f.berti
Works correctly on Windows on the same scenario in Reaper, seems like an OSX related issue.