mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Go back to ObjC file
This commit is contained in:
parent
3eb2ba9458
commit
f65ecf24f1
@ -39,6 +39,7 @@
|
||||
#if TARGET_OS_OSX
|
||||
#include "../ui/drivers/cocoa/ui_cocoa_window.m"
|
||||
#include "../ui/drivers/cocoa/ui_cocoa_browser_window.m"
|
||||
#include "../ui/drivers/cocoa/ui_cocoa_application.m"
|
||||
#include "../ui/drivers/cocoa/ui_cocoa_msg_window.m"
|
||||
#include "../ui/drivers/ui_cocoa.m"
|
||||
#endif
|
||||
|
119
ui/drivers/cocoa/ui_cocoa_application.c → ui/drivers/cocoa/ui_cocoa_application.m
Normal file → Executable file
119
ui/drivers/cocoa/ui_cocoa_application.c → ui/drivers/cocoa/ui_cocoa_application.m
Normal file → Executable file
@ -1,64 +1,55 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <objc/objc.h>
|
||||
#include <objc/message.h>
|
||||
#include <objc/NSObjCRuntime.h>
|
||||
#include "cocoa_defines.h"
|
||||
#include "../../ui_companion_driver.h"
|
||||
|
||||
extern id NSApp;
|
||||
extern id const NSDefaultRunLoopMode;
|
||||
|
||||
static void* ui_application_cocoa_initialize(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ui_application_cocoa_process_events(void)
|
||||
{
|
||||
SEL sel_nextEventMatchingMask_untilDate_inMode_dequeue =
|
||||
sel_registerName("nextEventMatchingMask:untilDate:inMode:dequeue:");
|
||||
Class class_NSDate = objc_getClass("NSDate");
|
||||
SEL sel_distantPast = sel_registerName("distantPast");
|
||||
SEL sel_sendEvent = sel_registerName("sendEvent:");
|
||||
id distant_past = ((id (*)(Class, SEL))objc_msgSend)(class_NSDate, sel_distantPast);
|
||||
for (;;)
|
||||
{
|
||||
id event = ((id (*)(id, SEL, NSUInteger, id, id, BOOL))objc_msgSend)(NSApp, sel_nextEventMatchingMask_untilDate_inMode_dequeue,
|
||||
NSUIntegerMax,
|
||||
distant_past,
|
||||
NSDefaultRunLoopMode,
|
||||
YES);
|
||||
if (event == nil)
|
||||
break;
|
||||
((id (*)(id, SEL, id))objc_msgSend)(NSApp, sel_sendEvent, event);
|
||||
}
|
||||
}
|
||||
|
||||
ui_application_t ui_application_cocoa = {
|
||||
ui_application_cocoa_initialize,
|
||||
ui_application_cocoa_process_events,
|
||||
NULL,
|
||||
false,
|
||||
"cocoa"
|
||||
};
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <objc/objc-runtime.h>
|
||||
#include "cocoa_defines.h"
|
||||
#include "cocoa_common.h"
|
||||
#include "../../ui_companion_driver.h"
|
||||
|
||||
static void* ui_application_cocoa_initialize(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ui_application_cocoa_process_events(void)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES];
|
||||
if (!event)
|
||||
break;
|
||||
#ifndef HAVE_COCOA_METAL
|
||||
[event retain];
|
||||
#endif
|
||||
[NSApp sendEvent: event];
|
||||
#ifndef HAVE_COCOA_METAL
|
||||
[event retain];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
ui_application_t ui_application_cocoa = {
|
||||
ui_application_cocoa_initialize,
|
||||
ui_application_cocoa_process_events,
|
||||
NULL,
|
||||
false,
|
||||
"cocoa"
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user