When two (or more) different Juce-based plugins (I used the demo plugin and a blank plugin created with the Introjucer, both Release builds) are open (e.g. both GUIs are visible) only the last opened will receive correct mouse wheel messages. The others will always get a maximum increment (e.g. positive, no matter in what direction the wheel was moved).
This doesn’t happen in the 64-bit plugins, though I only tested 64-bit on our plugins.
I traced this back to juce_win32_Windowing.cpp:1956
Sounds like it must be related to the VST mouse hook, but I can’t see why it’d go wrong like that. Wheel events that aren’t used by the plugin should be passed on to the next client…
I must admit I’m at a loss solving this. I just checked the quite recent (from monday or tuesday) modules tip, but the bug still seems to be there. I used the JuceDemoPlugin plus a plugin created with the Introjucer where I simply added a slider. When I load both plugins, only the one last loaded receives meaningfull mouse wheel messages.
I looked at the value of hs.mouseData for good and bad events. Working events result in 0x780000 for up and 0xFF880000 for down while in case of the ‘bad’ events it is always 0x75209e2e.
I added a check for the lower bytes of hs.mouseData being zero:
With this modification after opening another plugin the previous ones only get mouse wheel messages if one instance of them has keyboard focus (I had to click on them). So if I open three different plugins the third always gets mouse wheel messages, while the other ones need to get keyboard focus in order to receive mouse wheel messages. In case of several instances only one has to get keyboard focus.
Could the reason for this be related with Windows’s dislike of non-focused windows getting mouse wheel messages?
Yes, definitely. Bear in mind that all this event hooking is just a workaround to try to improve Windows’ crappy mouse-wheel behaviour. If it’s not working, you still get the normal events, just like any other Windows app.
I think the behaviour with the mentioned patch also is the same than simply removing the hook.
Would you consider removing the hook or making it switchable?
I must admit I don’t see any advantages when it only works as long as one Juce plugin is opened.
Thanks for the fast reply! That makes sense that I wasn't able to reproduce it on our computers then, since I keep all of them up-to-date with everything on Windows Update. I'll forward this to the customer.