Commit 53328576 authored by Alan Third's avatar Alan Third

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.
parent 799a8a33
......@@ -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;
......
......@@ -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
......
......@@ -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 */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment