Windows 11 animations not working when GLFW_DECORATED is false

As far as I can tell, windows doesn’t apply minimize/maximize animation to borderless windows, but from searching I found that there is a workaround which might work: when the your minimize button is clicked or event received you can set the window style back to having a border then minimize then restore it back to borderless when it is fully maximized.

However this doesn’t work if done via the iconify callback since that fires after the event, but it is possible to restore, set decorated and minimize as follows:

void IconifyCallback( GLFWwindow* window, int iconified )
{
    static bool inside = false;

    if( inside ) { return; }
    inside = true;
    if( iconified )
    {
        glfwRestoreWindow( window );
        glfwSetWindowAttrib( window, GLFW_DECORATED, GLFW_TRUE );
        glfwIconifyWindow( window );
    }
    else
    {
        glfwSetWindowAttrib( window, GLFW_DECORATED, GLFW_FALSE );
    }
    inside = false;
}


    // somewhere after in your window creation code:
    glfwSetWindowIconifyCallback( window, IconifyCallback );

Obviously if you’re minimizing via your own button you can do better and simply decorate then minimize. This will still show a border when animating though.

Finally you could animate the window yourself. This might not be a good idea for people who have turned animations off, but perhaps there is a way to read that setting and change your behaviour.

EDIT: you might also want to take a look at:

1 Like