I've created this minimal example:
#include "SFML/Window.hpp"
int main()
{
sf::Window window(sf::VideoMode(1280, 720), "piv", sf::Style::Default);
bool fullscreen = false;
sf::Event event;
while (window.isOpen())
{
while (window.pollEvent(event))
{
switch (event.type)
{
case sf::Event::Closed:
window.close();
break;
case sf::Event::KeyPressed:
switch (event.key.code)
{
case sf::Keyboard::Escape:
window.close();
break;
case sf::Keyboard::F:
printf("toggle fullscreen\n");
if (fullscreen)
{
window.create(sf::VideoMode(1280, 720), "piv", sf::Style::Default);
fullscreen = false;
}
else
{
window.create(sf::VideoMode::getDesktopMode(), "piv", sf::Style::Fullscreen);
fullscreen = true;
}
break;
default:
break;
}
break;
case sf::Event::Resized:
printf("%d %d\n", event.size.width, event.size.height);
break;
default:
break;
}
}
}
}
And this is the output:
1280 720
toggle fullscreen
1920 1080
1920 1043
1920 1080
toggle fullscreen
1280 720
toggle fullscreen
1920 1080
1920 1043
1920 1080
toggle fullscreen
1280 720
Why are there three resize events when switching to fullscreen?
Why is there an event for this weird resolution of 1920x1043?
Am I doing something funny here?
SFML 2.6.1 on fedora linux.