I’ve created a simple app in ocaml and run it under X on Linux. I’ve set
the video mode to resizable so the user can resize the window. All of
that works just fine and the app gets resize events whenever the user
BUT: The resize does not seem to reisze the surface of the window.
When the window shrinks I can clip the output to the visible portion
of the surface. Not so when the window grows. The surface is too
small. And the only way to get a bigger surface seems to be to call
set_video_mode to create a new surface.
Now the problem is that set_video_mode will resize the window. In my
window manager the window contents are redrawn in real-time while the
window is resized. So I get a resize event for every pixel the window
is resized. And while the WM is resizing the window the app’s resize
requests are queued up for later consideration. Then when I lift my
finger from the mouse button and end the resize all the queued up
resize requests from set_video_mode get processed. So the window
iterates over all the inbetween sizes. This even seems to spawn new
resize events to the size changes keep going and feed themself and the
window never comes to rest.
So how am I supposed to use resize events?