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: Sun, 24 Apr 2022 10:03:07 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="xN8Xjo/JKGJHkzEc" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28979"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Po Lu , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , Paul Eggert , 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 11:05:44 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 1niYBb-0007Jj-VJ for ged-emacs-devel@m.gmane-mx.org; Sun, 24 Apr 2022 11:05:44 +0200 Original-Received: from localhost ([::1]:57910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niYBa-0005CX-L0 for ged-emacs-devel@m.gmane-mx.org; Sun, 24 Apr 2022 05:05:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niY9G-0003bP-Pt for emacs-devel@gnu.org; Sun, 24 Apr 2022 05:03:19 -0400 Original-Received: from outbound.soverin.net ([116.202.126.228]:46713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niY9D-00074s-CA for emacs-devel@gnu.org; Sun, 24 Apr 2022 05:03:18 -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 9B8861F4; Sun, 24 Apr 2022 09:03:11 +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=1650790990; bh=VObFyD86eS/gu3WiJdAJkyX3KMrSOyPOilxw/4Hi4Rg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ktxC26DFEW0rLDOgNqKvqE+uTCGgPtgMKH9MCzYkwzeUuNZU0gjVUidZzckU/+Bf5 dTYIvt7yqbQTTlv8x7EfV8hm4vvg2zMC3TQj14mK9GgSJpc/nRJH8W8Nt8/ZN3xMm/ PZALcoYSdruS0K0vSXhRmj4s6eEJoH0i+kQg1pj0pWQSGSvOlI+LnRzO73nuU2hMxC /ttK4np0Jm7BbUYiUDXaZbtX/IqowkQgOprg2gPhi4pxV6fm6EgHE4f2HdsxiMbVfZ Af/7UV5gObVS8nj1/7/IEfonm0WieLo93Qmb0bX39KP7BFhPf4cXSf4xEumAn4r1WE FGxNuNQT446IA== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.95) (envelope-from ) id 1niY96-000m5v-13; Sun, 24 Apr 2022 10:03:08 +0100 Mail-Followup-To: Alan Third , Keith David Bershatsky , emacs-devel@gnu.org, Po Lu , Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , Paul Eggert 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:288828 Archived-At: --xN8Xjo/JKGJHkzEc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Apr 23, 2022 at 05:08:28PM -0700, Keith David Bershatsky wrote: > Here is the build output using the latest patch "v5-0001..." > > CC nsterm.o > nsterm.m: In function 'ns_parent_window_rect': > nsterm.m:761: warning: 'NSWindow' may not respond to '-convertRectToScreen:' > nsterm.m:761: warning: (Messages without a matching method signature > nsterm.m:761: warning: will be assumed to return 'id' and accept > nsterm.m:761: warning: '...' as arguments.) > nsterm.m:761: error: conversion to non-scalar type requested > nsterm.m: In function 'ns_frame_scale_factor': > nsterm.m:805: warning: 'NSWindow' may not respond to '-backingScaleFactor' > nsterm.m:805: error: pointer value used where a floating point value was expected > nsterm.m: In function '-[EmacsWindow initWithEmacsFrame:fullscreen:screen:]': > nsterm.m:8472: warning: 'EmacsWindow' may not respond to '-setTabbingMode:' > nsterm.m: In function '-[EmacsWindow setParentChildRelationships]': > nsterm.m:8545: warning: 'EmacsWindow' may not respond to '-setAccessibilitySubrole:' > nsterm.m:8547: warning: 'EmacsWindow' may not respond to '-setAccessibilitySubrole:' > make[1]: *** [nsterm.o] Error 1 > make: *** [src] Error 2 > ~/Desktop/emacs $ *sigh* I thought that would work, but you live and learn. This one should work. I hope. :) -- Alan Third --xN8Xjo/JKGJHkzEc Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0001-Fix-nsmenu-compilation-under-macOS-10.6.patch" >From dcfae2be07610a40c94a164c7518c0fdd7ffa37b Mon Sep 17 00:00:00 2001 From: Alan Third Date: Tue, 19 Apr 2022 05:05:17 +0100 Subject: [PATCH v6] 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 | 39 ++++++++++++++++++++++++++++----------- 4 files changed, 44 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..3c94f69e79 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,18 @@ 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]; + +#if defined (NS_IMPL_COCOA) && !defined (MAC_OS_X_VERSION_10_7) + parentRect.origin = [[parentView window] convertBaseToScreen:parentRect.origin]; +#elsif defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED < 1070 + if ([[parentView window] + respondsToSelector:@selector(convertRectToScreen:)]) + parentRect = [[parentView window] convertRectToScreen:parentRect]; + else + parentRect.origin = [[parentView window] convertBaseToScreen:parentRect.origin]; +#else parentRect = [[parentView window] convertRectToScreen:parentRect]; +#endif } else parentRect = [[[NSScreen screens] objectAtIndex:0] frame]; @@ -788,10 +799,16 @@ 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]; -#else +#if defined (NS_IMPL_GNUSTEP) || !defined (MAC_OS_X_VERSION_10_7) return [[FRAME_NS_VIEW (f) window] userSpaceScaleFactor]; +#elsif MAC_OS_X_VERSION_MIN_REQUIRED < 1070 + if ([[FRAME_NS_VIEW (f) window] + respondsToSelector:@selector(backingScaleFactor:)]) + return [[FRAME_NS_VIEW (f) window] backingScaleFactor]; + else + return [[FRAME_NS_VIEW (f) window] userSpaceScaleFactor]; +#else + return [[FRAME_NS_VIEW (f) window] backingScaleFactor]; #endif } @@ -6942,7 +6959,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 +8542,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 +8574,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 +8599,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 --xN8Xjo/JKGJHkzEc--