[macOS] Fix uncapped frame rate for windows in the non-active workspaces.

(cherry picked from commit 2ee45dc293)
This commit is contained in:
bruvzg 2023-07-17 10:29:49 +03:00 committed by Yuri Sizov
parent ed9216d1d8
commit e67b6e0d0f
1 changed files with 2 additions and 2 deletions

View File

@ -3085,14 +3085,14 @@ bool DisplayServerMacOS::window_is_focused(WindowID p_window) const {
} }
bool DisplayServerMacOS::window_can_draw(WindowID p_window) const { bool DisplayServerMacOS::window_can_draw(WindowID p_window) const {
return window_get_mode(p_window) != WINDOW_MODE_MINIMIZED; return (window_get_mode(p_window) != WINDOW_MODE_MINIMIZED) && [windows[p_window].window_object isOnActiveSpace];
} }
bool DisplayServerMacOS::can_any_window_draw() const { bool DisplayServerMacOS::can_any_window_draw() const {
_THREAD_SAFE_METHOD_ _THREAD_SAFE_METHOD_
for (const KeyValue<WindowID, WindowData> &E : windows) { for (const KeyValue<WindowID, WindowData> &E : windows) {
if (window_get_mode(E.key) != WINDOW_MODE_MINIMIZED) { if ((window_get_mode(E.key) != WINDOW_MODE_MINIMIZED) && [E.value.window_object isOnActiveSpace]) {
return true; return true;
} }
} }