RetroArch/ui/drivers/cocoa/ui_cocoa_application.m

56 lines
1.6 KiB
Mathematica
Raw Normal View History

2016-06-07 16:51:25 +02:00
/* RetroArch - A frontend for libretro.
2017-01-22 13:40:32 +01:00
* Copyright (C) 2011-2017 - Daniel De Matteis
2016-06-07 16:51:25 +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/>.
*/
#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"
2016-06-07 16:51:25 +02:00
#include "../../ui_companion_driver.h"
2018-04-30 14:33:05 -04:00
static void* ui_application_cocoa_initialize(void)
2016-06-09 15:22:03 +02:00
{
2018-04-30 14:33:05 -04:00
return NULL;
2016-06-09 15:22:03 +02:00
}
2016-06-07 17:07:11 +02:00
static void ui_application_cocoa_process_events(void)
2016-06-07 16:51:25 +02:00
{
while (1)
{
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
2016-06-07 18:04:07 +02:00
}
2016-06-07 16:51:25 +02:00
}
2018-04-30 14:33:05 -04:00
ui_application_t ui_application_cocoa = {
2016-06-09 15:22:03 +02:00
ui_application_cocoa_initialize,
2016-06-07 16:51:25 +02:00
ui_application_cocoa_process_events,
2018-04-30 14:33:05 -04:00
NULL,
false,
2016-06-07 16:51:25 +02:00
"cocoa"
};