1
Window / "setSize()" does not work
« on: March 03, 2022, 06:59:18 pm »
Hello,
I use the function "setSize" to resize a window when the user makes it too small.
This same exact code worked fine on Windows 10 but on Linux Mint - Cinnamon it's giving me problems.
The code resizes the window only once in a while instead of constantly resizing.
This is my code:
I call this function when the window gets resized here:
When I run my application every printf is triggered when making the window too small.
And yet the window does not resize.
Edit: Ok so I realized what makes the window resize: when I change the window size by dragging it fast it resizes immediatly but if I slowly drag the window the resizing doesn't take place.
I use the function "setSize" to resize a window when the user makes it too small.
This same exact code worked fine on Windows 10 but on Linux Mint - Cinnamon it's giving me problems.
The code resizes the window only once in a while instead of constantly resizing.
This is my code:
void Game::proportionateWin()
{
printf("Winsize : %4d %4d \n",w->getSize().x,w->getSize().y);
//changes window size to the minimum size (WIN_MIN) (it's 600)
if (w->getSize().x < WIN_MIN){
w->setSize(sf::Vector2u(WIN_MIN, w->getSize().y));
printf("resizing!");
}
....
{
printf("Winsize : %4d %4d \n",w->getSize().x,w->getSize().y);
//changes window size to the minimum size (WIN_MIN) (it's 600)
if (w->getSize().x < WIN_MIN){
w->setSize(sf::Vector2u(WIN_MIN, w->getSize().y));
printf("resizing!");
}
....
I call this function when the window gets resized here:
if (event.type == sf::Event::Resized) {
//printf("resized\n");
proportionateWin();
}
//printf("resized\n");
proportionateWin();
}
When I run my application every printf is triggered when making the window too small.
And yet the window does not resize.
Edit: Ok so I realized what makes the window resize: when I change the window size by dragging it fast it resizes immediatly but if I slowly drag the window the resizing doesn't take place.