Move WindowListener around

This commit is contained in:
Jean-André Santoni 2019-11-19 12:00:24 +07:00
parent c7ce2c7053
commit 947e15f34f
No known key found for this signature in database
GPG Key ID: 9D694E373914CC36
2 changed files with 34 additions and 31 deletions

View File

@ -1,15 +1,41 @@
#ifndef COCOA_APPLE_PLATFORM_H #ifndef COCOA_APPLE_PLATFORM_H
#define 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) #if defined(HAVE_COCOA_METAL)
id<ApplePlatform> apple_platform; id<ApplePlatform> apple_platform;
@interface RetroArch_OSX : NSObject <ApplePlatform, NSApplicationDelegate> @interface RetroArch_OSX : NSObject <ApplePlatform, NSApplicationDelegate>
{ {
NSWindow* _window; NSWindow *_window;
apple_view_type_t _vt; apple_view_type_t _vt;
NSView* _renderView; NSView *_renderView;
id _sleepActivity; id _sleepActivity;
WindowListener *_listener; WindowListener *_listener;
} }
#elif defined(HAVE_COCOA) #elif defined(HAVE_COCOA)
id apple_platform; id apple_platform;
@ -19,11 +45,11 @@ id apple_platform;
@interface RetroArch_OSX : NSObject <NSApplicationDelegate> @interface RetroArch_OSX : NSObject <NSApplicationDelegate>
#endif #endif
{ {
NSWindow* _window; NSWindow *_window;
} }
#endif #endif
@property (nonatomic, retain) NSWindow IBOutlet* window; @property(nonatomic, retain) NSWindow IBOutlet *window;
@end @end

View File

@ -40,29 +40,6 @@
#include "../../tasks/tasks_internal.h" #include "../../tasks/tasks_internal.h"
#include ".././verbosity.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
#include "cocoa/apple_platform.h" #include "cocoa/apple_platform.h"
static void app_terminate(void) static void app_terminate(void)
@ -151,7 +128,7 @@ static void app_terminate(void)
apple = (cocoa_input_data_t*)input_driver_get_data(); apple = (cocoa_input_data_t*)input_driver_get_data();
if (!apple) if (!apple)
return; return;
pos.x = 0; pos.x = 0;
pos.y = 0; pos.y = 0;