Repaint loop in FileListComponent w. LookAndFeel_V4 and ColourScheme != Dark

Hi,

In FileListComponent there seems to be a repaint loop when using LookAndFeel_V4 and a ColourScheme that is not the default dark one (e.g. getGreyColourScheme()).

The loop happens due to these lines in LookAndFeel_V4::drawFileBrowserRow():

    if (auto fileListComp = dynamic_cast<Component*> (&dcc))
    fileListComp->setColour (DirectoryContentsDisplayComponent::textColourId,
                             currentColourScheme.getUIColour (isItemSelected ? ColourScheme::UIColour::highlightedText
                                                                             : ColourScheme::UIColour::menuText));

If the ColourScheme::UIColour::highlightedText and ColourScheme::UIColour::menuText colours differ (as they do for the non-dark ColourSchemes), this will trigger ListBox::colourChanged() which queues a paint (through call to repaint()).

This issue can be seen in the JUCE demo by:

  • Enabling JUCE_ENABLE_REPAINT_DEBUGGING (super cool feature by the way!)
  • Run the demo and select “LookAndFeel_V4 Grey”
  • Choose the “Audio: File Playback” demo
  • Select a folder or file

It is visible that the file list repaints constantly.

Thanks, I’ll get that sorted.