title: SFML: waitEvent being called before pollEvent loop
body: <p>This is my code in the recent SFML 2.4.2</p>
  
  <pre><code>#include &lt;SFML/Graphics.hpp&gt;
  #include &lt;iostream&gt;
  
  int main() {
  sf::RenderWindow window(sf::VideoMode(800, 600), "My First SFML Game", sf::Style::Titlebar | sf::Style::Close);
  
  std::cout &lt;&lt; "Press a key to continue" &lt;&lt; std::endl;
  int i = 0;
  sf::Event event;
  
  while(window.isOpen()) {
  
      while(window.pollEvent(event)) {
          std::cout &lt;&lt; "Polling event" &lt;&lt; std::endl;
          if(event.type == sf::Event::Closed) {
  
              window.close();
          }
      }
  
      if(window.waitEvent(event)) {
          if(event.type == sf::Event::Closed)std::cout &lt;&lt; "Event Activated" &lt;&lt; i++ &lt;&lt; std::endl;
      }
  }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/1tqgr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1tqgr.png" alt="Output"></a>
  All the event Activated output you see was printed when I clicked the close button and all the poll event was printed when I moved in or out of the window. It did not print Polled Event even when I clicked in the window! My problem is, pollEvents, why you no get called first and close the window when you get the close event first (apparently) because you have been written first? It does not make sense why the wait events method would be called first and pop the que. Please help.</p>