Merge pull request #7545 from libretro/sgc-metal-cleanup

Metal cleanup and scissor support; enable ozone menu system
This commit is contained in:
Twinaphex 2018-11-06 16:02:47 +01:00 committed by GitHub
commit 1193eda5d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 109 additions and 162 deletions

View File

@ -292,6 +292,12 @@ static void frontend_darwin_get_os(char *s, size_t len, int *major, int *minor)
get_ios_version(major, minor);
strlcpy(s, "iOS", len);
#elif defined(OSX)
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 // MAC_OS_X_VERSION_10_13
NSOperatingSystemVersion version = NSProcessInfo.processInfo.operatingSystemVersion;
*major = (int)version.majorVersion;
*minor = (int)version.minorVersion;
#else
if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)])
{
typedef struct
@ -309,6 +315,7 @@ static void frontend_darwin_get_os(char *s, size_t len, int *major, int *minor)
Gestalt(gestaltSystemVersionMinor, (SInt32*)minor);
Gestalt(gestaltSystemVersionMajor, (SInt32*)major);
}
#endif
strlcpy(s, "OSX", len);
#endif
}

View File

@ -61,6 +61,9 @@ typedef struct
/*! @brief resets the viewport for the main render encoder to the drawable size */
- (void)resetRenderViewport;
/*! @brief resets the scissor rect for the main render encoder to the drawable size */
- (void)resetScissorRect;
/*! @brief draws a quad at the specified position (normalized coordinates) using the main render encoder */
- (void)drawQuadX:(float)x y:(float)y w:(float)w h:(float)h
r:(float)r g:(float)g b:(float)b a:(float)a;

View File

@ -565,6 +565,17 @@
[self.rce setViewport:vp];
}
- (void)resetScissorRect
{
MTLScissorRect sr = {
.x = 0,
.y = 0,
.width = _viewport.full_width,
.height = _viewport.full_height,
};
[self.rce setScissorRect:sr];
}
- (void)drawQuadX:(float)x y:(float)y w:(float)w h:(float)h
r:(float)r g:(float)g b:(float)b a:(float)a
{

View File

@ -14,6 +14,8 @@
- (instancetype)initWithContext:(Context *)context;
- (void)drawPipeline:(menu_display_ctx_draw_t *)draw video:(video_frame_info_t *)video;
- (void)draw:(menu_display_ctx_draw_t *)draw video:(video_frame_info_t *)video;
- (void)setScissorRect:(MTLScissorRect)rect;
- (void)clearScissorRect;
#pragma mark - static methods

View File

@ -14,8 +14,10 @@
{
Context *_context;
MTLClearColor _clearColor;
bool _clearNextRender;
MTLScissorRect _scissorRect;
BOOL _useScissorRect;
Uniforms _uniforms;
bool _clearNextRender;
}
- (instancetype)initWithContext:(Context *)context
@ -25,6 +27,7 @@
_context = context;
_clearColor = MTLClearColorMake(0.0, 0.0, 0.0, 1.0);
_uniforms.projectionMatrix = matrix_proj_ortho(0, 1, 0, 1);
_useScissorRect = NO;
}
return self;
}
@ -73,6 +76,19 @@
return _clearColor;
}
- (void)setScissorRect:(MTLScissorRect)rect
{
_scissorRect = rect;
_useScissorRect = YES;
}
- (void)clearScissorRect
{
_useScissorRect = NO;
[_context resetScissorRect];
}
- (MTLPrimitiveType)_toPrimitiveType:(enum menu_display_prim_type)prim
{
switch (prim)
@ -181,6 +197,10 @@
};
[rce setViewport:vp];
if (_useScissorRect) {
[rce setScissorRect:_scissorRect];
}
switch (draw->pipeline.id)
{
#if HAVE_SHADERPIPELINE

View File

@ -86,20 +86,16 @@
_frame = frame;
// update vertices
CGPoint o = frame.origin;
CGSize s = frame.size;
float l = o.x;
float t = o.y;
float r = o.x + s.width;
float b = o.y + s.height;
float l = (float)CGRectGetMinX(frame);
float t = (float)CGRectGetMinY(frame);
float r = (float)CGRectGetMaxX(frame);
float b = (float)CGRectGetMaxY(frame);
Vertex v[4] = {
{{l, b, 0}, {0, 1}},
{{r, b, 0}, {1, 1}},
{{l, t, 0}, {0, 0}},
{{r, t, 0}, {1, 0}},
{simd_make_float3(l, b, 0), simd_make_float2(0, 1)},
{simd_make_float3(r, b, 0), simd_make_float2(1, 1)},
{simd_make_float3(l, t, 0), simd_make_float2(0, 0)},
{simd_make_float3(r, t, 0), simd_make_float2(1, 0)},
};
memcpy(_v, v, sizeof(_v));
}

View File

@ -3152,6 +3152,9 @@ static void ozone_toggle(void *userdata, bool menu_on)
{
bool tmp = false;
ozone_handle_t *ozone = (ozone_handle_t*) userdata;
if (!ozone)
return;
if (!menu_on)
{
menu_display_ctx_clearcolor_t clearcolor;

View File

@ -88,6 +88,25 @@ static void menu_display_metal_viewport(menu_display_ctx_draw_t *draw,
{
}
static void menu_display_metal_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height)
{
MetalDriver *md = GET_DRIVER(video_info);
if (!md)
return;
MTLScissorRect r = {.x = (NSUInteger)x, .y = (NSUInteger)y, .width = width, .height = height};
[md.display setScissorRect:r];
}
static void menu_display_metal_scissor_end(video_frame_info_t *video_info)
{
MetalDriver *md = GET_DRIVER(video_info);
if (!md)
return;
[md.display clearScissorRect];
}
static void menu_display_metal_restore_clear_color(void)
{
// nothing to do
@ -135,7 +154,7 @@ menu_display_ctx_driver_t menu_display_ctx_metal = {
.type = MENU_VIDEO_DRIVER_METAL,
.ident = "menu_display_metal",
.handles_transform = NO,
.scissor_begin = NULL,
.scissor_end = NULL
.scissor_begin = menu_display_metal_scissor_begin,
.scissor_end = menu_display_metal_scissor_end
};

View File

@ -4,7 +4,7 @@
//
// Created by Stuart Carnie on 5/10/18.
//
OTHER_CFLAGS = $(inherited) -DHAVE_RUNAHEAD -DHAVE_GRIFFIN -DHAVE_FLAC -DHAVE_DR_FLAC -DHAVE_DR_MP3 -DHAVE_LROUND -DFLAC__HAS_OGG=0 -DHAVE_CHD -DHAVE_STB_VORBIS -DHAVE_MINIUPNPC -DHAVE_BUILTINMINIUPNPC -DHAVE_UPDATE_ASSETS -DHAVE_LANGEXTRA -DRC_DISABLE_LUA -DHAVE_CHEEVOS -DHAVE_IMAGEVIEWER -DHAVE_IOHIDMANAGER -DHAVE_CORETEXT -DHAVE_RGUI -DHAVE_MENU -DOSX -DHAVE_CC_RESAMPLER -DHAVE_GLSL -DINLINE=inline -D__LIBRETRO__ -DHAVE_COREAUDIO -DHAVE_DYNAMIC -DHAVE_OVERLAY -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_NETWORKGAMEPAD -DHAVE_NETWORKING -DHAVE_NETPLAYDISCOVERY -DRARCH_INTERNAL -DHAVE_THREADS -DHAVE_DYLIB -DHAVE_7ZIP -DHAVE_MATERIALUI -DHAVE_HID -DHAVE_XMB -DHAVE_SEGA -DHAVE_SHADERPIPELINE -DHAVE_MMAP -DHAVE_LIBRETRODB -DHAVE_GETOPT_LONG -DHAVE_METAL -DHAVE_SLANG -DHAVE_GLSLANG -DHAVE_SPIRV_CROSS -DWANT_GLSLANG -DENABLE_HLSL -DGLSLANG_OSINCLUDE_UNIX -DMETAL_DEBUG -DHAVE_OPENGL
OTHER_CFLAGS = $(inherited) -DHAVE_RUNAHEAD -DHAVE_GRIFFIN -DHAVE_FLAC -DHAVE_DR_FLAC -DHAVE_DR_MP3 -DHAVE_LROUND -DFLAC__HAS_OGG=0 -DHAVE_CHD -DHAVE_STB_VORBIS -DHAVE_MINIUPNPC -DHAVE_BUILTINMINIUPNPC -DHAVE_UPDATE_ASSETS -DHAVE_LANGEXTRA -DRC_DISABLE_LUA -DHAVE_CHEEVOS -DHAVE_IMAGEVIEWER -DHAVE_IOHIDMANAGER -DHAVE_CORETEXT -DHAVE_RGUI -DHAVE_MENU -DOSX -DHAVE_CC_RESAMPLER -DHAVE_GLSL -DINLINE=inline -D__LIBRETRO__ -DHAVE_COREAUDIO -DHAVE_DYNAMIC -DHAVE_OVERLAY -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_NETWORKGAMEPAD -DHAVE_NETWORKING -DHAVE_NETPLAYDISCOVERY -DRARCH_INTERNAL -DHAVE_THREADS -DHAVE_DYLIB -DHAVE_7ZIP -DHAVE_MATERIALUI -DHAVE_HID -DHAVE_XMB -DHAVE_SEGA -DHAVE_SHADERPIPELINE -DHAVE_MMAP -DHAVE_LIBRETRODB -DHAVE_GETOPT_LONG -DHAVE_METAL -DHAVE_SLANG -DHAVE_GLSLANG -DHAVE_SPIRV_CROSS -DWANT_GLSLANG -DENABLE_HLSL -DGLSLANG_OSINCLUDE_UNIX -DMETAL_DEBUG -DHAVE_OPENGL -DHAVE_OZONE
SRCBASE = $(SRCROOT)/../..
DEPS_DIR = $(SRCBASE)/deps

View File

@ -513,6 +513,8 @@
05D7753120A55D2700646447 /* BaseConfig.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = BaseConfig.xcconfig; sourceTree = "<group>"; };
05D7753320A5678300646447 /* griffin_cpp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = griffin_cpp.cpp; path = ../../griffin/griffin_cpp.cpp; sourceTree = "<group>"; };
05D7753420A5678400646447 /* griffin_glslang.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = griffin_glslang.cpp; path = ../../griffin/griffin_glslang.cpp; sourceTree = "<group>"; };
05EFAFC22191D64200D27059 /* stripes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stripes.c; sourceTree = "<group>"; };
05EFAFC32191D64200D27059 /* ozone.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ozone.c; sourceTree = "<group>"; };
05F2872F20F2BEEA00632D47 /* task_autodetect.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = task_autodetect.c; sourceTree = "<group>"; };
05F2873020F2BEEA00632D47 /* task_netplay_find_content.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = task_netplay_find_content.c; sourceTree = "<group>"; };
05F2873120F2BEEA00632D47 /* task_netplay_nat_traversal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = task_netplay_nat_traversal.c; sourceTree = "<group>"; };
@ -804,7 +806,9 @@
05A8C53320DB72F000FF7857 /* menu_generic.h */,
05A8C53D20DB72F000FF7857 /* nuklear.c */,
05A8C53E20DB72F000FF7857 /* null.c */,
05EFAFC32191D64200D27059 /* ozone.c */,
05A8C53C20DB72F000FF7857 /* rgui.c */,
05EFAFC22191D64200D27059 /* stripes.c */,
05A8C53220DB72F000FF7857 /* xmb.c */,
05A8C53B20DB72F000FF7857 /* xui.cpp */,
05A8C53F20DB72F000FF7857 /* zarch.c */,

View File

@ -14,8 +14,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __COCOA_COMMON_H
#define __COCOA_COMMON_H
#ifndef __COCOA_COMMON_METAL_H
#define __COCOA_COMMON_METAL_H
#include <Foundation/Foundation.h>

View File

@ -43,7 +43,6 @@
#include "../../../location/location_driver.h"
#include "../../../camera/camera_driver.h"
#ifdef HAVE_METAL
@implementation MetalView
- (void)keyDown:(NSEvent*)theEvent
@ -61,7 +60,6 @@
return YES;
}
@end
#endif
static CocoaView* g_instance;
@ -102,7 +100,7 @@ void *glkitview_init(void);
#if defined(HAVE_COCOA_METAL)
[self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[self registerForDraggedTypes:[NSArray arrayWithObjects:NSColorPboardType, NSFilenamesPboardType, nil]];
[self registerForDraggedTypes:@[NSColorPboardType, NSFilenamesPboardType]];
#elif defined(HAVE_COCOATOUCH)
self.view = (__bridge GLKView*)glkitview_init();

View File

@ -23,10 +23,6 @@
#include "cocoa_common_metal.h"
#include "../../ui_companion_driver.h"
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
#define NSEventMaskAny NSAnyEventMask
#endif
static void* ui_application_cocoa_initialize(void)
{
return NULL;
@ -47,14 +43,7 @@ static void ui_application_cocoa_process_events(void)
NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES];
if (!event)
break;
#if __has_feature(objc_arc)
[NSApp sendEvent: event];
#else
[event retain];
[NSApp sendEvent: event];
[event release];
#endif
}
}

View File

@ -27,31 +27,25 @@
static bool ui_browser_window_cocoa_open(ui_browser_window_state_t *state)
{
NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
NSArray *filetypes = NULL;
if (!string_is_empty(state->filters))
filetypes = [[NSArray alloc] initWithObjects:BOXSTRING(state->filters), BOXSTRING(state->filters_title), nil];
[panel setAllowedFileTypes:filetypes];
#if defined(MAC_OS_X_VERSION_10_6)
[panel setMessage:BOXSTRING(state->title)];
if ([panel runModalForDirectory:BOXSTRING(state->startdir) file:nil] != 1)
return false;
#else
[panel setTitle:NSLocalizedString(BOXSTRING(state->title), BOXSTRING("open panel"))];
[panel setDirectory:BOXSTRING(state->startdir)];
[panel setCanChooseDirectories:NO];
[panel setCanChooseFiles:YES];
[panel setAllowsMultipleSelection:NO];
[panel setTreatsFilePackagesAsDirectories:NO];
NSInteger result = [panel runModal];
if (result != 1)
return false;
#endif
NSURL *url = (NSURL*)panel.URL;
const char *res_path = [url.path UTF8String];
state->result = strdup(res_path);
NSOpenPanel *panel = [NSOpenPanel openPanel];
if (!string_is_empty(state->filters))
{
[panel setAllowedFileTypes:@[BOXSTRING(state->filters), BOXSTRING(state->filters_title)]];
}
panel.title = NSLocalizedString(BOXSTRING(state->title), BOXSTRING("open panel"));
panel.directoryURL = [NSURL fileURLWithPath:BOXSTRING(state->startdir)];
panel.canChooseDirectories = NO;
panel.canChooseFiles = YES;
panel.allowsMultipleSelection = NO;
panel.treatsFilePackagesAsDirectories = NO;
NSModalResponse result = [panel runModal];
if (result != NSModalResponseOK)
return false;
const char *res_path = [panel.URL.path UTF8String];
state->result = strdup(res_path);
return true;
}

View File

@ -25,20 +25,10 @@
#include "../../ui_companion_driver.h"
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
#define NSAlertStyleCritical NSCriticalAlertStyle
#define NSAlertStyleWarning NSWarningAlertStyle
#define NSAlertStyleInformational NSInformationalAlertStyle
#endif
static enum ui_msg_window_response ui_msg_window_cocoa_dialog(ui_msg_window_state *state, enum ui_msg_window_type type)
{
NSInteger response;
#if __has_feature(objc_arc)
NSModalResponse response;
NSAlert *alert = [NSAlert new];
#else
NSAlert* alert = [[NSAlert new] autorelease];
#endif
if (!string_is_empty(state->title))
[alert setMessageText:BOXSTRING(state->title)];
@ -80,19 +70,11 @@ static enum ui_msg_window_response ui_msg_window_cocoa_dialog(ui_msg_window_stat
break;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
[alert beginSheetModalForWindow:(BRIDGE NSWindow *)ui_companion_driver_get_main_window()
completionHandler:^(NSModalResponse returnCode) {
[[NSApplication sharedApplication] stopModalWithCode:returnCode];
}];
response = [alert runModal];
#else
[alert beginSheetModalForWindow:(BRIDGE NSWindow *)ui_companion_driver_get_main_window()
modalDelegate:apple_platform
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
contextInfo:nil];
response = [[NSApplication sharedApplication] runModalForWindow:[alert window]];
#endif
switch (state->buttons)
{

View File

@ -32,12 +32,6 @@ static void* ui_window_cocoa_init(void)
static void ui_window_cocoa_destroy(void *data)
{
#if !__has_feature(objc_arc)
ui_window_cocoa_t *cocoa = (ui_window_cocoa_t*)data;
CocoaView *cocoa_view = (CocoaView*)cocoa->data;
// TODO(sgc): incorrect behavior
[[cocoa_view window] release];
#endif
}
static void ui_window_cocoa_set_focused(void *data)
@ -73,7 +67,7 @@ static void ui_window_cocoa_set_droppable(void *data, bool droppable)
if (droppable)
{
[[cocoa_view window] registerForDraggedTypes:[NSArray arrayWithObjects:NSColorPboardType, NSFilenamesPboardType, nil]];
[[cocoa_view window] registerForDraggedTypes:@[NSPasteboardTypeColor, NSPasteboardTypeFileURL]];
}
else
{
@ -85,9 +79,7 @@ static bool ui_window_cocoa_focused(void *data)
{
ui_window_cocoa_t *cocoa = (ui_window_cocoa_t*)data;
CocoaView *cocoa_view = (BRIDGE CocoaView*)cocoa->data;
if ([[cocoa_view window] isMainWindow] == YES)
return true;
return false;
return cocoa_view.window.isMainWindow;
}
ui_window_t ui_window_cocoa = {

View File

@ -38,12 +38,9 @@
#include "../../tasks/tasks_internal.h"
#include ".././verbosity.h"
#ifdef HAVE_METAL
#import <Metal/Metal.h>
#import <MetalKit/MetalKit.h>
#endif
#if !((defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__))))
@interface WindowListener : NSResponder<NSWindowDelegate>
@end
@ -61,23 +58,16 @@
{}
@end
#endif
id<ApplePlatform> apple_platform;
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
@interface RetroArch_OSX : NSObject <ApplePlatform>
#else
@interface RetroArch_OSX : NSObject <ApplePlatform, NSApplicationDelegate>
#endif
{
NSWindow* _window;
apple_view_type_t _vt;
NSView* _renderView;
id _sleepActivity;
#if !(defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
WindowListener *_listener;
#endif
}
@property (nonatomic, retain) NSWindow IBOutlet* window;
@ -88,42 +78,10 @@ static void app_terminate(void)
{
[[NSApplication sharedApplication] terminate:nil];
}
#ifdef HAVE_METAL
@interface RAWindow : NSWindow
@end
@implementation RAWindow
#else
@interface RApplication : NSApplication
@end
@implementation RApplication
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
#define NSEventTypeKeyDown NSKeyDown
#define NSEventTypeKeyUp NSKeyUp
#define NSEventTypeFlagsChanged NSFlagsChanged
#define NSEventTypeMouseMoved NSMouseMoved
#define NSEventTypeLeftMouseDragged NSLeftMouseDragged
#define NSEventTypeRightMouseDragged NSRightMouseDragged
#define NSEventTypeOtherMouseDragged NSOtherMouseDragged
#define NSEventTypeLeftMouseDown NSLeftMouseDown
#define NSEventTypeRightMouseDown NSRightMouseDown
#define NSEventTypeOtherMouseDown NSOtherMouseDown
#define NSEventTypeLeftMouseUp NSLeftMouseUp
#define NSEventTypeRightMouseUp NSRightMouseUp
#define NSEventTypeOtherMouseUp NSOtherMouseUp
#define NSEventTypeScrollWheel NSScrollWheel
// modifier flags
#define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask
#define NSEventModifierFlagShift NSShiftKeyMask
#define NSEventModifierFlagControl NSControlKeyMask
#define NSEventModifierFlagOption NSAlternateKeyMask
#define NSEventModifierFlagCommand NSCommandKeyMask
#define NSEventModifierFlagNumericPad NSNumericPadKeyMask
#endif
- (void)sendEvent:(NSEvent *)event {
[super sendEvent:event];
@ -246,39 +204,19 @@ static char** waiting_argv;
@synthesize window = _window;
#if !__has_feature(objc_arc)
- (void)dealloc
{
[_window release];
[super dealloc];
}
#endif
#define NS_WINDOW_COLLECTION_BEHAVIOR_FULLSCREEN_PRIMARY (1 << 17)
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
unsigned i;
apple_platform = self;
SEL selector = NSSelectorFromString(BOXSTRING("setCollectionBehavior:"));
SEL fsselector = NSSelectorFromString(BOXSTRING("toggleFullScreen:"));
if ([self.window respondsToSelector:selector])
{
if ([self.window respondsToSelector:fsselector])
[self.window setCollectionBehavior:NS_WINDOW_COLLECTION_BEHAVIOR_FULLSCREEN_PRIMARY];
}
self.window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary;
#if !(defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
_listener = [WindowListener new];
#endif
[self.window setAcceptsMouseMovedEvents: YES];
#if !(defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
[self.window setNextResponder:_listener];
self.window.delegate = _listener;
#endif
[[self.window contentView] setAutoresizesSubviews:YES];
@ -324,14 +262,12 @@ static char** waiting_argv;
switch (vt) {
case APPLE_VIEW_TYPE_VULKAN:
case APPLE_VIEW_TYPE_METAL:
#if defined(HAVE_METAL) || defined(HAVE_VULKAN)
{
MetalView *v = [MetalView new];
v.paused = YES;
v.enableSetNeedsDisplay = NO;
_renderView = v;
}
#endif
break;
case APPLE_VIEW_TYPE_OPENGL:
@ -349,9 +285,7 @@ static char** waiting_argv;
[_renderView setFrame: [[self.window contentView] bounds]];
self.window.contentView = _renderView;
#if !(defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
[self.window.contentView setNextResponder:_listener];
#endif
self.window.contentView.nextResponder = _listener;
}
- (apple_view_type_t)viewType {
@ -367,8 +301,7 @@ static char** waiting_argv;
}
- (void)setVideoMode:(gfx_ctx_mode_t)mode {
#ifdef HAVE_METAL
BOOL isFullScreen = (self.window.styleMask & NSFullScreenWindowMask) == NSFullScreenWindowMask;
BOOL isFullScreen = (self.window.styleMask & NSWindowStyleMaskFullScreen) == NSWindowStyleMaskFullScreen;
if (mode.fullscreen && !isFullScreen)
{
[self.window toggleFullScreen:self];
@ -386,7 +319,6 @@ static char** waiting_argv;
[self.window setContentSize:NSMakeSize(mode.width-1, mode.height)];
}
[self.window setContentSize:NSMakeSize(mode.width, mode.height)];
#endif
}
- (void)setCursorVisible:(bool)v {
@ -398,7 +330,6 @@ static char** waiting_argv;
- (bool)setDisableDisplaySleep:(bool)disable
{
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
if (disable && _sleepActivity == nil)
{
_sleepActivity = [NSProcessInfo.processInfo beginActivityWithOptions:NSActivityIdleDisplaySleepDisabled reason:@"disable screen saver"];
@ -409,10 +340,6 @@ static char** waiting_argv;
_sleepActivity = nil;
}
return YES;
#else
return NO;
#endif
}