# GLFW and window minimize callback function

**URL:** <https://discourse.glfw.org/t/glfw-and-window-minimize-callback-function/230>\
**Category:** support\
**Created:** [May 22, 2012, 5:09pm UTC](https://discourse.glfw.org/t/glfw-and-window-minimize-callback-function/230 "2012-05-22T17:09:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [May 22, 2012, 5:09pm UTC](https://discourse.glfw.org/t/glfw-and-window-minimize-callback-function/230/1 "2012-05-22T17:09:51Z")

</div>

**anonymous** wrote on [Tuesday, May 22, 2012](https://sourceforge.net/p/glfw/discussion/247562/thread/b8abe629/#509b):

I like the way you can set callback functions to handle all the window and io  
specific events when they occur. But there’s one callback missing: a callback  
when window gets minimized. That would be very useful, because you could then  
set the program in sleep mode so it wouldn’t take all the CPU power. I don’t  
feel like checking if the window is minimized in a loop, since it takes some  
cpu power to make that function call. I would appreciate if that callback  
could be added to GLFW 3.0, or if you could actually set custom callbacks  
based on some parameters you pass to callback registration function.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [May 22, 2012, 6:20pm UTC](https://discourse.glfw.org/t/glfw-and-window-minimize-callback-function/230/2 "2012-05-22T18:20:36Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Tuesday, May 22, 2012](https://sourceforge.net/p/glfw/discussion/247562/thread/b8abe629/#ec4a):

glfwWaitEvents will return after events have been processed, including events  
not passed on via callbacks. You therefore only need to check the window’s  
iconification status after it returns and can avoid an active loop.

GLFW 3 already has a callback for iconification events, but it’s more a matter  
of convenience.
