I have a custom mouse cursor graphic that I load through the LookAndFeel. In Ableton, if the arrangement view is moving while playing and I mouse over my plugin, my cursor will show and then immediately revert back to the native mouse cursor.
Quick video showing what I mean.
My code is basically
class OtherLookAndFeel : public juce::LookAndFeel_V4
{
public:
OtherLookAndFeel()
{
...
mouseCursor = juce::Image(juce::ImageCache::getFromMemory(BinaryData::amiMouseCursor_png, BinaryData::amiMouseCursor_pngSize));
pixelCursor = juce::MouseCursor(mouseCursor.rescaled(22,22, juce::Graphics::lowResamplingQuality), 1, 1);
}
juce::MouseCursor getMouseCursorFor(juce::Component&) override
{
return pixelCursor;
}
...
private:
juce::Image mouseCursor;
juce::MouseCursor pixelCursor;
...
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OtherLookAndFeel)
};
And then I load the OtherLookAndFeel class like:
class AmiAudioProcessorEditor : public juce::AudioProcessorEditor
{
public:
AmiAudioProcessorEditor(AmiAudioProcessor& p) : AudioProcessorEditor (&p), audioProcessor(p)
{
setLookAndFeel(&lookNFeel);
...
}
~AmiAudioProcessorEditor() override
{
setLookAndFeel(nullptr);
}
...
private:
OtherLookAndFeel lookNFeel;
...
AmiAudioProcessor& audioProcessor;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AmiAudioProcessorEditor)
};
I’ve tried initializing mouseCursor
and pixelCursor
on the heap instead of the stack by making them unique pointers, thinking maybe it was an issue with those objects’ scope. I’ve tried, with little hope, making the lookNFeel
object a unique pointer, just in case it was an issue with that being on the stack.
I even tried overriding mouseEnter()
and putting setMouseCursor()
in there as a possibly hacky workaround until I found a better solution
At this point I think it’s more an issue with how Ableton is handling my plugin and there’s not much I can do about it, but I figured I’d check here if there’s anything I’m missing or if anyone had a similar issue and found a solution.
I’m using Windows 11 but IIRC it happens in Ableton on my mac as well