From 41b61ee6d500f58c981c9321642b5610f1cc8cfb Mon Sep 17 00:00:00 2001 From: jcm <6864788+jcm93@users.noreply.github.com> Date: Sun, 5 Jan 2025 01:21:39 -0800 Subject: [PATCH] hiro: Fix various warnings and deprecations in Cocoa (#1748) * Fix a bunch of miscellaneous name deprecations * Fix deprecated modal file handling patterns; use the `URL` properties rather than the ones for paths * Remove the Gatekeeper bypass menu item * While the idea here was quaint, it's very dated, the approach doesn't work at all on modern macOS (and would be a significant exploit surface if it did), and the functionality is somewhat outside the scope of the ares application in the first place. It won't remove Gatekeeper restrictions on ares itself, since if we're using the menu item, we've already made it past Gatekeeper. Functionality to disable Gatekeeper in general for other applications is, again, maybe nice in an abstract way, but well outside our scope. * Suppress OpenGL symbol resolver deprecation warnings * Fix protocol warnings in `CocoaMenu` that revealed a mistaken design pattern: * We had both a protocol and an interface called `CocoaMenu`, and our Cocoa hiro menu subclasses were declaring that they adopted the `CocoaMenu` protocol, rather than what was almost certainly intended, to be subclasses of `CocoaMenu` which would itself conform to the protocol by virtue of being an `NSMenuItem`. * In effect, this meant that each CocoaMenu subclass interface was telling the compiler it wanted to reimplement the `NSObject` protocol rather than be an `NSObject` subclass. This may have resulted in various typical properties of `NSObject`s not being present, and various methods (such as Accessibility) entirely not working. --- hiro/cocoa/action/action.hpp | 2 +- hiro/cocoa/action/menu-check-item.hpp | 2 +- hiro/cocoa/action/menu-item.hpp | 2 +- hiro/cocoa/action/menu-protocol.hpp | 2 +- hiro/cocoa/action/menu-radio-item.hpp | 2 +- hiro/cocoa/action/menu-separator.cpp | 2 +- hiro/cocoa/action/menu.hpp | 2 +- hiro/cocoa/application.cpp | 6 +- hiro/cocoa/browser-window.cpp | 30 ++++----- hiro/cocoa/message-window.cpp | 8 +-- hiro/cocoa/widget/horizontal-scroll-bar.cpp | 4 +- hiro/cocoa/widget/tab-frame.cpp | 2 +- hiro/cocoa/widget/table-view.cpp | 10 +-- hiro/cocoa/widget/vertical-scroll-bar.cpp | 4 +- hiro/cocoa/widget/viewport.cpp | 2 +- hiro/cocoa/window.cpp | 74 +++------------------ hiro/cocoa/window.hpp | 1 - ruby/video/opengl/main.hpp | 3 + 18 files changed, 53 insertions(+), 105 deletions(-) diff --git a/hiro/cocoa/action/action.hpp b/hiro/cocoa/action/action.hpp index ace5179793..4fbda11666 100644 --- a/hiro/cocoa/action/action.hpp +++ b/hiro/cocoa/action/action.hpp @@ -8,7 +8,7 @@ struct pAction : pObject { auto setEnabled(bool enabled) -> void override; auto setVisible(bool visible) -> void override; - NSMenuItem* cocoaAction = nullptr; + NSMenuItem* cocoaAction = nullptr; }; } diff --git a/hiro/cocoa/action/menu-check-item.hpp b/hiro/cocoa/action/menu-check-item.hpp index ae6fe3b456..0c8b45bd81 100644 --- a/hiro/cocoa/action/menu-check-item.hpp +++ b/hiro/cocoa/action/menu-check-item.hpp @@ -1,6 +1,6 @@ #if defined(Hiro_MenuCheckItem) -@interface CocoaMenuCheckItem : NSMenuItem { +@interface CocoaMenuCheckItem : CocoaMenu { @public hiro::mMenuCheckItem* menuCheckItem; } diff --git a/hiro/cocoa/action/menu-item.hpp b/hiro/cocoa/action/menu-item.hpp index 266f85a7b0..4ea7af0b10 100644 --- a/hiro/cocoa/action/menu-item.hpp +++ b/hiro/cocoa/action/menu-item.hpp @@ -1,6 +1,6 @@ #if defined(Hiro_MenuItem) -@interface CocoaMenuItem : NSMenuItem { +@interface CocoaMenuItem : CocoaMenu { @public hiro::mMenuItem* menuItem; } diff --git a/hiro/cocoa/action/menu-protocol.hpp b/hiro/cocoa/action/menu-protocol.hpp index 744b69623f..9feef3ed7e 100644 --- a/hiro/cocoa/action/menu-protocol.hpp +++ b/hiro/cocoa/action/menu-protocol.hpp @@ -1,3 +1,3 @@ -@protocol CocoaMenu +@protocol CocoaMenuProtocol -(NSMenu*) cocoaMenu; @end diff --git a/hiro/cocoa/action/menu-radio-item.hpp b/hiro/cocoa/action/menu-radio-item.hpp index 13e5be5d07..3d8c391deb 100644 --- a/hiro/cocoa/action/menu-radio-item.hpp +++ b/hiro/cocoa/action/menu-radio-item.hpp @@ -1,6 +1,6 @@ #if defined(Hiro_MenuRadioItem) -@interface CocoaMenuRadioItem : NSMenuItem { +@interface CocoaMenuRadioItem : CocoaMenu { @public hiro::mMenuRadioItem* menuRadioItem; } diff --git a/hiro/cocoa/action/menu-separator.cpp b/hiro/cocoa/action/menu-separator.cpp index a4d57cb02a..4b0e5d5a20 100644 --- a/hiro/cocoa/action/menu-separator.cpp +++ b/hiro/cocoa/action/menu-separator.cpp @@ -4,7 +4,7 @@ namespace hiro { auto pMenuSeparator::construct() -> void { cocoaSeparator = [NSMenuItem separatorItem]; - cocoaAction = (NSMenuItem *)cocoaSeparator; + cocoaAction = (NSMenuItem *)cocoaSeparator; pAction::construct(); } diff --git a/hiro/cocoa/action/menu.hpp b/hiro/cocoa/action/menu.hpp index 700a836fe0..091feb168c 100644 --- a/hiro/cocoa/action/menu.hpp +++ b/hiro/cocoa/action/menu.hpp @@ -1,6 +1,6 @@ #if defined(Hiro_Menu) -@interface CocoaMenu : NSMenuItem { +@interface CocoaMenu : NSMenuItem { @public hiro::mMenu* menu; NSMenu* cocoaMenu; diff --git a/hiro/cocoa/application.cpp b/hiro/cocoa/application.cpp index eded2af193..b796ca4d59 100644 --- a/hiro/cocoa/application.cpp +++ b/hiro/cocoa/application.cpp @@ -64,7 +64,7 @@ auto pApplication::run() -> void { auto pApplication::pendingEvents() -> bool { bool result = false; @autoreleasepool { - NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:NO]; + NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:NO]; if(event != nil) result = true; } return result; @@ -73,7 +73,7 @@ auto pApplication::pendingEvents() -> bool { auto pApplication::processEvents() -> void { @autoreleasepool { while(!Application::state().quit) { - NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES]; + NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES]; if(event == nil) break; [NSApp sendEvent:event]; } @@ -84,7 +84,7 @@ auto pApplication::quit() -> void { @autoreleasepool { [applicationTimer invalidate]; [NSApp stop:nil]; - NSEvent* event = [NSEvent otherEventWithType:NSApplicationDefined location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0.0 windowNumber:0 context:nil subtype:0 data1:0 data2:0]; + NSEvent* event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0.0 windowNumber:0 context:nil subtype:0 data1:0 data2:0]; [NSApp postEvent:event atStart:true]; } } diff --git a/hiro/cocoa/browser-window.cpp b/hiro/cocoa/browser-window.cpp index 32ad591429..8ac606fd05 100644 --- a/hiro/cocoa/browser-window.cpp +++ b/hiro/cocoa/browser-window.cpp @@ -10,11 +10,11 @@ auto pBrowserWindow::directory(BrowserWindow::State& state) -> string { if(state.title) [panel setTitle:[NSString stringWithUTF8String:state.title]]; panel.canChooseDirectories = YES; panel.canChooseFiles = NO; - panel.directory = [NSString stringWithUTF8String:state.path]; - if([panel runModal] == NSOKButton) { - NSArray* names = [panel filenames]; - const char* name = [[names objectAtIndex:0] UTF8String]; - if(name) result = name; + panel.directoryURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:state.path]]; + if([panel runModal] == NSModalResponseOK) { + NSArray* files = [panel URLs]; + const char* path = [[[files objectAtIndex:0] path] UTF8String]; + if(path) result = path; } } @@ -40,13 +40,13 @@ auto pBrowserWindow::open(BrowserWindow::State& state) -> string { panel.canChooseFiles = YES; if([filters count] > 0) panel.allowedFileTypes = filters; panel.allowsOtherFileTypes = NO; - panel.directory = [NSString stringWithUTF8String:state.path]; - if([panel runModal] == NSOKButton) { - NSString* name = panel.filenames.firstObject; + panel.directoryURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:state.path]]; + if([panel runModal] == NSModalResponseOK) { + NSString* path = panel.URLs.firstObject.path; BOOL isDirectory = NO; - [[NSFileManager defaultManager] fileExistsAtPath:name isDirectory:&isDirectory]; - if(isDirectory) name = [name stringByAppendingString:@"/"]; - if(name) result = name.UTF8String; + [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; + if(isDirectory) path = [path stringByAppendingString:@"/"]; + if(path) result = path.UTF8String; } } @@ -69,10 +69,10 @@ auto pBrowserWindow::save(BrowserWindow::State& state) -> string { NSSavePanel* panel = [NSSavePanel savePanel]; if(state.title) [panel setTitle:[NSString stringWithUTF8String:state.title]]; if([filters count] > 0) panel.allowedFileTypes = filters; - panel.directory = [NSString stringWithUTF8String:state.path]; - if([panel runModal] == NSOKButton) { - const char* name = panel.URL.path.UTF8String; - if(name) result = name; + panel.directoryURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:state.path]]; + if([panel runModal] == NSModalResponseOK) { + const char* path = panel.URL.path.UTF8String; + if(path) result = path; } } diff --git a/hiro/cocoa/message-window.cpp b/hiro/cocoa/message-window.cpp index 9f504e67c6..850e0dd51a 100644 --- a/hiro/cocoa/message-window.cpp +++ b/hiro/cocoa/message-window.cpp @@ -30,10 +30,10 @@ auto MessageWindow_dialog(MessageWindow::State& state, MessageWindowType type) - } switch(type) { - case MessageWindowType::Error: [alert setAlertStyle:NSCriticalAlertStyle]; break; - case MessageWindowType::Information: [alert setAlertStyle:NSInformationalAlertStyle]; break; - case MessageWindowType::Question: [alert setAlertStyle:NSInformationalAlertStyle]; break; - case MessageWindowType::Warning: [alert setAlertStyle:NSWarningAlertStyle]; break; + case MessageWindowType::Error: [alert setAlertStyle:NSAlertStyleCritical]; break; + case MessageWindowType::Information: [alert setAlertStyle:NSAlertStyleInformational]; break; + case MessageWindowType::Question: [alert setAlertStyle:NSAlertStyleInformational]; break; + case MessageWindowType::Warning: [alert setAlertStyle:NSAlertStyleWarning]; break; } NSInteger response = [alert runModal]; diff --git a/hiro/cocoa/widget/horizontal-scroll-bar.cpp b/hiro/cocoa/widget/horizontal-scroll-bar.cpp index 77c4b2d76f..28719a4dcd 100644 --- a/hiro/cocoa/widget/horizontal-scroll-bar.cpp +++ b/hiro/cocoa/widget/horizontal-scroll-bar.cpp @@ -9,7 +9,7 @@ [self setTarget:self]; [self setAction:@selector(scroll:)]; - [self setControlSize:NSRegularControlSize]; + [self setControlSize:NSControlSizeRegular]; [self setScrollerStyle:NSScrollerStyleLegacy]; [self setEnabled:YES]; @@ -67,7 +67,7 @@ auto pHorizontalScrollBar::destruct() -> void { } auto pHorizontalScrollBar::minimumSize() const -> Size { - return {32, (s32)[NSScroller scrollerWidthForControlSize:NSRegularControlSize scrollerStyle:NSScrollerStyleLegacy]}; + return {32, (s32)[NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy]}; } auto pHorizontalScrollBar::setLength(u32 length) -> void { diff --git a/hiro/cocoa/widget/tab-frame.cpp b/hiro/cocoa/widget/tab-frame.cpp index 14e7b8854b..f0303b35f6 100644 --- a/hiro/cocoa/widget/tab-frame.cpp +++ b/hiro/cocoa/widget/tab-frame.cpp @@ -52,7 +52,7 @@ [[NSGraphicsContext currentContext] saveGraphicsState]; NSRect targetRect = NSMakeRect(tabRect.origin.x, tabRect.origin.y + 2, iconSize, iconSize); - [image drawInRect:targetRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil]; + [image drawInRect:targetRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; [[NSGraphicsContext currentContext] restoreGraphicsState]; tabRect.origin.x += iconSize + 2; diff --git a/hiro/cocoa/widget/table-view.cpp b/hiro/cocoa/widget/table-view.cpp index b3601e2978..fe95c8670f 100644 --- a/hiro/cocoa/widget/table-view.cpp +++ b/hiro/cocoa/widget/table-view.cpp @@ -203,7 +203,7 @@ tableView = &tableViewReference; buttonCell = [[NSButtonCell alloc] initTextCell:@""]; [buttonCell setButtonType:NSSwitchButton]; - [buttonCell setControlSize:NSSmallControlSize]; + [buttonCell setControlSize:NSControlSizeSmall]; [buttonCell setRefusesFirstResponder:YES]; [buttonCell setTarget:self]; textCell = [[NSTextFieldCell alloc] init]; @@ -236,7 +236,7 @@ NSRect targetRect = NSMakeRect(frame.origin.x + 2, frame.origin.y + (frame.size.height - image.size.height) / 2, image.size.width, image.size.height); NSRect sourceRect = NSMakeRect(0, 0, image.size.width, image.size.height); - [image drawInRect:targetRect fromRect:sourceRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil]; + [image drawInRect:targetRect fromRect:sourceRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; [[NSGraphicsContext currentContext] restoreGraphicsState]; frame.origin.x += image.size.width + 4; frame.size.width -= image.size.width + 4; @@ -276,11 +276,11 @@ //so instead, I have to run a modal loop on events until the mouse button is released -(BOOL) trackMouse:(NSEvent*)event inRect:(NSRect)frame ofView:(NSView*)_view untilMouseUp:(BOOL)flag { NSTableView* view = (NSTableView*)_view; - if([event type] == NSLeftMouseDown) { + if([event type] == NSEventTypeLeftMouseDown) { NSWindow* window = [view window]; NSEvent* nextEvent; - while((nextEvent = [window nextEventMatchingMask:(NSLeftMouseDragged | NSLeftMouseUp)])) { - if([nextEvent type] == NSLeftMouseUp) { + while((nextEvent = [window nextEventMatchingMask:(NSEventTypeLeftMouseDragged | NSEventTypeLeftMouseUp)])) { + if([nextEvent type] == NSEventTypeLeftMouseUp) { NSPoint point = [view convertPoint:[nextEvent locationInWindow] fromView:nil]; NSRect rect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.height, frame.size.height); if(NSMouseInRect(point, rect, [view isFlipped])) { diff --git a/hiro/cocoa/widget/vertical-scroll-bar.cpp b/hiro/cocoa/widget/vertical-scroll-bar.cpp index 64837d9b6b..4776830c0c 100644 --- a/hiro/cocoa/widget/vertical-scroll-bar.cpp +++ b/hiro/cocoa/widget/vertical-scroll-bar.cpp @@ -9,7 +9,7 @@ [self setTarget:self]; [self setAction:@selector(scroll:)]; - [self setControlSize:NSRegularControlSize]; + [self setControlSize:NSControlSizeRegular]; [self setScrollerStyle:NSScrollerStyleLegacy]; [self setEnabled:YES]; @@ -67,7 +67,7 @@ auto pVerticalScrollBar::destruct() -> void { } auto pVerticalScrollBar::minimumSize() const -> Size { - return {(s32)[NSScroller scrollerWidthForControlSize:NSRegularControlSize scrollerStyle:NSScrollerStyleLegacy], 32}; + return {(s32)[NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy], 32}; } auto pVerticalScrollBar::setLength(u32 length) -> void { diff --git a/hiro/cocoa/widget/viewport.cpp b/hiro/cocoa/widget/viewport.cpp index 07681e22ba..0246a864de 100644 --- a/hiro/cocoa/widget/viewport.cpp +++ b/hiro/cocoa/widget/viewport.cpp @@ -18,7 +18,7 @@ -(void) drawRect:(NSRect)rect { [[NSColor blackColor] setFill]; NSRect frame = self.bounds; - NSRectFillUsingOperation(frame, NSCompositeSourceOver); + NSRectFillUsingOperation(frame, NSCompositingOperationSourceOver); } -(BOOL) acceptsFirstResponder { diff --git a/hiro/cocoa/window.cpp b/hiro/cocoa/window.cpp index 264a41ad95..25ad1a51be 100644 --- a/hiro/cocoa/window.cpp +++ b/hiro/cocoa/window.cpp @@ -5,8 +5,8 @@ -(id) initWith:(hiro::mWindow&)windowReference { window = &windowReference; - NSUInteger style = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask; - if(window->state.resizable) style |= NSResizableWindowMask; + NSUInteger style = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable; + if(window->state.resizable) style |= NSWindowStyleMaskResizable; if(self = [super initWithContentRect:NSMakeRect(0, 0, 640, 480) styleMask:style backing:NSBackingStoreBuffered defer:YES]) { [self setDelegate:self]; @@ -37,17 +37,10 @@ item = [[NSMenuItem alloc] initWithTitle:@"Preferences…" action:@selector(menuPreferences) keyEquivalent:@""]; [item setTarget:self]; - item.keyEquivalentModifierMask = NSCommandKeyMask; + item.keyEquivalentModifierMask = NSEventModifierFlagCommand; item.keyEquivalent = @","; [rootMenu addItem:item]; - string result = nall::execute("spctl", "--status").output.strip(); - if(result != "assessments disabled") { - disableGatekeeper = [[NSMenuItem alloc] initWithTitle:@"Disable Gatekeeper" action:@selector(menuDisableGatekeeper) keyEquivalent:@""]; - [disableGatekeeper setTarget:self]; - [rootMenu addItem:disableGatekeeper]; - } - [rootMenu addItem:[NSMenuItem separatorItem]]; NSMenu* servicesMenu = [[NSMenu alloc] initWithTitle:@"Services"]; @@ -60,14 +53,14 @@ item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"Hide %@", applicationName] action:@selector(hide:) keyEquivalent:@""]; [item setTarget:NSApp]; - item.keyEquivalentModifierMask = NSCommandKeyMask; + item.keyEquivalentModifierMask = NSEventModifierFlagCommand; item.keyEquivalent = @"h"; [rootMenu addItem:item]; item = [[NSMenuItem alloc] initWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@""]; [item setTarget:NSApp]; [item setTarget:NSApp]; - item.keyEquivalentModifierMask = NSCommandKeyMask | NSAlternateKeyMask; + item.keyEquivalentModifierMask = NSEventModifierFlagCommand | NSEventModifierFlagOption; item.keyEquivalent = @"h"; [rootMenu addItem:item]; @@ -79,12 +72,12 @@ item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"Quit %@", applicationName] action:@selector(menuQuit) keyEquivalent:@""]; [item setTarget:self]; - item.keyEquivalentModifierMask = NSCommandKeyMask; + item.keyEquivalentModifierMask = NSEventModifierFlagCommand; item.keyEquivalent = @"q"; [rootMenu addItem:item]; statusBar = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)]; - [statusBar setAlignment:NSLeftTextAlignment]; + [statusBar setAlignment:NSTextAlignmentLeft]; [statusBar setBordered:YES]; [statusBar setBezeled:YES]; [statusBar setBezelStyle:NSTextFieldSquareBezel]; @@ -149,53 +142,6 @@ hiro::Application::Cocoa::doPreferences(); } -//to hell with gatekeepers -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wwritable-strings" --(void) menuDisableGatekeeper { - NSAlert* alert = [[NSAlert alloc] init]; - [alert setMessageText:@"Disable Gatekeeper"]; - - AuthorizationRef authorization; - OSStatus status = AuthorizationCreate(nullptr, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &authorization); - if(status == errAuthorizationSuccess) { - AuthorizationItem items = {kAuthorizationRightExecute, 0, nullptr, 0}; - AuthorizationRights rights = {1, &items}; - status = AuthorizationCopyRights(authorization, &rights, nullptr, - kAuthorizationFlagDefaults - | kAuthorizationFlagInteractionAllowed - | kAuthorizationFlagPreAuthorize - | kAuthorizationFlagExtendRights, nullptr); - if(status == errAuthorizationSuccess) { - { char program[] = "/usr/sbin/spctl"; - char* arguments[] = {"--master-disable", nullptr}; - FILE* pipe = nullptr; - AuthorizationExecuteWithPrivileges(authorization, program, kAuthorizationFlagDefaults, arguments, &pipe); - } - { char program[] = "/usr/bin/defaults"; - char* arguments[] = {"write /Library/Preferences/com.apple.security GKAutoRearm -bool NO"}; - FILE* pipe = nullptr; - AuthorizationExecuteWithPrivileges(authorization, program, kAuthorizationFlagDefaults, arguments, &pipe); - } - } - AuthorizationFree(authorization, kAuthorizationFlagDefaults); - } - - string result = nall::execute("spctl", "--status").output.strip(); - if(result == "assessments disabled") { - [alert setAlertStyle:NSInformationalAlertStyle]; - [alert setInformativeText:@"Gatekeeper has been successfully disabled."]; - [disableGatekeeper setHidden:YES]; - } else { - [alert setAlertStyle:NSWarningAlertStyle]; - [alert setInformativeText:@"Error: failed to disable Gatekeeper."]; - } - - [alert addButtonWithTitle:@"Ok"]; - [alert runModal]; -} -#pragma clang diagnostic pop - -(void) menuQuit { hiro::Application::Cocoa::doQuit(); } @@ -360,14 +306,14 @@ auto pWindow::setModal(bool modal) -> void { [NSApp runModalForWindow:cocoaWindow]; } else { [NSApp stopModal]; - NSEvent* event = [NSEvent otherEventWithType:NSApplicationDefined location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0.0 windowNumber:0 context:nil subtype:0 data1:0 data2:0]; + NSEvent* event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0.0 windowNumber:0 context:nil subtype:0 data1:0 data2:0]; [NSApp postEvent:event atStart:true]; } } auto pWindow::setResizable(bool resizable) -> void { - NSUInteger style = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask; - if(resizable) style |= NSResizableWindowMask; + NSUInteger style = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable; + if(resizable) style |= NSWindowStyleMaskResizable; [cocoaWindow setStyleMask:style]; } diff --git a/hiro/cocoa/window.hpp b/hiro/cocoa/window.hpp index 6681043a2b..80d0bca8bb 100644 --- a/hiro/cocoa/window.hpp +++ b/hiro/cocoa/window.hpp @@ -20,7 +20,6 @@ -(NSMenu*) menuBar; -(void) menuAbout; -(void) menuPreferences; --(void) menuDisableGatekeeper; -(void) menuQuit; -(NSTextField*) statusBar; @end diff --git a/ruby/video/opengl/main.hpp b/ruby/video/opengl/main.hpp index 6a4a9abcf2..d2cabf6591 100644 --- a/ruby/video/opengl/main.hpp +++ b/ruby/video/opengl/main.hpp @@ -131,6 +131,8 @@ auto OpenGL::initialize(const string& shader) -> bool { return initialized = true; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" auto OpenGL::resolveSymbol(const char* name) -> const void * { #if defined(PLATFORM_MACOS) NSSymbol symbol; @@ -153,6 +155,7 @@ auto OpenGL::resolveSymbol(const char* name) -> const void * { } #endif #endif +#pragma clang diagnostic pop return symbol; }