Window resizing and aspect ratio?

In my current setup I am using glfwSetWindowSizeCallback to adjust glViewport. Additionally during initialization I am setting an aspect ratio with glfwSetWindowAspectRatio. In Windowed mode this is fine, but when I maximize the window (and probably on full screen as well), the image stretches. Is it possible to make it so that rather than stretching, you’d see a solid color (usually black) outside the actual image (similar to a letterbox effect, but on the sides instead of above and below)? An additional bonus would be if I can set the window non-resizeable so I could use a window size multiplier to scale the window from a settings menu.

As you know glfwSetWindowAspectRatio cannot work on a fullscreen window since the size has to be the size of the resolutions available.

If you want letterboxing or similar this needs to be done via the graphics API you’re using, i.e. OpenGL if you are using that. You can do this by clearing to black and then using glViewport to control the part of the screen you want to draw to.

You can set the window to non-resizeable by setting the window hint GLFW_RESIZABLE to false before creation of the window, and you can then set the window size yourself.