Ticket #65354: patch-safeAreaInsets-fix.diff

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

Source code patch – Removes uses of safeAreaInsets on systems older than MacOS 11

  • sources/NSScreen+iTerm.m

    old new  
    9393}
    9494
    9595- (CGFloat)notchHeight {
    96     if (@available(macOS 12.0, *)) {
    97         return self.safeAreaInsets.top;
    98     }
     96//  safeAreaInsets has proven to be absent and fail to compile on macOS 10.15.7 (Darwin 19.6.0), and indications of
     97//  issues on later systems have been seen and reported in https://trac.macports.org/ticket/63824
     98//  Commenting this out avoids the problem on these pre-notched Macs. See also below in it_menuBarHeight.
     99    // if (@available(macOS 12.0, *)) {
     100    //    return self.safeAreaInsets.top;
     101    // }
    99102    return 0;
    100103}
    101104
     
    107110}
    108111
    109112- (CGFloat)it_menuBarHeight {
    110     if (@available(macOS 12, *)) {
     113   // 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 :(
    113         return MAX(24, self.safeAreaInsets.top);
    114     }
     116        // return MAX(24, self.safeAreaInsets.top);
     117   // }
    115118    return NSApp.mainMenu.menuBarHeight;
    116119}
    117120
  • sources/iTermRootTerminalView.m

    old new  
    12521252    if (fakeHeight > 0) {
    12531253        return fakeHeight;
    12541254    }
    1255     if (@available(macOS 12, *)) {
    1256         // self.safeAreaInsets is all 0s on a notch Mac. Why the hell doesn't anything work right?
    1257         const NSEdgeInsets safeAreaInsets = self.window.screen.safeAreaInsets;
    1258         return safeAreaInsets.top;
    1259     }
     1255
     1256//  safeAreaInsets has proven to be absent and fail to compile on macOS 10.15.7 (Darwin 19.6.0), and indications of
     1257//  issues on later systems have been seen and reported in https://trac.macports.org/ticket/63824
     1258//  Commenting this out avoids the problem on these pre-notched Macs.
     1259//    if (@available(macOS 12, *)) {
     1260//        // self.safeAreaInsets is all 0s on a notch Mac. Why the hell doesn't anything work right?
     1261//        const NSEdgeInsets safeAreaInsets = self.window.screen.safeAreaInsets;
     1262//        return safeAreaInsets.top;
     1263//    }
    12601264    return 0;
    12611265}
    12621266