SFML community forums

Help => Window => Topic started by: Suslik on October 30, 2014, 02:21:14 am

Title: Multiple windows, top one does not receive input
Post by: Suslik on October 30, 2014, 02:21:14 am
Minimal code:
#include <SFML/Graphics.hpp>
int main()
{
        sf::RenderWindow largerWindow(sf::VideoMode(800, 600), "Larger window");
        sf::RenderWindow smallerWindow(sf::VideoMode(200, 100), "Smaller window");

        while (smallerWindow.isOpen() || largerWindow.isOpen())
        {
                sf::Event event;
                while (smallerWindow.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                        smallerWindow.close();
                }
                while (largerWindow.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                        largerWindow.close();
                }
        }
        return 0;
}

 
The code creates a larger window and a smaller one on top of it:
(https://dl.dropboxusercontent.com/u/25635148/Screenshot_2014-10-30_05-15.png)

The smaller window does not receive mouse input: you cannot drag or close it while it's above larger window. When you move larger window away you can select it though and after that it works as intended. Problem occurs only after creating windows - smaller one looks on top of larger one but acts as if it was under it.

Tested on Windows 7.
Title: Re: Multiple windows, top one does not receive input
Post by: binary1248 on October 30, 2014, 06:49:14 am
This should have been fixed a long time ago (however, shortly after 2.1 was released).

https://github.com/SFML/SFML/issues/437
https://github.com/SFML/SFML/pull/457
https://github.com/SFML/SFML/commit/9d3ea9399bef63c9472a112967c673ce380de454

If you don't already, use the master branch (either build yourself or grab eXpl0it3r's nightly build) and see if the problem persists.