You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
macOS: Embedded window can be dismissed by clicking close
- Installed a SIGINT handler to terminate the application gracefully. - Handle varying display scaling
This commit is contained in:
@@ -131,6 +131,8 @@ static void _setup_clock() {
|
||||
}
|
||||
#endif
|
||||
|
||||
struct sigaction old_action;
|
||||
|
||||
static void handle_interrupt(int sig) {
|
||||
if (!EngineDebugger::is_active()) {
|
||||
return;
|
||||
@@ -138,6 +140,11 @@ static void handle_interrupt(int sig) {
|
||||
|
||||
EngineDebugger::get_script_debugger()->set_depth(-1);
|
||||
EngineDebugger::get_script_debugger()->set_lines_left(1);
|
||||
|
||||
// Ensure we call the old action if it was configured.
|
||||
if (old_action.sa_handler && old_action.sa_handler != SIG_IGN && old_action.sa_handler != SIG_DFL) {
|
||||
old_action.sa_handler(sig);
|
||||
}
|
||||
}
|
||||
|
||||
void OS_Unix::initialize_debugging() {
|
||||
@@ -145,7 +152,7 @@ void OS_Unix::initialize_debugging() {
|
||||
struct sigaction action;
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = handle_interrupt;
|
||||
sigaction(SIGINT, &action, nullptr);
|
||||
sigaction(SIGINT, &action, &old_action);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user