From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: [PATCH] Fix macOS 12 deprecation notices Date: Thu, 18 Aug 2016 20:04:22 +0100 Message-ID: <20160818190422.GA23177@breton.holly.idiocy.org> References: <315BE3C4-D984-470E-A4B4-20C8148FBA5A@play-bow.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1471547124 15934 195.159.176.226 (18 Aug 2016 19:05:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 18 Aug 2016 19:05:24 +0000 (UTC) User-Agent: Mutt/1.6.0 (2016-04-01) Cc: emacs-devel@gnu.org To: Bob Halley Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 18 21:05:19 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baScw-0003ov-Ov for ged-emacs-devel@m.gmane.org; Thu, 18 Aug 2016 21:05:19 +0200 Original-Received: from localhost ([::1]:53996 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baScu-00031y-2q for ged-emacs-devel@m.gmane.org; Thu, 18 Aug 2016 15:05:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baScA-00031p-LQ for emacs-devel@gnu.org; Thu, 18 Aug 2016 15:04:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1baSc7-0006A7-Mu for emacs-devel@gnu.org; Thu, 18 Aug 2016 15:04:30 -0400 Original-Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:32920) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baSc7-00068o-71 for emacs-devel@gnu.org; Thu, 18 Aug 2016 15:04:27 -0400 Original-Received: by mail-wm0-x241.google.com with SMTP id o80so791222wme.0 for ; Thu, 18 Aug 2016 12:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=+3J9/JF63DRfZ4g8P67BtnoOqw+SuIabiobS7EjwUlk=; b=NRcB81PwOP9qQfvv9I3UhtjQNCnOzyI0kz2vjhzRdGcodCrAXD4+O4GGCkpxMuXz7b L3UUJQzsMSgkNJ++otN+uiCtZFhIwX2n0Anw79d2N5s5b5dTTBVlxGLIeL3Yf7iYCOfL G7h2oEwJuWQlIywhKxmFDrBSwYIL4S61VGD37H70XVFUSQPIviUwjGFnd5gQRab/P7Xf IbwkVkf6zM77RZuVPQrayzVtG9RNx3PSXsKlK6g+Qih+Jysy/nIrH2e1Z4E5TV6AKBGK q2ej/DupWKTvC36Y54e7vXqr7QzzW0VlGnlhIsB1tfOTONupfj52B13X9UNSldEg9Eam tOZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=+3J9/JF63DRfZ4g8P67BtnoOqw+SuIabiobS7EjwUlk=; b=JaMiHJpBE5enrbLPILhi58eTHFgX7GvVyAfqM8ew0RVeNFA5xOgPaP1+WVTg8TCHCi 0FRwT4VwRQOEE3do/Qdz+fXFmykaFmA7suNe2ocRihLG65+IlQBN1QyvQ5Wupj+/odm3 5czjhbkkHJBuEL+OzWQiuYgPmr1h/6ms5rY6Ariq0k0iX5CkbXBDgqsML5/GZvIXMJHA gL425PhlW0Zu3sPCc+R5+PhNrfvITqX6D/OHRiYJ8DZ7jn+0p0vFdRFawtJgEXi2XYsk Kb1E/kLhEVpmhTbIwLggNZ+q59cnqe8/BI8X1ERJfpm4egE/uX+QkArC+uuz2JUjoRl0 AkfQ== X-Gm-Message-State: AEkoouswM62J2lzSrQAgCSy7ovnKq+sGpyhr0HZ1s06OxKpV1gJA0vTgZlsdLjNI4RmSUw== X-Received: by 10.194.144.114 with SMTP id sl18mr3301472wjb.123.1471547065494; Thu, 18 Aug 2016 12:04:25 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-d04f-2f44-9b6a-2f12.holly.idiocy.org. [2001:8b0:3f8:8129:d04f:2f44:9b6a:2f12]) by smtp.gmail.com with ESMTPSA id a194sm825420wmd.24.2016.08.18.12.04.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Aug 2016 12:04:24 -0700 (PDT) Content-Disposition: inline In-Reply-To: <315BE3C4-D984-470E-A4B4-20C8148FBA5A@play-bow.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206652 Archived-At: * 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. * src/nsterm.m: Replace old constant names with new. * src/nsfns.m: Replace old constant names with new. --- src/nsfns.m | 12 ++--- src/nsmenu.m | 10 ++-- src/nsterm.h | 41 ++++++++++++++++ src/nsterm.m | 152 +++++++++++++++++++++++++++++------------------------------ 4 files changed, 127 insertions(+), 88 deletions(-) diff --git a/src/nsfns.m b/src/nsfns.m index 051e509..4566b7e 100644 --- a/src/nsfns.m +++ b/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; diff --git a/src/nsmenu.m b/src/nsmenu.m index d1f4b02..ea9f790 100644 --- a/src/nsmenu.m +++ b/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 diff --git a/src/nsterm.h b/src/nsterm.h index 3d8b1a1..c12c791 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -39,6 +39,9 @@ along with GNU Emacs. If not, see . */ #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 */ diff --git a/src/nsterm.m b/src/nsterm.m index dcc1e87..03bb011 100644 --- a/src/nsterm.m +++ b/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 ) 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] -- Hi Bob, can you test this removes most of the deprecation notices? There should still be some from macfont.m. -- Alan Third