From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: Emacs 28 on OSX: emacsclient.c:1415: warning: implicit declaration of function 'openat' Date: Sat, 23 Apr 2022 23:04:29 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="iMlwIgc3+4hAnM0m" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20076"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Po Lu , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , emacs-devel@gnu.org To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Apr 24 00:05:38 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1niNso-00051D-3v for ged-emacs-devel@m.gmane-mx.org; Sun, 24 Apr 2022 00:05:38 +0200 Original-Received: from localhost ([::1]:58094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niNsm-00064D-LM for ged-emacs-devel@m.gmane-mx.org; Sat, 23 Apr 2022 18:05:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niNrv-0005N3-9w for emacs-devel@gnu.org; Sat, 23 Apr 2022 18:04:43 -0400 Original-Received: from outbound.soverin.net ([116.202.126.228]:44671) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niNrs-0005s2-77 for emacs-devel@gnu.org; Sat, 23 Apr 2022 18:04:42 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 98A1095; Sat, 23 Apr 2022 22:04:34 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.99]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1650751474; bh=G8UhCwpmFp1oqQGQNzAQB1LiiLBgAJ7doY6dv5erPnA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iKr3X4FmJV4uONHV0Lpc0SUkdSMAhJvXCdzL+AqxcSD6aDAhqRXEbp3oBkOlbtnjb YKd+JOBdhcGNykUuOjtAPhL6eL+5aF2rwE9Q6x7YJ2X1ZWGXyiVPPYldQRiBlGI5p3 43VrTmi080s51/JAwc0PoJrqX23+xt7LzfAuFoSfjdm5foNJ8kapyI2rULO6PgRB+w 4Vnyaaw3VDxLozhbt2HwIvDWnfgo13+Dz2z6E05bqPMLPCg+gcAV53OiTajmLIj81+ pe6jqhAt8tFetsnPdeWi5HPJM5lVVJinPKFOqX5dtcNags8x2lZKVujmUdGBs7M3kq ZH8mxcCQCs+sg== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.95) (envelope-from ) id 1niNrh-000lhJ-3t; Sat, 23 Apr 2022 23:04:29 +0100 Mail-Followup-To: Alan Third , Keith David Bershatsky , emacs-devel@gnu.org, Po Lu , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=116.202.126.228; envelope-from=alan@idiocy.org; helo=outbound.soverin.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:288820 Archived-At: --iMlwIgc3+4hAnM0m Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --iMlwIgc3+4hAnM0m Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v5-0001-Fix-nsmenu-compilation-under-macOS-10.6.patch" >From 3dfed2f5d3bd4447ce5e405008ffe7e872d68c7e Mon Sep 17 00:00:00 2001 From: Alan Third 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 --- src/macfont.m | 15 +++++++++------ src/nsmenu.m | 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) diff --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 --iMlwIgc3+4hAnM0m--