Tearing in menus

When dragging the mouse through a JUCE menu, the selection “tears”. There is a brief moment when parts of two items are selected at the same time. I believe this has something to do with separate drawing for the menu text versus the menu mark (checkbox in this case). You can see it happen in the stock JUCE demo:


Hmm, it’s nothing to do with the menu itself - the code to repaint when the highlighting changes is all correct, and always repaints the entire row, never a sub-section of it.

It must be related to the intersection of the stuff behind it being repainted, and the only way I can think of this happening would be if the OS itself was losing some repaint events or getting the clipping wrong… Perhaps the fact that there’s a huge stream of events happening behind the menu means that the menu’s repaint event gets discarded too…?

Hmm…interesting idea. I noticed that it only happens in the Demo menu and not the Look-and-Feel menu. To make things more interesting, it doesn’t happen at all on the Multithreading demo page (which has animated repainting as well).

It’s very odd… I do strongly suspect Windows might be the culprit here.