Ticket #65354: patch-safeAreaInsets-fixv2.diff
File patch-safeAreaInsets-fixv2.diff, 1.3 KB (added by Gandoon (Erik Hedlund), 2 years ago) |
---|
-
sources/NSScreen+iTerm.m
old new 93 93 } 94 94 95 95 - (CGFloat)notchHeight { 96 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 120000 96 97 if (@available(macOS 12.0, *)) { 97 98 return self.safeAreaInsets.top; 98 99 } 100 #endif 99 101 return 0; 100 102 } 101 103 … … 107 109 } 108 110 109 111 - (CGFloat)it_menuBarHeight { 112 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 120000 110 113 if (@available(macOS 12, *)) { 111 114 // When the "current" screen has a notch, there doesn't seem to be a way to get the height 112 115 // of the menu bar on other screens :( 113 116 return MAX(24, self.safeAreaInsets.top); 114 117 } 118 #endif 115 119 return NSApp.mainMenu.menuBarHeight; 116 120 } 117 121 -
sources/iTermRootTerminalView.m
old new 1252 1252 if (fakeHeight > 0) { 1253 1253 return fakeHeight; 1254 1254 } 1255 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 120000 1255 1256 if (@available(macOS 12, *)) { 1256 1257 // self.safeAreaInsets is all 0s on a notch Mac. Why the hell doesn't anything work right? 1257 1258 const NSEdgeInsets safeAreaInsets = self.window.screen.safeAreaInsets; 1258 1259 return safeAreaInsets.top; 1259 1260 } 1261 #endif 1260 1262 return 0; 1261 1263 } 1262 1264