macOS: Embedded window fixes#106166
Conversation
|
Unfortunately, handling CTRL-C and ensuring the child process terminates is a lot more challenging, as the macOS app terminates without cleanly tearing down. I might be able to have the child process monitor the debugger connection and shutdown if it is terminated. |
Doesn't it work with the void OS_Unix::initialize_debugging() {
if (EngineDebugger::is_active()) {
struct sigaction action;
memset(&action, 0, sizeof(action));
action.sa_handler = handle_interrupt;
sigaction(SIGINT, &action, nullptr);
}
}I'm not too familiar with macOS but I'd be surprised if it couldn't react to |
That is installed in the child (embedded) process. If we send I will try that! |
9756b9d to
e6d00c6
Compare
|
@Calinou / @akien-mga |
6ac8665 to
2823ff2
Compare
614c394 to
298b812
Compare
|
@Calinou temporarily moving to draft, until I fix the following issue: I can replicate it, so I'll be able to resolve it. |
298b812 to
5174816
Compare
|
@Calinou I've now resolved the scaling issue described by a couple of our users, so this PR is ready for review |
|
It's better now. test 1 (Floating)Screen-2025-05-11-014948.mp4test 2Screen-2025-05-11-015202.mp4 |
|
There are still minor issues, but not critical. Details
2m 27s video
Once, it was wide. When I tried to reduce the width, the inspector was overlapped, but I couldn’t reproduce the issue again. (It's a similar issue at 1:39, perhaps.)
|
|
Good feedback, @Alex2782, thanks for testing! We should be able to address both issues. Pause Mode issue We would need to re-render the frame, but I am not aware of an API in Godot we can use. I'll ask around. The alternative is to step by one frame to refresh the rendered output at the new resolution, but that is less than ideal, as the gameplay would be moving forward. Initialised at startup I'll check that out – it seems the startup parameters don't match when the display is 1x 👍🏻 |
5174816 to
acdc889
Compare
- Installed a SIGINT handler to terminate the application gracefully. - Handle varying display scaling
acdc889 to
f658161
Compare
|
@Alex2782 I haven't been able to reproduce the incorrect initial size. I've reordered the messages sent at startup, so that the window size should be correct, based on the current desktop window scaling. The paused output is an issue when not embedding too, as the frame is not re-rendered. The difference is that the background colour is updated when the window redraws. We can probably do something similar, which I will look at. |
bruvzg
left a comment
There was a problem hiding this comment.
Found another resizing issue:
Screen.Recording.2025-05-12.at.22.50.50.mov
Should be fixable with something like this:
diff --git a/platform/macos/editor/embedded_process_macos.mm b/platform/macos/editor/embedded_process_macos.mm
index b2c80fb25a..e30031bf78 100644
--- a/platform/macos/editor/embedded_process_macos.mm
+++ b/platform/macos/editor/embedded_process_macos.mm
@@ -43,7 +43,10 @@
void EmbeddedProcessMacOS::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_RESIZED:
+ case NOTIFICATION_ENTER_TREE: {
+ set_notify_transform(true);
+ } break;
+ case NOTIFICATION_TRANSFORM_CHANGED:
case NOTIFICATION_VISIBILITY_CHANGED: {
update_embedded_process();
} break;I'm not entirely convinced about graceful shutdown on Ctrl+C, I would expect it to kill process instantly, but I guess it's just my personal preference.
|
|
Thanks! Merging now to include in 4.5-dev4, Stuart will work on the remaining points in a follow-up. |


Fixes in this PR:
SIGINT--embeddedis specified on unsupported platforms