macosx: fix Open ROM Image dialog doesn't appear on recent macOS (issue 216)

This commit is contained in:
tmkk 2017-10-29 15:06:37 +09:00
parent c63fda3400
commit d05d0b7d39

View File

@ -213,6 +213,7 @@
#import <wchar.h>
#import <Cocoa/Cocoa.h>
#import <objc/objc-runtime.h>
#import "mac-cocoatools.h"
#import "mac-prefix.h"
@ -293,6 +294,26 @@ static pascal Boolean NavPlayMovieFromPreview (NavCBRecPtr, NavCallBackUserData)
@end
@interface NSView (HICocoaViewDummy)
- (void) setNeedsDisplayOnHICocoaViewDummy;
@end
@implementation NSView (HICocoaViewDummy)
+ (void) initialize
{
/* Add a dummy instance method to make compatible with 10.10 or later */
if (self == [NSView self]) {
SEL sel = @selector(setNeedsDisplayOnHICocoaView);
if (![NSView instancesRespondToSelector:sel]) {
Method m = class_getInstanceMethod([NSView class], @selector(setNeedsDisplayOnHICocoaViewDummy));
IMP imp = method_getImplementation(m);
class_addMethod([NSView class], sel, imp, "v@");
}
}
}
- (void) setNeedsDisplayOnHICocoaViewDummy{}
@end
bool8 NavOpenROMImage (FSRef *ref)
{