aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2014-10-12 10:35:50 +0200
committerJan Djärv2014-10-12 10:35:50 +0200
commit9a265587d2f8ee034b8d00c4bcde070367fb0ad1 (patch)
treea899b66588961d5cadeff1cb03324f68a47b2b65 /src
parent4c4c5b9121a550d006d1b57bc2ad97b0415cee9f (diff)
downloademacs-9a265587d2f8ee034b8d00c4bcde070367fb0ad1.tar.gz
emacs-9a265587d2f8ee034b8d00c4bcde070367fb0ad1.zip
Require OSX >= 10.6. Remove PowerPC unexec code.
* configure.ac: Require OSX 10.6. Remove NSInteger test, use nsfont for Gnustep, macfont for OSX. * etc/NEWS: OSX required is 10.6 or newer. * src/Makefile.in: Replace nsfont.o macfont.o with ns_fontfile in comment. * src/macfont.h (MAC_FONT_FORMAT_ATTRIBUTE, MAC_FONT_FORMAT_BITMAP) (mac_font_copy_non_synthetic_table): Remove versions for OSX < 10.6 * src/nsfns.m: Always include src/macfont.h on COCOA. (ns_filename_from_panel, ns_directory_from_panel) (Fx_create_frame, Fns_popup_font_panel, ns_run_file_dialog) (Fns_read_file_name, Fns_list_services): Remove code for OSX < 10.6 * src/nsterm.m: Always include src/macfont.h on COCOA. (ns_update_auto_hide_menu_bar, ns_draw_fringe_bitmap) (ns_dumpglyphs_image, ns_check_menu_open) (applicationDidFinishLaunching) (antialiasThresholdDidChange:) (keyDown:, toggleFullScreen:, setPosition:portion:whole:): Remove checks for OSX <= 10.5/10.6. (changeFont:): Use macfont on COCOA, nsfont on GNUSTEP. (syms_of_nsterm): Call syms_of_macfont on COCOA, syms_of_nsfont on GNUSTEP. * src/macfont.m: Remove >= 1050 check. (macfont_create_family_with_symbol) (macfont_get_glyph_for_character) (mac_font_get_glyphs_for_variants) (mac_ctfont_create_available_families, syms_of_macfont): Remove code for OSX < 10.6. (mac_font_family_group, mac_font_family_compare): Remove, only used for OSX < 10.6. * src/nsimage.m (allocInitFromFile:): Remove code for OSX < 10.6. * src/nsmenu.m (NSMenuDidBeginTrackingNotification): Remove. (x_activate_menubar, trackingNotification:): Remove check for OSX >= 10.5. (menuNeedsUpdate:): Remove check for OSX < 10.5. * src/nsterm.h (MAC_OS_X_VERSION_10_4, MAC_OS_X_VERSION_10_5): Remove. (NS_HAVE_NSINTEGER): Remove block. Remove >= OSX 10.6 tests. * src/unexmacosx.c: Remove include ppc/reloc.h. (unrelocate, copy_dysymtab): Remove PPC code. (rebase_reloc_address): Remove, only used for PPC:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog48
-rw-r--r--src/Makefile.in2
-rw-r--r--src/macfont.h13
-rw-r--r--src/macfont.m126
-rw-r--r--src/nsfns.m34
-rw-r--r--src/nsimage.m2
-rw-r--r--src/nsmenu.m15
-rw-r--r--src/nsterm.h28
-rw-r--r--src/nsterm.m45
-rw-r--r--src/unexmacosx.c88
10 files changed, 85 insertions, 316 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 568022f478b..966363d7134 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,51 @@
12014-10-12 Jan Djärv <jan.h.d@swipnet.se>
2
3 * unexmacosx.c: Remove include ppc/reloc.h.
4 (unrelocate, copy_dysymtab): Remove PPC code.
5 (rebase_reloc_address): Remove, only used for PPC:
6
7 * nsterm.m: Always include macfont.h on COCOA.
8 (ns_update_auto_hide_menu_bar, ns_draw_fringe_bitmap)
9 (ns_dumpglyphs_image, ns_check_menu_open)
10 (applicationDidFinishLaunching)
11 (antialiasThresholdDidChange:)
12 (keyDown:, toggleFullScreen:, setPosition:portion:whole:): Remove
13 checks for OSX <= 10.5/10.6.
14 (changeFont:): Use macfont on COCOA, nsfont on GNUSTEP.
15 (syms_of_nsterm): Call syms_of_macfont on COCOA, syms_of_nsfont on
16 GNUSTEP.
17
18 * nsterm.h (MAC_OS_X_VERSION_10_4, MAC_OS_X_VERSION_10_5): Remove.
19 (NS_HAVE_NSINTEGER): Remove block.
20 Remove >= OSX 10.6 tests.
21
22 * nsmenu.m (NSMenuDidBeginTrackingNotification): Remove.
23 (x_activate_menubar, trackingNotification:): Remove check for
24 OSX >= 10.5.
25 (menuNeedsUpdate:): Remove check for OSX < 10.5.
26
27 * nsimage.m (allocInitFromFile:): Remove code for OSX < 10.6.
28
29 * nsfns.m: Always include macfont.h on COCOA.
30 (ns_filename_from_panel, ns_directory_from_panel)
31 (Fx_create_frame, Fns_popup_font_panel, ns_run_file_dialog)
32 (Fns_read_file_name, Fns_list_services): Remove code for OSX < 10.6
33
34 * macfont.m: Remove >= 1050 check.
35 (macfont_create_family_with_symbol)
36 (macfont_get_glyph_for_character)
37 (mac_font_get_glyphs_for_variants)
38 (mac_ctfont_create_available_families, syms_of_macfont): Remove
39 code for OSX < 10.6.
40 (mac_font_family_group, mac_font_family_compare): Remove, only used
41 for OSX < 10.6.
42
43 * macfont.h (MAC_FONT_FORMAT_ATTRIBUTE, MAC_FONT_FORMAT_BITMAP)
44 (mac_font_copy_non_synthetic_table): Remove versions for OSX < 10.6
45
46 * Makefile.in: Replace nsfont.o macfont.o with ns_fontfile in
47 comment.
48
12014-10-12 Paul Eggert <eggert@cs.ucla.edu> 492014-10-12 Paul Eggert <eggert@cs.ucla.edu>
2 50
3 Fix putenv race conditions with undefined behavior (Bug#8705). 51 Fix putenv race conditions with undefined behavior (Bug#8705).
diff --git a/src/Makefile.in b/src/Makefile.in
index dffb77e7338..36e145744b3 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -250,7 +250,7 @@ MSDOS_OBJ =
250MSDOS_X_OBJ = 250MSDOS_X_OBJ =
251 251
252NS_OBJ=@NS_OBJ@ 252NS_OBJ=@NS_OBJ@
253## nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macfont.o if HAVE_NS. 253## nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o ns_fontfile if HAVE_NS.
254NS_OBJC_OBJ=@NS_OBJC_OBJ@ 254NS_OBJC_OBJ=@NS_OBJC_OBJ@
255## Only set if NS_IMPL_GNUSTEP. 255## Only set if NS_IMPL_GNUSTEP.
256GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@ 256GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@
diff --git a/src/macfont.h b/src/macfont.h
index 7421cd63a79..e6e45ab152c 100644
--- a/src/macfont.h
+++ b/src/macfont.h
@@ -57,11 +57,7 @@ typedef CTCharacterCollection CharacterCollection;
57#define MAC_FONT_CASCADE_LIST_ATTRIBUTE kCTFontCascadeListAttribute 57#define MAC_FONT_CASCADE_LIST_ATTRIBUTE kCTFontCascadeListAttribute
58#define MAC_FONT_CHARACTER_SET_ATTRIBUTE kCTFontCharacterSetAttribute 58#define MAC_FONT_CHARACTER_SET_ATTRIBUTE kCTFontCharacterSetAttribute
59#define MAC_FONT_LANGUAGES_ATTRIBUTE kCTFontLanguagesAttribute 59#define MAC_FONT_LANGUAGES_ATTRIBUTE kCTFontLanguagesAttribute
60#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
61#define MAC_FONT_FORMAT_ATTRIBUTE kCTFontFormatAttribute 60#define MAC_FONT_FORMAT_ATTRIBUTE kCTFontFormatAttribute
62#else
63#define MAC_FONT_FORMAT_ATTRIBUTE (CFSTR ("NSCTFontFormatAttribute"))
64#endif
65#define MAC_FONT_SYMBOLIC_TRAIT kCTFontSymbolicTrait 61#define MAC_FONT_SYMBOLIC_TRAIT kCTFontSymbolicTrait
66#define MAC_FONT_WEIGHT_TRAIT kCTFontWeightTrait 62#define MAC_FONT_WEIGHT_TRAIT kCTFontWeightTrait
67#define MAC_FONT_WIDTH_TRAIT kCTFontWidthTrait 63#define MAC_FONT_WIDTH_TRAIT kCTFontWidthTrait
@@ -79,11 +75,7 @@ enum {
79}; 75};
80 76
81enum { 77enum {
82#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
83 MAC_FONT_FORMAT_BITMAP = kCTFontFormatBitmap 78 MAC_FONT_FORMAT_BITMAP = kCTFontFormatBitmap
84#else
85 MAC_FONT_FORMAT_BITMAP = 5
86#endif
87}; 79};
88 80
89enum { 81enum {
@@ -112,13 +104,8 @@ enum {
112#define mac_font_get_underline_position CTFontGetUnderlinePosition 104#define mac_font_get_underline_position CTFontGetUnderlinePosition
113#define mac_font_get_underline_thickness CTFontGetUnderlineThickness 105#define mac_font_get_underline_thickness CTFontGetUnderlineThickness
114#define mac_font_copy_graphics_font(font) CTFontCopyGraphicsFont (font, NULL) 106#define mac_font_copy_graphics_font(font) CTFontCopyGraphicsFont (font, NULL)
115#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
116#define mac_font_copy_non_synthetic_table(font, table) \ 107#define mac_font_copy_non_synthetic_table(font, table) \
117 CTFontCopyTable (font, table, kCTFontTableOptionNoOptions) 108 CTFontCopyTable (font, table, kCTFontTableOptionNoOptions)
118#else
119#define mac_font_copy_non_synthetic_table(font, table) \
120 CTFontCopyTable (font, table, kCTFontTableOptionExcludeSynthetic)
121#endif
122 109
123#define mac_font_create_preferred_family_for_attributes \ 110#define mac_font_create_preferred_family_for_attributes \
124 mac_ctfont_create_preferred_family_for_attributes 111 mac_ctfont_create_preferred_family_for_attributes
diff --git a/src/macfont.m b/src/macfont.m
index b1fa5a1a41b..e2f47b3e5f1 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -36,8 +36,6 @@ Original author: YAMAMOTO Mitsuharu
36#include "macfont.h" 36#include "macfont.h"
37#include "macuvs.h" 37#include "macuvs.h"
38 38
39#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
40
41#include <libkern/OSByteOrder.h> 39#include <libkern/OSByteOrder.h>
42 40
43static struct font_driver macfont_driver; 41static struct font_driver macfont_driver;
@@ -926,22 +924,9 @@ macfont_create_family_with_symbol (Lisp_Object symbol)
926 if (family_name == NULL) 924 if (family_name == NULL)
927 return NULL; 925 return NULL;
928 926
929#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
930#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
931 if (CTFontManagerCompareFontFamilyNames != NULL)
932#endif
933 { 927 {
934 family_name_comparator = CTFontManagerCompareFontFamilyNames; 928 family_name_comparator = CTFontManagerCompareFontFamilyNames;
935 } 929 }
936#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
937 else /* CTFontManagerCompareFontFamilyNames == NULL */
938#endif
939#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 */
940#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
941 {
942 family_name_comparator = mac_font_family_compare;
943 }
944#endif
945 930
946 if ((*family_name_comparator) (family_name, CFSTR ("LastResort"), NULL) 931 if ((*family_name_comparator) (family_name, CFSTR ("LastResort"), NULL)
947 == kCFCompareEqualTo) 932 == kCFCompareEqualTo)
@@ -1331,12 +1316,8 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c)
1331 CGGlyph *glyphs; 1316 CGGlyph *glyphs;
1332 int i, len; 1317 int i, len;
1333 int nrows; 1318 int nrows;
1334#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
1335 dispatch_queue_t queue; 1319 dispatch_queue_t queue;
1336 dispatch_group_t group = NULL; 1320 dispatch_group_t group = NULL;
1337#else
1338 int nkeys;
1339#endif
1340 1321
1341 if (row != 0) 1322 if (row != 0)
1342 { 1323 {
@@ -1374,14 +1355,12 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c)
1374 return glyph; 1355 return glyph;
1375 } 1356 }
1376 1357
1377#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
1378 queue = 1358 queue =
1379 dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 1359 dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
1380 group = dispatch_group_create (); 1360 group = dispatch_group_create ();
1381 dispatch_group_async (group, queue, ^{ 1361 dispatch_group_async (group, queue, ^{
1382 int nkeys; 1362 int nkeys;
1383 uintptr_t key; 1363 uintptr_t key;
1384#endif
1385 nkeys = nkeys_or_perm; 1364 nkeys = nkeys_or_perm;
1386 for (key = row * (256 / NGLYPHS_IN_VALUE); ; key++) 1365 for (key = row * (256 / NGLYPHS_IN_VALUE); ; key++)
1387 if (CFDictionaryContainsKey (dictionary, 1366 if (CFDictionaryContainsKey (dictionary,
@@ -1392,9 +1371,7 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c)
1392 if (--nkeys == 0) 1371 if (--nkeys == 0)
1393 break; 1372 break;
1394 } 1373 }
1395#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
1396 }); 1374 });
1397#endif
1398 } 1375 }
1399 1376
1400 len = 0; 1377 len = 0;
@@ -1436,13 +1413,11 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c)
1436 cache->glyph.matrix[nrows - 1] = glyphs; 1413 cache->glyph.matrix[nrows - 1] = glyphs;
1437 cache->glyph.nrows = nrows; 1414 cache->glyph.nrows = nrows;
1438 1415
1439#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
1440 if (group) 1416 if (group)
1441 { 1417 {
1442 dispatch_group_wait (group, DISPATCH_TIME_FOREVER); 1418 dispatch_group_wait (group, DISPATCH_TIME_FOREVER);
1443 dispatch_release (group); 1419 dispatch_release (group);
1444 } 1420 }
1445#endif
1446 } 1421 }
1447 1422
1448 return cache->glyph.matrix[nkeys_or_perm - ROW_PERM_OFFSET][c % 256]; 1423 return cache->glyph.matrix[nkeys_or_perm - ROW_PERM_OFFSET][c % 256];
@@ -3165,11 +3140,9 @@ mac_font_get_glyphs_for_variants (CFDataRef uvs_table, UTF32Char c,
3165 struct variation_selector_record *records = uvs->variation_selector_records; 3140 struct variation_selector_record *records = uvs->variation_selector_records;
3166 CFIndex i; 3141 CFIndex i;
3167 UInt32 ir, nrecords; 3142 UInt32 ir, nrecords;
3168#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
3169 dispatch_queue_t queue = 3143 dispatch_queue_t queue =
3170 dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 3144 dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
3171 dispatch_group_t group = dispatch_group_create (); 3145 dispatch_group_t group = dispatch_group_create ();
3172#endif
3173 3146
3174 nrecords = BUINT32_VALUE (uvs->num_var_selector_records); 3147 nrecords = BUINT32_VALUE (uvs->num_var_selector_records);
3175 i = 0; 3148 i = 0;
@@ -3193,9 +3166,7 @@ mac_font_get_glyphs_for_variants (CFDataRef uvs_table, UTF32Char c,
3193 default_uvs_offset = BUINT32_VALUE (records[ir].default_uvs_offset); 3166 default_uvs_offset = BUINT32_VALUE (records[ir].default_uvs_offset);
3194 non_default_uvs_offset = 3167 non_default_uvs_offset =
3195 BUINT32_VALUE (records[ir].non_default_uvs_offset); 3168 BUINT32_VALUE (records[ir].non_default_uvs_offset);
3196#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
3197 dispatch_group_async (group, queue, ^{ 3169 dispatch_group_async (group, queue, ^{
3198#endif
3199 glyphs[i] = kCGFontIndexInvalid; 3170 glyphs[i] = kCGFontIndexInvalid;
3200 3171
3201 if (default_uvs_offset) 3172 if (default_uvs_offset)
@@ -3247,18 +3218,14 @@ mac_font_get_glyphs_for_variants (CFDataRef uvs_table, UTF32Char c,
3247 BUINT24_VALUE (mappings[hi - 1].unicode_value) == c) 3218 BUINT24_VALUE (mappings[hi - 1].unicode_value) == c)
3248 glyphs[i] = BUINT16_VALUE (mappings[hi - 1].glyph_id); 3219 glyphs[i] = BUINT16_VALUE (mappings[hi - 1].glyph_id);
3249 } 3220 }
3250#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
3251 }); 3221 });
3252#endif
3253 i++; 3222 i++;
3254 ir++; 3223 ir++;
3255 } 3224 }
3256 while (i < count) 3225 while (i < count)
3257 glyphs[i++] = kCGFontIndexInvalid; 3226 glyphs[i++] = kCGFontIndexInvalid;
3258#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
3259 dispatch_group_wait (group, DISPATCH_TIME_FOREVER); 3227 dispatch_group_wait (group, DISPATCH_TIME_FOREVER);
3260 dispatch_release (group); 3228 dispatch_release (group);
3261#endif
3262} 3229}
3263 3230
3264static int 3231static int
@@ -3460,10 +3427,6 @@ mac_ctfont_create_available_families (void)
3460{ 3427{
3461 CFMutableArrayRef families = NULL; 3428 CFMutableArrayRef families = NULL;
3462 3429
3463#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
3464#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
3465 if (CTFontManagerCopyAvailableFontFamilyNames != NULL)
3466#endif
3467 { 3430 {
3468 CFArrayRef orig_families = CTFontManagerCopyAvailableFontFamilyNames (); 3431 CFArrayRef orig_families = CTFontManagerCopyAvailableFontFamilyNames ();
3469 3432
@@ -3487,56 +3450,8 @@ mac_ctfont_create_available_families (void)
3487 CFRelease (orig_families); 3450 CFRelease (orig_families);
3488 } 3451 }
3489 } 3452 }
3490#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
3491 else /* CTFontManagerCopyAvailableFontFamilyNames == NULL */
3492#endif
3493#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 */
3494#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
3495 {
3496 CTFontCollectionRef collection;
3497 CFArrayRef descs = NULL;
3498 3453
3499 collection = CTFontCollectionCreateFromAvailableFonts (NULL); 3454 return families;
3500 if (collection)
3501 {
3502 descs = CTFontCollectionCreateMatchingFontDescriptors (collection);
3503 CFRelease (collection);
3504 }
3505 if (descs)
3506 {
3507 CFIndex i, count = CFArrayGetCount (descs);
3508
3509 families = CFArrayCreateMutable (NULL, count, &kCFTypeArrayCallBacks);
3510 if (families)
3511 for (i = 0; i < count; i++)
3512 {
3513 FontDescriptorRef desc = CFArrayGetValueAtIndex (descs, i);
3514 CFStringRef name =
3515 mac_font_descriptor_copy_attribute (desc,
3516 MAC_FONT_FAMILY_NAME_ATTRIBUTE);
3517
3518 if (name)
3519 {
3520 CFIndex p, limit = CFArrayGetCount (families);
3521
3522 p = CFArrayBSearchValues (families, CFRangeMake (0, limit),
3523 (const void *) name,
3524 mac_font_family_compare, NULL);
3525 if (p >= limit)
3526 CFArrayAppendValue (families, name);
3527 else if (mac_font_family_compare
3528 (CFArrayGetValueAtIndex (families, p),
3529 name, NULL) != kCFCompareEqualTo)
3530 CFArrayInsertValueAtIndex (families, p, name);
3531 CFRelease (name);
3532 }
3533 }
3534 CFRelease (descs);
3535 }
3536 }
3537#endif
3538
3539 return families;
3540} 3455}
3541 3456
3542static Boolean 3457static Boolean
@@ -3855,41 +3770,6 @@ mac_ctfont_get_glyph_for_cid (CTFontRef font, CTCharacterCollection collection,
3855} 3770}
3856#endif 3771#endif
3857 3772
3858#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
3859static inline int
3860mac_font_family_group (CFStringRef family)
3861{
3862 if (CFStringHasPrefix (family, CFSTR ("#")))
3863 return 2;
3864 else
3865 {
3866 CFRange range;
3867
3868 range = CFStringFind (family, CFSTR ("Apple"),
3869 kCFCompareCaseInsensitive | kCFCompareAnchored);
3870 if (range.location != kCFNotFound)
3871 return 1;
3872
3873 return 0;
3874 }
3875}
3876
3877static CFComparisonResult
3878mac_font_family_compare (const void *val1, const void *val2, void *context)
3879{
3880 CFStringRef family1 = (CFStringRef) val1, family2 = (CFStringRef) val2;
3881 int group1, group2;
3882
3883 group1 = mac_font_family_group (family1);
3884 group2 = mac_font_family_group (family2);
3885 if (group1 < group2)
3886 return kCFCompareLessThan;
3887 if (group1 > group2)
3888 return kCFCompareGreaterThan;
3889 return CFStringCompare (family1, family2, kCFCompareCaseInsensitive);
3890}
3891#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
3892
3893static CFArrayRef 3773static CFArrayRef
3894mac_font_copy_default_descriptors_for_language (CFStringRef language) 3774mac_font_copy_default_descriptors_for_language (CFStringRef language)
3895{ 3775{
@@ -4040,13 +3920,10 @@ mac_register_font_driver (struct frame *f)
4040 register_font_driver (&macfont_driver, f); 3920 register_font_driver (&macfont_driver, f);
4041} 3921}
4042 3922
4043#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
4044
4045 3923
4046void 3924void
4047syms_of_macfont (void) 3925syms_of_macfont (void)
4048{ 3926{
4049#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
4050 static struct font_driver mac_font_driver; 3927 static struct font_driver mac_font_driver;
4051 3928
4052 DEFSYM (Qmac_ct, "mac-ct"); 3929 DEFSYM (Qmac_ct, "mac-ct");
@@ -4055,5 +3932,4 @@ syms_of_macfont (void)
4055 3932
4056 DEFSYM (QCdestination, ":destination"); 3933 DEFSYM (QCdestination, ":destination");
4057 DEFSYM (QCminspace, ":minspace"); 3934 DEFSYM (QCminspace, ":minspace");
4058#endif
4059} 3935}
diff --git a/src/nsfns.m b/src/nsfns.m
index 052c428fae5..5cf8387123e 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -46,10 +46,8 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
46 46
47#ifdef NS_IMPL_COCOA 47#ifdef NS_IMPL_COCOA
48#include <IOKit/graphics/IOGraphicsLib.h> 48#include <IOKit/graphics/IOGraphicsLib.h>
49#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
50#include "macfont.h" 49#include "macfont.h"
51#endif 50#endif
52#endif
53 51
54#if 0 52#if 0
55int fns_trace_num = 1; 53int fns_trace_num = 1;
@@ -197,7 +195,7 @@ ns_display_info_for_name (Lisp_Object name)
197static NSString * 195static NSString *
198ns_filename_from_panel (NSSavePanel *panel) 196ns_filename_from_panel (NSSavePanel *panel)
199{ 197{
200#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 198#ifdef NS_IMPL_COCOA
201 NSURL *url = [panel URL]; 199 NSURL *url = [panel URL];
202 NSString *str = [url path]; 200 NSString *str = [url path];
203 return str; 201 return str;
@@ -209,7 +207,7 @@ ns_filename_from_panel (NSSavePanel *panel)
209static NSString * 207static NSString *
210ns_directory_from_panel (NSSavePanel *panel) 208ns_directory_from_panel (NSSavePanel *panel)
211{ 209{
212#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 210#ifdef NS_IMPL_COCOA
213 NSURL *url = [panel directoryURL]; 211 NSURL *url = [panel directoryURL];
214 NSString *str = [url path]; 212 NSString *str = [url path];
215 return str; 213 return str;
@@ -1197,13 +1195,10 @@ This function is an internal primitive--use `make-frame' instead. */)
1197 block_input (); 1195 block_input ();
1198 1196
1199#ifdef NS_IMPL_COCOA 1197#ifdef NS_IMPL_COCOA
1200#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
1201 if (CTGetCoreTextVersion != NULL
1202 && CTGetCoreTextVersion () >= kCTVersionNumber10_5)
1203 mac_register_font_driver (f); 1198 mac_register_font_driver (f);
1199#else
1200 register_font_driver (&nsfont_driver, f);
1204#endif 1201#endif
1205#endif
1206 register_font_driver (&nsfont_driver, f);
1207 1202
1208 x_default_parameter (f, parms, Qfont_backend, Qnil, 1203 x_default_parameter (f, parms, Qfont_backend, Qnil,
1209 "fontBackend", "FontBackend", RES_TYPE_STRING); 1204 "fontBackend", "FontBackend", RES_TYPE_STRING);
@@ -1414,13 +1409,11 @@ DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel,
1414 id fm = [NSFontManager sharedFontManager]; 1409 id fm = [NSFontManager sharedFontManager];
1415 struct font *font = f->output_data.ns->font; 1410 struct font *font = f->output_data.ns->font;
1416 NSFont *nsfont; 1411 NSFont *nsfont;
1417 if (EQ (font->driver->type, Qns)) 1412#ifdef NS_IMPL_GNUSTEP
1418 nsfont = ((struct nsfont_info *)font)->nsfont; 1413 nsfont = ((struct nsfont_info *)font)->nsfont;
1419#ifdef NS_IMPL_COCOA
1420#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
1421 else
1422 nsfont = (NSFont *) macfont_get_nsctfont (font);
1423#endif 1414#endif
1415#ifdef NS_IMPL_COCOA
1416 nsfont = (NSFont *) macfont_get_nsctfont (font);
1424#endif 1417#endif
1425 [fm setSelectedFont: nsfont isMultiple: NO]; 1418 [fm setSelectedFont: nsfont isMultiple: NO];
1426 [fm orderFrontFontPanel: NSApp]; 1419 [fm orderFrontFontPanel: NSApp];
@@ -1442,8 +1435,7 @@ static struct
1442{ 1435{
1443 id panel; 1436 id panel;
1444 BOOL ret; 1437 BOOL ret;
1445#if ! defined (NS_IMPL_COCOA) || \ 1438#ifdef NS_IMPL_GNUSTEP
1446 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
1447 NSString *dirS, *initS; 1439 NSString *dirS, *initS;
1448 BOOL no_types; 1440 BOOL no_types;
1449#endif 1441#endif
@@ -1453,8 +1445,7 @@ void
1453ns_run_file_dialog (void) 1445ns_run_file_dialog (void)
1454{ 1446{
1455 if (ns_fd_data.panel == nil) return; 1447 if (ns_fd_data.panel == nil) return;
1456#if defined (NS_IMPL_COCOA) && \ 1448#ifdef NS_IMPL_COCOA
1457 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
1458 ns_fd_data.ret = [ns_fd_data.panel runModal]; 1449 ns_fd_data.ret = [ns_fd_data.panel runModal];
1459#else 1450#else
1460 if (ns_fd_data.no_types) 1451 if (ns_fd_data.no_types)
@@ -1534,8 +1525,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1534 block_input (); 1525 block_input ();
1535 ns_fd_data.panel = panel; 1526 ns_fd_data.panel = panel;
1536 ns_fd_data.ret = NO; 1527 ns_fd_data.ret = NO;
1537#if defined (NS_IMPL_COCOA) && \ 1528#ifdef NS_IMPL_COCOA
1538 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
1539 if (! NILP (mustmatch) || ! NILP (dir_only_p)) 1529 if (! NILP (mustmatch) || ! NILP (dir_only_p))
1540 [panel setAllowedFileTypes: nil]; 1530 [panel setAllowedFileTypes: nil];
1541 if (dirS) [panel setDirectoryURL: [NSURL fileURLWithPath: dirS]]; 1531 if (dirS) [panel setDirectoryURL: [NSURL fileURLWithPath: dirS]];
@@ -1995,7 +1985,7 @@ DEFUN ("ns-list-services", Fns_list_services, Sns_list_services, 0, 0, 0,
1995 doc: /* List available Nextstep services by querying NSApp. */) 1985 doc: /* List available Nextstep services by querying NSApp. */)
1996 (void) 1986 (void)
1997{ 1987{
1998#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 1988#ifdef NS_IMPL_COCOA
1999 /* You can't get services like this in 10.6+. */ 1989 /* You can't get services like this in 10.6+. */
2000 return Qnil; 1990 return Qnil;
2001#else 1991#else
diff --git a/src/nsimage.m b/src/nsimage.m
index 6b68072b87a..71e5f8aa5c6 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -188,7 +188,7 @@ static EmacsImage *ImageList = nil;
188 image = [[EmacsImage alloc] initByReferencingFile: 188 image = [[EmacsImage alloc] initByReferencingFile:
189 [NSString stringWithUTF8String: SSDATA (found)]]; 189 [NSString stringWithUTF8String: SSDATA (found)]];
190 190
191#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 191#ifdef NS_IMPL_COCOA
192 imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; 192 imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]];
193#else 193#else
194 imgRep = [image bestRepresentationForDevice: nil]; 194 imgRep = [image bestRepresentationForDevice: nil];
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 778b068ef8b..3d444dea61d 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -492,11 +492,9 @@ void
492x_activate_menubar (struct frame *f) 492x_activate_menubar (struct frame *f)
493{ 493{
494#ifdef NS_IMPL_COCOA 494#ifdef NS_IMPL_COCOA
495#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
496 ns_update_menubar (f, true, nil); 495 ns_update_menubar (f, true, nil);
497 ns_check_pending_open_menu (); 496 ns_check_pending_open_menu ();
498#endif 497#endif
499#endif
500} 498}
501 499
502 500
@@ -542,23 +540,14 @@ x_activate_menubar (struct frame *f)
542} 540}
543 541
544#ifdef NS_IMPL_COCOA 542#ifdef NS_IMPL_COCOA
545#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
546extern NSString *NSMenuDidBeginTrackingNotification;
547#endif
548#endif
549
550#ifdef NS_IMPL_COCOA
551-(void)trackingNotification:(NSNotification *)notification 543-(void)trackingNotification:(NSNotification *)notification
552{ 544{
553 /* Update menu in menuNeedsUpdate only while tracking menus. */ 545 /* Update menu in menuNeedsUpdate only while tracking menus. */
554 trackingMenu = ([notification name] == NSMenuDidBeginTrackingNotification 546 trackingMenu = ([notification name] == NSMenuDidBeginTrackingNotification
555 ? 1 : 0); 547 ? 1 : 0);
556#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
557 if (! trackingMenu) ns_check_menu_open (nil); 548 if (! trackingMenu) ns_check_menu_open (nil);
558#endif
559} 549}
560 550
561#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
562- (void)menuWillOpen:(NSMenu *)menu 551- (void)menuWillOpen:(NSMenu *)menu
563{ 552{
564 ++trackingMenu; 553 ++trackingMenu;
@@ -579,7 +568,6 @@ extern NSString *NSMenuDidBeginTrackingNotification;
579{ 568{
580 --trackingMenu; 569 --trackingMenu;
581} 570}
582#endif /* OSX >= 10.5 */
583 571
584#endif /* NS_IMPL_COCOA */ 572#endif /* NS_IMPL_COCOA */
585 573
@@ -608,8 +596,7 @@ extern NSString *NSMenuDidBeginTrackingNotification;
608 if (trackingMenu == 0) 596 if (trackingMenu == 0)
609 return; 597 return;
610/*fprintf (stderr, "Updating menu '%s'\n", [[self title] UTF8String]); NSLog (@"%@\n", event); */ 598/*fprintf (stderr, "Updating menu '%s'\n", [[self title] UTF8String]); NSLog (@"%@\n", event); */
611#if (! defined (NS_IMPL_COCOA) \ 599#ifdef NS_IMPL_GNUSTEP
612 || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
613 /* Don't know how to do this for anything other than OSX >= 10.5 600 /* Don't know how to do this for anything other than OSX >= 10.5
614 This is wrong, as it might run Lisp code in the event loop. */ 601 This is wrong, as it might run Lisp code in the event loop. */
615 ns_update_menubar (frame, true, self); 602 ns_update_menubar (frame, true, self);
diff --git a/src/nsterm.h b/src/nsterm.h
index e223281de28..f59405fe9af 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -27,12 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#ifdef HAVE_NS 27#ifdef HAVE_NS
28 28
29#ifdef NS_IMPL_COCOA 29#ifdef NS_IMPL_COCOA
30#ifndef MAC_OS_X_VERSION_10_4
31#define MAC_OS_X_VERSION_10_4 1040
32#endif
33#ifndef MAC_OS_X_VERSION_10_5
34#define MAC_OS_X_VERSION_10_5 1050
35#endif
36#ifndef MAC_OS_X_VERSION_10_6 30#ifndef MAC_OS_X_VERSION_10_6
37#define MAC_OS_X_VERSION_10_6 1060 31#define MAC_OS_X_VERSION_10_6 1060
38#endif 32#endif
@@ -58,21 +52,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
58 versions. 52 versions.
59 On Cocoa >= 10.5, functions expect CGFloat*. Make compatible type. */ 53 On Cocoa >= 10.5, functions expect CGFloat*. Make compatible type. */
60#ifdef NS_IMPL_COCOA 54#ifdef NS_IMPL_COCOA
61
62#ifndef NS_HAVE_NSINTEGER
63#if defined (__LP64__) && __LP64__
64typedef double CGFloat;
65typedef long NSInteger;
66typedef unsigned long NSUInteger;
67#else
68typedef float CGFloat;
69typedef int NSInteger;
70typedef unsigned int NSUInteger;
71#endif /* not LP64 */
72#endif /* not NS_HAVE_NSINTEGER */
73
74typedef CGFloat EmacsCGFloat; 55typedef CGFloat EmacsCGFloat;
75
76#elif GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION >= 22 56#elif GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION >= 22
77typedef CGFloat EmacsCGFloat; 57typedef CGFloat EmacsCGFloat;
78#else 58#else
@@ -139,7 +119,7 @@ typedef float EmacsCGFloat;
139 119
140@class EmacsToolbar; 120@class EmacsToolbar;
141 121
142#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 122#ifdef NS_IMPL_COCOA
143@interface EmacsView : NSView <NSTextInput, NSWindowDelegate> 123@interface EmacsView : NSView <NSTextInput, NSWindowDelegate>
144#else 124#else
145@interface EmacsView : NSView <NSTextInput> 125@interface EmacsView : NSView <NSTextInput>
@@ -217,7 +197,7 @@ typedef float EmacsCGFloat;
217 197
218 ========================================================================== */ 198 ========================================================================== */
219 199
220#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 200#ifdef NS_IMPL_COCOA
221@interface EmacsMenu : NSMenu <NSMenuDelegate> 201@interface EmacsMenu : NSMenu <NSMenuDelegate>
222#else 202#else
223@interface EmacsMenu : NSMenu 203@interface EmacsMenu : NSMenu
@@ -249,7 +229,7 @@ typedef float EmacsCGFloat;
249 229
250@class EmacsImage; 230@class EmacsImage;
251 231
252#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 232#ifdef NS_IMPL_COCOA
253@interface EmacsToolbar : NSToolbar <NSToolbarDelegate> 233@interface EmacsToolbar : NSToolbar <NSToolbarDelegate>
254#else 234#else
255@interface EmacsToolbar : NSToolbar 235@interface EmacsToolbar : NSToolbar
@@ -305,7 +285,7 @@ typedef float EmacsCGFloat;
305- (void)timeout_handler: (NSTimer *)timedEntry; 285- (void)timeout_handler: (NSTimer *)timedEntry;
306@end 286@end
307 287
308#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 288#ifdef NS_IMPL_COCOA
309@interface EmacsTooltip : NSObject <NSWindowDelegate> 289@interface EmacsTooltip : NSObject <NSWindowDelegate>
310#else 290#else
311@interface EmacsTooltip : NSObject 291@interface EmacsTooltip : NSObject
diff --git a/src/nsterm.m b/src/nsterm.m
index b0a2994bcf5..19d246d526a 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -65,10 +65,8 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
65#endif 65#endif
66 66
67#ifdef NS_IMPL_COCOA 67#ifdef NS_IMPL_COCOA
68#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
69#include "macfont.h" 68#include "macfont.h"
70#endif 69#endif
71#endif
72 70
73/* call tracing */ 71/* call tracing */
74#if 0 72#if 0
@@ -706,7 +704,6 @@ static void
706ns_update_auto_hide_menu_bar (void) 704ns_update_auto_hide_menu_bar (void)
707{ 705{
708#ifdef NS_IMPL_COCOA 706#ifdef NS_IMPL_COCOA
709#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
710 block_input (); 707 block_input ();
711 708
712 NSTRACE (ns_update_auto_hide_menu_bar); 709 NSTRACE (ns_update_auto_hide_menu_bar);
@@ -739,7 +736,6 @@ ns_update_auto_hide_menu_bar (void)
739 736
740 unblock_input (); 737 unblock_input ();
741#endif 738#endif
742#endif
743} 739}
744 740
745 741
@@ -2358,7 +2354,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
2358 [img setXBMColor: bm_color]; 2354 [img setXBMColor: bm_color];
2359 } 2355 }
2360 2356
2361#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 2357#ifdef NS_IMPL_COCOA
2362 [img drawInRect: r 2358 [img drawInRect: r
2363 fromRect: NSZeroRect 2359 fromRect: NSZeroRect
2364 operation: NSCompositeSourceOver 2360 operation: NSCompositeSourceOver
@@ -3037,7 +3033,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
3037 /* Draw the image.. do we need to draw placeholder if img ==nil? */ 3033 /* Draw the image.. do we need to draw placeholder if img ==nil? */
3038 if (img != nil) 3034 if (img != nil)
3039 { 3035 {
3040#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 3036#ifdef NS_IMPL_COCOA
3041 NSRect dr = NSMakeRect (x, y, s->slice.width, s->slice.height); 3037 NSRect dr = NSMakeRect (x, y, s->slice.width, s->slice.height);
3042 NSRect ir = NSMakeRect (s->slice.x, s->slice.y, 3038 NSRect ir = NSMakeRect (s->slice.x, s->slice.y,
3043 s->slice.width, s->slice.height); 3039 s->slice.width, s->slice.height);
@@ -3450,8 +3446,7 @@ check_native_fs ()
3450#endif 3446#endif
3451 3447
3452/* GNUstep and OSX <= 10.4 does not have cancelTracking. */ 3448/* GNUstep and OSX <= 10.4 does not have cancelTracking. */
3453#if defined (NS_IMPL_COCOA) && \ 3449#ifdef NS_IMPL_COCOA
3454 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
3455/* Check if menu open should be canceled or continued as normal. */ 3450/* Check if menu open should be canceled or continued as normal. */
3456void 3451void
3457ns_check_menu_open (NSMenu *menu) 3452ns_check_menu_open (NSMenu *menu)
@@ -3514,7 +3509,7 @@ ns_check_pending_open_menu ()
3514 menu_will_open_state = MENU_OPENING; 3509 menu_will_open_state = MENU_OPENING;
3515 } 3510 }
3516} 3511}
3517#endif /* NS_IMPL_COCOA) && >= MAC_OS_X_VERSION_10_5 */ 3512#endif /* NS_IMPL_COCOA */
3518 3513
3519static void 3514static void
3520unwind_apploopnr (Lisp_Object not_used) 3515unwind_apploopnr (Lisp_Object not_used)
@@ -4720,14 +4715,12 @@ ns_term_shutdown (int sig)
4720 4715
4721 [self antialiasThresholdDidChange:nil]; 4716 [self antialiasThresholdDidChange:nil];
4722#ifdef NS_IMPL_COCOA 4717#ifdef NS_IMPL_COCOA
4723#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
4724 [[NSNotificationCenter defaultCenter] 4718 [[NSNotificationCenter defaultCenter]
4725 addObserver:self 4719 addObserver:self
4726 selector:@selector(antialiasThresholdDidChange:) 4720 selector:@selector(antialiasThresholdDidChange:)
4727 name:NSAntialiasThresholdChangedNotification 4721 name:NSAntialiasThresholdChangedNotification
4728 object:nil]; 4722 object:nil];
4729#endif 4723#endif
4730#endif
4731 4724
4732 ns_send_appdefined (-2); 4725 ns_send_appdefined (-2);
4733} 4726}
@@ -4735,10 +4728,8 @@ ns_term_shutdown (int sig)
4735- (void)antialiasThresholdDidChange:(NSNotification *)notification 4728- (void)antialiasThresholdDidChange:(NSNotification *)notification
4736{ 4729{
4737#ifdef NS_IMPL_COCOA 4730#ifdef NS_IMPL_COCOA
4738#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
4739 macfont_update_antialias_threshold (); 4731 macfont_update_antialias_threshold ();
4740#endif 4732#endif
4741#endif
4742} 4733}
4743 4734
4744 4735
@@ -5078,13 +5069,11 @@ not_in_argv (NSString *arg)
5078 if (!emacs_event) 5069 if (!emacs_event)
5079 return; 5070 return;
5080 5071
5081 if (EQ (font->driver->type, Qns)) 5072#ifdef NS_IMPL_GNUSTEP
5082 nsfont = ((struct nsfont_info *)font)->nsfont; 5073 nsfont = ((struct nsfont_info *)font)->nsfont;
5083#ifdef NS_IMPL_COCOA
5084#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
5085 else
5086 nsfont = (NSFont *) macfont_get_nsctfont (font);
5087#endif 5074#endif
5075#ifdef NS_IMPL_COCOA
5076 nsfont = (NSFont *) macfont_get_nsctfont (font);
5088#endif 5077#endif
5089 5078
5090 if ((newFont = [sender convertFont: nsfont])) 5079 if ((newFont = [sender convertFont: nsfont]))
@@ -5136,7 +5125,7 @@ not_in_argv (NSString *arg)
5136 int code; 5125 int code;
5137 unsigned fnKeysym = 0; 5126 unsigned fnKeysym = 0;
5138 static NSMutableArray *nsEvArray; 5127 static NSMutableArray *nsEvArray;
5139#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 5128#ifdef NS_IMPL_GNUSTEP
5140 static BOOL firstTime = YES; 5129 static BOOL firstTime = YES;
5141#endif 5130#endif
5142 int left_is_none; 5131 int left_is_none;
@@ -5367,7 +5356,7 @@ not_in_argv (NSString *arg)
5367 } 5356 }
5368 5357
5369 5358
5370#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 5359#ifdef NS_IMPL_GNUSTEP
5371 /* if we get here we should send the key for input manager processing */ 5360 /* if we get here we should send the key for input manager processing */
5372 /* Disable warning, there is nothing a user can do about it anyway, and 5361 /* Disable warning, there is nothing a user can do about it anyway, and
5373 it does not seem to matter. */ 5362 it does not seem to matter. */
@@ -6509,8 +6498,7 @@ if (cols > 0 && rows > 0)
6509 /* Hide dock and menubar if we are on the primary screen. */ 6498 /* Hide dock and menubar if we are on the primary screen. */
6510 if (onFirstScreen) 6499 if (onFirstScreen)
6511 { 6500 {
6512#if defined (NS_IMPL_COCOA) && \ 6501#ifdef NS_IMPL_COCOA
6513 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
6514 NSApplicationPresentationOptions options 6502 NSApplicationPresentationOptions options
6515 = NSApplicationPresentationAutoHideDock 6503 = NSApplicationPresentationAutoHideDock
6516 | NSApplicationPresentationAutoHideMenuBar; 6504 | NSApplicationPresentationAutoHideMenuBar;
@@ -6562,8 +6550,7 @@ if (cols > 0 && rows > 0)
6562 6550
6563 if (onFirstScreen) 6551 if (onFirstScreen)
6564 { 6552 {
6565#if defined (NS_IMPL_COCOA) && \ 6553#ifdef NS_IMPL_COCOA
6566 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
6567 [NSApp setPresentationOptions: NSApplicationPresentationDefault]; 6554 [NSApp setPresentationOptions: NSApplicationPresentationDefault];
6568#else 6555#else
6569 [NSMenu setMenuBarVisible:YES]; 6556 [NSMenu setMenuBarVisible:YES];
@@ -7285,7 +7272,7 @@ if (cols > 0 && rows > 0)
7285 7272
7286 if (portion >= whole) 7273 if (portion >= whole)
7287 { 7274 {
7288#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 7275#ifdef NS_IMPL_COCOA
7289 [self setKnobProportion: 1.0]; 7276 [self setKnobProportion: 1.0];
7290 [self setDoubleValue: 1.0]; 7277 [self setDoubleValue: 1.0];
7291#else 7278#else
@@ -7299,7 +7286,7 @@ if (cols > 0 && rows > 0)
7299 portion = max ((float)whole*min_portion/pixel_height, portion); 7286 portion = max ((float)whole*min_portion/pixel_height, portion);
7300 pos = (float)position / (whole - portion); 7287 pos = (float)position / (whole - portion);
7301 por = (CGFloat)portion/whole; 7288 por = (CGFloat)portion/whole;
7302#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 7289#ifdef NS_IMPL_COCOA
7303 [self setKnobProportion: por]; 7290 [self setKnobProportion: por];
7304 [self setDoubleValue: pos]; 7291 [self setDoubleValue: pos];
7305#else 7292#else
@@ -7829,14 +7816,12 @@ baseline level. The default value is nil. */);
7829 DEFSYM (Qcocoa, "cocoa"); 7816 DEFSYM (Qcocoa, "cocoa");
7830 DEFSYM (Qgnustep, "gnustep"); 7817 DEFSYM (Qgnustep, "gnustep");
7831 7818
7832 syms_of_nsfont ();
7833#ifdef NS_IMPL_COCOA 7819#ifdef NS_IMPL_COCOA
7834 Fprovide (Qcocoa, Qnil); 7820 Fprovide (Qcocoa, Qnil);
7835#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
7836 syms_of_macfont (); 7821 syms_of_macfont ();
7837#endif
7838#else 7822#else
7839 Fprovide (Qgnustep, Qnil); 7823 Fprovide (Qgnustep, Qnil);
7824 syms_of_nsfont ();
7840#endif 7825#endif
7841 7826
7842} 7827}
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 3bd8f3b02fc..2e1ac880d2a 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -107,9 +107,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
107#include <mach/mach.h> 107#include <mach/mach.h>
108#include <mach-o/loader.h> 108#include <mach-o/loader.h>
109#include <mach-o/reloc.h> 109#include <mach-o/reloc.h>
110#if defined (__ppc__)
111#include <mach-o/ppc/reloc.h>
112#endif
113#ifdef HAVE_MALLOC_MALLOC_H 110#ifdef HAVE_MALLOC_MALLOC_H
114#include <malloc/malloc.h> 111#include <malloc/malloc.h>
115#else 112#else
@@ -1033,17 +1030,8 @@ unrelocate (const char *name, off_t reloff, int nrel, vm_address_t base)
1033 name, i, reloc_info.r_type); 1030 name, i, reloc_info.r_type);
1034 } 1031 }
1035 else 1032 else
1036 switch (sc_reloc_info->r_type) 1033 unexec_error ("unrelocate: %s:%d cannot handle scattered type = %d",
1037 { 1034 name, i, sc_reloc_info->r_type);
1038#if defined (__ppc__)
1039 case PPC_RELOC_PB_LA_PTR:
1040 /* nothing to do for prebound lazy pointer */
1041 break;
1042#endif
1043 default:
1044 unexec_error ("unrelocate: %s:%d cannot handle scattered type = %d",
1045 name, i, sc_reloc_info->r_type);
1046 }
1047 } 1035 }
1048 1036
1049 if (nrel > 0) 1037 if (nrel > 0)
@@ -1051,35 +1039,6 @@ unrelocate (const char *name, off_t reloff, int nrel, vm_address_t base)
1051 unreloc_count, nrel, name); 1039 unreloc_count, nrel, name);
1052} 1040}
1053 1041
1054#if __ppc64__
1055/* Rebase r_address in the relocation table. */
1056static void
1057rebase_reloc_address (off_t reloff, int nrel, long linkedit_delta, long diff)
1058{
1059 int i;
1060 struct relocation_info reloc_info;
1061 struct scattered_relocation_info *sc_reloc_info
1062 = (struct scattered_relocation_info *) &reloc_info;
1063
1064 for (i = 0; i < nrel; i++, reloff += sizeof (reloc_info))
1065 {
1066 if (lseek (infd, reloff - linkedit_delta, L_SET)
1067 != reloff - linkedit_delta)
1068 unexec_error ("rebase_reloc_table: cannot seek to reloc_info");
1069 if (!unexec_read (&reloc_info, sizeof (reloc_info)))
1070 unexec_error ("rebase_reloc_table: cannot read reloc_info");
1071
1072 if (sc_reloc_info->r_scattered == 0
1073 && reloc_info.r_type == GENERIC_RELOC_VANILLA)
1074 {
1075 reloc_info.r_address -= diff;
1076 if (!unexec_write (reloff, &reloc_info, sizeof (reloc_info)))
1077 unexec_error ("rebase_reloc_table: cannot write reloc_info");
1078 }
1079 }
1080}
1081#endif
1082
1083/* Copy a LC_DYSYMTAB load command from the input file to the output 1042/* Copy a LC_DYSYMTAB load command from the input file to the output
1084 file, adjusting the file offset fields. */ 1043 file, adjusting the file offset fields. */
1085static void 1044static void
@@ -1089,28 +1048,8 @@ copy_dysymtab (struct load_command *lc, long delta)
1089 vm_address_t base; 1048 vm_address_t base;
1090 1049
1091#ifdef _LP64 1050#ifdef _LP64
1092#if __ppc64__
1093 {
1094 int i;
1095
1096 base = 0;
1097 for (i = 0; i < nlc; i++)
1098 if (lca[i]->cmd == LC_SEGMENT)
1099 {
1100 struct segment_command *scp = (struct segment_command *) lca[i];
1101
1102 if (scp->vmaddr + scp->vmsize > 0x100000000
1103 && (scp->initprot & VM_PROT_WRITE) != 0)
1104 {
1105 base = data_segment_scp->vmaddr;
1106 break;
1107 }
1108 }
1109 }
1110#else
1111 /* First writable segment address. */ 1051 /* First writable segment address. */
1112 base = data_segment_scp->vmaddr; 1052 base = data_segment_scp->vmaddr;
1113#endif
1114#else 1053#else
1115 /* First segment address in the file (unless MH_SPLIT_SEGS set). */ 1054 /* First segment address in the file (unless MH_SPLIT_SEGS set). */
1116 base = 0; 1055 base = 0;
@@ -1136,29 +1075,6 @@ copy_dysymtab (struct load_command *lc, long delta)
1136 unexec_error ("cannot write symtab command to header"); 1075 unexec_error ("cannot write symtab command to header");
1137 1076
1138 curr_header_offset += lc->cmdsize; 1077 curr_header_offset += lc->cmdsize;
1139
1140#if __ppc64__
1141 /* Check if the relocation base needs to be changed. */
1142 if (base == 0)
1143 {
1144 vm_address_t newbase = 0;
1145 int i;
1146
1147 for (i = 0; i < num_unexec_regions; i++)
1148 if (unexec_regions[i].range.address + unexec_regions[i].range.size
1149 > 0x100000000)
1150 {
1151 newbase = data_segment_scp->vmaddr;
1152 break;
1153 }
1154
1155 if (newbase)
1156 {
1157 rebase_reloc_address (dstp->locreloff, dstp->nlocrel, delta, newbase);
1158 rebase_reloc_address (dstp->extreloff, dstp->nextrel, delta, newbase);
1159 }
1160 }
1161#endif
1162} 1078}
1163 1079
1164/* Copy a LC_TWOLEVEL_HINTS load command from the input file to the output 1080/* Copy a LC_TWOLEVEL_HINTS load command from the input file to the output