Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Multiple windows, top one does not receive input  (Read 1899 times)

0 Members and 1 Guest are viewing this topic.

Suslik

  • Newbie
  • *
  • Posts: 33
    • View Profile
Multiple windows, top one does not receive input
« 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:


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.
« Last Edit: October 30, 2014, 02:22:46 am by Suslik »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Multiple windows, top one does not receive input
« Reply #1 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.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

 

anything