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

Author Topic: Alt-F4 not sending sf::Event::Closed to sf::Window  (Read 5789 times)

0 Members and 1 Guest are viewing this topic.

Aster

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Alt-F4 not sending sf::Event::Closed to sf::Window
« on: July 17, 2014, 09:10:58 pm »
Hi there.

Upon testing my game on Linux, as it has no menu yet, the only way to close it is using Alt-F4.
This method works perfectly fine on Windows with both fullscreen and windowed mode..
.. But on Linux, it only works in windowed mode. With fullscreen mode, Alt-F4 won't send the sf::Event::Closed event, and Alt-Tab won't change the window's focus.

I've tested this on Archlinux with GNOME 3, GNOME Classic, and XFCE.
I'm using SFML from latest git.


Here's some example code:
#include <SFML/OpenGL.hpp>
#include <SFML/Window.hpp>

int main()
{
        sf::Window window{sf::VideoMode::getDesktopMode(), "Whee", sf::Style::Fullscreen};

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

                glClear(GL_COLOR_BUFFER_BIT);
                window.display();
        }

        return 0;
}

 

The OpenGL stuff (include, glClear and window.display()) is optional, but I put it in there so that you can clearly see the fullscreen window.
The only way for me to exit this program or return to my desktop is to switch to a different TTY and pkill it.


Any help is appreciated.
Cheers.
« Last Edit: July 17, 2014, 09:20:36 pm by Aster »

BlaXpirit

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • My projects
Re: Alt-F4 not sending sf::Event::Closed to sf::Window
« Reply #1 on: July 17, 2014, 09:17:42 pm »
Same problem on Arch Linux (KDE) with SFML 2.1, python-sfml.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Alt-F4 not sending sf::Event::Closed to sf::Window
« Reply #2 on: July 17, 2014, 09:33:18 pm »
Works fine for me on 64bit Arch Linux with KDE and 64bit RHEL6.5 with Gnome.

Edit: note; my SFML build is a couple months old.

Aster

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: Alt-F4 not sending sf::Event::Closed to sf::Window
« Reply #3 on: July 17, 2014, 09:35:45 pm »
Edit: note; my SFML build is a couple months old.

How old exactly? We could find the commit that broke it.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Alt-F4 not sending sf::Event::Closed to sf::Window
« Reply #4 on: July 17, 2014, 09:47:16 pm »
I'm not sure exactely.
The current checkout that I have of SFML is commit d73418261b5 but that's not what I have installed. Based on the timestamp on my libsfml-window.so.2.1 file what I have installed is from June 25 2014, but what exact commit that was I don't know. I'm also pretty sure that I cloned/updated the repository at least a week or two before I build and installed it. So if you are looking to do a "git bisect" I'd advice starting with commits early in (or before) may 1'st.
« Last Edit: July 17, 2014, 10:03:19 pm by Jesper Juhl »

Aster

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: Alt-F4 not sending sf::Event::Closed to sf::Window
« Reply #5 on: July 17, 2014, 11:10:30 pm »
After going through every commit between now and April 25th, I think this may either be an issue with Linux that has never been noticed, or an issue with Arch because something is too bleeding-edge again.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Alt-F4 not sending sf::Event::Closed to sf::Window
« Reply #6 on: July 17, 2014, 11:21:52 pm »
This was already reported 2 years ago.
https://github.com/SFML/SFML/issues/274
This might be fixed by switching over to XCB, so that is probably the issue that gets taken care of first. Tank was originally assigned to oversee it, but considering he has less time now, I might take over so it doesn't have to wait for too long.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Aster

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: Alt-F4 not sending sf::Event::Closed to sf::Window
« Reply #7 on: July 17, 2014, 11:41:59 pm »
Alright. Just going to confirm that this bug does happen in Ubuntu 14.04 with Unity.