Merge pull request #9745 from libretro/kivutar/osxmake

Fix building with make on OSX
This commit is contained in:
Twinaphex 2019-11-19 07:12:07 +01:00 committed by GitHub
commit 15b6da2a17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 50 deletions

View File

@ -48,6 +48,8 @@
#include "../common/metal_common.h"
#endif
#include "../../ui/drivers/cocoa/apple_platform.h"
typedef struct cocoa_ctx_data
{
bool core_hw_context_enable;
@ -370,7 +372,7 @@ float cocoagl_gfx_ctx_get_native_scale(void)
static void cocoagl_gfx_ctx_update_title(void *data, void *data2)
{
const ui_window_t *window = ui_companion_driver_get_window_ptr();
if (window)
{
char title[128];

View File

@ -0,0 +1,56 @@
#ifndef COCOA_APPLE_PLATFORM_H
#define COCOA_APPLE_PLATFORM_H
#if defined(HAVE_COCOA_METAL)
#import <Metal/Metal.h>
#import <MetalKit/MetalKit.h>
@interface WindowListener : NSResponder <NSWindowDelegate>
@end
@implementation WindowListener
/* Similarly to SDL, we'll respond to key events by doing nothing so we don't beep.
*/
- (void)flagsChanged:(NSEvent *)event
{
}
- (void)keyDown:(NSEvent *)event
{
}
- (void)keyUp:(NSEvent *)event
{
}
@end
#endif
#if defined(HAVE_COCOA_METAL)
id<ApplePlatform> apple_platform;
@interface RetroArch_OSX : NSObject <ApplePlatform, NSApplicationDelegate>
{
NSWindow *_window;
apple_view_type_t _vt;
NSView *_renderView;
id _sleepActivity;
WindowListener *_listener;
}
#elif defined(HAVE_COCOA)
id apple_platform;
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
@interface RetroArch_OSX : NSObject
#else
@interface RetroArch_OSX : NSObject <NSApplicationDelegate>
#endif
{
NSWindow *_window;
}
#endif
@property(nonatomic, retain) NSWindow IBOutlet *window;
@end
#endif

View File

@ -40,54 +40,7 @@
#include "../../tasks/tasks_internal.h"
#include ".././verbosity.h"
#if defined(HAVE_COCOA_METAL)
#import <Metal/Metal.h>
#import <MetalKit/MetalKit.h>
@interface WindowListener : NSResponder<NSWindowDelegate>
@end
@implementation WindowListener
/* Similarly to SDL, we'll respond to key events by doing nothing so we don't beep.
*/
- (void)flagsChanged:(NSEvent *)event
{}
- (void)keyDown:(NSEvent *)event
{}
- (void)keyUp:(NSEvent *)event
{}
@end
#endif
#if defined(HAVE_COCOA_METAL)
id<ApplePlatform> apple_platform;
@interface RetroArch_OSX : NSObject <ApplePlatform, NSApplicationDelegate>
{
NSWindow* _window;
apple_view_type_t _vt;
NSView* _renderView;
id _sleepActivity;
WindowListener *_listener;
}
#elif defined(HAVE_COCOA)
id apple_platform;
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
@interface RetroArch_OSX : NSObject
#else
@interface RetroArch_OSX : NSObject <NSApplicationDelegate>
#endif
{
NSWindow* _window;
}
#endif
@property (nonatomic, retain) NSWindow IBOutlet* window;
@end
#include "cocoa/apple_platform.h"
static void app_terminate(void)
{
@ -175,7 +128,7 @@ static void app_terminate(void)
apple = (cocoa_input_data_t*)input_driver_get_data();
if (!apple)
return;
pos.x = 0;
pos.y = 0;