diff --git a/command.c b/command.c index c1a988f83f..376f974ddd 100644 --- a/command.c +++ b/command.c @@ -2108,7 +2108,11 @@ void command_event_reinit(const int flags) #ifdef HAVE_MENU p_disp->flags |= GFX_DISP_FLAG_FB_DIRTY; if (video_fullscreen) - video_driver_hide_mouse(); + { + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, false); + } if ( (menu_st->flags & MENU_ST_FLAG_ALIVE) && video_st->current_video->set_nonblock_state) video_st->current_video->set_nonblock_state( diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index f2014b6b9b..751970321d 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -481,85 +481,94 @@ void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id) bool win32_load_content_from_gui(const char *szFilename) { /* poll list of current cores */ - size_t list_size; - content_ctx_info_t content_info = { 0 }; core_info_list_t *core_info_list = NULL; - const core_info_t *core_info = NULL; core_info_get_list(&core_info_list); - if (!core_info_list) - return false; - - core_info_list_get_supported_cores(core_info_list, - (const char*)szFilename, &core_info, &list_size); - - if (!list_size) - return false; - - path_set(RARCH_PATH_CONTENT, szFilename); - - if (!path_is_empty(RARCH_PATH_CONTENT)) + if (core_info_list) { - unsigned i; - core_info_t *current_core = NULL; - core_info_get_current_core(¤t_core); + size_t list_size; + content_ctx_info_t content_info = { 0 }; + const core_info_t *core_info = NULL; + core_info_list_get_supported_cores(core_info_list, + (const char*)szFilename, &core_info, &list_size); - /*we already have path for libretro core */ - for (i = 0; i < list_size; i++) + if (list_size) { - const core_info_t *info = (const core_info_t*)&core_info[i]; + path_set(RARCH_PATH_CONTENT, szFilename); - if (string_is_equal(path_get(RARCH_PATH_CORE), info->path)) + if (!path_is_empty(RARCH_PATH_CONTENT)) { - /* Our previous core supports the current rom */ - task_push_load_content_with_current_core_from_companion_ui( - NULL, - &content_info, - CORE_TYPE_PLAIN, - NULL, NULL); - return true; + unsigned i; + core_info_t *current_core = NULL; + core_info_get_current_core(¤t_core); + + /*we already have path for libretro core */ + for (i = 0; i < list_size; i++) + { + const core_info_t *info = (const core_info_t*)&core_info[i]; + + if (string_is_equal(path_get(RARCH_PATH_CORE), info->path)) + { + /* Our previous core supports the current rom */ + task_push_load_content_with_current_core_from_companion_ui( + NULL, + &content_info, + CORE_TYPE_PLAIN, + NULL, NULL); + return true; + } + } + } + + /* Poll for cores for current rom since none exist. */ + if (list_size == 1) + { + /*pick core that only exists and is bound to work. Ish. */ + const core_info_t *info = (const core_info_t*)&core_info[0]; + + if (info) + { + task_push_load_content_with_new_core_from_companion_ui( + info->path, NULL, NULL, NULL, NULL, &content_info, NULL, NULL); + return true; + } + } + else + { + bool okay = false; + settings_t *settings = config_get_ptr(); + bool video_is_fs = settings->bools.video_fullscreen; + video_driver_state_t *video_st = video_state_get_ptr(); + + /* Fullscreen: Show mouse cursor for dialog */ + if (video_is_fs) + { + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, true); + } + + /* Pick one core that could be compatible, ew */ + if (DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_PICKCORE), + main_window.hwnd, pick_core_proc, (LPARAM)NULL) == IDOK) + { + task_push_load_content_with_current_core_from_companion_ui( + NULL, &content_info, CORE_TYPE_PLAIN, NULL, NULL); + okay = true; + } + + /* Fullscreen: Hide mouse cursor after dialog */ + if (video_is_fs) + { + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, false); + } + return okay; } } } - - /* Poll for cores for current rom since none exist. */ - if (list_size == 1) - { - /*pick core that only exists and is bound to work. Ish. */ - const core_info_t *info = (const core_info_t*)&core_info[0]; - - if (info) - { - task_push_load_content_with_new_core_from_companion_ui( - info->path, NULL, NULL, NULL, NULL, &content_info, NULL, NULL); - return true; - } - } - else - { - bool okay = false; - settings_t *settings = config_get_ptr(); - bool video_is_fs = settings->bools.video_fullscreen; - - /* Fullscreen: Show mouse cursor for dialog */ - if (video_is_fs) - video_driver_show_mouse(); - - /* Pick one core that could be compatible, ew */ - if (DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_PICKCORE), - main_window.hwnd, pick_core_proc, (LPARAM)NULL) == IDOK) - { - task_push_load_content_with_current_core_from_companion_ui( - NULL, &content_info, CORE_TYPE_PLAIN, NULL, NULL); - okay = true; - } - - /* Fullscreen: Hide mouse cursor after dialog */ - if (video_is_fs) - video_driver_hide_mouse(); - return okay; - } return false; } diff --git a/gfx/video_driver.c b/gfx/video_driver.c index bfc3576114..7e7f925d6e 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -2175,22 +2175,6 @@ void video_driver_update_viewport( } } -void video_driver_show_mouse(void) -{ - video_driver_state_t *video_st = &video_driver_st; - if ( video_st->poke - && video_st->poke->show_mouse) - video_st->poke->show_mouse(video_st->data, true); -} - -void video_driver_hide_mouse(void) -{ - video_driver_state_t *video_st = &video_driver_st; - if ( video_st->poke - && video_st->poke->show_mouse) - video_st->poke->show_mouse(video_st->data, false); -} - void video_driver_restore_cached(void *settings_data) { settings_t *settings = (settings_t*)settings_data; @@ -3519,13 +3503,17 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled) * (re-)initialisation */ if (input_st->flags & INP_FLAG_GRAB_MOUSE_STATE) { - video_driver_hide_mouse(); + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, false); if (input_driver_grab_mouse()) input_st->flags |= INP_FLAG_GRAB_MOUSE_STATE; } else if (video.fullscreen) { - video_driver_hide_mouse(); + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, false); if (!settings->bools.video_windowed_fullscreen) if (input_driver_grab_mouse()) input_st->flags |= INP_FLAG_GRAB_MOUSE_STATE; diff --git a/gfx/video_driver.h b/gfx/video_driver.h index e0b94345b5..07bd6be71e 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -940,10 +940,6 @@ void video_driver_set_aspect_ratio(void); void video_driver_update_viewport(struct video_viewport* vp, bool force_full, bool keep_aspect); -void video_driver_show_mouse(void); - -void video_driver_hide_mouse(void); - void video_driver_apply_state_changes(void); bool video_driver_read_viewport(uint8_t *buffer, bool is_idle); diff --git a/input/input_driver.c b/input/input_driver.c index 0d7d660ada..57d2eb9c4e 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -3911,7 +3911,11 @@ static void input_overlay_loaded(retro_task_t *task, free(data); if (!input_overlay_show_mouse_cursor) - video_driver_hide_mouse(); + { + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, false); + } /* Attempt to automatically rotate overlay, if required */ if (inp_overlay_auto_rotate) diff --git a/retroarch.c b/retroarch.c index b20d398067..0fb1bf42ee 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2637,6 +2637,7 @@ bool command_event(enum event_command cmd, void *data) bool load_dummy_core = data ? *(bool*)data : true; content_ctx_info_t content_info = {0}; global_t *global = global_get_ptr(); + video_driver_state_t *video_st = video_state_get_ptr(); rarch_system_info_t *sys_info = &runloop_st->system; uint8_t flags = content_get_flags(); @@ -2680,7 +2681,9 @@ bool command_event(enum event_command cmd, void *data) if (!settings->bools.video_fullscreen) { input_driver_state_t *input_st = input_state_get_ptr(); - video_driver_show_mouse(); + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, true); if (input_driver_ungrab_mouse()) input_st->flags &= ~INP_FLAG_GRAB_MOUSE_STATE; } @@ -3779,14 +3782,18 @@ bool command_event(enum event_command cmd, void *data) command_event(CMD_EVENT_REINIT, NULL); if (video_fullscreen) { - video_driver_hide_mouse(); + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, false); if (!settings->bools.video_windowed_fullscreen) if (input_driver_grab_mouse()) input_st->flags |= INP_FLAG_GRAB_MOUSE_STATE; } else { - video_driver_show_mouse(); + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, true); if (!settings->bools.video_windowed_fullscreen) if (input_driver_ungrab_mouse()) input_st->flags &= ~INP_FLAG_GRAB_MOUSE_STATE; @@ -3979,9 +3986,17 @@ bool command_event(enum event_command cmd, void *data) grab_mouse_state ? "ON" : "OFF"); if (grab_mouse_state) - video_driver_hide_mouse(); + { + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, false); + } else - video_driver_show_mouse(); + { + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, true); + } } break; case CMD_EVENT_UI_COMPANION_TOGGLE: @@ -4065,7 +4080,9 @@ bool command_event(enum event_command cmd, void *data) { if (input_driver_grab_mouse()) input_st->flags |= INP_FLAG_GRAB_MOUSE_STATE; - video_driver_hide_mouse(); + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, false); } /* Ungrab only if windowed and auto mouse grab is disabled */ else if (!video_fullscreen && @@ -4073,7 +4090,9 @@ bool command_event(enum event_command cmd, void *data) { if (input_driver_ungrab_mouse()) input_st->flags &= ~INP_FLAG_GRAB_MOUSE_STATE; - video_driver_show_mouse(); + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, true); } if (input_st->game_focus_state.enabled) diff --git a/runloop.c b/runloop.c index 2862a91163..6e99349d10 100644 --- a/runloop.c +++ b/runloop.c @@ -2467,6 +2467,7 @@ bool runloop_environment_cb(unsigned cmd, void *data) { recording_state_t *recording_st = recording_state_get_ptr(); + video_driver_state_t *video_st = video_state_get_ptr(); bool video_fullscreen = settings->bools.video_fullscreen; int reinit_flags = DRIVERS_CMD_ALL & ~(DRIVER_VIDEO_MASK | DRIVER_INPUT_MASK | DRIVER_MENU_MASK); @@ -2493,7 +2494,11 @@ bool runloop_environment_cb(unsigned cmd, void *data) /* Hide mouse cursor in fullscreen mode */ if (video_fullscreen) - video_driver_hide_mouse(); + { + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, false); + } } break; } @@ -2691,7 +2696,11 @@ bool runloop_environment_cb(unsigned cmd, void *data) /* Hide mouse cursor in fullscreen after * a RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO call. */ if (video_fullscreen) - video_driver_hide_mouse(); + { + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, false); + } /* Recalibrate frame delay target when video reinits * and pause frame delay when video does not reinit */ diff --git a/ui/drivers/ui_qt.cpp b/ui/drivers/ui_qt.cpp index bcfa0dd963..e87aa1db90 100644 --- a/ui/drivers/ui_qt.cpp +++ b/ui/drivers/ui_qt.cpp @@ -4840,7 +4840,9 @@ static void ui_companion_qt_toggle(void *data, bool force) if (mouse_grabbed) command_event(CMD_EVENT_GRAB_MOUSE_TOGGLE, NULL); - video_driver_show_mouse(); + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, true); if (video_fullscreen) command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL); diff --git a/ui/drivers/ui_win32.c b/ui/drivers/ui_win32.c index 472f3dff1d..cebd5b6f94 100644 --- a/ui/drivers/ui_win32.c +++ b/ui/drivers/ui_win32.c @@ -248,6 +248,7 @@ static bool ui_browser_window_win32_core( OPENFILENAME ofn; bool okay = true; settings_t *settings = config_get_ptr(); + video_driver_state_t *video_st = video_state_get_ptr(); bool video_fullscreen = settings->bools.video_fullscreen; ofn.lStructSize = sizeof(OPENFILENAME); @@ -280,7 +281,11 @@ static bool ui_browser_window_win32_core( /* Full Screen: Show mouse for the file dialog */ if (video_fullscreen) - video_driver_show_mouse(); + { + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, true); + } if (!save && !GetOpenFileName(&ofn)) okay = false; @@ -289,7 +294,11 @@ static bool ui_browser_window_win32_core( /* Full screen: Hide mouse after the file dialog */ if (video_fullscreen) - video_driver_hide_mouse(); + { + if ( video_st->poke + && video_st->poke->show_mouse) + video_st->poke->show_mouse(video_st->data, false); + } return okay; }