Ticket #65354: patch-safeAreaInsets-fixv2.diff

File patch-safeAreaInsets-fixv2.diff, 1.3 KB (added by Gandoon (Erik Hedlund), 23 months ago)

Source code patch – Removes uses of safeAreaInsets on systems older than MacOS 11, variant using the availability macros as suggested

  • sources/NSScreen+iTerm.m

    old new  
    9393}
    9494
    9595- (CGFloat)notchHeight {
     96#if MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
    9697    if (@available(macOS 12.0, *)) {
    9798        return self.safeAreaInsets.top;
    9899    }
     100#endif
    99101    return 0;
    100102}
    101103
     
    107109}
    108110
    109111- (CGFloat)it_menuBarHeight {
     112#if MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
    110113    if (@available(macOS 12, *)) {
    111114        // When the "current" screen has a notch, there doesn't seem to be a way to get the height
    112115        // of the menu bar on other screens :(
    113116        return MAX(24, self.safeAreaInsets.top);
    114117    }
     118#endif
    115119    return NSApp.mainMenu.menuBarHeight;
    116120}
    117121
  • sources/iTermRootTerminalView.m

    old new  
    12521252    if (fakeHeight > 0) {
    12531253        return fakeHeight;
    12541254    }
     1255#if MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
    12551256    if (@available(macOS 12, *)) {
    12561257        // self.safeAreaInsets is all 0s on a notch Mac. Why the hell doesn't anything work right?
    12571258        const NSEdgeInsets safeAreaInsets = self.window.screen.safeAreaInsets;
    12581259        return safeAreaInsets.top;
    12591260    }
     1261#endif
    12601262    return 0;
    12611263}
    12621264