mirror of
https://github.com/libretro/RetroArch
synced 2025-02-27 00:40:20 +00:00
Add ui_companion_driver_get_main_window
This commit is contained in:
parent
8431b63235
commit
b11bfc8a73
@ -101,15 +101,6 @@ void get_ios_version(int *major, int *minor);
|
||||
|
||||
@end
|
||||
|
||||
@interface RetroArch_OSX : NSObject <NSApplicationDelegate>
|
||||
{
|
||||
NSWindow* _window;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSWindow IBOutlet* window;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
#define BOXSTRING(x) [NSString stringWithUTF8String:x]
|
||||
|
@ -72,7 +72,7 @@ static enum ui_msg_window_response ui_msg_window_cocoa_dialog(ui_msg_window_stat
|
||||
break;
|
||||
}
|
||||
|
||||
[alert beginSheetModalForWindow:((RetroArch_OSX*)[[NSApplication sharedApplication] delegate]).window
|
||||
[alert beginSheetModalForWindow:ui_companion_driver_get_main_window()
|
||||
modalDelegate:apple_platform
|
||||
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
|
||||
contextInfo:nil];
|
||||
|
@ -37,6 +37,15 @@
|
||||
|
||||
id apple_platform;
|
||||
|
||||
@interface RetroArch_OSX : NSObject <NSApplicationDelegate>
|
||||
{
|
||||
NSWindow* _window;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSWindow IBOutlet* window;
|
||||
|
||||
@end
|
||||
|
||||
static void app_terminate(void)
|
||||
{
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
@ -384,7 +393,7 @@ static void open_document_handler(ui_browser_window_state_t *state, bool result)
|
||||
|
||||
if (browser)
|
||||
{
|
||||
ui_browser_window_state_t browser_state = {0};
|
||||
ui_browser_window_state_t browser_state = {{0}};
|
||||
settings_t *settings = config_get_ptr();
|
||||
NSString *startdir = BOXSTRING(settings->directory.menu_content);
|
||||
|
||||
@ -546,6 +555,11 @@ static void ui_companion_cocoa_notify_list_pushed(void *data,
|
||||
(void)menu_list;
|
||||
}
|
||||
|
||||
static void *ui_companion_cocoa_get_main_window(void *data)
|
||||
{
|
||||
return ((RetroArch_OSX*)[[NSApplication sharedApplication] delegate]).window;
|
||||
}
|
||||
|
||||
const ui_companion_driver_t ui_companion_cocoa = {
|
||||
ui_companion_cocoa_init,
|
||||
ui_companion_cocoa_deinit,
|
||||
@ -557,6 +571,7 @@ const ui_companion_driver_t ui_companion_cocoa = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
ui_companion_cocoa_get_main_window,
|
||||
&ui_browser_window_cocoa,
|
||||
&ui_msg_window_cocoa,
|
||||
&ui_window_cocoa,
|
||||
|
@ -689,6 +689,7 @@ const ui_companion_driver_t ui_companion_cocoatouch = {
|
||||
ui_companion_cocoatouch_notify_refresh,
|
||||
ui_companion_cocoatouch_msg_queue_push,
|
||||
ui_companion_cocoatouch_render_messagebox,
|
||||
NULL,
|
||||
&ui_browser_window_null,
|
||||
&ui_msg_window_null,
|
||||
&ui_window_null,
|
||||
|
@ -88,6 +88,7 @@ const ui_companion_driver_t ui_companion_null = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&ui_browser_window_null,
|
||||
&ui_msg_window_null,
|
||||
&ui_window_null,
|
||||
|
@ -144,6 +144,7 @@ const ui_companion_driver_t ui_companion_qt = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&ui_browser_window_qt,
|
||||
&ui_msg_window_qt,
|
||||
&ui_window_qt,
|
||||
|
@ -741,6 +741,7 @@ const ui_companion_driver_t ui_companion_win32 = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&ui_browser_window_win32,
|
||||
&ui_msg_window_win32,
|
||||
&ui_window_win32,
|
||||
|
@ -201,3 +201,11 @@ const ui_application_t *ui_companion_driver_get_application_ptr(void)
|
||||
return NULL;
|
||||
return ui->application;
|
||||
}
|
||||
|
||||
void *ui_companion_driver_get_main_window(void)
|
||||
{
|
||||
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
||||
if (!ui || !ui->get_main_window)
|
||||
return NULL;
|
||||
return ui->get_main_window(ui_companion_data);
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ typedef struct ui_companion_driver
|
||||
void (*notify_refresh)(void *data);
|
||||
void (*msg_queue_push)(const char *msg, unsigned priority, unsigned duration, bool flush);
|
||||
void (*render_messagebox)(const char *msg);
|
||||
void *(*get_main_window)(void *data);
|
||||
const ui_browser_window_t *browser_window;
|
||||
const ui_msg_window_t *msg_window;
|
||||
const ui_window_t *window;
|
||||
@ -215,6 +216,8 @@ const ui_window_t *ui_companion_driver_get_window_ptr(void);
|
||||
|
||||
const ui_application_t *ui_companion_driver_get_application_ptr(void);
|
||||
|
||||
void *ui_companion_driver_get_main_window(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user