瀏覽代碼

[macOS] Fix driver crash when enabling per-pixel transparency on M1 macs.

bruvzg 3 年之前
父節點
當前提交
f72cc71ebe
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      platform/osx/os_osx.mm

+ 4 - 3
platform/osx/os_osx.mm

@@ -2909,11 +2909,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];
 		}
 	}
 }