diff --git a/menu/widgets/menu_widgets.c b/menu/widgets/menu_widgets.c index 44d466dc31..369d258929 100644 --- a/menu/widgets/menu_widgets.c +++ b/menu/widgets/menu_widgets.c @@ -890,7 +890,6 @@ void menu_widgets_iterate(void) /* Load screenshot and start its animation */ if (screenshot_filename[0] != '\0') { - menu_animation_ctx_entry_t entry; menu_timer_ctx_entry_t timer; unsigned width; @@ -912,17 +911,7 @@ void menu_widgets_iterate(void) screenshot_shotname_length = (width - screenshot_thumbnail_width - simple_widget_padding*2) / glyph_width; - screenshot_y = -((float)screenshot_height); - - entry.cb = NULL; - entry.duration = MSG_QUEUE_ANIMATION_DURATION; - entry.easing_enum = EASING_OUT_QUAD; - entry.subject = &screenshot_y; - entry.tag = generic_tag; - entry.target_value = 0.0f; - entry.userdata = NULL; - - menu_animation_push(&entry); + screenshot_y = 0.0f; timer.cb = menu_widgets_screenshot_end; timer.duration = SCREENSHOT_NOTIFICATION_DURATION; @@ -2037,7 +2026,7 @@ static void menu_widgets_screenshot_fadeout(void *userdata) if (!menu_widgets_inited) return; - entry.cb = menu_widgets_screenshot_fadeout; + entry.cb = NULL; entry.duration = SCREENSHOT_DURATION_OUT; entry.easing_enum = EASING_OUT_QUAD; entry.subject = &screenshot_alpha; @@ -2068,6 +2057,9 @@ static void menu_widgets_play_screenshot_flash(void) void menu_widgets_screenshot_taken(const char *shotname, const char *filename) { + if (!menu_widgets_inited) + return; + menu_widgets_play_screenshot_flash(); strlcpy(screenshot_filename, filename, sizeof(screenshot_filename)); strlcpy(screenshot_shotname, shotname, sizeof(screenshot_shotname)); diff --git a/menu/widgets/menu_widgets.h b/menu/widgets/menu_widgets.h index aef16bd19e..55331660c2 100644 --- a/menu/widgets/menu_widgets.h +++ b/menu/widgets/menu_widgets.h @@ -30,7 +30,7 @@ #define VOLUME_DURATION 3000 #define SCREENSHOT_DURATION_IN 66 #define SCREENSHOT_DURATION_OUT SCREENSHOT_DURATION_IN*10 -#define SCREENSHOT_NOTIFICATION_DURATION 4000 +#define SCREENSHOT_NOTIFICATION_DURATION 6000 #define CHEEVO_NOTIFICATION_DURATION 4000 #define TASK_FINISHED_DURATION 3000 #define HOURGLASS_INTERVAL 5000 diff --git a/tasks/task_screenshot.c b/tasks/task_screenshot.c index 4647ccf6c9..90e4185cf9 100644 --- a/tasks/task_screenshot.c +++ b/tasks/task_screenshot.c @@ -129,11 +129,6 @@ static bool screenshot_dump_direct(screenshot_task_state_t *state) } #endif -#if defined(HAVE_MENU) && defined(HAVE_MENU_WIDGETS) - if (!state->silence) - menu_widgets_screenshot_taken(state->shotname, state->filename); -#endif - return ret; } @@ -158,7 +153,13 @@ static void task_screenshot_handler(retro_task_t *task) if (state->userbuf) free(state->userbuf); - free(state); +#ifdef HAVE_MENU_WIDGETS + /* If menu widgets are enabled, state is freed + in the callback after the notification + is displayed */ + if (!video_driver_has_widgets()) +#endif + free(state); return; } @@ -194,6 +195,23 @@ static void task_screenshot_handler(retro_task_t *task) task_free_title(task); } +#ifdef HAVE_MENU_WIDGETS +static void task_screenshot_callback(retro_task_t *task, + void *task_data, + void *user_data, const char *error) +{ + screenshot_task_state_t *state = (screenshot_task_state_t*)task->state; + + if (!video_driver_has_widgets()) + return; + + if (state && !state->silence) + menu_widgets_screenshot_taken(state->shotname, state->filename); + + free(state); +} +#endif + /* Take frame bottom-up. */ static bool screenshot_dump( const char *name_base, @@ -295,6 +313,9 @@ static bool screenshot_dump( task->type = TASK_TYPE_BLOCKING; task->state = state; task->handler = task_screenshot_handler; +#ifdef HAVE_MENU_WIDGETS + task->callback = task_screenshot_callback; +#endif if (use_thread) {