1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-01 01:41:01 -08:00

Fix compiler warnings on Mac OS X 10.12

* configure.ac: Check for Mac OS X 12 and link with
UniformTypeIdentifiers.framework.

* src/nsfns.m (IOMasterPort): Define to `IOMainPort' on Mac OS X
12.
(ns_implicitly_set_icon_type, Fns_read_file_name):
* src/nsxwidget.m: ([XwWebView
initWithFrame:configuration:xwidget:]): Fix uses of obsolete
things.
This commit is contained in:
Po Lu 2022-05-22 11:02:24 +08:00
parent 672af0a5da
commit e5e474baae
3 changed files with 52 additions and 2 deletions

View file

@ -2081,6 +2081,16 @@ Either fix this, or re-configure with the option '--without-ns'.])])
fi
fi
AC_CACHE_CHECK([for Mac OS X 12.0 or later],
[emacs_cv_macosx_12_0],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <AvailabilityMacros.h>
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
Mac OS X 12.x or later.
#endif
]])], [emacs_cv_macosx_12_0=no],
[emacs_cv_macosx_12_0=yes]))
if test "${with_native_image_api}" = yes; then
AC_DEFINE(HAVE_NATIVE_IMAGE_API, 1, [Define to use native OS APIs for images.])
NATIVE_IMAGE_API="yes (ns)"
@ -6216,6 +6226,9 @@ case "$opsys" in
if test "$NS_IMPL_COCOA" = "yes"; then
libs_nsgui="$libs_nsgui -framework IOKit -framework Carbon \
-framework IOSurface -framework QuartzCore"
if test "$emacs_cv_macosx_12_0" = "yes"; then
libs_nsgui="$libs_nsgui -framework UniformTypeIdentifiers"
fi
fi
else
libs_nsgui=

View file

@ -47,6 +47,13 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
#ifdef NS_IMPL_COCOA
#include <IOKit/graphics/IOGraphicsLib.h>
#include "macfont.h"
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
#include <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
#define IOMasterPort IOMainPort
#endif
#endif
#endif
#ifdef HAVE_NS
@ -789,11 +796,13 @@ ns_implicitly_set_icon_type (struct frame *f)
Lisp_Object chain, elt;
NSAutoreleasePool *pool;
BOOL setMini = YES;
NSWorkspace *workspace;
NSTRACE ("ns_implicitly_set_icon_type");
block_input ();
pool = [[NSAutoreleasePool alloc] init];
workspace = [NSWorkspace sharedWorkspace];
if (f->output_data.ns->miniimage
&& [[NSString stringWithLispString:f->name]
isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]])
@ -838,7 +847,19 @@ ns_implicitly_set_icon_type (struct frame *f)
if (image == nil)
{
image = [[[NSWorkspace sharedWorkspace] iconForFileType: @"text"] retain];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000
if ([workspace respondsToSelector: @selector (iconForContentType:)])
#endif
image = [[workspace iconForContentType:
[UTType typeWithIdentifier: @"text"]] retain];
#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000
else
#endif
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000
image = [[workspace iconForFileType: @"text"] retain];
#endif
setMini = NO;
}
@ -1757,7 +1778,20 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
ns_fd_data.ret = NO;
#ifdef NS_IMPL_COCOA
if (! NILP (mustmatch) || ! NILP (dir_only_p))
[panel setAllowedFileTypes: nil];
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000
if ([panel respondsToSelector: @selector (setAllowedContentTypes:)])
#endif
[panel setAllowedContentTypes: [NSArray array]];
#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000
else
#endif
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED < 120000
[panel setAllowedFileTypes: nil];
#endif
}
if (dirS) [panel setDirectoryURL: [NSURL fileURLWithPath: dirS]];
if (initS && NILP (Ffile_directory_p (init)))
[panel setNameFieldStringValue: [initS lastPathComponent]];

View file

@ -69,10 +69,13 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
[configuration.preferences setValue:@YES
forKey:@"developerExtrasEnabled"];
#if 0 /* Plugins are not supported by Mac OS X anymore. */
Lisp_Object enablePlugins =
Fintern (build_string ("xwidget-webkit-enable-plugins"), Qnil);
if (!EQ (Fsymbol_value (enablePlugins), Qnil))
configuration.preferences.plugInsEnabled = YES;
#endif
self = [super initWithFrame:frame configuration:configuration];
if (self)