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.
This commit is contained in:
parent
799a8a3338
commit
5332857670
4 changed files with 127 additions and 88 deletions
12
src/nsfns.m
12
src/nsfns.m
|
@ -1582,7 +1582,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
|
|||
The file dialog may pop up a confirm dialog after Ok has been pressed,
|
||||
so we can not simply pop down on the Ok/Cancel press.
|
||||
*/
|
||||
nxev = [NSEvent otherEventWithType: NSApplicationDefined
|
||||
nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
|
||||
location: NSMakePoint (0, 0)
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
|
@ -2193,7 +2193,7 @@ and GNUstep implementations ("distributor-specific release
|
|||
errors aren't returned and executeAndReturnError hangs forever.
|
||||
Post an event that runs applescript and then start the event loop.
|
||||
The event loop is exited when the script is done. */
|
||||
nxev = [NSEvent otherEventWithType: NSApplicationDefined
|
||||
nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
|
||||
location: NSMakePoint (0, 0)
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
|
@ -2987,7 +2987,7 @@ value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are
|
|||
int i;
|
||||
BOOL ret = NO;
|
||||
|
||||
if ([theEvent type] != NSKeyDown) return NO;
|
||||
if ([theEvent type] != NSEventTypeKeyDown) return NO;
|
||||
s = [theEvent characters];
|
||||
|
||||
for (i = 0; i < [s length]; ++i)
|
||||
|
@ -3006,7 +3006,7 @@ value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are
|
|||
/* Don't send command modified keys, as those are handled in the
|
||||
performKeyEquivalent method of the super class.
|
||||
*/
|
||||
if (! ([theEvent modifierFlags] & NSCommandKeyMask))
|
||||
if (! ([theEvent modifierFlags] & NSEventModifierFlagCommand))
|
||||
{
|
||||
[panel sendEvent: theEvent];
|
||||
ret = YES;
|
||||
|
@ -3023,7 +3023,7 @@ value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are
|
|||
case 'c': // Copy
|
||||
case 'v': // Paste
|
||||
case 'a': // Select all
|
||||
if ([theEvent modifierFlags] & NSCommandKeyMask)
|
||||
if ([theEvent modifierFlags] & NSEventModifierFlagCommand)
|
||||
{
|
||||
[NSApp sendAction:
|
||||
(ch == 'x'
|
||||
|
@ -3039,7 +3039,7 @@ value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are
|
|||
default:
|
||||
// Send all control keys, as the text field supports C-a, C-f, C-e
|
||||
// C-b and more.
|
||||
if ([theEvent modifierFlags] & NSControlKeyMask)
|
||||
if ([theEvent modifierFlags] & NSEventModifierFlagControl)
|
||||
{
|
||||
[panel sendEvent: theEvent];
|
||||
ret = YES;
|
||||
|
|
10
src/nsmenu.m
10
src/nsmenu.m
|
@ -604,7 +604,7 @@ - (BOOL)performKeyEquivalent: (NSEvent *)theEvent
|
|||
-(NSString *)parseKeyEquiv: (const char *)key
|
||||
{
|
||||
const char *tpos = key;
|
||||
keyEquivModMask = NSCommandKeyMask;
|
||||
keyEquivModMask = NSEventModifierFlagCommand;
|
||||
|
||||
if (!key || !strlen (key))
|
||||
return @"";
|
||||
|
@ -692,7 +692,6 @@ - (void)fillWithWidgetValue: (void *)wvptr frame: (struct frame *)f
|
|||
widget_value *wv = (widget_value *)wvptr;
|
||||
|
||||
/* clear existing contents */
|
||||
[self setMenuChangedMessagesEnabled: NO];
|
||||
[self clear];
|
||||
|
||||
/* add new contents */
|
||||
|
@ -716,7 +715,6 @@ - (void)fillWithWidgetValue: (void *)wvptr frame: (struct frame *)f
|
|||
}
|
||||
}
|
||||
|
||||
[self setMenuChangedMessagesEnabled: YES];
|
||||
#ifdef NS_IMPL_GNUSTEP
|
||||
if ([[self window] isVisible])
|
||||
[self sizeToFit];
|
||||
|
@ -748,7 +746,7 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
|
|||
/* p = [view convertPoint:p fromView: nil]; */
|
||||
p.y = NSHeight ([view frame]) - p.y;
|
||||
e = [[view window] currentEvent];
|
||||
event = [NSEvent mouseEventWithType: NSRightMouseDown
|
||||
event = [NSEvent mouseEventWithType: NSEventTypeRightMouseDown
|
||||
location: p
|
||||
modifierFlags: 0
|
||||
timestamp: [e timestamp]
|
||||
|
@ -1534,7 +1532,7 @@ @implementation EmacsDialogPanel
|
|||
[img autorelease];
|
||||
[imgView autorelease];
|
||||
|
||||
aStyle = NSTitledWindowMask|NSClosableWindowMask|NSUtilityWindowMask;
|
||||
aStyle = NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSUtilityWindowMask;
|
||||
flag = YES;
|
||||
rows = 0;
|
||||
cols = 1;
|
||||
|
@ -1792,7 +1790,7 @@ - (void)clicked: sender
|
|||
|
||||
- (void)timeout_handler: (NSTimer *)timedEntry
|
||||
{
|
||||
NSEvent *nxev = [NSEvent otherEventWithType: NSApplicationDefined
|
||||
NSEvent *nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
|
||||
location: NSMakePoint (0, 0)
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
|
|
41
src/nsterm.h
41
src/nsterm.h
|
@ -39,6 +39,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#ifndef MAC_OS_X_VERSION_10_9
|
||||
#define MAC_OS_X_VERSION_10_9 1090
|
||||
#endif
|
||||
#ifndef MAC_OS_X_VERSION_10_12
|
||||
#define MAC_OS_X_VERSION_10_12 101200
|
||||
#endif
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
#define HAVE_NATIVE_FS
|
||||
|
@ -1233,4 +1236,42 @@ extern char gnustep_base_version[]; /* version tracking */
|
|||
? (min) : (((x)>(max)) ? (max) : (x)))
|
||||
#define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX))
|
||||
|
||||
/* macOS 10.12 deprecates a bunch of constants. */
|
||||
#if !defined (NS_IMPL_COCOA) || \
|
||||
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
|
||||
#define NSEventModifierFlagCommand NSCommandKeyMask
|
||||
#define NSEventModifierFlagControl NSControlKeyMask
|
||||
#define NSEventModifierFlagHelp NSHelpKeyMask
|
||||
#define NSEventModifierFlagNumericPad NSNumericPadKeyMask
|
||||
#define NSEventModifierFlagOption NSAlternateKeyMask
|
||||
#define NSEventModifierFlagShift NSShiftKeyMask
|
||||
#define NSCompositingOperationSourceOver NSCompositeSourceOver
|
||||
#define NSEventMaskApplicationDefined NSApplicationDefinedMask
|
||||
#define NSEventTypeApplicationDefined NSApplicationDefined
|
||||
#define NSEventTypeCursorUpdate NSCursorUpdate
|
||||
#define NSEventTypeMouseMoved NSMouseMoved
|
||||
#define NSEventTypeLeftMouseDown NSLeftMouseDown
|
||||
#define NSEventTypeRightMouseDown NSRightMouseDown
|
||||
#define NSEventTypeOtherMouseDown NSOtherMouseDown
|
||||
#define NSEventTypeLeftMouseUp NSLeftMouseUp
|
||||
#define NSEventTypeRightMouseUp NSRightMouseUp
|
||||
#define NSEventTypeOtherMouseUp NSOtherMouseUp
|
||||
#define NSEventTypeLeftMouseDragged NSLeftMouseDragged
|
||||
#define NSEventTypeRightMouseDragged NSRightMouseDragged
|
||||
#define NSEventTypeOtherMouseDragged NSOtherMouseDragged
|
||||
#define NSEventTypeScrollWheel NSScrollWheel
|
||||
#define NSEventTypeKeyDown NSKeyDown
|
||||
#define NSEventTypeKeyUp NSKeyUp
|
||||
#define NSEventTypeFlagsChanged NSFlagsChanged
|
||||
#define NSEventMaskAny NSAnyEventMask
|
||||
#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
|
||||
#define NSWindowStyleMaskClosable NSClosableWindowMask
|
||||
#define NSWindowStyleMaskFullScreen NSFullScreenWindowMask
|
||||
#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
|
||||
#define NSWindowStyleMaskResizable NSResizableWindowMask
|
||||
#define NSWindowStyleMaskTitled NSTitledWindowMask
|
||||
#define NSAlertStyleCritical NSCriticalAlertStyle
|
||||
#define NSControlSizeRegular NSRegularControlSize
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_NS */
|
||||
|
|
152
src/nsterm.m
152
src/nsterm.m
|
@ -230,22 +230,22 @@ - (NSColor *)colorUsingDefaultColorSpace
|
|||
NSNewlineCharacter, 0x0D,
|
||||
NSEnterCharacter, 0x8D,
|
||||
|
||||
0x41|NSNumericPadKeyMask, 0xAE, /* KP_Decimal */
|
||||
0x43|NSNumericPadKeyMask, 0xAA, /* KP_Multiply */
|
||||
0x45|NSNumericPadKeyMask, 0xAB, /* KP_Add */
|
||||
0x4B|NSNumericPadKeyMask, 0xAF, /* KP_Divide */
|
||||
0x4E|NSNumericPadKeyMask, 0xAD, /* KP_Subtract */
|
||||
0x51|NSNumericPadKeyMask, 0xBD, /* KP_Equal */
|
||||
0x52|NSNumericPadKeyMask, 0xB0, /* KP_0 */
|
||||
0x53|NSNumericPadKeyMask, 0xB1, /* KP_1 */
|
||||
0x54|NSNumericPadKeyMask, 0xB2, /* KP_2 */
|
||||
0x55|NSNumericPadKeyMask, 0xB3, /* KP_3 */
|
||||
0x56|NSNumericPadKeyMask, 0xB4, /* KP_4 */
|
||||
0x57|NSNumericPadKeyMask, 0xB5, /* KP_5 */
|
||||
0x58|NSNumericPadKeyMask, 0xB6, /* KP_6 */
|
||||
0x59|NSNumericPadKeyMask, 0xB7, /* KP_7 */
|
||||
0x5B|NSNumericPadKeyMask, 0xB8, /* KP_8 */
|
||||
0x5C|NSNumericPadKeyMask, 0xB9, /* KP_9 */
|
||||
0x41|NSEventModifierFlagNumericPad, 0xAE, /* KP_Decimal */
|
||||
0x43|NSEventModifierFlagNumericPad, 0xAA, /* KP_Multiply */
|
||||
0x45|NSEventModifierFlagNumericPad, 0xAB, /* KP_Add */
|
||||
0x4B|NSEventModifierFlagNumericPad, 0xAF, /* KP_Divide */
|
||||
0x4E|NSEventModifierFlagNumericPad, 0xAD, /* KP_Subtract */
|
||||
0x51|NSEventModifierFlagNumericPad, 0xBD, /* KP_Equal */
|
||||
0x52|NSEventModifierFlagNumericPad, 0xB0, /* KP_0 */
|
||||
0x53|NSEventModifierFlagNumericPad, 0xB1, /* KP_1 */
|
||||
0x54|NSEventModifierFlagNumericPad, 0xB2, /* KP_2 */
|
||||
0x55|NSEventModifierFlagNumericPad, 0xB3, /* KP_3 */
|
||||
0x56|NSEventModifierFlagNumericPad, 0xB4, /* KP_4 */
|
||||
0x57|NSEventModifierFlagNumericPad, 0xB5, /* KP_5 */
|
||||
0x58|NSEventModifierFlagNumericPad, 0xB6, /* KP_6 */
|
||||
0x59|NSEventModifierFlagNumericPad, 0xB7, /* KP_7 */
|
||||
0x5B|NSEventModifierFlagNumericPad, 0xB8, /* KP_8 */
|
||||
0x5C|NSEventModifierFlagNumericPad, 0xB9, /* KP_9 */
|
||||
|
||||
0x1B, 0x1B /* escape */
|
||||
};
|
||||
|
@ -333,28 +333,28 @@ - (NSColor *)colorUsingDefaultColorSpace
|
|||
|
||||
/* Convert modifiers in a NeXTstep event to emacs style modifiers. */
|
||||
#define NS_FUNCTION_KEY_MASK 0x800000
|
||||
#define NSLeftControlKeyMask (0x000001 | NSControlKeyMask)
|
||||
#define NSRightControlKeyMask (0x002000 | NSControlKeyMask)
|
||||
#define NSLeftCommandKeyMask (0x000008 | NSCommandKeyMask)
|
||||
#define NSRightCommandKeyMask (0x000010 | NSCommandKeyMask)
|
||||
#define NSLeftAlternateKeyMask (0x000020 | NSAlternateKeyMask)
|
||||
#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask)
|
||||
#define NSLeftControlKeyMask (0x000001 | NSEventModifierFlagControl)
|
||||
#define NSRightControlKeyMask (0x002000 | NSEventModifierFlagControl)
|
||||
#define NSLeftCommandKeyMask (0x000008 | NSEventModifierFlagCommand)
|
||||
#define NSRightCommandKeyMask (0x000010 | NSEventModifierFlagCommand)
|
||||
#define NSLeftAlternateKeyMask (0x000020 | NSEventModifierFlagOption)
|
||||
#define NSRightAlternateKeyMask (0x000040 | NSEventModifierFlagOption)
|
||||
#define EV_MODIFIERS2(flags) \
|
||||
(((flags & NSHelpKeyMask) ? \
|
||||
(((flags & NSEventModifierFlagHelp) ? \
|
||||
hyper_modifier : 0) \
|
||||
| (!EQ (ns_right_alternate_modifier, Qleft) && \
|
||||
((flags & NSRightAlternateKeyMask) \
|
||||
== NSRightAlternateKeyMask) ? \
|
||||
parse_solitary_modifier (ns_right_alternate_modifier) : 0) \
|
||||
| ((flags & NSAlternateKeyMask) ? \
|
||||
| ((flags & NSEventModifierFlagOption) ? \
|
||||
parse_solitary_modifier (ns_alternate_modifier) : 0) \
|
||||
| ((flags & NSShiftKeyMask) ? \
|
||||
| ((flags & NSEventModifierFlagShift) ? \
|
||||
shift_modifier : 0) \
|
||||
| (!EQ (ns_right_control_modifier, Qleft) && \
|
||||
((flags & NSRightControlKeyMask) \
|
||||
== NSRightControlKeyMask) ? \
|
||||
parse_solitary_modifier (ns_right_control_modifier) : 0) \
|
||||
| ((flags & NSControlKeyMask) ? \
|
||||
| ((flags & NSEventModifierFlagControl) ? \
|
||||
parse_solitary_modifier (ns_control_modifier) : 0) \
|
||||
| ((flags & NS_FUNCTION_KEY_MASK) ? \
|
||||
parse_solitary_modifier (ns_function_modifier) : 0) \
|
||||
|
@ -362,24 +362,24 @@ - (NSColor *)colorUsingDefaultColorSpace
|
|||
((flags & NSRightCommandKeyMask) \
|
||||
== NSRightCommandKeyMask) ? \
|
||||
parse_solitary_modifier (ns_right_command_modifier) : 0) \
|
||||
| ((flags & NSCommandKeyMask) ? \
|
||||
| ((flags & NSEventModifierFlagCommand) ? \
|
||||
parse_solitary_modifier (ns_command_modifier):0))
|
||||
#define EV_MODIFIERS(e) EV_MODIFIERS2 ([e modifierFlags])
|
||||
|
||||
#define EV_UDMODIFIERS(e) \
|
||||
((([e type] == NSLeftMouseDown) ? down_modifier : 0) \
|
||||
| (([e type] == NSRightMouseDown) ? down_modifier : 0) \
|
||||
| (([e type] == NSOtherMouseDown) ? down_modifier : 0) \
|
||||
| (([e type] == NSLeftMouseDragged) ? down_modifier : 0) \
|
||||
| (([e type] == NSRightMouseDragged) ? down_modifier : 0) \
|
||||
| (([e type] == NSOtherMouseDragged) ? down_modifier : 0) \
|
||||
| (([e type] == NSLeftMouseUp) ? up_modifier : 0) \
|
||||
| (([e type] == NSRightMouseUp) ? up_modifier : 0) \
|
||||
| (([e type] == NSOtherMouseUp) ? up_modifier : 0))
|
||||
((([e type] == NSEventTypeLeftMouseDown) ? down_modifier : 0) \
|
||||
| (([e type] == NSEventTypeRightMouseDown) ? down_modifier : 0) \
|
||||
| (([e type] == NSEventTypeOtherMouseDown) ? down_modifier : 0) \
|
||||
| (([e type] == NSEventTypeLeftMouseDragged) ? down_modifier : 0) \
|
||||
| (([e type] == NSEventTypeRightMouseDragged) ? down_modifier : 0) \
|
||||
| (([e type] == NSEventTypeOtherMouseDragged) ? down_modifier : 0) \
|
||||
| (([e type] == NSEventTypeLeftMouseUp) ? up_modifier : 0) \
|
||||
| (([e type] == NSEventTypeRightMouseUp) ? up_modifier : 0) \
|
||||
| (([e type] == NSEventTypeOtherMouseUp) ? up_modifier : 0))
|
||||
|
||||
#define EV_BUTTON(e) \
|
||||
((([e type] == NSLeftMouseDown) || ([e type] == NSLeftMouseUp)) ? 0 : \
|
||||
(([e type] == NSRightMouseDown) || ([e type] == NSRightMouseUp)) ? 2 : \
|
||||
((([e type] == NSEventTypeLeftMouseDown) || ([e type] == NSEventTypeLeftMouseUp)) ? 0 : \
|
||||
(([e type] == NSEventTypeRightMouseDown) || ([e type] == NSEventTypeRightMouseUp)) ? 2 : \
|
||||
[e buttonNumber] - 1)
|
||||
|
||||
/* Convert the time field to a timestamp in milliseconds. */
|
||||
|
@ -2787,7 +2787,7 @@ static void hide_bell ()
|
|||
|
||||
[img drawInRect: r
|
||||
fromRect: fromRect
|
||||
operation: NSCompositeSourceOver
|
||||
operation: NSCompositingOperationSourceOver
|
||||
fraction: 1.0
|
||||
respectFlipped: YES
|
||||
hints: nil];
|
||||
|
@ -2795,7 +2795,7 @@ static void hide_bell ()
|
|||
{
|
||||
NSPoint pt = r.origin;
|
||||
pt.y += p->h;
|
||||
[img compositeToPoint: pt operation: NSCompositeSourceOver];
|
||||
[img compositeToPoint: pt operation: NSCompositingOperationSourceOver];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -3482,13 +3482,13 @@ Function modeled after x_draw_glyph_string_box ().
|
|||
s->slice.width, s->slice.height);
|
||||
[img drawInRect: dr
|
||||
fromRect: ir
|
||||
operation: NSCompositeSourceOver
|
||||
operation: NSCompositingOperationSourceOver
|
||||
fraction: 1.0
|
||||
respectFlipped: YES
|
||||
hints: nil];
|
||||
#else
|
||||
[img compositeToPoint: NSMakePoint (x, y + s->slice.height)
|
||||
operation: NSCompositeSourceOver];
|
||||
operation: NSCompositingOperationSourceOver];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3949,7 +3949,7 @@ overwriting cursor (usually when cursor on a tab) */
|
|||
/* OSX 10.10.1 swallows the AppDefined event we are sending ourselves
|
||||
in certain situations (rapid incoming events).
|
||||
So check if we have one, if not add one. */
|
||||
NSEvent *appev = [NSApp nextEventMatchingMask:NSApplicationDefinedMask
|
||||
NSEvent *appev = [NSApp nextEventMatchingMask:NSEventMaskApplicationDefined
|
||||
untilDate:[NSDate distantPast]
|
||||
inMode:NSDefaultRunLoopMode
|
||||
dequeue:NO];
|
||||
|
@ -3972,7 +3972,7 @@ in certain situations (rapid incoming events).
|
|||
timed_entry = nil;
|
||||
}
|
||||
|
||||
nxev = [NSEvent otherEventWithType: NSApplicationDefined
|
||||
nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
|
||||
location: NSMakePoint (0, 0)
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
|
@ -4994,7 +4994,7 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes.
|
|||
action: @selector (hideOtherApplications:)
|
||||
keyEquivalent: @"h"
|
||||
atIndex: 7];
|
||||
[item setKeyEquivalentModifierMask: NSCommandKeyMask | NSAlternateKeyMask];
|
||||
[item setKeyEquivalentModifierMask: NSEventModifierFlagCommand | NSEventModifierFlagOption];
|
||||
[appMenu insertItem: [NSMenuItem separatorItem] atIndex: 8];
|
||||
[appMenu insertItemWithTitle: @"Quit Emacs"
|
||||
action: @selector (terminate:)
|
||||
|
@ -5138,7 +5138,7 @@ - (void)run
|
|||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSEvent *event =
|
||||
[self nextEventMatchingMask:NSAnyEventMask
|
||||
[self nextEventMatchingMask:NSEventMaskAny
|
||||
untilDate:[NSDate distantFuture]
|
||||
inMode:NSDefaultRunLoopMode
|
||||
dequeue:YES];
|
||||
|
@ -5187,7 +5187,7 @@ - (void)sendEvent: (NSEvent *)theEvent
|
|||
#ifdef NS_IMPL_GNUSTEP
|
||||
// Keyboard events aren't propagated to file dialogs for some reason.
|
||||
if ([NSApp modalWindow] != nil &&
|
||||
(type == NSKeyDown || type == NSKeyUp || type == NSFlagsChanged))
|
||||
(type == NSEventTypeKeyDown || type == NSEventTypeKeyUp || type == NSEventTypeFlagsChanged))
|
||||
{
|
||||
[[NSApp modalWindow] sendEvent: theEvent];
|
||||
return;
|
||||
|
@ -5211,7 +5211,7 @@ - (void)sendEvent: (NSEvent *)theEvent
|
|||
represented_frame = NULL;
|
||||
}
|
||||
|
||||
if (type == NSApplicationDefined)
|
||||
if (type == NSEventTypeApplicationDefined)
|
||||
{
|
||||
switch ([theEvent data2])
|
||||
{
|
||||
|
@ -5228,13 +5228,13 @@ - (void)sendEvent: (NSEvent *)theEvent
|
|||
}
|
||||
}
|
||||
|
||||
if (type == NSCursorUpdate && window == nil)
|
||||
if (type == NSEventTypeCursorUpdate && window == nil)
|
||||
{
|
||||
fprintf (stderr, "Dropping external cursor update event.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == NSApplicationDefined)
|
||||
if (type == NSEventTypeApplicationDefined)
|
||||
{
|
||||
/* Events posted by ns_send_appdefined interrupt the run loop here.
|
||||
But, if a modal window is up, an appdefined can still come through,
|
||||
|
@ -5257,7 +5257,7 @@ - (void)sendEvent: (NSEvent *)theEvent
|
|||
It is a mouse move in an auxiliary menu, i.e. on the top right on OSX,
|
||||
such as Wifi, sound, date or similar.
|
||||
This prevents "spooky" highlighting in the frame under the menu. */
|
||||
if (type == NSMouseMoved && [NSApp modalWindow] == nil)
|
||||
if (type == NSEventTypeMouseMoved && [NSApp modalWindow] == nil)
|
||||
{
|
||||
struct ns_display_info *di;
|
||||
BOOL has_focus = NO;
|
||||
|
@ -5412,7 +5412,7 @@ - (void) terminate: (id)sender
|
|||
== NSAlertDefaultReturn;
|
||||
#else
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
[alert setAlertStyle: NSCriticalAlertStyle];
|
||||
[alert setAlertStyle: NSAlertStyleCritical];
|
||||
[alert setMessageText: msgFormat];
|
||||
[alert addButtonWithTitle: defaultButton];
|
||||
[alert addButtonWithTitle: alternateButton];
|
||||
|
@ -5796,7 +5796,7 @@ - (void)keyDown: (NSEvent *)theEvent
|
|||
/* Rhapsody and OS X give up and down events for the arrow keys */
|
||||
if (ns_fake_keydown == YES)
|
||||
ns_fake_keydown = NO;
|
||||
else if ([theEvent type] != NSKeyDown)
|
||||
else if ([theEvent type] != NSEventTypeKeyDown)
|
||||
return;
|
||||
|
||||
if (!emacs_event)
|
||||
|
@ -5840,12 +5840,12 @@ most recently updated (I guess), which is not the correct one. */
|
|||
/* (Carbon way: [theEvent keyCode]) */
|
||||
|
||||
/* is it a "function key"? */
|
||||
/* Note: Sometimes a plain key will have the NSNumericPadKeyMask
|
||||
/* Note: Sometimes a plain key will have the NSEventModifierFlagNumericPad
|
||||
flag set (this is probably a bug in the OS).
|
||||
*/
|
||||
if (code < 0x00ff && (flags&NSNumericPadKeyMask))
|
||||
if (code < 0x00ff && (flags&NSEventModifierFlagNumericPad))
|
||||
{
|
||||
fnKeysym = ns_convert_key ([theEvent keyCode] | NSNumericPadKeyMask);
|
||||
fnKeysym = ns_convert_key ([theEvent keyCode] | NSEventModifierFlagNumericPad);
|
||||
}
|
||||
if (fnKeysym == 0)
|
||||
{
|
||||
|
@ -5874,15 +5874,15 @@ flag set (this is probably a bug in the OS).
|
|||
/* are there modifiers? */
|
||||
emacs_event->modifiers = 0;
|
||||
|
||||
if (flags & NSHelpKeyMask)
|
||||
if (flags & NSEventModifierFlagHelp)
|
||||
emacs_event->modifiers |= hyper_modifier;
|
||||
|
||||
if (flags & NSShiftKeyMask)
|
||||
if (flags & NSEventModifierFlagShift)
|
||||
emacs_event->modifiers |= shift_modifier;
|
||||
|
||||
is_right_key = (flags & NSRightCommandKeyMask) == NSRightCommandKeyMask;
|
||||
is_left_key = (flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask
|
||||
|| (! is_right_key && (flags & NSCommandKeyMask) == NSCommandKeyMask);
|
||||
|| (! is_right_key && (flags & NSEventModifierFlagCommand) == NSEventModifierFlagCommand);
|
||||
|
||||
if (is_right_key)
|
||||
emacs_event->modifiers |= parse_solitary_modifier
|
||||
|
@ -5903,7 +5903,7 @@ flag set (this is probably a bug in the OS).
|
|||
{
|
||||
/* XXX: the code we get will be unshifted, so if we have
|
||||
a shift modifier, must convert ourselves */
|
||||
if (!(flags & NSShiftKeyMask))
|
||||
if (!(flags & NSEventModifierFlagShift))
|
||||
code = [[theEvent characters] characterAtIndex: 0];
|
||||
#if 0
|
||||
/* this is ugly and also requires linking w/Carbon framework
|
||||
|
@ -5918,7 +5918,7 @@ flag set (this is probably a bug in the OS).
|
|||
UCKeyTranslate ((UCKeyboardLayout*)*uchrHandle,
|
||||
[[theEvent characters] characterAtIndex: 0],
|
||||
kUCKeyActionDisplay,
|
||||
(flags & ~NSCommandKeyMask) >> 8,
|
||||
(flags & ~NSEventModifierFlagCommand) >> 8,
|
||||
LMGetKbdType (), kUCKeyTranslateNoDeadKeysMask,
|
||||
&dummy, 1, &dummy, &code);
|
||||
code &= 0xFF;
|
||||
|
@ -5929,7 +5929,7 @@ flag set (this is probably a bug in the OS).
|
|||
|
||||
is_right_key = (flags & NSRightControlKeyMask) == NSRightControlKeyMask;
|
||||
is_left_key = (flags & NSLeftControlKeyMask) == NSLeftControlKeyMask
|
||||
|| (! is_right_key && (flags & NSControlKeyMask) == NSControlKeyMask);
|
||||
|| (! is_right_key && (flags & NSEventModifierFlagControl) == NSEventModifierFlagControl);
|
||||
|
||||
if (is_right_key)
|
||||
emacs_event->modifiers |= parse_solitary_modifier
|
||||
|
@ -5952,7 +5952,7 @@ flag set (this is probably a bug in the OS).
|
|||
== NSRightAlternateKeyMask;
|
||||
is_left_key = (flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask
|
||||
|| (! is_right_key
|
||||
&& (flags & NSAlternateKeyMask) == NSAlternateKeyMask);
|
||||
&& (flags & NSEventModifierFlagOption) == NSEventModifierFlagOption);
|
||||
|
||||
if (is_right_key)
|
||||
{
|
||||
|
@ -6040,7 +6040,7 @@ -(void)keyUp: (NSEvent *)theEvent
|
|||
NSTRACE ("[EmacsView keyUp:]");
|
||||
|
||||
if (floor (NSAppKitVersionNumber) <= 824 /*NSAppKitVersionNumber10_4*/ &&
|
||||
code == 0x30 && (flags & NSControlKeyMask) && !(flags & NSCommandKeyMask))
|
||||
code == 0x30 && (flags & NSEventModifierFlagControl) && !(flags & NSEventModifierFlagCommand))
|
||||
{
|
||||
if (NS_KEYLOG)
|
||||
fprintf (stderr, "keyUp: passed test");
|
||||
|
@ -6293,7 +6293,7 @@ - (void)mouseDown: (NSEvent *)theEvent
|
|||
button clicks */
|
||||
emacsframe->mouse_moved = 0;
|
||||
|
||||
if ([theEvent type] == NSScrollWheel)
|
||||
if ([theEvent type] == NSEventTypeScrollWheel)
|
||||
{
|
||||
CGFloat delta = [theEvent deltaY];
|
||||
/* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */
|
||||
|
@ -6848,12 +6848,12 @@ - (BOOL)isOpaque
|
|||
|
||||
win = [[EmacsWindow alloc]
|
||||
initWithContentRect: r
|
||||
styleMask: (NSResizableWindowMask |
|
||||
styleMask: (NSWindowStyleMaskResizable |
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
NSTitledWindowMask |
|
||||
NSWindowStyleMaskTitled |
|
||||
#endif
|
||||
NSMiniaturizableWindowMask |
|
||||
NSClosableWindowMask)
|
||||
NSWindowStyleMaskMiniaturizable |
|
||||
NSWindowStyleMaskClosable)
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: YES];
|
||||
|
||||
|
@ -7276,7 +7276,7 @@ - (BOOL)isFullscreen
|
|||
else
|
||||
{
|
||||
#ifdef HAVE_NATIVE_FS
|
||||
res = (([[self window] styleMask] & NSFullScreenWindowMask) != 0);
|
||||
res = (([[self window] styleMask] & NSWindowStyleMaskFullScreen) != 0);
|
||||
#else
|
||||
res = NO;
|
||||
#endif
|
||||
|
@ -7360,7 +7360,7 @@ - (void)toggleFullScreen: (id)sender
|
|||
|
||||
fw = [[EmacsFSWindow alloc]
|
||||
initWithContentRect:[w contentRectForFrameRect:wr]
|
||||
styleMask:NSBorderlessWindowMask
|
||||
styleMask:NSWindowStyleMaskBorderless
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:YES
|
||||
screen:screen];
|
||||
|
@ -7668,11 +7668,11 @@ -(BOOL)performDragOperation: (id <NSDraggingInfo>) sender
|
|||
(op & 0xf) != 0xf)
|
||||
{
|
||||
if (op & NSDragOperationLink)
|
||||
modifiers |= NSControlKeyMask;
|
||||
modifiers |= NSEventModifierFlagControl;
|
||||
if (op & NSDragOperationCopy)
|
||||
modifiers |= NSAlternateKeyMask;
|
||||
modifiers |= NSEventModifierFlagOption;
|
||||
if (op & NSDragOperationGeneric)
|
||||
modifiers |= NSCommandKeyMask;
|
||||
modifiers |= NSEventModifierFlagCommand;
|
||||
}
|
||||
|
||||
modifiers = EV_MODIFIERS2 (modifiers);
|
||||
|
@ -8121,7 +8121,7 @@ + (CGFloat) scrollerWidth
|
|||
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
|
||||
r = [NSScroller scrollerWidth];
|
||||
#else
|
||||
r = [NSScroller scrollerWidthForControlSize: NSRegularControlSize
|
||||
r = [NSScroller scrollerWidthForControlSize: NSControlSizeRegular
|
||||
scrollerStyle: NSScrollerStyleLegacy];
|
||||
#endif
|
||||
return r;
|
||||
|
@ -8467,7 +8467,7 @@ - (void)mouseDown: (NSEvent *)e
|
|||
pos = loc;
|
||||
|
||||
/* send a fake mouse-up to super to preempt modal -trackKnob: mode */
|
||||
fake_event = [NSEvent mouseEventWithType: NSLeftMouseUp
|
||||
fake_event = [NSEvent mouseEventWithType: NSEventTypeLeftMouseUp
|
||||
location: [e locationInWindow]
|
||||
modifierFlags: [e modifierFlags]
|
||||
timestamp: [e timestamp]
|
||||
|
|
Loading…
Add table
Reference in a new issue