mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
GWindow: Allow clients to prevent close requests from closing
This is done by hooking the new on_close_request callback and returning GWindow::CloseRequestDecision::StayOpen (instead of ...::Close.)
This commit is contained in:
parent
ecbedda34c
commit
c4b1456c88
2 changed files with 12 additions and 1 deletions
|
@ -322,6 +322,10 @@ void GWindow::event(CEvent& event)
|
|||
}
|
||||
|
||||
if (event.type() == GEvent::WindowCloseRequest) {
|
||||
if (on_close_request) {
|
||||
if (on_close_request() == GWindow::CloseRequestDecision::StayOpen)
|
||||
return;
|
||||
}
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue