Skip to content

API change proposal for window closing #434

@august64

Description

@august64

Currently, the Closed event indicates when a window has been destroyed, and clicking the × button (or closing the window through some other external means) leads to the unconditional destruction of the window. Ideally, application developers should have the opportunity to decide how to handle external requests for the window to close, such as prompting the user about unsaved work, but that's not presently possible.

Proposal

A new event named Destroyed should be created, taking the place of the existing Closed event. This is consistent with the naming scheme used in both Win32 and X11.

The existing Closed event should be removed in favor of CloseRequested. This prevents existing code from missing the API change, and prevents ambiguity in future code. When × is pressed/etc., the only behavior that should occur is this event being sent, allowing the application developer to decide what action to take.

A close method could be added to Window (#13). In the simplest case, CloseRequested would be handled by calling close for that window. However, since this method would have the same effect as dropping the window, it could be preferable to leave out this method and just make dropping the canonical solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    S - apiDesign and usability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions