Skip to content

Commit

Permalink
Keep calling Main::iteration() during live resizing
Browse files Browse the repository at this point in the history
Otherwise, when the mouse stops moving the engine doesn't keep running.

Also don't call Main::force_redraw() during live resizing, because it
is already being called from -[GodotContentLayerDelegate displayLayer:].
  • Loading branch information
pcbeard committed Dec 2, 2023
1 parent 3a197cb commit 8b2c438
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions platform/macos/os_macos.mm
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,15 @@
// Do not redraw when rendering is done from the separate thread, it will conflict with the OpenGL context updates.

DisplayServerMacOS *ds = (DisplayServerMacOS *)DisplayServer::get_singleton();
if (get_singleton()->get_main_loop() && ds && (get_singleton()->get_render_thread_mode() != RENDER_SEPARATE_THREAD) && !ds->get_is_resizing()) {
Main::force_redraw();
if (get_singleton()->get_main_loop() && ds && (get_singleton()->get_render_thread_mode() != RENDER_SEPARATE_THREAD)) {
if (!ds->get_is_resizing()) {
// Don't force redraws during resize.
// -[GodotContentLayerDelegate displayLayer:] forces redraws during resizing, and
// also calls Main::iteration(), but only when the window is actively resized. If
// the mouse is still held down, but not moving, the game stalls.

Main::force_redraw();
}
if (!Main::is_iterating()) { // Avoid cyclic loop.
Main::iteration();
}
Expand Down

0 comments on commit 8b2c438

Please sign in to comment.