steinbergmedia / vstgui

A user interface toolkit mainly for audio plug-ins
Other
869 stars 123 forks source link

[Windows] Cannot move window after a COptionMenu has been popped up #302

Closed nickdowell closed 1 year ago

nickdowell commented 1 year ago

Steps to reproduce

  1. Build & Run vstgui standalone target
  2. Click on one of the COptionMenu controls on the right hand side
  3. Select one of the menu items
  4. Try to move the window by clicking & dragging its title bar
  5. Observe that the window doesn't move. It will move on the second attempt.

This bug does not occur if the menu is dismissed by clicking outside the popup.

Note: it also occurs when using vstgui in a plug-in, not just standalone.

Does not occur on macOS.

Environment

nickdowell commented 1 year ago

Update: this is a regression introduced in release 4.11

Using git bisect I have tracked it down to commit e0acde7fef744eae9010713a0de2c4ad72712b4f

e0acde7fef744eae9010713a0de2c4ad72712b4f is the first bad commit
commit e0acde7fef744eae9010713a0de2c4ad72712b4f
Author: scheffle <scheffle@users.noreply.github.com>
Date:   Sat Apr 24 17:59:09 2021 +0200

    new mouse event handling

 vstgui/lib/cframe.cpp                              | 269 +++++++++++----------
 vstgui/lib/cframe.h                                |  10 +-
 vstgui/lib/cview.cpp                               | 105 ++++++++
 vstgui/lib/cview.h                                 |  14 +-
 vstgui/lib/cviewcontainer.cpp                      | 195 ++++++++-------
 vstgui/lib/cviewcontainer.h                        |  11 +-
 vstgui/lib/events.h                                | 245 ++++++++++++++++++-
 vstgui/lib/platform/iplatformframecallback.h       |   3 -
 vstgui/lib/platform/mac/cocoa/nsviewframe.mm       |  81 ++++---
 vstgui/lib/platform/win32/win32frame.cpp           | 105 ++++----
 vstgui/lib/vstguifwd.h                             |   5 +
 .../examples/standalone/resource/resources.uidesc  |   2 +-
 .../examples/standalone/resource/test.uidesc       |  12 +-
 vstgui/tests/unittest/lib/cframe_test.cpp          |  91 ++++---
 vstgui/tests/unittest/lib/csplitview_test.cpp      |  68 +++---
 vstgui/tests/unittest/lib/cview_test.cpp           |   9 +-
 vstgui/tests/unittest/lib/cviewcontainer_test.cpp  |  58 +++--
 vstgui/tests/unittest/unittests.cpp                |   6 +
 vstgui/tests/unittest/unittests.h                  |   2 +-
 19 files changed, 874 insertions(+), 417 deletions(-)
nickdowell commented 1 year ago

The root cause is that Win32Frame::proc is calling SetCapture when handling WM_XBUTTONDOWN for option menus. COptionMenu returns kMouseDownEventHandledButDontNeedMovedOrUpEvents so this wasn't the case before the offending commit. Pull Request with fix incoming!