New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No resize event when going fullscreen #893

Closed
jube opened this Issue May 23, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@jube

jube commented May 23, 2015

No resize event is sent when the window is going fullscreen. Calling setSize() in fullscreen does not trigger any event either. I work on a Linux system (Debian unstable).

When pressing F, the following code only displays "Resized: 200x200".

#include <cstdio>
#include <SFML/Graphics.hpp>

int main() {
  bool fullscreen = false;

  sf::VideoMode initialMode(200, 200);

  sf::RenderWindow window(initialMode, "Bug");

  while (window.isOpen()) {
    sf::Event event;

    while (window.pollEvent(event)) {
      switch (event.type) {
        case sf::Event::Closed:
          window.close();
          break;

        case sf::Event::Resized:
          std::printf("Resized: %ux%u\n", event.size.width, event.size.height);
          break;

        case sf::Event::KeyPressed:
          if (event.key.code == sf::Keyboard::F) {
            fullscreen = !fullscreen;
            sf::Uint32 style = sf::Style::Default;
            sf::VideoMode mode = initialMode;

            if (fullscreen) {
              style |= sf::Style::Fullscreen;
              mode = sf::VideoMode::getFullscreenModes().front();
            }

            window.create(mode, "Bug", style);
          }

        default:
          break;
      }
    }

    window.clear(sf::Color::White);

    window.display();
  }

  return 0;
}
@eXpl0it3r

This comment has been minimized.

Show comment
Hide comment
@eXpl0it3r

eXpl0it3r May 23, 2015

Member

Thanks for the report. This has already been reported (#878) and is fixed in the 2.3.x branch, meaning it will be included in the 2.3.1 patch release ones it gets out.

We would highly appreciate it, if you could test the 2.3.x branch to see if you issue is gone and whether you notice other issue that might need to be included for 2.3.1. 😉

Member

eXpl0it3r commented May 23, 2015

Thanks for the report. This has already been reported (#878) and is fixed in the 2.3.x branch, meaning it will be included in the 2.3.1 patch release ones it gets out.

We would highly appreciate it, if you could test the 2.3.x branch to see if you issue is gone and whether you notice other issue that might need to be included for 2.3.1. 😉

@jube

This comment has been minimized.

Show comment
Hide comment
@jube

jube May 23, 2015

On the 2.3.x branch, the previous code works. I changed it a little bit: I disabled key repeat and added a printf when F is pressed. It now displays:

Resized: 200x200
Ask for fullscreen
Resized: 1306x748
Resized: 1366x768
Ask for fullscreen
Resized: 200x200

The "Resized: 1306x748" is weird (as if the window was maximized before going fullscreen) but the overall behaviour seems ok though.

jube commented May 23, 2015

On the 2.3.x branch, the previous code works. I changed it a little bit: I disabled key repeat and added a printf when F is pressed. It now displays:

Resized: 200x200
Ask for fullscreen
Resized: 1306x748
Resized: 1366x768
Ask for fullscreen
Resized: 200x200

The "Resized: 1306x748" is weird (as if the window was maximized before going fullscreen) but the overall behaviour seems ok though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment