# Smooth resizing on Windows

**URL:** <https://discourse.glfw.org/t/smooth-resizing-on-windows/2867>\
**Category:** support\
**Created:** [March 1, 2025, 8:50pm UTC](https://discourse.glfw.org/t/smooth-resizing-on-windows/2867 "2025-03-01T20:50:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![constantitus](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/constantitus/32/994_2.png) [@constantitus](https://discourse.glfw.org/u/constantitus)\
**Post date:** [March 1, 2025, 8:50pm UTC](https://discourse.glfw.org/t/smooth-resizing-on-windows/2867/1 "2025-03-01T20:50:49Z")

</div>

I am running a setup where all glfw calls are on a separate thread so my program doesn’t block when the window is being resized. My issue is that the resize callback is only being called once, when I release the mouse. I would like to get continuous window size updates as I resize the window (which is what happens on linux) so I can smoothly resize my viewport. Is there any way to get that behaviour ?

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [March 2, 2025, 3:17pm UTC](https://discourse.glfw.org/t/smooth-resizing-on-windows/2867/2 "2025-03-02T15:17:27Z")

</div>

At the moment I think the best approach would be to explicitly check the window size every frame with `glfwGetFramebufferSize`.

There is some discussion on Win32 resizing on [#1426](https://github.com/glfw/glfw/pull/1426).

I think we should consider calling the size callbacks when `WM_RESIZE` is called and not just `WM_SIZE`, however this might break single threaded code which expects the callbacks to only be called once per `glfwPollEvents` call since Windows blocks this function during resizing. Having this as an optional property might be a reasonable approach.

---

<div class="post-metadata">

**Author:** ![constantitus](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/constantitus/32/994_2.png) [@constantitus](https://discourse.glfw.org/u/constantitus)\
**Post date:** [March 11, 2025, 11:33pm UTC](https://discourse.glfw.org/t/smooth-resizing-on-windows/2867/3 "2025-03-11T23:33:37Z")

</div>

After a lot of experimenting, I have arrived at the following solution, which I’ll share here aswell.  
To get smooth rendering while resizing on windows, the best solution is to draw during `WM_PAINT` (which means ditching glfw or heavily modifying it to support this).  
Even by calling `glfwGetFramebufferSize` every frame, the resizes will still be out of sync and the drawing will be jittery. I have not found any other way to deal with this.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [March 12, 2025, 8:14am UTC](https://discourse.glfw.org/t/smooth-resizing-on-windows/2867/4 "2025-03-12T08:14:40Z")

</div>

If you want to get a callback for `WM_PAINT` on Windows in GLFW then use [the Window damage and refresh callback](https://www.glfw.org/docs/latest/window_guide.html#window_refresh).

---

<div class="post-metadata">

**Author:** ![constantitus](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/constantitus/32/994_2.png) [@constantitus](https://discourse.glfw.org/u/constantitus)\
**Post date:** [March 12, 2025, 2:15pm UTC](https://discourse.glfw.org/t/smooth-resizing-on-windows/2867/5 "2025-03-12T14:15:30Z")

</div>

While messing with polling events in another thread I did end up implementing the platform layer from scratch only to end up finding out there’s no way to get smooth drawing during resize unless you draw during wm\_paint. But I forgot to actually check if glfw has a way to draw during wm\_paint. Thanks for pointing that out!
