steinbergmedia / vstgui

A user interface toolkit mainly for audio plug-ins
Other
880 stars 124 forks source link

Fix erroneous SetCapture after COptionMenu::onMouseDown #303

Closed nickdowell closed 1 year ago

nickdowell commented 1 year ago

Fixes #302

COptionMenu::onMouseDown returns kMouseDownEventHandledButDontNeedMovedOrUpEvents

Prior to release 4.11, Win32Frame::proc would not call SetCapture in response: https://github.com/steinbergmedia/vstgui/blob/6431f630f65f630c52ec1dfbb93d39d40600c41c/vstgui/lib/platform/win32/win32frame.cpp#L778-L779

In 4.11 and onwards, only event.consumed is being checked, so kMouseDownEventHandledButDontNeedMovedOrUpEvents results in a call to SetCapture which leads to the behavious described in #302: https://github.com/steinbergmedia/vstgui/blob/addf12b9486fd9460a3abf2cf2a2dd96c44ed807/vstgui/lib/platform/win32/win32frame.cpp#L833-L834

This PR adds a !event.ignoreFollowUpMoveAndUpEvents () check so that SetCapture is not called in response to kMouseDownEventHandledButDontNeedMovedOrUpEvents.