mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
(Cocoa) Implement ui_application_process_events
This commit is contained in:
parent
c1a321015a
commit
02910fd64d
@ -19,10 +19,21 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <objc/objc-runtime.h>
|
||||
#include "cocoa_common.h"
|
||||
#include "../../ui_companion_driver.h"
|
||||
|
||||
static void ui_application_cocoa_process_events(void)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES];
|
||||
if (!event)
|
||||
break;
|
||||
[event retain];
|
||||
[NSApp sendEvent: event];
|
||||
[event release];
|
||||
};
|
||||
}
|
||||
|
||||
const ui_application_t ui_application_cocoa = {
|
||||
|
@ -207,15 +207,7 @@ static char** waiting_argv;
|
||||
|
||||
static void poll_iteration(void)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES];
|
||||
if (!event)
|
||||
break;
|
||||
[event retain];
|
||||
[NSApp sendEvent: event];
|
||||
[event release];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
- (void) rarch_main
|
||||
@ -224,7 +216,9 @@ static void poll_iteration(void)
|
||||
while (ret != -1)
|
||||
{
|
||||
unsigned sleep_ms = 0;
|
||||
poll_iteration();
|
||||
const ui_application_t *application = ui_companion_driver_get_application_ptr();
|
||||
if (application)
|
||||
application->process_events();
|
||||
ret = runloop_iterate(&sleep_ms);
|
||||
if (ret == 1 && sleep_ms > 0)
|
||||
retro_sleep(sleep_ms);
|
||||
|
Loading…
x
Reference in New Issue
Block a user