Skip to content

Add new event for os window #6049

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

beck-thompson
Copy link
Member

Needed for space-wizards/space-station-14#36969

Right now, there isn't a way to listen for when the window is requested to close (E.g someone clicks the X button). This means that you have to listen for ALL closes. In the viewport pr, we want to actually close the window when someone presses the x, but we don't want to close it when they simply pop the window back in (that will close the OS window, but not the viewport window)

@beck-thompson beck-thompson added T: New Feature Type: New feature Priority: 3-Not Required A: UI Things like game screens, menus, and windows. Size: Very Small For especially small issues/PRs. D3: Low Not impossible to figure out for newer coders, and simple for experienced ones. S: Needs Review This PR needs to be reviewed before it can be merged. labels Jun 26, 2025
@PJB3005
Copy link
Member

PJB3005 commented Jun 27, 2025

So I don't mind having this as a feature (assuming you change the API so the request takes a proper cancellation opportunity), but this PR isn't necessary to implement your content feature.

@PJB3005 PJB3005 added S: Awaiting Changes and removed S: Needs Review This PR needs to be reviewed before it can be merged. labels Jun 27, 2025
@beck-thompson
Copy link
Member Author

So I don't mind having this as a feature (assuming you change the API so the request takes a proper cancellation opportunity), but this PR isn't necessary to implement your content feature.

I'm not sure if I should pass through the WindowRequestClosedEventArgs as well as the cancellation. Let me know 🫡

/// <summary>
/// Raised when the user clicks the close button on the window. Can be canceled!
/// </summary>
public event Action<CancelEventArgs>? RequestClosed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this a new event type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: UI Things like game screens, menus, and windows. D3: Low Not impossible to figure out for newer coders, and simple for experienced ones. Priority: 3-Not Required S: Awaiting Changes Size: Very Small For especially small issues/PRs. T: New Feature Type: New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants