emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs 28 on OSX: emacsclient.c:1415: warning: implicit declaration o


From: Po Lu
Subject: Re: Emacs 28 on OSX: emacsclient.c:1415: warning: implicit declaration of function 'openat'
Date: Mon, 18 Apr 2022 10:53:39 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

Keith David Bershatsky <esq@lawlist.com> writes:

> I applied the patch from Po Lu to the master branch and have the following 
> output when building on OSX 10.6.8:
>
>   CC       nsterm.o
> In file included from nsterm.m:46:
> lisp.h:2156: warning: declaration does not declare anything
> nsterm.m: In function 'ns_frame_scale_factor':
> nsterm.m:807: warning: 'NSWindow' may not respond to '-backingScaleFactor'
> nsterm.m:807: warning: (Messages without a matching method signature
> nsterm.m:807: warning: will be assumed to return 'id' and accept
> nsterm.m:807: warning: '...' as arguments.)
> nsterm.m:807: error: incompatible types in return
> nsterm.m: In function '-[EmacsWindow initWithEmacsFrame:fullscreen:screen:]':
> nsterm.m:8405: warning: 'EmacsWindow' may not respond to '-setTabbingMode:'
> nsterm.m: In function '-[EmacsWindow setParentChildRelationships]':
> nsterm.m:8478: warning: 'EmacsWindow' may not respond to 
> '-setAccessibilitySubrole:'
> nsterm.m:8480: warning: 'EmacsWindow' may not respond to 
> '-setAccessibilitySubrole:'
> make[1]: *** [nsterm.o] Error 1
> make: *** [src] Error 2
> ~/Desktop/emacs $ 
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>> Date: [04-17-2022 18:39:41] <18 Apr 2022 09:39:41 +0800>
>> From: Po Lu <luangruo@yahoo.com>
>> * * *

This should fix the setTabbingMode warning, but what's the value of
MAC_OS_X_VERSION_MAX_ALLOWED on your system?  I guess it should be
`1060', not higher, not lower.

diff --git a/src/nsterm.m b/src/nsterm.m
index 550f29212e..fd6e67a8cb 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -751,7 +751,19 @@ 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 MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+      if ([[parentView window] respondsToSelector: 
@selector(convertRectToScreen:)])
+#endif
+       parentRect = [[parentView window] convertRectToScreen: parentRect];
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+      else
+#endif
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 */
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070       \
+  || defined (NS_IMPL_GNUSTEP)
+       parentRect.origin = [[parentView window] convertBaseToScreen: 
parentRect.origin];
+#endif
     }
   else
     parentRect = [[[NSScreen screens] objectAtIndex:0] frame];
@@ -789,7 +801,14 @@ Free a pool and temporary objects it refers to (callable 
from C)
 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 MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+  if ([[FRAME_NS_VIEW (f) window] respondsToSelector: 
@selector(convertRectToScreen:)])
+#endif
+    return [[FRAME_NS_VIEW (f) window] backingScaleFactor];
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+  else
+    return [[FRAME_NS_VIEW (f) window] userSpaceScaleFactor];
+#endif
 #else
   return [[FRAME_NS_VIEW (f) window] userSpaceScaleFactor];
 #endif
@@ -6869,7 +6888,7 @@ - (void)otherMouseDragged: (NSEvent *)e
   [self mouseMoved: e];
 }
 
-#ifdef NS_IMPL_COCOA
+#if defined NS_IMPL_COCOA && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
 - (void) magnifyWithEvent: (NSEvent *) event
 {
   NSPoint pt = [self convertPoint: [event locationInWindow] fromView: nil];
@@ -6886,11 +6905,18 @@ - (void) magnifyWithEvent: (NSEvent *) event
 
       if ([event phase] == NSEventPhaseBegan)
        {
-         last_scale = 1.0 + [event magnification];
-         emacs_event->arg = list4 (make_float (0.0),
-                                   make_float (0.0),
-                                   make_float (last_scale),
-                                   make_float (0.0));
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+         if ([event respondsToSelector: @selector(magnification)])
+           {
+#endif
+             last_scale = 1.0 + [event magnification];
+             emacs_event->arg = list4 (make_float (0.0),
+                                       make_float (0.0),
+                                       make_float (last_scale),
+                                       make_float (0.0));
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+           }
+#endif
        }
       else
        /* Report a tiny change so that Lisp code doesn't think this
@@ -8381,7 +8407,7 @@ - (instancetype) initWithEmacsFrame:(struct frame *)f
       /* macOS Sierra automatically enables tabbed windows.  We can't
          allow this to be enabled until it's available on a Free system.
          Currently it only happens by accident and is buggy anyway.  */
-#ifdef NS_IMPL_COCOA
+#if defined NS_IMPL_COCOA && MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
       if ([self respondsToSelector:@selector(setTabbingMode:)])
         [self setTabbingMode:NSWindowTabbingModeDisallowed];
 #endif
@@ -8451,14 +8477,16 @@ - (void)setParentChildRelationships
      behaviors early otherwise child windows may not go fullscreen as
      expected later.  */
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
 #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)
       [self setAccessibilitySubrole:NSAccessibilityFloatingWindowSubrole];
     else
       [self setAccessibilitySubrole:NSAccessibilityStandardWindowSubrole];
+#endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
   [ourView updateCollectionBehavior];
@@ -8484,7 +8512,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.  */
@@ -8509,11 +8537,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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]