]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix warnings in ns*m files: Replace deprecated methods, declare new interfaces.
authorJan Djärv <jan.h.d@swipnet.se>
Fri, 8 Jul 2011 10:04:23 +0000 (12:04 +0200)
committerJan Djärv <jan.h.d@swipnet.se>
Fri, 8 Jul 2011 10:04:23 +0000 (12:04 +0200)
* emacs.c: Declare unexec_init_emacs_zone.

* nsfns.m (check_ns_display_info): Cast to long and use %ld in error
to avoid warning.

* nsimage.m (allocInitFromFile): Don't use deprecated method
bestRepresentationForDevice on OSX >= 10.6.

* nsmenu.m (fillWithWidgetValue): Don't use depercated method
sizeToFit on OSX >= 10.2.

* nsselect.m (ns_string_from_pasteboard): Don't use deprecated methods
cString and lossyCString on OSX >= 10.4

* nsterm.h (MAC_OS_X_VERSION_10_3, MAC_OS_X_VERSION_10_4)
(MAC_OS_X_VERSION_10_5): Define if not defined.
(EmacsView, EmacsTooltip): Implements NSWindowDelegate on OSX >= 10.6.
(EmacsMenu): Implements NSMenuDelegate on OSX >= 10.6.
(EmacsToolbar): Implements NSToolbarDelegate on OSX >= 10.6.

* nsterm.m (keyDown): Call to wantsToDelayTextChangeNotifications and
variable firstTime not needed on OSX >= 10.6.
(setPosition): setFloatValue:knobProportion: is deprecated on OSX
>= 10.5.  Use setKnobProportion, setDoubleValue.

src/ChangeLog
src/emacs.c
src/nsfns.m
src/nsimage.m
src/nsmenu.m
src/nsselect.m
src/nsterm.h
src/nsterm.m

index 3c718c078d396e09bd9c3b31612c4f0f9d1995f3..89f5e0ee64d703ffd30a8059cc9c9e687ec7ead4 100644 (file)
@@ -1,5 +1,30 @@
 2011-07-08  Jan Djärv  <jan.h.d@swipnet.se>
 
+       * nsterm.m (keyDown): Call to wantsToDelayTextChangeNotifications and
+       variable firstTime not needed on OSX >= 10.6.
+       (setPosition): setFloatValue:knobProportion: is deprecated on OSX
+       >= 10.5.  Use setKnobProportion, setDoubleValue.
+
+       * nsterm.h (MAC_OS_X_VERSION_10_3, MAC_OS_X_VERSION_10_4)
+       (MAC_OS_X_VERSION_10_5): Define if not defined.
+       (EmacsView, EmacsTooltip): Implements NSWindowDelegate on OSX >= 10.6.
+       (EmacsMenu): Implements NSMenuDelegate on OSX >= 10.6.
+       (EmacsToolbar): Implements NSToolbarDelegate on OSX >= 10.6.
+
+       * nsselect.m (ns_string_from_pasteboard): Don't use deprecated methods
+       cString and lossyCString on OSX >= 10.4
+
+       * nsmenu.m (fillWithWidgetValue): Don't use depercated method
+       sizeToFit on OSX >= 10.2.
+
+       * nsimage.m (allocInitFromFile): Don't use deprecated method
+       bestRepresentationForDevice on OSX >= 10.6.
+
+       * nsfns.m (check_ns_display_info): Cast to long and use %ld in error
+       to avoid warning.
+
+       * emacs.c: Declare unexec_init_emacs_zone.
+
        * nsgui.h: Fix compiler warning about gnulib redefining verify.
 
        * nsselect.m (ns_get_local_selection): Change to extern (Bug#8842).
index e4b3a68a6c161557f51a6a8fc7c15a06695f2b5f..c1d517900ca936b7a8c02ecbbc274ac738aff73b 100644 (file)
@@ -129,6 +129,10 @@ Lisp_Object empty_unibyte_string, empty_multibyte_string;
   on subsequent starts.  */
 int initialized;
 
+#ifdef DARWIN_OS
+extern void unexec_init_emacs_zone (void);
+#endif
+
 #ifdef DOUG_LEA_MALLOC
 /* Preserves a pointer to the memory allocated that copies that
    static data inside glibc's malloc.  */
index d124f61a4f27923dee08b6d41e10aef5ed9bd73a..865fc0da9cb8699ac02a4b51ef7f5bc4bdcc0d29 100644 (file)
@@ -162,7 +162,7 @@ check_ns_display_info (Lisp_Object frame)
       struct terminal *t = get_terminal (frame, 1);
 
       if (t->type != output_ns)
-        error ("Terminal %d is not a Nextstep display", XINT (frame));
+        error ("Terminal %ld is not a Nextstep display", (long) XINT (frame));
 
       return t->display_info.ns;
     }
index c38cefdc5d54a24556bd4bef1c048e90826d9ea8..2cb0c3bff76fa0213cd301c4d5141e4d8395d60f 100644 (file)
@@ -189,7 +189,11 @@ static EmacsImage *ImageList = nil;
   image = [[EmacsImage alloc] initByReferencingFile:
                      [NSString stringWithUTF8String: SDATA (found)]];
 
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+  imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]];
+#else
   imgRep = [image bestRepresentationForDevice: nil];
+#endif
   if (imgRep == nil)
     {
       [image release];
index 0d25b82d5b53f48640722c4e19be5d7ae2e298ff..6a9ee7dd4f5826fce382e3948e37b463fc280dd6 100644 (file)
@@ -695,9 +695,11 @@ set_frame_menubar (struct frame *f, int first_time, int deep_p)
   if ([[self window] isVisible])
     [self sizeToFit];
 #else
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_2
   if ([self supermenu] == nil)
     [self sizeToFit];
 #endif
+#endif
 }
 
 
index aeb2a3e3a9957d8b2af259dcaa4f75184db658e7..867cf3252e5eed5a5a0af2d46e0eab55182cb6e7 100644 (file)
@@ -352,16 +352,22 @@ ns_string_from_pasteboard (id pb)
       utfStr = [mstr UTF8String];
       length = [mstr lengthOfBytesUsingEncoding: NSUTF8StringEncoding];
 
+#if ! defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4
       if (!utfStr) 
         {
           utfStr = [mstr cString];
           length = strlen (utfStr);
         }
+#endif
     }
   NS_HANDLER
     {
       message1 ("ns_string_from_pasteboard: UTF8String failed\n");
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+      utfStr = "Conversion failed";
+#else
       utfStr = [str lossyCString];
+#endif
       length = strlen (utfStr);
     }
   NS_ENDHANDLER
index b442973f0d9adbbb435dae84195dbe7478054fe7..f419391a11e70e75631e69609e0c98566b03107f 100644 (file)
@@ -26,10 +26,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifdef HAVE_NS
 
 #ifdef NS_IMPL_COCOA
+#ifndef MAC_OS_X_VERSION_10_3
+#define MAC_OS_X_VERSION_10_3 1030
+#endif
+#ifndef MAC_OS_X_VERSION_10_4
+#define MAC_OS_X_VERSION_10_4 1040
+#endif
+#ifndef MAC_OS_X_VERSION_10_5
+#define MAC_OS_X_VERSION_10_5 1050
+#endif
 #ifndef MAC_OS_X_VERSION_10_6
 #define MAC_OS_X_VERSION_10_6 1060
 #endif
-#endif
+#endif /* NS_IMPL_COCOA */
 
 #ifdef __OBJC__
 
@@ -61,7 +70,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 @class EmacsToolbar;
 
-@interface EmacsView : NSView <NSTextInput> /* 10.6+: NSWindowDelegate */
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+@interface EmacsView : NSView <NSTextInput, NSWindowDelegate>
+#else
+@interface EmacsView : NSView <NSTextInput>
+#endif
    {
    char *old_title;
    BOOL windowClosing;
@@ -112,7 +125,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
    ========================================================================== */
 
-@interface EmacsMenu : NSMenu  /* 10.6+: <NSMenuDelegate> */
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+@interface EmacsMenu : NSMenu  <NSMenuDelegate>
+#else
+@interface EmacsMenu : NSMenu
+#endif
 {
   struct frame *frame;
   unsigned long keyEquivModMask;
@@ -139,7 +156,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 @class EmacsImage;
 
-@interface EmacsToolbar : NSToolbar  /* 10.6+: <NSToolbarDelegate> */
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+@interface EmacsToolbar : NSToolbar <NSToolbarDelegate>
+#else
+@interface EmacsToolbar : NSToolbar
+#endif
    {
      EmacsView *emacsView;
      NSMutableDictionary *identifierToItem;
@@ -182,7 +203,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 - (Lisp_Object)runDialogAt: (NSPoint)p;
 @end
 
-@interface EmacsTooltip : NSObject  /* 10.6+: <NSWindowDelegate> */
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+@interface EmacsTooltip : NSObject <NSWindowDelegate>
+#else
+@interface EmacsTooltip : NSObject
+#endif
   {
     NSWindow *win;
     NSTextField *textField;
index ac95409ee7e41dff4dd7ceba37b113dd00cb9161..b724b6a02f3e7ade60d315cfc437d30d7369aafc 100644 (file)
@@ -4515,7 +4515,9 @@ ns_term_shutdown (int sig)
   unsigned fnKeysym = 0;
   int flags;
   static NSMutableArray *nsEvArray;
+#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
   static BOOL firstTime = YES;
+#endif
   int left_is_none;
 
   NSTRACE (keyDown);
@@ -4703,13 +4705,15 @@ ns_term_shutdown (int sig)
         }
     }
 
+  
+#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
   /* if we get here we should send the key for input manager processing */
   if (firstTime && [[NSInputManager currentInputManager]
                      wantsToDelayTextChangeNotifications] == NO)
     fprintf (stderr,
           "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n");
   firstTime = NO;
-
+#endif
   if (NS_KEYLOG && !processingCompose)
     fprintf (stderr, "keyDown: Begin compose sequence.\n");
 
@@ -6066,14 +6070,26 @@ ns_term_shutdown (int sig)
   em_whole = whole;
 
   if (portion >= whole)
-    [self setFloatValue: 0.0 knobProportion: 1.0];
+    {
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
+      [self setKnobProportion: 1.0];
+      [self setDoubleValue: 1.0];
+#else
+      [self setFloatValue: 0.0 knobProportion: 1.0];
+#endif
+    }
   else
     {
       float pos, por;
       portion = max ((float)whole*min_portion/pixel_height, portion);
       pos = (float)position / (whole - portion);
       por = (float)portion/whole;
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
+      [self setKnobProportion: por];
+      [self setDoubleValue: pos];
+#else
       [self setFloatValue: pos knobProportion: por];
+#endif
     }
   return self;
 }