diff options
| author | Jan Djärv | 2011-07-08 12:04:23 +0200 |
|---|---|---|
| committer | Jan Djärv | 2011-07-08 12:04:23 +0200 |
| commit | 4393663bc52fc24c15aa9c1779dfc23d3a0f901f (patch) | |
| tree | ac7c3b0fd0cf38005423465b7779da4ed2c3bb87 /src | |
| parent | 2287ac9896c30303d7f469a3e5cb348fbbbd9e23 (diff) | |
| download | emacs-4393663bc52fc24c15aa9c1779dfc23d3a0f901f.tar.gz emacs-4393663bc52fc24c15aa9c1779dfc23d3a0f901f.zip | |
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.
Diffstat (limited to 'src')
| -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 @@ | |||
| 1 | 2011-07-08 Jan Djärv <jan.h.d@swipnet.se> | 1 | 2011-07-08 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 2 | ||
| 3 | * nsterm.m (keyDown): Call to wantsToDelayTextChangeNotifications and | ||
| 4 | variable firstTime not needed on OSX >= 10.6. | ||
| 5 | (setPosition): setFloatValue:knobProportion: is deprecated on OSX | ||
| 6 | >= 10.5. Use setKnobProportion, setDoubleValue. | ||
| 7 | |||
| 8 | * nsterm.h (MAC_OS_X_VERSION_10_3, MAC_OS_X_VERSION_10_4) | ||
| 9 | (MAC_OS_X_VERSION_10_5): Define if not defined. | ||
| 10 | (EmacsView, EmacsTooltip): Implements NSWindowDelegate on OSX >= 10.6. | ||
| 11 | (EmacsMenu): Implements NSMenuDelegate on OSX >= 10.6. | ||
| 12 | (EmacsToolbar): Implements NSToolbarDelegate on OSX >= 10.6. | ||
| 13 | |||
| 14 | * nsselect.m (ns_string_from_pasteboard): Don't use deprecated methods | ||
| 15 | cString and lossyCString on OSX >= 10.4 | ||
| 16 | |||
| 17 | * nsmenu.m (fillWithWidgetValue): Don't use depercated method | ||
| 18 | sizeToFit on OSX >= 10.2. | ||
| 19 | |||
| 20 | * nsimage.m (allocInitFromFile): Don't use deprecated method | ||
| 21 | bestRepresentationForDevice on OSX >= 10.6. | ||
| 22 | |||
| 23 | * nsfns.m (check_ns_display_info): Cast to long and use %ld in error | ||
| 24 | to avoid warning. | ||
| 25 | |||
| 26 | * emacs.c: Declare unexec_init_emacs_zone. | ||
| 27 | |||
| 3 | * nsgui.h: Fix compiler warning about gnulib redefining verify. | 28 | * nsgui.h: Fix compiler warning about gnulib redefining verify. |
| 4 | 29 | ||
| 5 | * nsselect.m (ns_get_local_selection): Change to extern (Bug#8842). | 30 | * 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; | |||
| 129 | on subsequent starts. */ | 129 | on subsequent starts. */ |
| 130 | int initialized; | 130 | int initialized; |
| 131 | 131 | ||
| 132 | #ifdef DARWIN_OS | ||
| 133 | extern void unexec_init_emacs_zone (void); | ||
| 134 | #endif | ||
| 135 | |||
| 132 | #ifdef DOUG_LEA_MALLOC | 136 | #ifdef DOUG_LEA_MALLOC |
| 133 | /* Preserves a pointer to the memory allocated that copies that | 137 | /* Preserves a pointer to the memory allocated that copies that |
| 134 | static data inside glibc's malloc. */ | 138 | 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) | |||
| 162 | struct terminal *t = get_terminal (frame, 1); | 162 | struct terminal *t = get_terminal (frame, 1); |
| 163 | 163 | ||
| 164 | if (t->type != output_ns) | 164 | if (t->type != output_ns) |
| 165 | error ("Terminal %d is not a Nextstep display", XINT (frame)); | 165 | error ("Terminal %ld is not a Nextstep display", (long) XINT (frame)); |
| 166 | 166 | ||
| 167 | return t->display_info.ns; | 167 | return t->display_info.ns; |
| 168 | } | 168 | } |
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; | |||
| 189 | image = [[EmacsImage alloc] initByReferencingFile: | 189 | image = [[EmacsImage alloc] initByReferencingFile: |
| 190 | [NSString stringWithUTF8String: SDATA (found)]]; | 190 | [NSString stringWithUTF8String: SDATA (found)]]; |
| 191 | 191 | ||
| 192 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | ||
| 193 | imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; | ||
| 194 | #else | ||
| 192 | imgRep = [image bestRepresentationForDevice: nil]; | 195 | imgRep = [image bestRepresentationForDevice: nil]; |
| 196 | #endif | ||
| 193 | if (imgRep == nil) | 197 | if (imgRep == nil) |
| 194 | { | 198 | { |
| 195 | [image release]; | 199 | [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) | |||
| 695 | if ([[self window] isVisible]) | 695 | if ([[self window] isVisible]) |
| 696 | [self sizeToFit]; | 696 | [self sizeToFit]; |
| 697 | #else | 697 | #else |
| 698 | #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_2 | ||
| 698 | if ([self supermenu] == nil) | 699 | if ([self supermenu] == nil) |
| 699 | [self sizeToFit]; | 700 | [self sizeToFit]; |
| 700 | #endif | 701 | #endif |
| 702 | #endif | ||
| 701 | } | 703 | } |
| 702 | 704 | ||
| 703 | 705 | ||
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) | |||
| 352 | utfStr = [mstr UTF8String]; | 352 | utfStr = [mstr UTF8String]; |
| 353 | length = [mstr lengthOfBytesUsingEncoding: NSUTF8StringEncoding]; | 353 | length = [mstr lengthOfBytesUsingEncoding: NSUTF8StringEncoding]; |
| 354 | 354 | ||
| 355 | #if ! defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4 | ||
| 355 | if (!utfStr) | 356 | if (!utfStr) |
| 356 | { | 357 | { |
| 357 | utfStr = [mstr cString]; | 358 | utfStr = [mstr cString]; |
| 358 | length = strlen (utfStr); | 359 | length = strlen (utfStr); |
| 359 | } | 360 | } |
| 361 | #endif | ||
| 360 | } | 362 | } |
| 361 | NS_HANDLER | 363 | NS_HANDLER |
| 362 | { | 364 | { |
| 363 | message1 ("ns_string_from_pasteboard: UTF8String failed\n"); | 365 | message1 ("ns_string_from_pasteboard: UTF8String failed\n"); |
| 366 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 | ||
| 367 | utfStr = "Conversion failed"; | ||
| 368 | #else | ||
| 364 | utfStr = [str lossyCString]; | 369 | utfStr = [str lossyCString]; |
| 370 | #endif | ||
| 365 | length = strlen (utfStr); | 371 | length = strlen (utfStr); |
| 366 | } | 372 | } |
| 367 | NS_ENDHANDLER | 373 | 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/>. */ | |||
| 26 | #ifdef HAVE_NS | 26 | #ifdef HAVE_NS |
| 27 | 27 | ||
| 28 | #ifdef NS_IMPL_COCOA | 28 | #ifdef NS_IMPL_COCOA |
| 29 | #ifndef MAC_OS_X_VERSION_10_3 | ||
| 30 | #define MAC_OS_X_VERSION_10_3 1030 | ||
| 31 | #endif | ||
| 32 | #ifndef MAC_OS_X_VERSION_10_4 | ||
| 33 | #define MAC_OS_X_VERSION_10_4 1040 | ||
| 34 | #endif | ||
| 35 | #ifndef MAC_OS_X_VERSION_10_5 | ||
| 36 | #define MAC_OS_X_VERSION_10_5 1050 | ||
| 37 | #endif | ||
| 29 | #ifndef MAC_OS_X_VERSION_10_6 | 38 | #ifndef MAC_OS_X_VERSION_10_6 |
| 30 | #define MAC_OS_X_VERSION_10_6 1060 | 39 | #define MAC_OS_X_VERSION_10_6 1060 |
| 31 | #endif | 40 | #endif |
| 32 | #endif | 41 | #endif /* NS_IMPL_COCOA */ |
| 33 | 42 | ||
| 34 | #ifdef __OBJC__ | 43 | #ifdef __OBJC__ |
| 35 | 44 | ||
| @@ -61,7 +70,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 61 | 70 | ||
| 62 | @class EmacsToolbar; | 71 | @class EmacsToolbar; |
| 63 | 72 | ||
| 64 | @interface EmacsView : NSView <NSTextInput> /* 10.6+: NSWindowDelegate */ | 73 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 |
| 74 | @interface EmacsView : NSView <NSTextInput, NSWindowDelegate> | ||
| 75 | #else | ||
| 76 | @interface EmacsView : NSView <NSTextInput> | ||
| 77 | #endif | ||
| 65 | { | 78 | { |
| 66 | char *old_title; | 79 | char *old_title; |
| 67 | BOOL windowClosing; | 80 | BOOL windowClosing; |
| @@ -112,7 +125,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 112 | 125 | ||
| 113 | ========================================================================== */ | 126 | ========================================================================== */ |
| 114 | 127 | ||
| 115 | @interface EmacsMenu : NSMenu /* 10.6+: <NSMenuDelegate> */ | 128 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 |
| 129 | @interface EmacsMenu : NSMenu <NSMenuDelegate> | ||
| 130 | #else | ||
| 131 | @interface EmacsMenu : NSMenu | ||
| 132 | #endif | ||
| 116 | { | 133 | { |
| 117 | struct frame *frame; | 134 | struct frame *frame; |
| 118 | unsigned long keyEquivModMask; | 135 | unsigned long keyEquivModMask; |
| @@ -139,7 +156,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 139 | 156 | ||
| 140 | @class EmacsImage; | 157 | @class EmacsImage; |
| 141 | 158 | ||
| 142 | @interface EmacsToolbar : NSToolbar /* 10.6+: <NSToolbarDelegate> */ | 159 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 |
| 160 | @interface EmacsToolbar : NSToolbar <NSToolbarDelegate> | ||
| 161 | #else | ||
| 162 | @interface EmacsToolbar : NSToolbar | ||
| 163 | #endif | ||
| 143 | { | 164 | { |
| 144 | EmacsView *emacsView; | 165 | EmacsView *emacsView; |
| 145 | NSMutableDictionary *identifierToItem; | 166 | NSMutableDictionary *identifierToItem; |
| @@ -182,7 +203,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 182 | - (Lisp_Object)runDialogAt: (NSPoint)p; | 203 | - (Lisp_Object)runDialogAt: (NSPoint)p; |
| 183 | @end | 204 | @end |
| 184 | 205 | ||
| 185 | @interface EmacsTooltip : NSObject /* 10.6+: <NSWindowDelegate> */ | 206 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 |
| 207 | @interface EmacsTooltip : NSObject <NSWindowDelegate> | ||
| 208 | #else | ||
| 209 | @interface EmacsTooltip : NSObject | ||
| 210 | #endif | ||
| 186 | { | 211 | { |
| 187 | NSWindow *win; | 212 | NSWindow *win; |
| 188 | NSTextField *textField; | 213 | 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) | |||
| 4515 | unsigned fnKeysym = 0; | 4515 | unsigned fnKeysym = 0; |
| 4516 | int flags; | 4516 | int flags; |
| 4517 | static NSMutableArray *nsEvArray; | 4517 | static NSMutableArray *nsEvArray; |
| 4518 | #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | ||
| 4518 | static BOOL firstTime = YES; | 4519 | static BOOL firstTime = YES; |
| 4520 | #endif | ||
| 4519 | int left_is_none; | 4521 | int left_is_none; |
| 4520 | 4522 | ||
| 4521 | NSTRACE (keyDown); | 4523 | NSTRACE (keyDown); |
| @@ -4703,13 +4705,15 @@ ns_term_shutdown (int sig) | |||
| 4703 | } | 4705 | } |
| 4704 | } | 4706 | } |
| 4705 | 4707 | ||
| 4708 | |||
| 4709 | #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | ||
| 4706 | /* if we get here we should send the key for input manager processing */ | 4710 | /* if we get here we should send the key for input manager processing */ |
| 4707 | if (firstTime && [[NSInputManager currentInputManager] | 4711 | if (firstTime && [[NSInputManager currentInputManager] |
| 4708 | wantsToDelayTextChangeNotifications] == NO) | 4712 | wantsToDelayTextChangeNotifications] == NO) |
| 4709 | fprintf (stderr, | 4713 | fprintf (stderr, |
| 4710 | "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n"); | 4714 | "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n"); |
| 4711 | firstTime = NO; | 4715 | firstTime = NO; |
| 4712 | 4716 | #endif | |
| 4713 | if (NS_KEYLOG && !processingCompose) | 4717 | if (NS_KEYLOG && !processingCompose) |
| 4714 | fprintf (stderr, "keyDown: Begin compose sequence.\n"); | 4718 | fprintf (stderr, "keyDown: Begin compose sequence.\n"); |
| 4715 | 4719 | ||
| @@ -6066,14 +6070,26 @@ ns_term_shutdown (int sig) | |||
| 6066 | em_whole = whole; | 6070 | em_whole = whole; |
| 6067 | 6071 | ||
| 6068 | if (portion >= whole) | 6072 | if (portion >= whole) |
| 6069 | [self setFloatValue: 0.0 knobProportion: 1.0]; | 6073 | { |
| 6074 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 | ||
| 6075 | [self setKnobProportion: 1.0]; | ||
| 6076 | [self setDoubleValue: 1.0]; | ||
| 6077 | #else | ||
| 6078 | [self setFloatValue: 0.0 knobProportion: 1.0]; | ||
| 6079 | #endif | ||
| 6080 | } | ||
| 6070 | else | 6081 | else |
| 6071 | { | 6082 | { |
| 6072 | float pos, por; | 6083 | float pos, por; |
| 6073 | portion = max ((float)whole*min_portion/pixel_height, portion); | 6084 | portion = max ((float)whole*min_portion/pixel_height, portion); |
| 6074 | pos = (float)position / (whole - portion); | 6085 | pos = (float)position / (whole - portion); |
| 6075 | por = (float)portion/whole; | 6086 | por = (float)portion/whole; |
| 6087 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 | ||
| 6088 | [self setKnobProportion: por]; | ||
| 6089 | [self setDoubleValue: pos]; | ||
| 6090 | #else | ||
| 6076 | [self setFloatValue: pos knobProportion: por]; | 6091 | [self setFloatValue: pos knobProportion: por]; |
| 6092 | #endif | ||
| 6077 | } | 6093 | } |
| 6078 | return self; | 6094 | return self; |
| 6079 | } | 6095 | } |