aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Third2016-08-18 19:55:52 +0100
committerAlan Third2016-08-24 19:21:56 +0100
commit5332857670eb3977b192eba433ec470a391c4ea4 (patch)
tree72df888858c91e200bc94e9e633909d49525a329
parent799a8a3338389013e8a76a70f507664ccb09a14f (diff)
downloademacs-5332857670eb3977b192eba433ec470a391c4ea4.tar.gz
emacs-5332857670eb3977b192eba433ec470a391c4ea4.zip
Fix macOS 12 deprecation notices
* src/nsterm.h: Add #defines to allow older versions of macOS to use the new constant names. * src/nsmenu.m: Replace old constant names with new. (fillWithWidgetValue): Remove calls to deprecated setMenuChangedMessagesEnabled. * src/nsterm.m: Replace old constant names with new. * src/nsfns.m: Replace old constant names with new.
-rw-r--r--src/nsfns.m12
-rw-r--r--src/nsmenu.m10
-rw-r--r--src/nsterm.h41
-rw-r--r--src/nsterm.m152
4 files changed, 127 insertions, 88 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index 051e5091919..4566b7e38e8 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1582,7 +1582,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1582 The file dialog may pop up a confirm dialog after Ok has been pressed, 1582 The file dialog may pop up a confirm dialog after Ok has been pressed,
1583 so we can not simply pop down on the Ok/Cancel press. 1583 so we can not simply pop down on the Ok/Cancel press.
1584 */ 1584 */
1585 nxev = [NSEvent otherEventWithType: NSApplicationDefined 1585 nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
1586 location: NSMakePoint (0, 0) 1586 location: NSMakePoint (0, 0)
1587 modifierFlags: 0 1587 modifierFlags: 0
1588 timestamp: 0 1588 timestamp: 0
@@ -2193,7 +2193,7 @@ In case the execution fails, an error is signaled. */)
2193 errors aren't returned and executeAndReturnError hangs forever. 2193 errors aren't returned and executeAndReturnError hangs forever.
2194 Post an event that runs applescript and then start the event loop. 2194 Post an event that runs applescript and then start the event loop.
2195 The event loop is exited when the script is done. */ 2195 The event loop is exited when the script is done. */
2196 nxev = [NSEvent otherEventWithType: NSApplicationDefined 2196 nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
2197 location: NSMakePoint (0, 0) 2197 location: NSMakePoint (0, 0)
2198 modifierFlags: 0 2198 modifierFlags: 0
2199 timestamp: 0 2199 timestamp: 0
@@ -2987,7 +2987,7 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent)
2987 int i; 2987 int i;
2988 BOOL ret = NO; 2988 BOOL ret = NO;
2989 2989
2990 if ([theEvent type] != NSKeyDown) return NO; 2990 if ([theEvent type] != NSEventTypeKeyDown) return NO;
2991 s = [theEvent characters]; 2991 s = [theEvent characters];
2992 2992
2993 for (i = 0; i < [s length]; ++i) 2993 for (i = 0; i < [s length]; ++i)
@@ -3006,7 +3006,7 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent)
3006 /* Don't send command modified keys, as those are handled in the 3006 /* Don't send command modified keys, as those are handled in the
3007 performKeyEquivalent method of the super class. 3007 performKeyEquivalent method of the super class.
3008 */ 3008 */
3009 if (! ([theEvent modifierFlags] & NSCommandKeyMask)) 3009 if (! ([theEvent modifierFlags] & NSEventModifierFlagCommand))
3010 { 3010 {
3011 [panel sendEvent: theEvent]; 3011 [panel sendEvent: theEvent];
3012 ret = YES; 3012 ret = YES;
@@ -3023,7 +3023,7 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent)
3023 case 'c': // Copy 3023 case 'c': // Copy
3024 case 'v': // Paste 3024 case 'v': // Paste
3025 case 'a': // Select all 3025 case 'a': // Select all
3026 if ([theEvent modifierFlags] & NSCommandKeyMask) 3026 if ([theEvent modifierFlags] & NSEventModifierFlagCommand)
3027 { 3027 {
3028 [NSApp sendAction: 3028 [NSApp sendAction:
3029 (ch == 'x' 3029 (ch == 'x'
@@ -3039,7 +3039,7 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent)
3039 default: 3039 default:
3040 // Send all control keys, as the text field supports C-a, C-f, C-e 3040 // Send all control keys, as the text field supports C-a, C-f, C-e
3041 // C-b and more. 3041 // C-b and more.
3042 if ([theEvent modifierFlags] & NSControlKeyMask) 3042 if ([theEvent modifierFlags] & NSEventModifierFlagControl)
3043 { 3043 {
3044 [panel sendEvent: theEvent]; 3044 [panel sendEvent: theEvent];
3045 ret = YES; 3045 ret = YES;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index d1f4b020bb0..ea9f790990f 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -604,7 +604,7 @@ x_activate_menubar (struct frame *f)
604-(NSString *)parseKeyEquiv: (const char *)key 604-(NSString *)parseKeyEquiv: (const char *)key
605{ 605{
606 const char *tpos = key; 606 const char *tpos = key;
607 keyEquivModMask = NSCommandKeyMask; 607 keyEquivModMask = NSEventModifierFlagCommand;
608 608
609 if (!key || !strlen (key)) 609 if (!key || !strlen (key))
610 return @""; 610 return @"";
@@ -692,7 +692,6 @@ x_activate_menubar (struct frame *f)
692 widget_value *wv = (widget_value *)wvptr; 692 widget_value *wv = (widget_value *)wvptr;
693 693
694 /* clear existing contents */ 694 /* clear existing contents */
695 [self setMenuChangedMessagesEnabled: NO];
696 [self clear]; 695 [self clear];
697 696
698 /* add new contents */ 697 /* add new contents */
@@ -716,7 +715,6 @@ x_activate_menubar (struct frame *f)
716 } 715 }
717 } 716 }
718 717
719 [self setMenuChangedMessagesEnabled: YES];
720#ifdef NS_IMPL_GNUSTEP 718#ifdef NS_IMPL_GNUSTEP
721 if ([[self window] isVisible]) 719 if ([[self window] isVisible])
722 [self sizeToFit]; 720 [self sizeToFit];
@@ -748,7 +746,7 @@ x_activate_menubar (struct frame *f)
748/* p = [view convertPoint:p fromView: nil]; */ 746/* p = [view convertPoint:p fromView: nil]; */
749 p.y = NSHeight ([view frame]) - p.y; 747 p.y = NSHeight ([view frame]) - p.y;
750 e = [[view window] currentEvent]; 748 e = [[view window] currentEvent];
751 event = [NSEvent mouseEventWithType: NSRightMouseDown 749 event = [NSEvent mouseEventWithType: NSEventTypeRightMouseDown
752 location: p 750 location: p
753 modifierFlags: 0 751 modifierFlags: 0
754 timestamp: [e timestamp] 752 timestamp: [e timestamp]
@@ -1534,7 +1532,7 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
1534 [img autorelease]; 1532 [img autorelease];
1535 [imgView autorelease]; 1533 [imgView autorelease];
1536 1534
1537 aStyle = NSTitledWindowMask|NSClosableWindowMask|NSUtilityWindowMask; 1535 aStyle = NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSUtilityWindowMask;
1538 flag = YES; 1536 flag = YES;
1539 rows = 0; 1537 rows = 0;
1540 cols = 1; 1538 cols = 1;
@@ -1792,7 +1790,7 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
1792 1790
1793- (void)timeout_handler: (NSTimer *)timedEntry 1791- (void)timeout_handler: (NSTimer *)timedEntry
1794{ 1792{
1795 NSEvent *nxev = [NSEvent otherEventWithType: NSApplicationDefined 1793 NSEvent *nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
1796 location: NSMakePoint (0, 0) 1794 location: NSMakePoint (0, 0)
1797 modifierFlags: 0 1795 modifierFlags: 0
1798 timestamp: 0 1796 timestamp: 0
diff --git a/src/nsterm.h b/src/nsterm.h
index 3d8b1a16a32..c12c791c635 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -39,6 +39,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
39#ifndef MAC_OS_X_VERSION_10_9 39#ifndef MAC_OS_X_VERSION_10_9
40#define MAC_OS_X_VERSION_10_9 1090 40#define MAC_OS_X_VERSION_10_9 1090
41#endif 41#endif
42#ifndef MAC_OS_X_VERSION_10_12
43#define MAC_OS_X_VERSION_10_12 101200
44#endif
42 45
43#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 46#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
44#define HAVE_NATIVE_FS 47#define HAVE_NATIVE_FS
@@ -1233,4 +1236,42 @@ extern char gnustep_base_version[]; /* version tracking */
1233 ? (min) : (((x)>(max)) ? (max) : (x))) 1236 ? (min) : (((x)>(max)) ? (max) : (x)))
1234#define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX)) 1237#define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX))
1235 1238
1239/* macOS 10.12 deprecates a bunch of constants. */
1240#if !defined (NS_IMPL_COCOA) || \
1241 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
1242#define NSEventModifierFlagCommand NSCommandKeyMask
1243#define NSEventModifierFlagControl NSControlKeyMask
1244#define NSEventModifierFlagHelp NSHelpKeyMask
1245#define NSEventModifierFlagNumericPad NSNumericPadKeyMask
1246#define NSEventModifierFlagOption NSAlternateKeyMask
1247#define NSEventModifierFlagShift NSShiftKeyMask
1248#define NSCompositingOperationSourceOver NSCompositeSourceOver
1249#define NSEventMaskApplicationDefined NSApplicationDefinedMask
1250#define NSEventTypeApplicationDefined NSApplicationDefined
1251#define NSEventTypeCursorUpdate NSCursorUpdate
1252#define NSEventTypeMouseMoved NSMouseMoved
1253#define NSEventTypeLeftMouseDown NSLeftMouseDown
1254#define NSEventTypeRightMouseDown NSRightMouseDown
1255#define NSEventTypeOtherMouseDown NSOtherMouseDown
1256#define NSEventTypeLeftMouseUp NSLeftMouseUp
1257#define NSEventTypeRightMouseUp NSRightMouseUp
1258#define NSEventTypeOtherMouseUp NSOtherMouseUp
1259#define NSEventTypeLeftMouseDragged NSLeftMouseDragged
1260#define NSEventTypeRightMouseDragged NSRightMouseDragged
1261#define NSEventTypeOtherMouseDragged NSOtherMouseDragged
1262#define NSEventTypeScrollWheel NSScrollWheel
1263#define NSEventTypeKeyDown NSKeyDown
1264#define NSEventTypeKeyUp NSKeyUp
1265#define NSEventTypeFlagsChanged NSFlagsChanged
1266#define NSEventMaskAny NSAnyEventMask
1267#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
1268#define NSWindowStyleMaskClosable NSClosableWindowMask
1269#define NSWindowStyleMaskFullScreen NSFullScreenWindowMask
1270#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
1271#define NSWindowStyleMaskResizable NSResizableWindowMask
1272#define NSWindowStyleMaskTitled NSTitledWindowMask
1273#define NSAlertStyleCritical NSCriticalAlertStyle
1274#define NSControlSizeRegular NSRegularControlSize
1275#endif
1276
1236#endif /* HAVE_NS */ 1277#endif /* HAVE_NS */
diff --git a/src/nsterm.m b/src/nsterm.m
index dcc1e87280b..03bb0115509 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -230,22 +230,22 @@ static unsigned convert_ns_to_X_keysym[] =
230 NSNewlineCharacter, 0x0D, 230 NSNewlineCharacter, 0x0D,
231 NSEnterCharacter, 0x8D, 231 NSEnterCharacter, 0x8D,
232 232
233 0x41|NSNumericPadKeyMask, 0xAE, /* KP_Decimal */ 233 0x41|NSEventModifierFlagNumericPad, 0xAE, /* KP_Decimal */
234 0x43|NSNumericPadKeyMask, 0xAA, /* KP_Multiply */ 234 0x43|NSEventModifierFlagNumericPad, 0xAA, /* KP_Multiply */
235 0x45|NSNumericPadKeyMask, 0xAB, /* KP_Add */ 235 0x45|NSEventModifierFlagNumericPad, 0xAB, /* KP_Add */
236 0x4B|NSNumericPadKeyMask, 0xAF, /* KP_Divide */ 236 0x4B|NSEventModifierFlagNumericPad, 0xAF, /* KP_Divide */
237 0x4E|NSNumericPadKeyMask, 0xAD, /* KP_Subtract */ 237 0x4E|NSEventModifierFlagNumericPad, 0xAD, /* KP_Subtract */
238 0x51|NSNumericPadKeyMask, 0xBD, /* KP_Equal */ 238 0x51|NSEventModifierFlagNumericPad, 0xBD, /* KP_Equal */
239 0x52|NSNumericPadKeyMask, 0xB0, /* KP_0 */ 239 0x52|NSEventModifierFlagNumericPad, 0xB0, /* KP_0 */
240 0x53|NSNumericPadKeyMask, 0xB1, /* KP_1 */ 240 0x53|NSEventModifierFlagNumericPad, 0xB1, /* KP_1 */
241 0x54|NSNumericPadKeyMask, 0xB2, /* KP_2 */ 241 0x54|NSEventModifierFlagNumericPad, 0xB2, /* KP_2 */
242 0x55|NSNumericPadKeyMask, 0xB3, /* KP_3 */ 242 0x55|NSEventModifierFlagNumericPad, 0xB3, /* KP_3 */
243 0x56|NSNumericPadKeyMask, 0xB4, /* KP_4 */ 243 0x56|NSEventModifierFlagNumericPad, 0xB4, /* KP_4 */
244 0x57|NSNumericPadKeyMask, 0xB5, /* KP_5 */ 244 0x57|NSEventModifierFlagNumericPad, 0xB5, /* KP_5 */
245 0x58|NSNumericPadKeyMask, 0xB6, /* KP_6 */ 245 0x58|NSEventModifierFlagNumericPad, 0xB6, /* KP_6 */
246 0x59|NSNumericPadKeyMask, 0xB7, /* KP_7 */ 246 0x59|NSEventModifierFlagNumericPad, 0xB7, /* KP_7 */
247 0x5B|NSNumericPadKeyMask, 0xB8, /* KP_8 */ 247 0x5B|NSEventModifierFlagNumericPad, 0xB8, /* KP_8 */
248 0x5C|NSNumericPadKeyMask, 0xB9, /* KP_9 */ 248 0x5C|NSEventModifierFlagNumericPad, 0xB9, /* KP_9 */
249 249
250 0x1B, 0x1B /* escape */ 250 0x1B, 0x1B /* escape */
251}; 251};
@@ -333,28 +333,28 @@ static CGPoint menu_mouse_point;
333 333
334/* Convert modifiers in a NeXTstep event to emacs style modifiers. */ 334/* Convert modifiers in a NeXTstep event to emacs style modifiers. */
335#define NS_FUNCTION_KEY_MASK 0x800000 335#define NS_FUNCTION_KEY_MASK 0x800000
336#define NSLeftControlKeyMask (0x000001 | NSControlKeyMask) 336#define NSLeftControlKeyMask (0x000001 | NSEventModifierFlagControl)
337#define NSRightControlKeyMask (0x002000 | NSControlKeyMask) 337#define NSRightControlKeyMask (0x002000 | NSEventModifierFlagControl)
338#define NSLeftCommandKeyMask (0x000008 | NSCommandKeyMask) 338#define NSLeftCommandKeyMask (0x000008 | NSEventModifierFlagCommand)
339#define NSRightCommandKeyMask (0x000010 | NSCommandKeyMask) 339#define NSRightCommandKeyMask (0x000010 | NSEventModifierFlagCommand)
340#define NSLeftAlternateKeyMask (0x000020 | NSAlternateKeyMask) 340#define NSLeftAlternateKeyMask (0x000020 | NSEventModifierFlagOption)
341#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) 341#define NSRightAlternateKeyMask (0x000040 | NSEventModifierFlagOption)
342#define EV_MODIFIERS2(flags) \ 342#define EV_MODIFIERS2(flags) \
343 (((flags & NSHelpKeyMask) ? \ 343 (((flags & NSEventModifierFlagHelp) ? \
344 hyper_modifier : 0) \ 344 hyper_modifier : 0) \
345 | (!EQ (ns_right_alternate_modifier, Qleft) && \ 345 | (!EQ (ns_right_alternate_modifier, Qleft) && \
346 ((flags & NSRightAlternateKeyMask) \ 346 ((flags & NSRightAlternateKeyMask) \
347 == NSRightAlternateKeyMask) ? \ 347 == NSRightAlternateKeyMask) ? \
348 parse_solitary_modifier (ns_right_alternate_modifier) : 0) \ 348 parse_solitary_modifier (ns_right_alternate_modifier) : 0) \
349 | ((flags & NSAlternateKeyMask) ? \ 349 | ((flags & NSEventModifierFlagOption) ? \
350 parse_solitary_modifier (ns_alternate_modifier) : 0) \ 350 parse_solitary_modifier (ns_alternate_modifier) : 0) \
351 | ((flags & NSShiftKeyMask) ? \ 351 | ((flags & NSEventModifierFlagShift) ? \
352 shift_modifier : 0) \ 352 shift_modifier : 0) \
353 | (!EQ (ns_right_control_modifier, Qleft) && \ 353 | (!EQ (ns_right_control_modifier, Qleft) && \
354 ((flags & NSRightControlKeyMask) \ 354 ((flags & NSRightControlKeyMask) \
355 == NSRightControlKeyMask) ? \ 355 == NSRightControlKeyMask) ? \
356 parse_solitary_modifier (ns_right_control_modifier) : 0) \ 356 parse_solitary_modifier (ns_right_control_modifier) : 0) \
357 | ((flags & NSControlKeyMask) ? \ 357 | ((flags & NSEventModifierFlagControl) ? \
358 parse_solitary_modifier (ns_control_modifier) : 0) \ 358 parse_solitary_modifier (ns_control_modifier) : 0) \
359 | ((flags & NS_FUNCTION_KEY_MASK) ? \ 359 | ((flags & NS_FUNCTION_KEY_MASK) ? \
360 parse_solitary_modifier (ns_function_modifier) : 0) \ 360 parse_solitary_modifier (ns_function_modifier) : 0) \
@@ -362,24 +362,24 @@ static CGPoint menu_mouse_point;
362 ((flags & NSRightCommandKeyMask) \ 362 ((flags & NSRightCommandKeyMask) \
363 == NSRightCommandKeyMask) ? \ 363 == NSRightCommandKeyMask) ? \
364 parse_solitary_modifier (ns_right_command_modifier) : 0) \ 364 parse_solitary_modifier (ns_right_command_modifier) : 0) \
365 | ((flags & NSCommandKeyMask) ? \ 365 | ((flags & NSEventModifierFlagCommand) ? \
366 parse_solitary_modifier (ns_command_modifier):0)) 366 parse_solitary_modifier (ns_command_modifier):0))
367#define EV_MODIFIERS(e) EV_MODIFIERS2 ([e modifierFlags]) 367#define EV_MODIFIERS(e) EV_MODIFIERS2 ([e modifierFlags])
368 368
369#define EV_UDMODIFIERS(e) \ 369#define EV_UDMODIFIERS(e) \
370 ((([e type] == NSLeftMouseDown) ? down_modifier : 0) \ 370 ((([e type] == NSEventTypeLeftMouseDown) ? down_modifier : 0) \
371 | (([e type] == NSRightMouseDown) ? down_modifier : 0) \ 371 | (([e type] == NSEventTypeRightMouseDown) ? down_modifier : 0) \
372 | (([e type] == NSOtherMouseDown) ? down_modifier : 0) \ 372 | (([e type] == NSEventTypeOtherMouseDown) ? down_modifier : 0) \
373 | (([e type] == NSLeftMouseDragged) ? down_modifier : 0) \ 373 | (([e type] == NSEventTypeLeftMouseDragged) ? down_modifier : 0) \
374 | (([e type] == NSRightMouseDragged) ? down_modifier : 0) \ 374 | (([e type] == NSEventTypeRightMouseDragged) ? down_modifier : 0) \
375 | (([e type] == NSOtherMouseDragged) ? down_modifier : 0) \ 375 | (([e type] == NSEventTypeOtherMouseDragged) ? down_modifier : 0) \
376 | (([e type] == NSLeftMouseUp) ? up_modifier : 0) \ 376 | (([e type] == NSEventTypeLeftMouseUp) ? up_modifier : 0) \
377 | (([e type] == NSRightMouseUp) ? up_modifier : 0) \ 377 | (([e type] == NSEventTypeRightMouseUp) ? up_modifier : 0) \
378 | (([e type] == NSOtherMouseUp) ? up_modifier : 0)) 378 | (([e type] == NSEventTypeOtherMouseUp) ? up_modifier : 0))
379 379
380#define EV_BUTTON(e) \ 380#define EV_BUTTON(e) \
381 ((([e type] == NSLeftMouseDown) || ([e type] == NSLeftMouseUp)) ? 0 : \ 381 ((([e type] == NSEventTypeLeftMouseDown) || ([e type] == NSEventTypeLeftMouseUp)) ? 0 : \
382 (([e type] == NSRightMouseDown) || ([e type] == NSRightMouseUp)) ? 2 : \ 382 (([e type] == NSEventTypeRightMouseDown) || ([e type] == NSEventTypeRightMouseUp)) ? 2 : \
383 [e buttonNumber] - 1) 383 [e buttonNumber] - 1)
384 384
385/* Convert the time field to a timestamp in milliseconds. */ 385/* Convert the time field to a timestamp in milliseconds. */
@@ -2787,7 +2787,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
2787 2787
2788 [img drawInRect: r 2788 [img drawInRect: r
2789 fromRect: fromRect 2789 fromRect: fromRect
2790 operation: NSCompositeSourceOver 2790 operation: NSCompositingOperationSourceOver
2791 fraction: 1.0 2791 fraction: 1.0
2792 respectFlipped: YES 2792 respectFlipped: YES
2793 hints: nil]; 2793 hints: nil];
@@ -2795,7 +2795,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
2795 { 2795 {
2796 NSPoint pt = r.origin; 2796 NSPoint pt = r.origin;
2797 pt.y += p->h; 2797 pt.y += p->h;
2798 [img compositeToPoint: pt operation: NSCompositeSourceOver]; 2798 [img compositeToPoint: pt operation: NSCompositingOperationSourceOver];
2799 } 2799 }
2800#endif 2800#endif
2801 } 2801 }
@@ -3482,13 +3482,13 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
3482 s->slice.width, s->slice.height); 3482 s->slice.width, s->slice.height);
3483 [img drawInRect: dr 3483 [img drawInRect: dr
3484 fromRect: ir 3484 fromRect: ir
3485 operation: NSCompositeSourceOver 3485 operation: NSCompositingOperationSourceOver
3486 fraction: 1.0 3486 fraction: 1.0
3487 respectFlipped: YES 3487 respectFlipped: YES
3488 hints: nil]; 3488 hints: nil];
3489#else 3489#else
3490 [img compositeToPoint: NSMakePoint (x, y + s->slice.height) 3490 [img compositeToPoint: NSMakePoint (x, y + s->slice.height)
3491 operation: NSCompositeSourceOver]; 3491 operation: NSCompositingOperationSourceOver];
3492#endif 3492#endif
3493 } 3493 }
3494 3494
@@ -3949,7 +3949,7 @@ ns_send_appdefined (int value)
3949 /* OSX 10.10.1 swallows the AppDefined event we are sending ourselves 3949 /* OSX 10.10.1 swallows the AppDefined event we are sending ourselves
3950 in certain situations (rapid incoming events). 3950 in certain situations (rapid incoming events).
3951 So check if we have one, if not add one. */ 3951 So check if we have one, if not add one. */
3952 NSEvent *appev = [NSApp nextEventMatchingMask:NSApplicationDefinedMask 3952 NSEvent *appev = [NSApp nextEventMatchingMask:NSEventMaskApplicationDefined
3953 untilDate:[NSDate distantPast] 3953 untilDate:[NSDate distantPast]
3954 inMode:NSDefaultRunLoopMode 3954 inMode:NSDefaultRunLoopMode
3955 dequeue:NO]; 3955 dequeue:NO];
@@ -3972,7 +3972,7 @@ ns_send_appdefined (int value)
3972 timed_entry = nil; 3972 timed_entry = nil;
3973 } 3973 }
3974 3974
3975 nxev = [NSEvent otherEventWithType: NSApplicationDefined 3975 nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
3976 location: NSMakePoint (0, 0) 3976 location: NSMakePoint (0, 0)
3977 modifierFlags: 0 3977 modifierFlags: 0
3978 timestamp: 0 3978 timestamp: 0
@@ -4994,7 +4994,7 @@ ns_term_init (Lisp_Object display_name)
4994 action: @selector (hideOtherApplications:) 4994 action: @selector (hideOtherApplications:)
4995 keyEquivalent: @"h" 4995 keyEquivalent: @"h"
4996 atIndex: 7]; 4996 atIndex: 7];
4997 [item setKeyEquivalentModifierMask: NSCommandKeyMask | NSAlternateKeyMask]; 4997 [item setKeyEquivalentModifierMask: NSEventModifierFlagCommand | NSEventModifierFlagOption];
4998 [appMenu insertItem: [NSMenuItem separatorItem] atIndex: 8]; 4998 [appMenu insertItem: [NSMenuItem separatorItem] atIndex: 8];
4999 [appMenu insertItemWithTitle: @"Quit Emacs" 4999 [appMenu insertItemWithTitle: @"Quit Emacs"
5000 action: @selector (terminate:) 5000 action: @selector (terminate:)
@@ -5138,7 +5138,7 @@ ns_term_shutdown (int sig)
5138 pool = [[NSAutoreleasePool alloc] init]; 5138 pool = [[NSAutoreleasePool alloc] init];
5139 5139
5140 NSEvent *event = 5140 NSEvent *event =
5141 [self nextEventMatchingMask:NSAnyEventMask 5141 [self nextEventMatchingMask:NSEventMaskAny
5142 untilDate:[NSDate distantFuture] 5142 untilDate:[NSDate distantFuture]
5143 inMode:NSDefaultRunLoopMode 5143 inMode:NSDefaultRunLoopMode
5144 dequeue:YES]; 5144 dequeue:YES];
@@ -5187,7 +5187,7 @@ ns_term_shutdown (int sig)
5187#ifdef NS_IMPL_GNUSTEP 5187#ifdef NS_IMPL_GNUSTEP
5188 // Keyboard events aren't propagated to file dialogs for some reason. 5188 // Keyboard events aren't propagated to file dialogs for some reason.
5189 if ([NSApp modalWindow] != nil && 5189 if ([NSApp modalWindow] != nil &&
5190 (type == NSKeyDown || type == NSKeyUp || type == NSFlagsChanged)) 5190 (type == NSEventTypeKeyDown || type == NSEventTypeKeyUp || type == NSEventTypeFlagsChanged))
5191 { 5191 {
5192 [[NSApp modalWindow] sendEvent: theEvent]; 5192 [[NSApp modalWindow] sendEvent: theEvent];
5193 return; 5193 return;
@@ -5211,7 +5211,7 @@ ns_term_shutdown (int sig)
5211 represented_frame = NULL; 5211 represented_frame = NULL;
5212 } 5212 }
5213 5213
5214 if (type == NSApplicationDefined) 5214 if (type == NSEventTypeApplicationDefined)
5215 { 5215 {
5216 switch ([theEvent data2]) 5216 switch ([theEvent data2])
5217 { 5217 {
@@ -5228,13 +5228,13 @@ ns_term_shutdown (int sig)
5228 } 5228 }
5229 } 5229 }
5230 5230
5231 if (type == NSCursorUpdate && window == nil) 5231 if (type == NSEventTypeCursorUpdate && window == nil)
5232 { 5232 {
5233 fprintf (stderr, "Dropping external cursor update event.\n"); 5233 fprintf (stderr, "Dropping external cursor update event.\n");
5234 return; 5234 return;
5235 } 5235 }
5236 5236
5237 if (type == NSApplicationDefined) 5237 if (type == NSEventTypeApplicationDefined)
5238 { 5238 {
5239 /* Events posted by ns_send_appdefined interrupt the run loop here. 5239 /* Events posted by ns_send_appdefined interrupt the run loop here.
5240 But, if a modal window is up, an appdefined can still come through, 5240 But, if a modal window is up, an appdefined can still come through,
@@ -5257,7 +5257,7 @@ ns_term_shutdown (int sig)
5257 It is a mouse move in an auxiliary menu, i.e. on the top right on OSX, 5257 It is a mouse move in an auxiliary menu, i.e. on the top right on OSX,
5258 such as Wifi, sound, date or similar. 5258 such as Wifi, sound, date or similar.
5259 This prevents "spooky" highlighting in the frame under the menu. */ 5259 This prevents "spooky" highlighting in the frame under the menu. */
5260 if (type == NSMouseMoved && [NSApp modalWindow] == nil) 5260 if (type == NSEventTypeMouseMoved && [NSApp modalWindow] == nil)
5261 { 5261 {
5262 struct ns_display_info *di; 5262 struct ns_display_info *di;
5263 BOOL has_focus = NO; 5263 BOOL has_focus = NO;
@@ -5412,7 +5412,7 @@ runAlertPanel(NSString *title,
5412 == NSAlertDefaultReturn; 5412 == NSAlertDefaultReturn;
5413#else 5413#else
5414 NSAlert *alert = [[NSAlert alloc] init]; 5414 NSAlert *alert = [[NSAlert alloc] init];
5415 [alert setAlertStyle: NSCriticalAlertStyle]; 5415 [alert setAlertStyle: NSAlertStyleCritical];
5416 [alert setMessageText: msgFormat]; 5416 [alert setMessageText: msgFormat];
5417 [alert addButtonWithTitle: defaultButton]; 5417 [alert addButtonWithTitle: defaultButton];
5418 [alert addButtonWithTitle: alternateButton]; 5418 [alert addButtonWithTitle: alternateButton];
@@ -5796,7 +5796,7 @@ not_in_argv (NSString *arg)
5796 /* Rhapsody and OS X give up and down events for the arrow keys */ 5796 /* Rhapsody and OS X give up and down events for the arrow keys */
5797 if (ns_fake_keydown == YES) 5797 if (ns_fake_keydown == YES)
5798 ns_fake_keydown = NO; 5798 ns_fake_keydown = NO;
5799 else if ([theEvent type] != NSKeyDown) 5799 else if ([theEvent type] != NSEventTypeKeyDown)
5800 return; 5800 return;
5801 5801
5802 if (!emacs_event) 5802 if (!emacs_event)
@@ -5840,12 +5840,12 @@ not_in_argv (NSString *arg)
5840 /* (Carbon way: [theEvent keyCode]) */ 5840 /* (Carbon way: [theEvent keyCode]) */
5841 5841
5842 /* is it a "function key"? */ 5842 /* is it a "function key"? */
5843 /* Note: Sometimes a plain key will have the NSNumericPadKeyMask 5843 /* Note: Sometimes a plain key will have the NSEventModifierFlagNumericPad
5844 flag set (this is probably a bug in the OS). 5844 flag set (this is probably a bug in the OS).
5845 */ 5845 */
5846 if (code < 0x00ff && (flags&NSNumericPadKeyMask)) 5846 if (code < 0x00ff && (flags&NSEventModifierFlagNumericPad))
5847 { 5847 {
5848 fnKeysym = ns_convert_key ([theEvent keyCode] | NSNumericPadKeyMask); 5848 fnKeysym = ns_convert_key ([theEvent keyCode] | NSEventModifierFlagNumericPad);
5849 } 5849 }
5850 if (fnKeysym == 0) 5850 if (fnKeysym == 0)
5851 { 5851 {
@@ -5874,15 +5874,15 @@ not_in_argv (NSString *arg)
5874 /* are there modifiers? */ 5874 /* are there modifiers? */
5875 emacs_event->modifiers = 0; 5875 emacs_event->modifiers = 0;
5876 5876
5877 if (flags & NSHelpKeyMask) 5877 if (flags & NSEventModifierFlagHelp)
5878 emacs_event->modifiers |= hyper_modifier; 5878 emacs_event->modifiers |= hyper_modifier;
5879 5879
5880 if (flags & NSShiftKeyMask) 5880 if (flags & NSEventModifierFlagShift)
5881 emacs_event->modifiers |= shift_modifier; 5881 emacs_event->modifiers |= shift_modifier;
5882 5882
5883 is_right_key = (flags & NSRightCommandKeyMask) == NSRightCommandKeyMask; 5883 is_right_key = (flags & NSRightCommandKeyMask) == NSRightCommandKeyMask;
5884 is_left_key = (flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask 5884 is_left_key = (flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask
5885 || (! is_right_key && (flags & NSCommandKeyMask) == NSCommandKeyMask); 5885 || (! is_right_key && (flags & NSEventModifierFlagCommand) == NSEventModifierFlagCommand);
5886 5886
5887 if (is_right_key) 5887 if (is_right_key)
5888 emacs_event->modifiers |= parse_solitary_modifier 5888 emacs_event->modifiers |= parse_solitary_modifier
@@ -5903,7 +5903,7 @@ not_in_argv (NSString *arg)
5903 { 5903 {
5904 /* XXX: the code we get will be unshifted, so if we have 5904 /* XXX: the code we get will be unshifted, so if we have
5905 a shift modifier, must convert ourselves */ 5905 a shift modifier, must convert ourselves */
5906 if (!(flags & NSShiftKeyMask)) 5906 if (!(flags & NSEventModifierFlagShift))
5907 code = [[theEvent characters] characterAtIndex: 0]; 5907 code = [[theEvent characters] characterAtIndex: 0];
5908#if 0 5908#if 0
5909 /* this is ugly and also requires linking w/Carbon framework 5909 /* this is ugly and also requires linking w/Carbon framework
@@ -5918,7 +5918,7 @@ not_in_argv (NSString *arg)
5918 UCKeyTranslate ((UCKeyboardLayout*)*uchrHandle, 5918 UCKeyTranslate ((UCKeyboardLayout*)*uchrHandle,
5919 [[theEvent characters] characterAtIndex: 0], 5919 [[theEvent characters] characterAtIndex: 0],
5920 kUCKeyActionDisplay, 5920 kUCKeyActionDisplay,
5921 (flags & ~NSCommandKeyMask) >> 8, 5921 (flags & ~NSEventModifierFlagCommand) >> 8,
5922 LMGetKbdType (), kUCKeyTranslateNoDeadKeysMask, 5922 LMGetKbdType (), kUCKeyTranslateNoDeadKeysMask,
5923 &dummy, 1, &dummy, &code); 5923 &dummy, 1, &dummy, &code);
5924 code &= 0xFF; 5924 code &= 0xFF;
@@ -5929,7 +5929,7 @@ not_in_argv (NSString *arg)
5929 5929
5930 is_right_key = (flags & NSRightControlKeyMask) == NSRightControlKeyMask; 5930 is_right_key = (flags & NSRightControlKeyMask) == NSRightControlKeyMask;
5931 is_left_key = (flags & NSLeftControlKeyMask) == NSLeftControlKeyMask 5931 is_left_key = (flags & NSLeftControlKeyMask) == NSLeftControlKeyMask
5932 || (! is_right_key && (flags & NSControlKeyMask) == NSControlKeyMask); 5932 || (! is_right_key && (flags & NSEventModifierFlagControl) == NSEventModifierFlagControl);
5933 5933
5934 if (is_right_key) 5934 if (is_right_key)
5935 emacs_event->modifiers |= parse_solitary_modifier 5935 emacs_event->modifiers |= parse_solitary_modifier
@@ -5952,7 +5952,7 @@ not_in_argv (NSString *arg)
5952 == NSRightAlternateKeyMask; 5952 == NSRightAlternateKeyMask;
5953 is_left_key = (flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask 5953 is_left_key = (flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask
5954 || (! is_right_key 5954 || (! is_right_key
5955 && (flags & NSAlternateKeyMask) == NSAlternateKeyMask); 5955 && (flags & NSEventModifierFlagOption) == NSEventModifierFlagOption);
5956 5956
5957 if (is_right_key) 5957 if (is_right_key)
5958 { 5958 {
@@ -6040,7 +6040,7 @@ not_in_argv (NSString *arg)
6040 NSTRACE ("[EmacsView keyUp:]"); 6040 NSTRACE ("[EmacsView keyUp:]");
6041 6041
6042 if (floor (NSAppKitVersionNumber) <= 824 /*NSAppKitVersionNumber10_4*/ && 6042 if (floor (NSAppKitVersionNumber) <= 824 /*NSAppKitVersionNumber10_4*/ &&
6043 code == 0x30 && (flags & NSControlKeyMask) && !(flags & NSCommandKeyMask)) 6043 code == 0x30 && (flags & NSEventModifierFlagControl) && !(flags & NSEventModifierFlagCommand))
6044 { 6044 {
6045 if (NS_KEYLOG) 6045 if (NS_KEYLOG)
6046 fprintf (stderr, "keyUp: passed test"); 6046 fprintf (stderr, "keyUp: passed test");
@@ -6293,7 +6293,7 @@ not_in_argv (NSString *arg)
6293 button clicks */ 6293 button clicks */
6294 emacsframe->mouse_moved = 0; 6294 emacsframe->mouse_moved = 0;
6295 6295
6296 if ([theEvent type] == NSScrollWheel) 6296 if ([theEvent type] == NSEventTypeScrollWheel)
6297 { 6297 {
6298 CGFloat delta = [theEvent deltaY]; 6298 CGFloat delta = [theEvent deltaY];
6299 /* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */ 6299 /* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */
@@ -6848,12 +6848,12 @@ not_in_argv (NSString *arg)
6848 6848
6849 win = [[EmacsWindow alloc] 6849 win = [[EmacsWindow alloc]
6850 initWithContentRect: r 6850 initWithContentRect: r
6851 styleMask: (NSResizableWindowMask | 6851 styleMask: (NSWindowStyleMaskResizable |
6852#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 6852#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
6853 NSTitledWindowMask | 6853 NSWindowStyleMaskTitled |
6854#endif 6854#endif
6855 NSMiniaturizableWindowMask | 6855 NSWindowStyleMaskMiniaturizable |
6856 NSClosableWindowMask) 6856 NSWindowStyleMaskClosable)
6857 backing: NSBackingStoreBuffered 6857 backing: NSBackingStoreBuffered
6858 defer: YES]; 6858 defer: YES];
6859 6859
@@ -7276,7 +7276,7 @@ not_in_argv (NSString *arg)
7276 else 7276 else
7277 { 7277 {
7278#ifdef HAVE_NATIVE_FS 7278#ifdef HAVE_NATIVE_FS
7279 res = (([[self window] styleMask] & NSFullScreenWindowMask) != 0); 7279 res = (([[self window] styleMask] & NSWindowStyleMaskFullScreen) != 0);
7280#else 7280#else
7281 res = NO; 7281 res = NO;
7282#endif 7282#endif
@@ -7360,7 +7360,7 @@ not_in_argv (NSString *arg)
7360 7360
7361 fw = [[EmacsFSWindow alloc] 7361 fw = [[EmacsFSWindow alloc]
7362 initWithContentRect:[w contentRectForFrameRect:wr] 7362 initWithContentRect:[w contentRectForFrameRect:wr]
7363 styleMask:NSBorderlessWindowMask 7363 styleMask:NSWindowStyleMaskBorderless
7364 backing:NSBackingStoreBuffered 7364 backing:NSBackingStoreBuffered
7365 defer:YES 7365 defer:YES
7366 screen:screen]; 7366 screen:screen];
@@ -7668,11 +7668,11 @@ not_in_argv (NSString *arg)
7668 (op & 0xf) != 0xf) 7668 (op & 0xf) != 0xf)
7669 { 7669 {
7670 if (op & NSDragOperationLink) 7670 if (op & NSDragOperationLink)
7671 modifiers |= NSControlKeyMask; 7671 modifiers |= NSEventModifierFlagControl;
7672 if (op & NSDragOperationCopy) 7672 if (op & NSDragOperationCopy)
7673 modifiers |= NSAlternateKeyMask; 7673 modifiers |= NSEventModifierFlagOption;
7674 if (op & NSDragOperationGeneric) 7674 if (op & NSDragOperationGeneric)
7675 modifiers |= NSCommandKeyMask; 7675 modifiers |= NSEventModifierFlagCommand;
7676 } 7676 }
7677 7677
7678 modifiers = EV_MODIFIERS2 (modifiers); 7678 modifiers = EV_MODIFIERS2 (modifiers);
@@ -8121,7 +8121,7 @@ not_in_argv (NSString *arg)
8121 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 8121 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
8122 r = [NSScroller scrollerWidth]; 8122 r = [NSScroller scrollerWidth];
8123#else 8123#else
8124 r = [NSScroller scrollerWidthForControlSize: NSRegularControlSize 8124 r = [NSScroller scrollerWidthForControlSize: NSControlSizeRegular
8125 scrollerStyle: NSScrollerStyleLegacy]; 8125 scrollerStyle: NSScrollerStyleLegacy];
8126#endif 8126#endif
8127 return r; 8127 return r;
@@ -8467,7 +8467,7 @@ not_in_argv (NSString *arg)
8467 pos = loc; 8467 pos = loc;
8468 8468
8469 /* send a fake mouse-up to super to preempt modal -trackKnob: mode */ 8469 /* send a fake mouse-up to super to preempt modal -trackKnob: mode */
8470 fake_event = [NSEvent mouseEventWithType: NSLeftMouseUp 8470 fake_event = [NSEvent mouseEventWithType: NSEventTypeLeftMouseUp
8471 location: [e locationInWindow] 8471 location: [e locationInWindow]
8472 modifierFlags: [e modifierFlags] 8472 modifierFlags: [e modifierFlags]
8473 timestamp: [e timestamp] 8473 timestamp: [e timestamp]