Sublime Forum

How does ST achieve flickerless resizing?

#1

I notice on all platforms, even Windows, when you resize the main window, not only is it fast, it does not flicker the bottom and right hand sides of the window.

I have repeatedly try to do this in my program and haven’t had much success, especially under Windows I can’t get it to do it at all, there is always flicker.

How to make resizing a top-level window both fast and without flicker?

  • Steve
0 Likes

#2

I guess the trick is the custom gui toolkit used by sublimehq. It can handle all events resulting in resizing/moving controls itself, while applications which use OS APIs for all kinds of controls rely on system messages and/or quality of underlying frameworks to calculate new positions and sizes as well as redrawing them. Latter one depend on propably deeply nested API call paths, which result in delays.

0 Likes

#3

In terms of making it fast, that’s really just down to making your application draw as fast as possible. Our custom UI toolkit uses either Skia or OpenGL for drawing and we’ve put in a lot of work to keep it fast.

As for flickering when resizing there’s a number of likely causes. One that springs to mind is properly handling WM_ERASEBKGND. You generally want to ignore this event except before the first paint.

0 Likes

#4

Right, looks like you’ve succeeded where nearly all other Windows apps failed. I couldn’t do it even going into HWNDs and HDCs, and intercepting WM_NCCALCSIZE and WM_SIZING. I’ll look into WM_ERASEBKGND.

0 Likes