So, I tried it and it worked well.
the "window" element of the PANEL struct has a nice habbit.
If you use a bitmap that has the power of 2 it will be repeatet, when you exceed the borders of the given bitmap in dx or dy.
With this method you can use very small bitmaps, without interpolated pixels.
I removed every blitting operation in your header (concering the Windows) and I removed the bmap_createblack command ind the window_update function.
The update function only sets the window elements positions new and scales the borders and the content.

The speed gain is huge.
When I cleaned up the code tomorrow (or weekend) I will upload it.

I don't now If I am boring you with this posts laugh I hope not.