# SDL: macOS: fix initial Metal drawable size in certain multi-display setups (17ecb)

**URL:** <https://discourse.libsdl.org/t/sdl-macos-fix-initial-metal-drawable-size-in-certain-multi-display-setups-17ecb/42342>\
**Category:** SDL Commits\
**Created:** [February 2, 2023, 6:44am UTC](https://discourse.libsdl.org/t/sdl-macos-fix-initial-metal-drawable-size-in-certain-multi-display-setups-17ecb/42342 "2023-02-02T06:44:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [February 2, 2023, 6:44am UTC](https://discourse.libsdl.org/t/sdl-macos-fix-initial-metal-drawable-size-in-certain-multi-display-setups-17ecb/42342/1 "2023-02-02T06:44:03Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/17ecb11ed6fb448ced09f7753e6160b28569153b>
>
> (cherry picked from commit baca26d72701655157c2a1ab678c2d5af0830d53)

```diff
From 17ecb11ed6fb448ced09f7753e6160b28569153b Mon Sep 17 00:00:00 2001
From: Sasha Szpakowski <[EMAIL REDACTED]>
Date: Wed, 1 Feb 2023 18:56:33 -0400
Subject: [PATCH] macOS: fix initial Metal drawable size in certain
 multi-display setups

(cherry picked from commit baca26d72701655157c2a1ab678c2d5af0830d53)
---
 src/video/cocoa/SDL_cocoametalview.m | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/video/cocoa/SDL_cocoametalview.m b/src/video/cocoa/SDL_cocoametalview.m
index 61ca9d158f08..2f1b73ba30b4 100644
--- a/src/video/cocoa/SDL_cocoametalview.m
+++ b/src/video/cocoa/SDL_cocoametalview.m
@@ -94,7 +94,7 @@ - (instancetype)initWithFrame:(NSRect)frame
 
         [self updateDrawableSize];
     }
-  
+
     return self;
 }
 
@@ -151,6 +151,9 @@ - (NSView *)hitTest:(NSPoint)point {
 
     [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;

```
