CallOutBox - slow on Windows?


#1

I've got a component with several children, including a couple ListBoxes, and I'm presenting it to the user in a CallOutBox. On Mac, it works quite smoothly, but on Windows it's quite a bit slower. You can see this in the JuceDemo app as well - look at the color picker in a CallOutBox. When you drag the mouse around in the color area, the interaction is much faster on Mac than Windows.

If I show my component inside a regular window on Windows, the interaction is much smoother than the CallOutBox.

So, my question is, is this just the nature of transparent or non-rectangular windows on Windows? Or is there something I can do to speed up the CallOutBox? I really want to use a CallOutBox, but the lag is frustrating. Maybe not a Juce problem at all, but if anyone knows something I can do to make it run faster in Windows, I'd appreciate it. Thanks!


#2

As a comparison, I put my component inside a PopupMenu, and everything is much smoother. A PopupMenu is rectangular and opaque, which is why I'm thinking that transparent windows may just take a natural performance hit on Windows.

But I really prefer the look of CallOutBox, and would like to make it work.

If anyone can confirm that this is just the nature of Windows, then I can make the decision about taking a performance hit vs looking nicer, and I can quit wasting time trying to fix something that's unfixable.


#3

Yes - on Windows all semi-transparent windows will be slow to render - it's a side-effect of an ancient Win2000 hack that MS used to implement transparency, which means that the whole window has to be repainted when anything changes.

TBH I don't know whether there have been new win32 additions in later versions of Windows that could be used to improve this, it has been many years since I looked into it.


#4

OK, thanks.

I figured it was a limitation of Windows, but I'm glad to confirm that. Now I just need to decide if I can tolerate the lag, or if I need to take a different approach.


#5


Maybe take a look at this:
 

​https://msdn.microsoft.com/en-us/library/windows/desktop/ms632599(v=vs.85).aspx#layered

Using a layered window can significantly improve performance and visual effects for a window that has a complex shape, animates its shape, or wishes to use alpha blending effects. The system automatically composes and repaints layered windows and the windows of underlying applications. As a result, layered windows are rendered smoothly, without the flickering typical of complex window regions. In addition, layered windows can be partially translucent, that is, alpha-blended.

....

Note Beginning with Windows 8, WS_EX_LAYERED can be used with child windows and top-level windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.

 

ps - had to put the url in a code block because the forum makes a mess of it (even using <a> tags)


#6

Yes, juce uses layered windows. But the way they implemented it meant that it doesn't use the normal invalid region system, so whole thing gets repainted when any of it changes.