Mouselistener callbacks don't work unless the editor or a subview has received one click


I'm using Ableton Live 9 on Mac.  I noticed that mouseMove & mouseEnter are not called until the GUI receives one mouse click, then everything works fine.

If I then close the editor and reopen it, the same thing.

Am I doing something wrong or is this the correct behaviour?







Presumably this is OSX? That's how all windows on OSX work - you have to click to focus them first.

Yes Jules, it is OS X.


Thanks for the Swift reply but the window has focus but still needs a click on an actual component 



Sorry, maybe I replied too soon, I had already clicked the bar at the top of the top, turning the left most circle red but needed to click the actual GUI in order for the callbacks to become active

In apps, I have a few tricks in JUCE that let the GUIs handle mouse-moves before the windows get focused, but that sort of hackery isn't available in plugins, so the windows have to behave in the way the OS/host makes them.

When I open the GUI in Ableton, it doesn't have focus, then when I click the grey bar above my plugin, it DOES have focus but still those callbacks don't trigger until I actually make a click on the GUI (not the grey bar)


I'll take a look at the Audio plugin demo and see what I'm doing differently 

ok, the callback works in JuceDemoPlugin so I must be doing soemthing wrong.  I'll look at my code.





I believe that the titlebar for the window isn't part of the content component, which is where the mouseEvents listeners are responsive.  perhaps that's the problem?  

Maybe the titlebar has focus, as opposed to the content component, and clicking on the content component changes the focus, which turns on the event listeners.   I'm just guessing tho..  

Hi matkatmusic.

Well, for Jules's JuceDemoPlugin it works.  I mean, I added:


void JuceDemoPluginAudioProcessorEditor::mouseMove (const MouseEvent& e)


and the callbacks happen even if I only click the bar at the top. Also, I just noticed the keys on the midi keyboard light up as I hover over them on the Demo but in my plugin, that only happens after I click once on the GUI!!


Very weird


Did you set “Plugin Editor requires Keyboard Focus” in Introjucer?
You might also need to add setWantsKeyboardFocus(true) in your PluginEditor component?

Hi ckk,

I hadn't set that but I looked and Jules has set that for the demo so I'll try that.  I'm busy with somehting for half an hour but I'll report back once I've checked that out




Just had to click 'Plugin editor requires keybaord focus' in the Introjucer and all is well.

Cheers ckk!