Skip to content
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

(Linux) Window Close Event not triggered with sf::Style None, Titlebar, Resize #2943

Open
3 tasks done
danieljpetersen opened this issue Apr 13, 2024 · 0 comments · May be fixed by #2947
Open
3 tasks done

(Linux) Window Close Event not triggered with sf::Style None, Titlebar, Resize #2943

danieljpetersen opened this issue Apr 13, 2024 · 0 comments · May be fixed by #2947

Comments

@danieljpetersen
Copy link
Contributor

Prerequisite Checklist

Describe your issue here

The window event sf::Event::Closed never get triggered when creating a window with sf::Style::None, sf::Style::Titlebar, sf::Style::Resize.

Most distros come with a hotkey to close the in-focus window. These hotkeys should allow you to trigger a window close event, but with SFML one never occurs. I tested both GLFW and SDL2 for the same behavior, they both behave as one would expect (the close event is propagated / the window closes).

I initially thought it was styles without a close button on the decorations, but sf::Style::Fullscreen works.

Your Environment

- OS: I tested against Linux Mint 23.1 Cinnamon x11. KDE was also tested by Flareon on Discord. I didn't test against Wayland.

- SFML version: Latest master, 30fcb35

- Compiler / toolchain: GCC 13.1

Steps to reproduce

Make sure hotkey is bound which closes in-focus window, compile / run this code, press hotkey -- the window will not get sf::Event::Close, the window will never close.

#include <SFML/Window.hpp>
 
int main()
{
    sf::Window window; // also happens with RenderWindow
 
    // The following are all not working: Titlebar, Resize, None
    window.create(sf::VideoMode({800, 600}), "My window", sf::Style::None);
 
    while (window.isOpen()) {
        sf::Event event{};
        while (window.pollEvent(event)) {
            // sf::Event::Closed is never given to us from window.pollEvent(event)
            if (event.type == sf::Event::Closed)
                window.close();
        }
 
        window.display();
    }
 
    return 0;
}

Expected behavior

The event sf::Close should be given via pollEvent when the user attempts to quit (such as by pressing hotkeys).

Actual behavior

The event sf::Close is never triggered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants