From: Alan Third <alan@idiocy.org>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: "Po Lu" <luangruo@yahoo.com>,
"Mattias Engdegård" <mattiase@acm.org>,
emacs-devel@gnu.org
Subject: Re: Emacs 28 on OSX: emacsclient.c:1415: warning: implicit declaration of function 'openat'
Date: Sat, 23 Apr 2022 23:04:29 +0100 [thread overview]
Message-ID: <YmR37ei6l0sWw9AT@idiocy.org> (raw)
In-Reply-To: <m235i4o1uc.wl%esq@lawlist.com>
[-- Attachment #1: Type: text/plain, Size: 834 bytes --]
On Fri, Apr 22, 2022 at 09:33:47PM -0700, Keith David Bershatsky wrote:
> I've built Emacs master branch a few times now on OSX 10.6.8 from
> scratch beginning from cloning the master and have concluded that
> the fist suggestion by Alan is sufficient to permit a successful
> build and working version of Emacs.
>
> - unsignedlong does not need any changes.
>
> - ns_query_color does not need any changes.
>
> Changing colorUsingDefaultColorSpace from deviceRGBColorSpace to
> genericRGBColorSpace is sufficient.
OK, thanks, that's good to know.
Can you try the attached patch? I've rolled in Po Lu's changes too, so
hopefully this should deal with all the errors.
I've reinstated some code that will cause warnings, but as long as it
builds without errors and doesn't crash I prefer the easier to read
code.
--
Alan Third
[-- Attachment #2: v5-0001-Fix-nsmenu-compilation-under-macOS-10.6.patch --]
[-- Type: text/x-diff, Size: 8872 bytes --]
From 3dfed2f5d3bd4447ce5e405008ffe7e872d68c7e Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Tue, 19 Apr 2022 05:05:17 +0100
Subject: [PATCH v5] Fix nsmenu compilation under macOS 10.6
* src/nsmenu.m ([EmacsMenu fillWithWidgetValue:]): Replace modern
shorthand dictionary and array definitions.
* src/nsterm.h (NSTextAlignmentRight): Redefine if necessary.
* src/macfont.m (mac_font_create_preferred_family_for_attributes):
isOperatingSystemAtLeastVersion is new in macOS 10.10, so it's
probably wrong to use it to check whether we're below 10.9.
(mac_font_copy_default_descriptors_for_language):
(mac_font_copy_default_name_for_charset_and_languages): It seems these
functions are only used on macOS 10.8 and below.
* src/nsterm.m ([NSColor colorUsingDefaultColorSpace]): Use the
generic colorspace.
(ns_parent_window_rect):
(ns_frame_scale_factor):
([EmacsWindow setParentChildRelationships]): Fix macOS version stuff.
Co-authored-by: Po Lu <luangruo@yahoo.com>
---
src/macfont.m | 15 +++++++++------
| 10 ++++++----
src/nsterm.h | 1 +
src/nsterm.m | 35 ++++++++++++++++++++++++-----------
4 files changed, 40 insertions(+), 21 deletions(-)
diff --git a/src/macfont.m b/src/macfont.m
index 34e48afb98..35648df06c 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -57,8 +57,10 @@ static Boolean mac_font_descriptor_supports_languages (CTFontDescriptorRef,
static CFIndex mac_font_shape (CTFontRef, CFStringRef,
struct mac_glyph_layout *, CFIndex,
enum lgstring_direction);
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
static CFArrayRef mac_font_copy_default_descriptors_for_language (CFStringRef);
static CFStringRef mac_font_copy_default_name_for_charset_and_languages (CFCharacterSetRef, CFArrayRef);
+#endif
#if USE_CT_GLYPH_INFO
static CGGlyph mac_ctfont_get_glyph_for_cid (CTFontRef, CTCharacterCollection,
CGFontIndex);
@@ -3570,18 +3572,17 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
if (languages && CFArrayGetCount (languages) > 0)
{
- if ([[NSProcessInfo processInfo]
- isOperatingSystemAtLeastVersion:
- ((NSOperatingSystemVersion){
- .majorVersion = 10, .minorVersion = 9})])
- values[num_values++] = CFArrayGetValueAtIndex (languages, 0);
- else
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
+ if (CTGetCoreTextVersion () < kCTVersionNumber10_9)
{
CFCharacterSetRef charset =
CFDictionaryGetValue (attributes, kCTFontCharacterSetAttribute);
result = mac_font_copy_default_name_for_charset_and_languages (charset, languages);
}
+ else
+#endif
+ values[num_values++] = CFArrayGetValueAtIndex (languages, 0);
}
if (result == NULL)
{
@@ -4000,6 +4001,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
}
#endif
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
static CFArrayRef
mac_font_copy_default_descriptors_for_language (CFStringRef language)
{
@@ -4134,6 +4136,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
return result;
}
+#endif
void *
macfont_get_nsctfont (struct font *font)
--git a/src/nsmenu.m b/src/nsmenu.m
index 81d7cd2da1..0f7d1fb98f 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -649,7 +649,8 @@ - (void)fillWithWidgetValue: (void *)wvptr
work around it by using tabs to split the title into two
columns. */
NSFont *menuFont = [NSFont menuFontOfSize:0];
- NSDictionary *font_attribs = @{NSFontAttributeName: menuFont};
+ NSDictionary *font_attribs = [NSDictionary dictionaryWithObjectsAndKeys:
+ menuFont, NSFontAttributeName, nil];
CGFloat maxNameWidth = 0;
CGFloat maxKeyWidth = 0;
@@ -677,11 +678,12 @@ - (void)fillWithWidgetValue: (void *)wvptr
NSTextTab *tab =
[[[NSTextTab alloc] initWithTextAlignment: NSTextAlignmentRight
location: maxWidth
- options: @{}] autorelease];
+ options: [NSDictionary dictionary]] autorelease];
NSMutableParagraphStyle *pstyle = [[[NSMutableParagraphStyle alloc] init]
autorelease];
- [pstyle setTabStops: @[tab]];
- attributes = @{NSParagraphStyleAttributeName: pstyle};
+ [pstyle setTabStops: [NSArray arrayWithObject:tab]];
+ attributes = [NSDictionary dictionaryWithObjectsAndKeys:
+ pstyle, NSParagraphStyleAttributeName, nil];
#endif
/* clear existing contents */
diff --git a/src/nsterm.h b/src/nsterm.h
index 4cba5c0be8..5b121ede98 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1290,6 +1290,7 @@ #define NSWindowStyleMaskUtilityWindow NSUtilityWindowMask
#define NSAlertStyleCritical NSCriticalAlertStyle
#define NSControlSizeRegular NSRegularControlSize
#define NSCompositingOperationCopy NSCompositeCopy
+#define NSTextAlignmentRight NSRightTextAlignment
/* And adds NSWindowStyleMask. */
#ifdef __OBJC__
diff --git a/src/nsterm.m b/src/nsterm.m
index 5a6a4d663b..e5d8af9af0 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -163,7 +163,7 @@ - (NSColor *)colorUsingDefaultColorSpace
&& NSAppKitVersionNumber >= NSAppKitVersionNumber10_7)
return [self colorUsingColorSpace: [NSColorSpace sRGBColorSpace]];
#endif
- return [self colorUsingColorSpace: [NSColorSpace deviceRGBColorSpace]];
+ return [self colorUsingColorSpace: [NSColorSpace genericRGBColorSpace]];
}
+ (NSColor *)colorWithUnsignedLong:(unsigned long)c
@@ -751,7 +751,14 @@ Free a pool and temporary objects it refers to (callable from C)
EmacsView *parentView = FRAME_NS_VIEW (FRAME_PARENT_FRAME (f));
parentRect = [parentView convertRect:[parentView frame]
toView:nil];
- parentRect = [[parentView window] convertRectToScreen:parentRect];
+
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+ if (![[parentView window]
+ respondsToSelector:@selector(convertRectToScreen:)])
+ parentRect.origin = [[parentView window] convertBaseToScreen:parentRect.origin];
+ else
+#endif
+ parentRect = (NSRect)[[parentView window] convertRectToScreen:parentRect];
}
else
parentRect = [[[NSScreen screens] objectAtIndex:0] frame];
@@ -788,8 +795,14 @@ Free a pool and temporary objects it refers to (callable from C)
double
ns_frame_scale_factor (struct frame *f)
{
-#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > 1060
- return [[FRAME_NS_VIEW (f) window] backingScaleFactor];
+#if defined (NS_IMPL_COCOA)
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+ if (! [[FRAME_NS_VIEW (f) window]
+ respondsToSelector:@selector(convertRectToScreen:)])
+ return [[FRAME_NS_VIEW (f) window] userSpaceScaleFactor];
+ else
+#endif
+ return (double)[[FRAME_NS_VIEW (f) window] backingScaleFactor];
#else
return [[FRAME_NS_VIEW (f) window] userSpaceScaleFactor];
#endif
@@ -6942,7 +6955,7 @@ - (void)otherMouseDragged: (NSEvent *)e
[self mouseMoved: e];
}
-#ifdef NS_IMPL_COCOA
+#if defined NS_IMPL_COCOA && defined MAC_OS_X_VERSION_10_7
- (void) magnifyWithEvent: (NSEvent *) event
{
NSPoint pt = [self convertPoint: [event locationInWindow] fromView: nil];
@@ -8525,7 +8538,7 @@ - (void)setParentChildRelationships
expected later. */
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
- if ([child respondsToSelector:@selector(setAccessibilitySubrole:)])
+ if ([self respondsToSelector:@selector(setAccessibilitySubrole:)])
#endif
/* Set the accessibility subroles. */
if (parentFrame)
@@ -8557,7 +8570,7 @@ - (void)setParentChildRelationships
#ifdef NS_IMPL_COCOA
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
- if ([ourView respondsToSelector:@selector (toggleFullScreen)]
+ if ([ourView respondsToSelector:@selector (toggleFullScreen)])
#endif
/* If we are the descendent of a fullscreen window and we
have no new parent, go fullscreen. */
@@ -8582,11 +8595,11 @@ - (void)setParentChildRelationships
#ifdef NS_IMPL_COCOA
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
- if ([ourView respondsToSelector:@selector (toggleFullScreen)]
+ if ([ourView respondsToSelector:@selector (toggleFullScreen)])
#endif
- /* Child frames must not be fullscreen. */
- if ([ourView fsIsNative] && [ourView isFullscreen])
- [ourView toggleFullScreen:self];
+ /* Child frames must not be fullscreen. */
+ if ([ourView fsIsNative] && [ourView isFullscreen])
+ [ourView toggleFullScreen:self];
#endif
[parentWindow addChildWindow:self
--
2.35.1
next prev parent reply other threads:[~2022-04-23 22:04 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-23 4:33 Emacs 28 on OSX: emacsclient.c:1415: warning: implicit declaration of function 'openat' Keith David Bershatsky
2022-04-23 22:04 ` Alan Third [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-04-26 2:56 Keith David Bershatsky
2022-04-26 3:14 ` Po Lu
2022-04-25 5:17 Keith David Bershatsky
2022-04-25 5:43 ` Po Lu
2022-04-25 9:56 ` Alan Third
2022-04-25 10:30 ` Po Lu
2022-04-25 18:07 ` Alan Third
2022-04-26 0:10 ` Po Lu
2022-04-25 3:46 Keith David Bershatsky
2022-04-25 4:13 ` Po Lu
2022-04-25 1:49 Keith David Bershatsky
2022-04-25 3:09 ` Po Lu
2022-04-25 1:35 Keith David Bershatsky
2022-04-25 18:08 ` Alan Third
2022-04-24 17:02 Keith David Bershatsky
2022-04-24 19:22 ` Alan Third
2022-04-24 0:08 Keith David Bershatsky
2022-04-24 9:03 ` Alan Third
2022-04-22 21:29 Keith David Bershatsky
2022-04-23 22:13 ` Alan Third
2022-04-22 21:23 Keith David Bershatsky
2022-04-21 22:40 Keith David Bershatsky
2022-04-21 22:44 ` Alan Third
2022-04-21 20:51 Keith David Bershatsky
2022-04-21 22:22 ` Alan Third
2022-04-21 17:52 Keith David Bershatsky
2022-04-21 19:21 ` Alan Third
2022-04-21 2:22 Keith David Bershatsky
2022-04-21 0:51 Keith David Bershatsky
2022-04-21 2:05 ` Po Lu
2022-04-21 5:09 ` Alan Third
2022-04-20 13:55 Keith David Bershatsky
2022-04-20 16:48 ` Alan Third
2022-04-19 4:36 Keith David Bershatsky
2022-04-19 4:38 ` Po Lu
2022-04-19 1:24 Keith David Bershatsky
2022-04-19 2:35 ` Po Lu
2022-04-19 4:19 ` Alan Third
2022-04-19 4:24 ` Po Lu
2022-04-19 6:04 ` Eli Zaretskii
2022-04-20 1:23 ` Po Lu
2022-04-20 8:07 ` Alan Third
2022-04-19 2:56 ` Paul Eggert
2022-04-18 20:43 Keith David Bershatsky
2022-04-18 19:51 Keith David Bershatsky
2022-04-18 19:54 ` Paul Eggert
2022-04-19 1:00 ` Po Lu
2022-04-18 2:24 Keith David Bershatsky
2022-04-18 2:53 ` Po Lu
2022-04-18 0:38 Keith David Bershatsky
2022-04-18 0:58 ` Paul Eggert
2022-04-18 1:39 ` Po Lu
2022-04-17 21:57 Keith David Bershatsky
2022-04-17 23:21 ` Paul Eggert
2022-04-17 18:45 Keith David Bershatsky
2022-04-17 20:37 ` Alan Third
2022-04-17 20:37 ` Paul Eggert
2022-04-15 19:11 Keith David Bershatsky
2022-04-17 9:01 ` Mattias Engdegård
2022-04-17 17:49 ` Paul Eggert
2022-04-17 19:12 ` Eli Zaretskii
2022-04-17 20:36 ` Paul Eggert
2022-04-18 4:49 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YmR37ei6l0sWw9AT@idiocy.org \
--to=alan@idiocy.org \
--cc=emacs-devel@gnu.org \
--cc=esq@lawlist.com \
--cc=luangruo@yahoo.com \
--cc=mattiase@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).