2015-04-05 05:36:53 +02:00
/ * RetroArch - A frontend for libretro .
* Copyright ( C ) 2013 -2014 - Jason Fetters
2017-01-22 13:40:32 +01:00
* Copyright ( C ) 2011 -2017 - Daniel De Matteis
2019-02-03 15:49:35 -08:00
*
2015-04-05 05:36:53 +02:00
* RetroArch is free software : you can redistribute it and / or modify it under the terms
* of the GNU General Public License as published by the Free Software Found -
* ation , either version 3 of the License , or ( at your option ) any later version .
*
* RetroArch is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE . See the GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License along with RetroArch .
* If not , see < http : // www . gnu . org / licenses / > .
* /
# import < AvailabilityMacros . h >
# include < sys / stat . h >
2021-01-22 22:20:38 +01:00
# include < retro_assert . h >
2015-04-20 12:52:16 +02:00
# include "cocoa_common.h"
2021-01-19 04:38:07 +01:00
# include "apple_platform.h"
2016-06-07 16:47:48 +02:00
# include "../ui_cocoa.h"
2016-09-08 11:59:44 +02:00
2021-01-22 22:20:38 +01:00
# ifdef HAVE_COCOATOUCH
# import "../../../pkg/apple/WebServer/GCDWebUploader/GCDWebUploader.h"
# import "WebServer.h"
# endif
2016-09-08 11:59:44 +02:00
2021-01-18 21:21:17 +01:00
# include "../../../configuration.h"
# include "../../../retroarch.h"
2016-06-08 07:41:59 +02:00
# include "../../../verbosity.h"
2015-04-05 05:36:53 +02:00
2021-01-18 19:17:12 +01:00
static CocoaView * g_instance ;
2019-11-20 06:25:40 +01:00
# ifdef HAVE_COCOATOUCH
2021-01-18 03:03:35 +01:00
void * glkitview_init ( void ) ;
2019-01-26 13:18:32 -10:00
@ interface CocoaView ( ) < GCDWebUploaderDelegate > {
2019-11-20 06:25:40 +01:00
2019-01-26 13:18:32 -10:00
}
@ end
# endif
2015-04-20 20:39:39 +02:00
@ implementation CocoaView
2016-10-05 02:00:11 +02:00
2021-01-24 03:53:10 +01:00
# if ! defined ( HAVE_COCOATOUCH )
2020-12-28 07:52:08 +01:00
# ifdef HAVE_COCOA _METAL
2020-09-15 19:48:43 +02:00
- ( BOOL ) layer : ( CALayer * ) layer shouldInheritContentsScale : ( CGFloat ) newScale fromWindow : ( NSWindow * ) window { return YES ; }
2019-02-09 21:10:28 +01:00
# endif
2020-09-15 20:50:20 +02:00
- ( void ) scrollWheel : ( NSEvent * ) theEvent { }
2016-10-05 02:00:11 +02:00
# endif
2015-04-20 20:39:39 +02:00
+ ( CocoaView * ) get
2015-04-05 05:36:53 +02:00
{
2019-09-22 11:19:54 +02:00
CocoaView * view = ( BRIDGE CocoaView * ) nsview_get _ptr ( ) ;
if ( ! view )
{
2019-11-20 06:25:40 +01:00
view = [ CocoaView new ] ;
nsview_set _ptr ( view ) ;
2019-09-22 11:19:54 +02:00
}
return view ;
2015-04-05 05:36:53 +02:00
}
- ( id ) init
{
self = [ super init ] ;
2019-02-03 15:49:35 -08:00
2021-01-24 03:53:10 +01:00
# if defined ( HAVE_COCOATOUCH )
2020-07-07 08:19:46 -10:00
# if defined ( HAVE_COCOA _METAL )
2020-09-16 10:09:03 +02:00
self . view = [ UIView new ] ;
2020-07-07 08:19:46 -10:00
# else
2020-09-16 10:09:03 +02:00
self . view = ( BRIDGE GLKView * ) glkitview_init ( ) ;
2015-04-05 05:36:53 +02:00
# endif
2021-01-24 03:53:10 +01:00
# if TARGET_OS _IOS
UISwipeGestureRecognizer * swipe = [ [ UISwipeGestureRecognizer alloc ] initWithTarget : self action : @ selector ( showNativeMenu ) ] ;
swipe . numberOfTouchesRequired = 4 ;
swipe . direction = UISwipeGestureRecognizerDirectionDown ;
[ self . view addGestureRecognizer : swipe ] ;
2021-01-19 04:51:38 +01:00
# endif
2021-01-24 03:53:10 +01:00
# else
[ self setAutoresizingMask : NSViewWidthSizable | NSViewHeightSizable ] ;
NSArray * array = [ NSArray arrayWithObjects : NSColorPboardType , NSFilenamesPboardType , nil ] ;
[ self registerForDraggedTypes : array ] ;
2019-02-03 15:49:35 -08:00
2021-01-24 03:53:10 +01:00
ui_window _cocoa _t cocoa_view ;
cocoa_view . data = ( CocoaView * ) self ;
2016-06-03 19:21:22 +02:00
2021-01-24 03:53:10 +01:00
video_driver _display _type _set ( RARCH_DISPLAY _OSX ) ;
video_driver _display _set ( 0 ) ;
video_driver _display _userdata _set ( ( uintptr_t ) self ) ;
# endif
2019-02-03 15:49:35 -08:00
2021-01-24 03:53:10 +01:00
return self ;
2016-06-03 19:21:22 +02:00
}
2021-01-24 03:53:10 +01:00
# if TARGET_OS _IOS
2020-09-15 19:48:43 +02:00
- ( void ) showNativeMenu
{
2019-10-06 09:41:53 -10:00
dispatch_async ( dispatch_get _main _queue ( ) , ^ {
2020-07-20 15:38:24 -10:00
command_event ( CMD_EVENT _MENU _TOGGLE , NULL ) ;
2019-10-06 09:41:53 -10:00
} ) ;
2019-06-14 08:35:33 -10:00
}
2020-09-15 19:48:43 +02:00
- ( BOOL ) prefersHomeIndicatorAutoHidden { return YES ; }
- ( void ) viewWillTransitionToSize : ( CGSize ) size withTransitionCoordinator : ( id < UIViewControllerTransitionCoordinator > ) coordinator
2018-11-27 09:29:30 -10:00
{
[ super viewWillTransitionToSize : size withTransitionCoordinator : coordinator ] ;
2020-09-16 10:09:03 +02:00
if ( @ available ( iOS 11 , * ) )
{
2018-11-27 09:29:30 -10:00
[ coordinator animateAlongsideTransition : ^ ( id < UIViewControllerTransitionCoordinatorContext > _Nonnull context ) {
[ self adjustViewFrameForSafeArea ] ;
} completion : ^ ( id < UIViewControllerTransitionCoordinatorContext > _Nonnull context ) {
} ] ;
}
}
2020-09-15 19:48:43 +02:00
- ( void ) adjustViewFrameForSafeArea
{
/ * This is for adjusting the view frame to account for
* the notch in iPhone X phones * /
if ( @ available ( iOS 11 , * ) )
{
2021-01-18 15:41:30 +01:00
RAScreen * screen = ( BRIDGE RAScreen * ) cocoa_screen _get _chosen ( ) ;
2020-09-15 19:48:43 +02:00
CGRect screenSize = [ screen bounds ] ;
UIEdgeInsets inset = [ [ UIApplication sharedApplication ] delegate ] . window . safeAreaInsets ;
UIInterfaceOrientation orientation = [ [ UIApplication sharedApplication ] statusBarOrientation ] ;
switch ( orientation )
{
case UIInterfaceOrientationPortrait :
self . view . frame = CGRectMake ( screenSize . origin . x ,
screenSize . origin . y + inset . top ,
screenSize . size . width ,
screenSize . size . height - inset . top ) ;
break ;
case UIInterfaceOrientationLandscapeLeft :
self . view . frame = CGRectMake ( screenSize . origin . x + inset . right ,
screenSize . origin . y ,
screenSize . size . width - inset . right * 2 ,
screenSize . size . height ) ;
break ;
case UIInterfaceOrientationLandscapeRight :
self . view . frame = CGRectMake ( screenSize . origin . x + inset . left ,
screenSize . origin . y ,
screenSize . size . width - inset . left * 2 ,
screenSize . size . height ) ;
break ;
default :
self . view . frame = screenSize ;
break ;
}
}
2018-11-27 09:29:30 -10:00
}
2019-02-09 21:10:28 +01:00
2015-04-05 05:36:53 +02:00
- ( void ) viewWillLayoutSubviews
{
2021-01-17 00:12:29 +01:00
float width = 0.0 f , height = 0.0 f ;
2021-01-18 15:41:30 +01:00
RAScreen * screen = ( BRIDGE RAScreen * ) cocoa_screen _get _chosen ( ) ;
2018-11-04 09:29:40 -07:00
UIInterfaceOrientation orientation = self . interfaceOrientation ;
2015-11-05 22:13:49 +01:00
CGRect screenSize = [ screen bounds ] ;
2020-09-15 19:48:43 +02:00
SEL selector = NSSelectorFromString ( BOXSTRING ( "coordinateSpace" ) ) ;
2019-02-03 15:49:35 -08:00
2020-09-15 19:48:43 +02:00
if ( [ screen respondsToSelector : selector ] )
{
screenSize = [ [ screen coordinateSpace ] bounds ] ;
width = CGRectGetWidth ( screenSize ) ;
height = CGRectGetHeight ( screenSize ) ;
}
else
{
width = ( ( int ) orientation < 3 )
? CGRectGetWidth ( screenSize )
: CGRectGetHeight ( screenSize ) ;
height = ( ( int ) orientation < 3 )
? CGRectGetHeight ( screenSize )
: CGRectGetWidth ( screenSize ) ;
}
2019-02-03 15:49:35 -08:00
2018-11-27 09:29:30 -10:00
[ self adjustViewFrameForSafeArea ] ;
2015-04-05 05:36:53 +02:00
}
/ * NOTE : This version runs on iOS6 + . * /
- ( NSUInteger ) supportedInterfaceOrientations
{
2016-05-02 14:54:08 +02:00
return ( NSUInteger ) apple_frontend _settings . orientation_flags ;
2015-04-05 05:36:53 +02:00
}
/ * NOTE : This version runs on iOS2 - iOS5 , but not iOS6 + . * /
- ( BOOL ) shouldAutorotateToInterfaceOrientation : ( UIInterfaceOrientation ) interfaceOrientation
{
2020-09-17 21:57:35 +02:00
unsigned orientation_flags = apple_frontend _settings . orientation_flags ;
2015-04-05 05:36:53 +02:00
switch ( interfaceOrientation )
{
case UIInterfaceOrientationPortrait :
2020-09-17 21:57:35 +02:00
return ( orientation_flags
2020-09-15 19:48:43 +02:00
& UIInterfaceOrientationMaskPortrait ) ;
2015-04-05 05:36:53 +02:00
case UIInterfaceOrientationPortraitUpsideDown :
2020-09-17 21:57:35 +02:00
return ( orientation_flags
2020-09-15 19:48:43 +02:00
& UIInterfaceOrientationMaskPortraitUpsideDown ) ;
2015-04-05 05:36:53 +02:00
case UIInterfaceOrientationLandscapeLeft :
2020-09-17 21:57:35 +02:00
return ( orientation_flags
2020-09-15 19:48:43 +02:00
& UIInterfaceOrientationMaskLandscapeLeft ) ;
2015-04-05 05:36:53 +02:00
case UIInterfaceOrientationLandscapeRight :
2020-09-17 21:57:35 +02:00
return ( orientation_flags
2020-09-15 19:48:43 +02:00
& UIInterfaceOrientationMaskLandscapeRight ) ;
2015-04-05 05:36:53 +02:00
default :
2020-09-17 21:57:35 +02:00
break ;
2015-04-05 05:36:53 +02:00
}
2019-02-03 15:49:35 -08:00
2020-09-17 21:57:35 +02:00
return ( orientation_flags
& UIInterfaceOrientationMaskAll ) ;
2015-04-05 05:36:53 +02:00
}
# endif
2019-01-26 13:18:32 -10:00
- ( void ) viewDidAppear : ( BOOL ) animated
{
# if TARGET_OS _IOS
2020-09-16 10:09:03 +02:00
if ( @ available ( iOS 11.0 , * ) )
2019-01-26 13:18:32 -10:00
[ self setNeedsUpdateOfHomeIndicatorAutoHidden ] ;
# endif
}
2020-09-16 10:09:03 +02:00
- ( void ) viewWillAppear : ( BOOL ) animated
{
2019-01-26 13:18:32 -10:00
[ super viewWillAppear : animated ] ;
# if TARGET_OS _TV
[ [ WebServer sharedInstance ] startUploader ] ;
[ WebServer sharedInstance ] . webUploader . delegate = self ;
# endif
}
# pragma mark GCDWebServerDelegate
2020-09-16 10:09:03 +02:00
- ( void ) webServerDidCompleteBonjourRegistration : ( GCDWebServer * ) server
{
2019-01-26 13:18:32 -10:00
NSMutableString * servers = [ [ NSMutableString alloc ] init ] ;
2020-09-15 19:48:43 +02:00
if ( server . serverURL ! = nil )
2019-01-26 13:18:32 -10:00
[ servers appendString : [ NSString stringWithFormat : @ "%@" , server . serverURL ] ] ;
2020-09-15 19:48:43 +02:00
if ( servers . length > 0 )
2019-01-26 13:18:32 -10:00
[ servers appendString : @ "\n\n" ] ;
2020-09-15 19:48:43 +02:00
if ( server . bonjourServerURL ! = nil )
2019-01-26 13:18:32 -10:00
[ servers appendString : [ NSString stringWithFormat : @ "%@" , server . bonjourServerURL ] ] ;
2020-09-16 10:12:43 +02:00
# if TARGET_OS _TV || TARGET_OS _IOS
2019-02-03 08:59:24 -10:00
UIAlertController * alert = [ UIAlertController alertControllerWithTitle : @ "Welcome to RetroArch" message : [ NSString stringWithFormat : @ "To transfer files from your computer, go to one of these addresses on your web browser:\n\n%@" , servers ] preferredStyle : UIAlertControllerStyleAlert ] ;
2020-09-16 10:12:43 +02:00
# if TARGET_OS _TV
[ alert addAction : [ UIAlertAction actionWithTitle : @ "OK"
style : UIAlertActionStyleDefault handler : ^ ( UIAlertAction * _Nonnull action ) {
2019-01-26 13:18:32 -10:00
} ] ] ;
# elif TARGET_OS _IOS
[ alert addAction : [ UIAlertAction actionWithTitle : @ "Stop Server" style : UIAlertActionStyleDefault handler : ^ ( UIAlertAction * _Nonnull action ) {
[ [ WebServer sharedInstance ] webUploader ] . delegate = nil ;
[ [ WebServer sharedInstance ] stopUploader ] ;
} ] ] ;
2020-09-16 10:12:43 +02:00
# endif
2019-01-26 13:18:32 -10:00
[ self presentViewController : alert animated : YES completion : ^ {
} ] ;
# endif
}
2021-01-24 03:53:10 +01:00
# else
- ( void ) setFrame : ( NSRect ) frameRect
{
[ super setFrame : frameRect ] ;
/ * forward declarations * /
# if defined ( HAVE_OPENGL )
void cocoa_gl _gfx _ctx _update ( void ) ;
cocoa_gl _gfx _ctx _update ( ) ;
# endif
}
/ * Stop the annoying sound when pressing a key . * /
- ( BOOL ) acceptsFirstResponder { return YES ; }
- ( BOOL ) isFlipped { return YES ; }
- ( void ) keyDown : ( NSEvent * ) theEvent { }
- ( NSDragOperation ) draggingEntered : ( id < NSDraggingInfo > ) sender
{
NSDragOperation sourceDragMask = [ sender draggingSourceOperationMask ] ;
NSPasteboard * pboard = [ sender draggingPasteboard ] ;
if ( [ [ pboard types ] containsObject : NSFilenamesPboardType ] )
{
if ( sourceDragMask & NSDragOperationCopy )
return NSDragOperationCopy ;
}
return NSDragOperationNone ;
}
- ( BOOL ) performDragOperation : ( id < NSDraggingInfo > ) sender
{
NSPasteboard * pboard = [ sender draggingPasteboard ] ;
if ( [ [ pboard types ] containsObject : NSURLPboardType ] )
{
NSURL * fileURL = [ NSURL URLFromPasteboard : pboard ] ;
NSString * s = [ fileURL path ] ;
if ( s ! = nil )
{
RARCH_LOG ( "Drop name is: %s\n" , [ s UTF8String ] ) ;
}
}
return YES ;
}
- ( void ) draggingExited : ( id < NSDraggingInfo > ) sender { [ self setNeedsDisplay : YES ] ; }
2019-09-22 10:28:51 +02:00
# endif
2019-01-26 13:18:32 -10:00
2015-04-05 05:36:53 +02:00
@ end
2021-01-18 15:41:30 +01:00
void * cocoa_screen _get _chosen ( void )
{
unsigned monitor_index ;
settings_t * settings = config_get _ptr ( ) ;
NSArray * screens = [ RAScreen screens ] ;
if ( ! screens || ! settings )
return NULL ;
monitor_index = settings -> uints . video_monitor _index ;
if ( monitor_index >= screens . count )
{
RARCH_WARN ( "video_monitor_index is greater than the number of connected monitors; using main screen instead." ) ;
return ( BRIDGE void * ) screens ;
}
return ( ( BRIDGE void * ) [ screens objectAtIndex : monitor_index ] ) ;
}
bool cocoa_has _focus ( void * data )
{
# if defined ( HAVE_COCOATOUCH )
return ( [ [ UIApplication sharedApplication ] applicationState ]
= = UIApplicationStateActive ) ;
# else
return [ NSApp isActive ] ;
# endif
}
void cocoa_show _mouse ( void * data , bool state )
{
2021-01-24 03:53:10 +01:00
# if ! defined ( HAVE_COCOATOUCH )
2021-01-18 15:41:30 +01:00
if ( state )
[ NSCursor unhide ] ;
else
[ NSCursor hide ] ;
# endif
}
2021-01-24 03:53:10 +01:00
# if defined ( HAVE_COCOATOUCH )
2021-01-18 15:41:30 +01:00
static float get_from _selector (
Class obj_class , id obj_id , SEL selector , CGFloat * ret )
{
NSInvocation * invocation = [ NSInvocation invocationWithMethodSignature :
[ obj_class instanceMethodSignatureForSelector : selector ] ] ;
[ invocation setSelector : selector ] ;
[ invocation setTarget : obj_id ] ;
[ invocation invoke ] ;
[ invocation getReturnValue : ret ] ;
RELEASE ( invocation ) ;
return * ret ;
}
/ * NOTE : nativeScale only available on iOS 8.0 and up . * /
float cocoa_screen _get _native _scale ( void )
{
SEL selector ;
static CGFloat ret = 0.0 f ;
RAScreen * screen = NULL ;
if ( ret ! = 0.0 f )
return ret ;
screen = ( BRIDGE RAScreen * ) cocoa_screen _get _chosen ( ) ;
if ( ! screen )
return 0.0 f ;
selector = NSSelectorFromString ( BOXSTRING ( "nativeScale" ) ) ;
if ( [ screen respondsToSelector : selector ] )
ret = ( float ) get_from _selector (
[ screen class ] , screen , selector , & ret ) ;
else
{
ret = 1.0 f ;
selector = NSSelectorFromString ( BOXSTRING ( "scale" ) ) ;
if ( [ screen respondsToSelector : selector ] )
ret = screen . scale ;
}
return ret ;
}
2021-01-24 03:53:10 +01:00
# else
# if MAC_OS _X _VERSION _10 _7
/ * NOTE : backingScaleFactor only available on MacOS X 10.7 and up . * /
float cocoa_screen _get _backing _scale _factor ( void )
{
static float
backing_scale _def = 0.0 f ;
if ( backing_scale _def = = 0.0 f )
{
RAScreen * screen = ( BRIDGE RAScreen * ) cocoa_screen _get _chosen ( ) ;
if ( ! screen )
return 1.0 f ;
backing_scale _def = [ screen backingScaleFactor ] ;
}
return backing_scale _def ;
}
# else
float cocoa_screen _get _backing _scale _factor ( void ) { return 1.0 f ; }
# endif
2021-01-18 15:41:30 +01:00
# endif
2021-01-18 19:17:12 +01:00
void * nsview_get _ptr ( void )
{
2021-01-24 03:53:10 +01:00
# if ! defined ( HAVE_COCOATOUCH )
2021-01-18 19:17:12 +01:00
video_driver _display _type _set ( RARCH_DISPLAY _OSX ) ;
video_driver _display _set ( 0 ) ;
video_driver _display _userdata _set ( ( uintptr_t ) g_instance ) ;
# endif
return ( BRIDGE void * ) g_instance ;
}
void nsview_set _ptr ( CocoaView * p ) { g_instance = p ; }
CocoaView * cocoaview_get ( void )
{
# if defined ( HAVE_COCOA _METAL )
return ( CocoaView * ) apple_platform . renderView ;
# elif defined ( HAVE_COCOA )
return g_instance ;
# else
/ * TODO / FIXME - implement * /
return NULL ;
# endif
}
2021-01-18 19:28:36 +01:00
2021-01-24 03:53:10 +01:00
# if defined ( HAVE_COCOATOUCH )
bool cocoa_get _metrics (
void * data , enum display_metric _types type ,
float * value )
{
RAScreen * screen = ( BRIDGE RAScreen * ) cocoa_screen _get _chosen ( ) ;
float scale = cocoa_screen _get _native _scale ( ) ;
CGRect screen_rect = [ screen bounds ] ;
float physical_width = screen_rect . size . width * scale ;
float physical_height = screen_rect . size . height * scale ;
float dpi = 160 * scale ;
NSInteger idiom_type = UI_USER _INTERFACE _IDIOM ( ) ;
switch ( idiom_type )
{
case -1 : / * UIUserInterfaceIdiomUnspecified * /
/ * TODO * /
break ;
case UIUserInterfaceIdiomPad :
dpi = 132 * scale ;
break ;
case UIUserInterfaceIdiomPhone :
{
CGFloat maxSize = fmaxf ( physical_width , physical_height ) ;
/ * Larger iPhones : iPhone Plus , X , XR , XS , XS Max , 11 , 11 Pro Max * /
if ( maxSize >= 2208.0 )
dpi = 81 * scale ;
else
dpi = 163 * scale ;
}
break ;
case UIUserInterfaceIdiomTV :
case UIUserInterfaceIdiomCarPlay :
/ * TODO * /
break ;
}
switch ( type )
{
case DISPLAY_METRIC _MM _WIDTH :
* value = physical_width ;
break ;
case DISPLAY_METRIC _MM _HEIGHT :
* value = physical_height ;
break ;
case DISPLAY_METRIC _DPI :
* value = dpi ;
break ;
case DISPLAY_METRIC _NONE :
default :
* value = 0 ;
return false ;
}
return true ;
}
# else
2021-01-18 19:28:36 +01:00
void cocoa_update _title ( void * data )
{
const ui_window _t * window = ui_companion _driver _get _window _ptr ( ) ;
if ( window )
{
char title [ 128 ] ;
title [ 0 ] = ' \ 0 ' ;
video_driver _get _window _title ( title , sizeof ( title ) ) ;
if ( title [ 0 ] )
window -> set_title ( ( void * ) video_driver _display _userdata _get ( ) , title ) ;
}
}
2021-01-18 19:33:06 +01:00
bool cocoa_get _metrics (
void * data , enum display_metric _types type ,
float * value )
{
RAScreen * screen = ( BRIDGE RAScreen * ) cocoa_screen _get _chosen ( ) ;
NSDictionary * desc = [ screen deviceDescription ] ;
CGSize display_physical _size = CGDisplayScreenSize (
[ [ desc objectForKey : @ "NSScreenNumber" ] unsignedIntValue ] ) ;
float physical_width = display_physical _size . width ;
float physical_height = display_physical _size . height ;
switch ( type )
{
case DISPLAY_METRIC _MM _WIDTH :
* value = physical_width ;
break ;
case DISPLAY_METRIC _MM _HEIGHT :
* value = physical_height ;
break ;
case DISPLAY_METRIC _DPI :
{
NSSize disp_pixel _size = [ [ desc objectForKey : NSDeviceSize ] sizeValue ] ;
float dispwidth = disp_pixel _size . width ;
float scale = cocoa_screen _get _backing _scale _factor ( ) ;
float dpi = ( dispwidth / physical_width ) * 25.4 f * scale ;
* value = dpi ;
}
break ;
case DISPLAY_METRIC _NONE :
default :
* value = 0 ;
return false ;
}
return true ;
}
2021-01-24 03:53:10 +01:00
# endif
2021-01-18 19:33:06 +01:00
2021-01-24 03:53:10 +01:00
# if defined ( HAVE_COCOA _METAL ) && ! defined ( HAVE_COCOATOUCH )
@ implementation WindowListener
2021-01-18 19:33:06 +01:00
2021-01-24 03:53:10 +01:00
/ * 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 { }
2021-01-18 19:33:06 +01:00
2021-01-24 03:53:10 +01:00
@ end
2021-01-18 19:28:36 +01:00
# endif