Forcing a Minimum Size

mast4as wrote on Sunday, September 21, 2014:

Hello,

  1. FLGW is very useful. Thx for developing it.

  2. I am trying to have an app in which the window can’t be resized below a minimum size.

I can’t seem able to do this at all. I tried to play with:

glfwSetWindowSizeCallback(window, windowSizeCallback);

void windowSizeCallback(GLFWwindow* window, int width, int height)
{
printf(“new size %d %d\n”, width, height);
glfwSetWindowSize(window, 640, 480);
}

but first, you can still resize the window below it’s minimum size and two, while the call back always seems to be called, the windows is not always resized to 640,480. In ohter words, they are times where this doesn’t seem to work…?

Is there a good solution to this. What I want is:

  • window size can’t be lower than 400,400 say
  • user can resize it and make it bigger than that.
  • if the user resized the window, if the size is greater than 400,400 he/she can see the window changing size. But if he/she tries to make it smaller than 400,400 the window keeps a fixed size.

Thanks.

elmindreda wrote on Sunday, September 21, 2014:

This is planned for 3.2 with the glfwSetWindowSizeLimits function, which will support minimum size, maximum size and enforced aspect ratio, but currently there is no way to do it.

mast4as wrote on Sunday, September 21, 2014:

Great – good to know. I can work around it for mow.

Please keep going with this good and very useful work.