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

Meaning of Event::Closed not clear #520

Closed
lschmierer opened this issue Jul 10, 2015 · 4 comments
Closed

Meaning of Event::Closed not clear #520

lschmierer opened this issue Jul 10, 2015 · 4 comments

Comments

@lschmierer
Copy link

As far as I understood the Event::Closed event is fired when the user attempts to close the window (e.g. presses the Close (x) button of the window). At least thats the behaviour during my testing under X11.

The docs (and the name) meanwhile give the impression that the event actually is fired after the window really has been closed.

    /// The window has been closed.
    Closed,

If the window should be closed directly, what is the way to catch ShouldClose like events?

@tomaka
Copy link
Contributor

tomaka commented Jul 10, 2015

The event is reported after the window has been closed.
There's no way to detect when the user clicks on the 'X' and prevent the window from closing.

@lschmierer
Copy link
Author

So, in my opinion that would be beneficial feature like it is possible in e.g. GLFW.

@wolfiestyle
Copy link

Relevant to this, here is something I found while testing stuff under OSX. There it works as an actual ShouldClose event, so clicking the close button doesn't actually close the window and you have to break the event loop manually. But on Linux it unconditionally closes the window. Clearly there is an inconsistency here, and imho it should just send the close event but don't destroy the window, so you get a chance to display those "save? yes/no/cancel" dialogs. Gtk can do it under linux, so it should be possible.

@tomaka
Copy link
Contributor

tomaka commented Nov 3, 2016

Closing for rust-windowing/winit#46

@tomaka tomaka closed this as completed Nov 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants