Does background window update automatically?

When I draw something with renderer, then switch my window to background, I can see the contents of this window redraws automatically even this window overlaps by other windows.

Is it a feature of SDL? Please help to make sure!

I think it’s an expected behavior. But if you don’t want this, you could implement the code to prevent redrawing while the window is inactive (by handling events).

mr_tawan wrote:

I think it’s an expected behavior.
If so, then it’s a very nice feature!

I’m porting to SDL a BlackBox component framework that uses an WinApi.InvalidateRect function to determine overlapping regions and to redraw only the changed region of a window.

This old-school technique was good in a middle of 1990, but now with SDL there no need to redraw parts of background window, i think.

mr_tawan wrote:

But if you don’t want this, you could implement the code to prevent redrawing while the window is inactive (by handling events).
I don’t see any window event flying into the background window. So, there are no need to code any redrawing in a background, I think.