From 2d7c3e73d8735856969ba0e51d841940fc404a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Fri, 20 Feb 2026 10:12:55 +0200 Subject: [PATCH] [macOS] Enable wake for events if `Magnet` is running. (cherry picked from commit f7faabb95e7e6a291bd5e1fd486bcab8206e33d5) --- platform/macos/os_macos.mm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm index 3a924e635e..7c20645b4f 100644 --- a/platform/macos/os_macos.mm +++ b/platform/macos/os_macos.mm @@ -57,7 +57,14 @@ #include void OS_MacOS::add_frame_delay(bool p_can_draw, bool p_wake_for_events) { - if (p_wake_for_events) { + bool wake_for_events = p_wake_for_events; + if (!wake_for_events) { + NSArray *proc_array = [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.crowdcafe.windowmagnet"]; + if (proc_array && proc_array.count > 0) { + wake_for_events = true; + } + } + if (wake_for_events) { uint64_t delay = get_frame_delay(p_can_draw); if (delay == 0) { return; @@ -75,7 +82,7 @@ void OS_MacOS::add_frame_delay(bool p_can_draw, bool p_wake_for_events) { CFRunLoopAddTimer(CFRunLoopGetCurrent(), wait_timer, kCFRunLoopCommonModes); return; } - OS_Unix::add_frame_delay(p_can_draw, p_wake_for_events); + OS_Unix::add_frame_delay(p_can_draw, wake_for_events); } void OS_MacOS::initialize() {