diff options
author | Jan Djärv <jan.h.d@swipnet.se> | 2011-07-08 12:04:23 +0200 |
---|---|---|
committer | Jan Djärv <jan.h.d@swipnet.se> | 2011-07-08 12:04:23 +0200 |
commit | 4393663bc52fc24c15aa9c1779dfc23d3a0f901f (patch) | |
tree | ac7c3b0fd0cf38005423465b7779da4ed2c3bb87 | |
parent | 2287ac9896c30303d7f469a3e5cb348fbbbd9e23 (diff) | |
download | emacs-4393663bc52fc24c15aa9c1779dfc23d3a0f901f.tar.gz |
Fix warnings in ns*m files: Replace deprecated methods, declare new interfaces.
* 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.
-rw-r--r-- | src/ChangeLog | 25 | ||||
-rw-r--r-- | src/emacs.c | 4 | ||||
-rw-r--r-- | src/nsfns.m | 2 | ||||
-rw-r--r-- | src/nsimage.m | 4 | ||||
-rw-r--r-- | src/nsmenu.m | 2 | ||||
-rw-r--r-- | src/nsselect.m | 6 | ||||
-rw-r--r-- | src/nsterm.h | 35 | ||||
-rw-r--r-- | src/nsterm.m | 20 |
8 files changed, 90 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3c718c078d3..89f5e0ee64d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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). diff --git a/src/emacs.c b/src/emacs.c index e4b3a68a6c1..c1d517900ca 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -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. */ diff --git a/src/nsfns.m b/src/nsfns.m index d124f61a4f2..865fc0da9cb 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -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; } diff --git a/src/nsimage.m b/src/nsimage.m index c38cefdc5d5..2cb0c3bff76 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -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]; diff --git a/src/nsmenu.m b/src/nsmenu.m index 0d25b82d5b5..6a9ee7dd4f5 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -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 } diff --git a/src/nsselect.m b/src/nsselect.m index aeb2a3e3a99..867cf3252e5 100644 --- a/src/nsselect.m +++ b/src/nsselect.m @@ -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 diff --git a/src/nsterm.h b/src/nsterm.h index b442973f0d9..f419391a11e 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -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; diff --git a/src/nsterm.m b/src/nsterm.m index ac95409ee7e..b724b6a02f3 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -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; } |