From 726fe83b8464041581b74846090e285bcd0adc6f Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 30 Nov 2021 11:03:41 +0200 Subject: [PATCH] [macOS] Fix driver crash when enabling per-pixel transparency on M1 macs. (cherry picked from commit f72cc71ebe130920b0f8ae30be710160b4d3a163) --- platform/osx/os_osx.mm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 59f21d21e59..1cad6d79187 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -2903,11 +2903,12 @@ void OS_OSX::set_window_per_pixel_transparency_enabled(bool p_enabled) { layered_window = false; } [context update]; - NSRect frame = [window_object frame]; if (!is_no_window_mode_enabled()) { - [window_object setFrame:NSMakeRect(frame.origin.x, frame.origin.y, 1, 1) display:YES]; - [window_object setFrame:frame display:YES]; + // Force resize window frame to update OpenGL context. + NSRect frameRect = [window_object frame]; + [window_object setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO]; + [window_object setFrame:frameRect display:YES]; } } }