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.
This commit is contained in:
Jan Djärv 2011-07-08 12:04:23 +02:00
parent 2287ac9896
commit 4393663bc5
8 changed files with 90 additions and 8 deletions

View 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).

View 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. */

View file

@ -162,7 +162,7 @@ Updated by Christian Limpach (chris@nice.ch)
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;
}

View file

@ -189,7 +189,11 @@ @implementation EmacsImage
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];

View file

@ -695,9 +695,11 @@ - (void)fillWithWidgetValue: (void *)wvptr
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
}

View file

@ -352,16 +352,22 @@ Updated by Christian Limpach (chris@nice.ch)
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

View 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;

View file

@ -4515,7 +4515,9 @@ - (void)keyDown: (NSEvent *)theEvent
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 @@ most recently updated (I guess), which is not the correct one. */
}
}
#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 @@ - (int) checkSamePosition: (int) position portion: (int) portion
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;
}