Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#3016·SFML

Unable to update the window while resizing or dragging the window

Author: eXpl0it3rCreated May 16, 2024Updated Aug 22, 2026
Labelsbugm:sfml-windowp:windows

Describe your issue here

On Windows, while a window is being resized or dragged, it's currently not possible to refresh the window's content and thus you may get odd smearing effects or black rectangles.

The root cause is the way events are processed on Windows, which never gives control back to the main loop. More specifically, DispatchMessageW doesn't return until the resize is finished.

It's important to note, that if you application gets out of sync or disconnects, while resizing the window, it's really considered an issue in your code. Blocked CPU time can happen in other cases as well, which should be properly handled in your application.

I currently see four possibilities:

  • Callback
  • Threading
  • Parent-Child Window
  • WM_SYSCOMMAND + Custom Resize Handler

Also check the solution design for a more in-depth discussion: https://github.com/SFML/SFML/wiki/SD:-Render-while-Resizing

SDL has addressed this issue not to long ago in https://github.com/libsdl-org/SDL/issues/1059 for SDL 2 (https://github.com/libsdl-org/SDL/commit/509c70c6982b6927f5a8d4fb32f9319cbaf0c2ef) and SDL 3 (https://github.com/libsdl-org/SDL/commit/02f356439d1fedf0b4e5f96cd23c2d570e2f7be2). The linked issue also shows a few alternative approaches and discusses why some are better than others. Maybe it can serve as an inspiration for a solution within SFML.

Allegro seems to choose the approach of using a separate thread to handle the resize events. I haven't fully understood when this thread is launched and how it gives control back to the main event loop.

This issue is related to #1601, #1604, #1397, and many more discussion on the forum and Discord

Your Environment

  • OS / distro / window manager: Windows
  • SFML version: 2.x / 3.x

Steps to reproduce

  1. Display something dynamic on the window
  2. Resize the window

Expected behavior

The dynamic rendering continues rendering and slowly adjusts in size as the window get larger or smaller

Actual behavior

The rendering stops completely, as well as the application update handling.

Source: SFML/SFML

View original on GitHubView discussion on GitHub