[MacPorts] #65354: iTerm2 @3.4.15_3: SafeAreaInsets are still breaking builds on older systems
MacPorts
noreply at macports.org
Sun Jun 19 17:45:58 UTC 2022
#65354: iTerm2 @3.4.15_3: SafeAreaInsets are still breaking builds on older systems
----------------------+----------------------
Reporter: Gandoon | Owner: markemer
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version: 2.7.2
Resolution: | Keywords:
Port: iTerm2 |
----------------------+----------------------
Comment (by Gandoon):
So if I understand the use of those macros correctly, something along the
lines of the content of `patch-safeAreaInsets-fixv2.diff` (appended to the
ticket and shown below) should be ok?
It builds on my machine with that patch applied instead of the previously
suggested one. Please, do let me know if this is more in line with what
you had in mind.
I here use the `#if MAC_OS_X_VERSION_MIN_REQUIRED >= 120000` to do the
same I did before by explicitly commenting out of the relevant sections.
It is still unnecessary to apply it to MacOS 12 targets though, but if it
works as it should, it shouldn't break anything for them either.
{{{
--- sources/NSScreen+iTerm.m.orig 2021-12-05 01:21:52.000000000
+0100
+++ sources/NSScreen+iTerm.m 2022-06-19 19:06:28.781367951 +0200
@@ -93,9 +93,11 @@
}
- (CGFloat)notchHeight {
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
if (@available(macOS 12.0, *)) {
return self.safeAreaInsets.top;
}
+#endif
return 0;
}
@@ -107,11 +109,13 @@
}
- (CGFloat)it_menuBarHeight {
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
if (@available(macOS 12, *)) {
// When the "current" screen has a notch, there doesn't seem to
be a way to get the height
// of the menu bar on other screens :(
return MAX(24, self.safeAreaInsets.top);
}
+#endif
return NSApp.mainMenu.menuBarHeight;
}
--- sources/iTermRootTerminalView.m.orig 2021-12-05
01:21:52.000000000 +0100
+++ sources/iTermRootTerminalView.m 2022-06-19 19:04:11.922745994
+0200
@@ -1252,11 +1252,13 @@
if (fakeHeight > 0) {
return fakeHeight;
}
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
if (@available(macOS 12, *)) {
// self.safeAreaInsets is all 0s on a notch Mac. Why the hell
doesn't anything work right?
const NSEdgeInsets safeAreaInsets =
self.window.screen.safeAreaInsets;
return safeAreaInsets.top;
}
+#endif
return 0;
}
}}}
--
Ticket URL: <https://trac.macports.org/ticket/65354#comment:11>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list