Browse Source

macOS: fix initial Metal drawable size in certain multi-display setups

(cherry picked from commit baca26d72701655157c2a1ab678c2d5af0830d53)
Sasha Szpakowski 2 years ago
parent
commit
17ecb11ed6
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/video/cocoa/SDL_cocoametalview.m

+ 4 - 1
src/video/cocoa/SDL_cocoametalview.m

@@ -94,7 +94,7 @@ SDL_MetalViewEventWatch(void *userdata, SDL_Event *event)
 
         [self updateDrawableSize];
     }
-  
+
     return self;
 }
 
@@ -151,6 +151,9 @@ Cocoa_Metal_CreateView(_THIS, SDL_Window * window)
 
     [view addSubview:newview];
 
+    /* Make sure the drawable size is up to date after attaching the view. */
+    [newview updateDrawableSize];
+
     metalview = (SDL_MetalView)CFBridgingRetain(newview);
 
     return metalview;