diff -pNur qemu-5.2.0-orig/ui/cocoa.m qemu-5.2.0/ui/cocoa.m
--- qemu-5.2.0-orig/ui/cocoa.m	2021-01-27 22:21:06.000000000 +0100
+++ qemu-5.2.0/ui/cocoa.m	2021-01-27 22:28:33.000000000 +0100
@@ -418,7 +418,7 @@ QemuCocoaView *cocoaView;
     COCOA_DEBUG("QemuCocoaView: drawRect\n");
 
     // get CoreGraphic context
-    CGContextRef viewContextRef = [[NSGraphicsContext currentContext] CGContext];
+    CGContextRef viewContextRef = [[NSGraphicsContext currentContext] graphicsPort];
 
     CGContextSetInterpolationQuality (viewContextRef, kCGInterpolationNone);
     CGContextSetShouldAntialias (viewContextRef, NO);
@@ -585,7 +585,7 @@ QemuCocoaView *cocoaView;
         } else {
             [NSMenu setMenuBarVisible:NO];
             fullScreenWindow = [[NSWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame]
-                styleMask:NSWindowStyleMaskBorderless
+                styleMask:NSBorderlessWindowMask
                 backing:NSBackingStoreBuffered
                 defer:NO];
             [fullScreenWindow setAcceptsMouseMovedEvents: YES];
@@ -620,7 +620,7 @@ QemuCocoaView *cocoaView;
     int control_key = 0;
 
     // if the control key is down
-    if ([event modifierFlags] & NSEventModifierFlagControl) {
+    if ([event modifierFlags] & NSControlKeyMask) {
         control_key = 1;
     }
 
@@ -706,7 +706,7 @@ QemuCocoaView *cocoaView;
     NSPoint p = [self screenLocationOfEvent:event];
 
     switch ([event type]) {
-        case NSEventTypeFlagsChanged:
+        case NSFlagsChangedMask:
             if ([event keyCode] == 0) {
                 // When the Cocoa keyCode is zero that means keys should be
                 // synthesized based on the values in in the eventModifiers
@@ -715,19 +715,19 @@ QemuCocoaView *cocoaView;
                 if (qemu_console_is_graphic(NULL)) {
                     NSUInteger modifiers = [event modifierFlags];
 
-                    if (!!(modifiers & NSEventModifierFlagCapsLock) != !!modifiers_state[Q_KEY_CODE_CAPS_LOCK]) {
+                    if (!!(modifiers & NSAlphaShiftKeyMask) != !!modifiers_state[Q_KEY_CODE_CAPS_LOCK]) {
                         [self toggleStatefulModifier:Q_KEY_CODE_CAPS_LOCK];
                     }
-                    if (!!(modifiers & NSEventModifierFlagShift) != !!modifiers_state[Q_KEY_CODE_SHIFT]) {
+                    if (!!(modifiers & NSShiftKeyMask) != !!modifiers_state[Q_KEY_CODE_SHIFT]) {
                         [self toggleModifier:Q_KEY_CODE_SHIFT];
                     }
-                    if (!!(modifiers & NSEventModifierFlagControl) != !!modifiers_state[Q_KEY_CODE_CTRL]) {
+                    if (!!(modifiers & NSControlKeyMask) != !!modifiers_state[Q_KEY_CODE_CTRL]) {
                         [self toggleModifier:Q_KEY_CODE_CTRL];
                     }
-                    if (!!(modifiers & NSEventModifierFlagOption) != !!modifiers_state[Q_KEY_CODE_ALT]) {
+                    if (!!(modifiers & NSAlternateKeyMask) != !!modifiers_state[Q_KEY_CODE_ALT]) {
                         [self toggleModifier:Q_KEY_CODE_ALT];
                     }
-                    if (!!(modifiers & NSEventModifierFlagCommand) != !!modifiers_state[Q_KEY_CODE_META_L]) {
+                    if (!!(modifiers & NSCommandKeyMask) != !!modifiers_state[Q_KEY_CODE_META_L]) {
                         [self toggleModifier:Q_KEY_CODE_META_L];
                     }
                 }
@@ -756,11 +756,11 @@ QemuCocoaView *cocoaView;
             }
 
             break;
-        case NSEventTypeKeyDown:
+        case NSKeyDownMask:
             keycode = cocoa_keycode_to_qemu([event keyCode]);
 
             // forward command key combos to the host UI unless the mouse is grabbed
-            if (!isMouseGrabbed && ([event modifierFlags] & NSEventModifierFlagCommand)) {
+            if (!isMouseGrabbed && ([event modifierFlags] & NSCommandKeyMask)) {
                 /*
                  * Prevent the command key from being stuck down in the guest
                  * when using Command-F to switch to full screen mode.
@@ -774,7 +774,7 @@ QemuCocoaView *cocoaView;
             // default
 
             // handle control + alt Key Combos (ctrl+alt+[1..9,g] is reserved for QEMU)
-            if (([event modifierFlags] & NSEventModifierFlagControl) && ([event modifierFlags] & NSEventModifierFlagOption)) {
+            if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) {
                 NSString *keychar = [event charactersIgnoringModifiers];
                 if ([keychar length] == 1) {
                     char key = [keychar characterAtIndex:0];
@@ -799,12 +799,12 @@ QemuCocoaView *cocoaView;
                 [self handleMonitorInput: event];
             }
             break;
-        case NSEventTypeKeyUp:
+        case NSKeyUpMask:
             keycode = cocoa_keycode_to_qemu([event keyCode]);
 
             // don't pass the guest a spurious key-up if we treated this
             // command-key combo as a host UI action
-            if (!isMouseGrabbed && ([event modifierFlags] & NSEventModifierFlagCommand)) {
+            if (!isMouseGrabbed && ([event modifierFlags] & NSCommandKeyMask)) {
                 return true;
             }
 
@@ -812,7 +812,7 @@ QemuCocoaView *cocoaView;
                 qemu_input_event_send_key_qcode(dcl->con, keycode, false);
             }
             break;
-        case NSEventTypeMouseMoved:
+        case NSMouseMovedMask:
             if (isAbsoluteEnabled) {
                 // Cursor re-entered into a window might generate events bound to screen coordinates
                 // and `nil` window property, and in full screen mode, current window might not be
@@ -829,39 +829,39 @@ QemuCocoaView *cocoaView;
             }
             mouse_event = true;
             break;
-        case NSEventTypeLeftMouseDown:
-            if ([event modifierFlags] & NSEventModifierFlagCommand) {
+        case NSLeftMouseDownMask:
+            if ([event modifierFlags] & NSCommandKeyMask) {
                 buttons |= MOUSE_EVENT_RBUTTON;
             } else {
                 buttons |= MOUSE_EVENT_LBUTTON;
             }
             mouse_event = true;
             break;
-        case NSEventTypeRightMouseDown:
+        case NSRightMouseDownMask:
             buttons |= MOUSE_EVENT_RBUTTON;
             mouse_event = true;
             break;
-        case NSEventTypeOtherMouseDown:
+        case NSOtherMouseDownMask:
             buttons |= MOUSE_EVENT_MBUTTON;
             mouse_event = true;
             break;
-        case NSEventTypeLeftMouseDragged:
-            if ([event modifierFlags] & NSEventModifierFlagCommand) {
+        case NSLeftMouseDraggedMask:
+            if ([event modifierFlags] & NSCommandKeyMask) {
                 buttons |= MOUSE_EVENT_RBUTTON;
             } else {
                 buttons |= MOUSE_EVENT_LBUTTON;
             }
             mouse_event = true;
             break;
-        case NSEventTypeRightMouseDragged:
+        case NSRightMouseDraggedMask:
             buttons |= MOUSE_EVENT_RBUTTON;
             mouse_event = true;
             break;
-        case NSEventTypeOtherMouseDragged:
+        case NSOtherMouseDraggedMask:
             buttons |= MOUSE_EVENT_MBUTTON;
             mouse_event = true;
             break;
-        case NSEventTypeLeftMouseUp:
+        case NSLeftMouseUpMask:
             mouse_event = true;
             if (!isMouseGrabbed && [self screenContainsPoint:p]) {
                 /*
@@ -874,13 +874,13 @@ QemuCocoaView *cocoaView;
                 }
             }
             break;
-        case NSEventTypeRightMouseUp:
+        case NSRightMouseUpMask:
             mouse_event = true;
             break;
-        case NSEventTypeOtherMouseUp:
+        case NSOtherMouseUpMask:
             mouse_event = true;
             break;
-        case NSEventTypeScrollWheel:
+        case NSScrollWheelMask:
             /*
              * Send wheel events to the guest regardless of window focus.
              * This is in-line with standard Mac OS X UI behaviour.
@@ -1064,7 +1064,7 @@ QemuCocoaView *cocoaView;
 
         // create a window
         normalWindow = [[NSWindow alloc] initWithContentRect:[cocoaView frame]
-            styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskClosable
+            styleMask:NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask
             backing:NSBackingStoreBuffered defer:NO];
         if(!normalWindow) {
             fprintf(stderr, "(cocoa) can't create window\n");
@@ -1370,8 +1370,8 @@ QemuCocoaView *cocoaView;
     int x = 0, y = 0, about_width = 400, about_height = 200;
     NSRect window_rect = NSMakeRect(x, y, about_width, about_height);
     about_window = [[NSWindow alloc] initWithContentRect:window_rect
-                    styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
-                    NSWindowStyleMaskMiniaturizable
+                    styleMask:NSTitledWindowMask | NSClosableWindowMask |
+                    NSMiniaturizableWindowMask
                     backing:NSBackingStoreBuffered
                     defer:NO];
     [about_window setTitle: @"About"];
@@ -1410,7 +1410,7 @@ QemuCocoaView *cocoaView;
     [name_label setEditable: NO];
     [name_label setBezeled: NO];
     [name_label setDrawsBackground: NO];
-    [name_label setAlignment: NSTextAlignmentCenter];
+    [name_label setAlignment: NSCenterTextAlignment];
     NSString *qemu_name = [[NSString alloc] initWithCString: gArgv[0]
                                             encoding: NSASCIIStringEncoding];
     qemu_name = [qemu_name lastPathComponent];
@@ -1426,7 +1426,7 @@ QemuCocoaView *cocoaView;
                                                       version_rect];
     [version_label setEditable: NO];
     [version_label setBezeled: NO];
-    [version_label setAlignment: NSTextAlignmentCenter];
+    [version_label setAlignment: NSCenterTextAlignment];
     [version_label setDrawsBackground: NO];
 
     /* Create the version string*/
@@ -1446,7 +1446,7 @@ QemuCocoaView *cocoaView;
     [copyright_label setEditable: NO];
     [copyright_label setBezeled: NO];
     [copyright_label setDrawsBackground: NO];
-    [copyright_label setAlignment: NSTextAlignmentCenter];
+    [copyright_label setAlignment: NSCenterTextAlignment];
     [copyright_label setStringValue: [NSString stringWithFormat: @"%s",
                                      QEMU_COPYRIGHT]];
     [superView addSubview: copyright_label];
@@ -1511,7 +1511,7 @@ static void create_initial_menus(void)
     [menu addItem:[NSMenuItem separatorItem]]; //Separator
     [menu addItemWithTitle:@"Hide QEMU" action:@selector(hide:) keyEquivalent:@"h"]; //Hide QEMU
     menuItem = (NSMenuItem *)[menu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; // Hide Others
-    [menuItem setKeyEquivalentModifierMask:(NSEventModifierFlagOption|NSEventModifierFlagCommand)];
+    [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
     [menu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; // Show All
     [menu addItem:[NSMenuItem separatorItem]]; //Separator
     [menu addItemWithTitle:@"Quit QEMU" action:@selector(terminate:) keyEquivalent:@"q"];
