Hi all,
In our app, popup menus take around 600 ms to appear on Windows when an OpenGLContext is continuously repainting. I’ve created a minimal example to demonstrate the bug:
struct MainComponent : Component
{
MainComponent()
{
addAndMakeVisible(button);
button.setBounds(20, 20, 160, 30);
button.onClick = []
{
struct Content : Component
{
Content()
{
addAndMakeVisible(button);
button.setBounds(20, 20, 160, 30);
button.onClick = [this]
{
PopupMenu menu;
menu.addItem(1, "Item 1");
menu.addItem(2, "Item 2");
menu.addItem(3, "Item 3");
menu.showMenuAsync({});
};
setSize(200, 70);
}
TextButton button{ "Show menu" };
};
DialogWindow::LaunchOptions options;
options.content.setOwned(new Content());
options.launchAsync();
};
context.setPreferredVersion({ 3, 2 });
context.setPreferredProfile(OpenGLProfile::core);
context.setContinuousRepainting(true);
context.attachTo(*this);
setSize(400, 400);
}
OpenGLContext context;
TextButton button{ "Open dialog" };
};
The menu in the example is opened from a dialog window, because that was the only way I could reproduce the issue in a minimal example. In our own app, we also see it in other places.
Turning off continuous repainting and calling triggerRepaint() from a VBlankAttachment fixes the issue for our app. If that’s the right fix, we’ll go with it, but if this is a JUCE bug, I hope it can be fixed.
This issue has been around for a while and is still present with JUCE 9.0.4.
Best,
Jelle