Add option for showing notifications only in menu (#13326)

This commit is contained in:
Tony 2021-12-16 15:38:43 +02:00 committed by GitHub
parent aea8dad1ae
commit 71836c1055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 53 additions and 3 deletions

View File

@ -1029,6 +1029,10 @@ static const bool audio_enable_menu_bgm = false;
#define DEFAULT_NOTIFICATION_SHOW_NETPLAY_EXTRA false
#endif
#ifdef HAVE_MENU
#define DEFAULT_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE false
#endif
/* Output samplerate. */
#ifdef GEKKO
#define DEFAULT_OUTPUT_RATE 32000

View File

@ -1707,6 +1707,9 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("notification_show_refresh_rate", &settings->bools.notification_show_refresh_rate, true, DEFAULT_NOTIFICATION_SHOW_REFRESH_RATE, false);
#ifdef HAVE_NETWORKING
SETTING_BOOL("notification_show_netplay_extra", &settings->bools.notification_show_netplay_extra, true, DEFAULT_NOTIFICATION_SHOW_NETPLAY_EXTRA, false);
#endif
#ifdef HAVE_MENU
SETTING_BOOL("notification_show_when_menu_is_alive", &settings->bools.notification_show_when_menu_is_alive, true, DEFAULT_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE, false);
#endif
SETTING_BOOL("menu_widget_scale_auto", &settings->bools.menu_widget_scale_auto, true, DEFAULT_MENU_WIDGET_SCALE_AUTO, false);
SETTING_BOOL("audio_enable_menu", &settings->bools.audio_enable_menu, true, audio_enable_menu, false);

View File

@ -628,6 +628,9 @@ typedef struct settings
#endif
bool notification_show_refresh_rate;
bool notification_show_netplay_extra;
#ifdef HAVE_MENU
bool notification_show_when_menu_is_alive;
#endif
bool menu_widget_scale_auto;
bool menu_show_start_screen;
bool menu_pause_libretro;

View File

@ -1469,12 +1469,13 @@ void gfx_widgets_frame(void *data)
bool widgets_is_rewinding = video_info->widgets_is_rewinding;
bool runloop_is_slowmotion = video_info->runloop_is_slowmotion;
bool menu_screensaver_active = video_info->menu_screensaver_active;
bool notifications_hidden = video_info->notifications_hidden;
int top_right_x_advance = video_width;
p_dispwidget->gfx_widgets_frame_count++;
/* If menu screensaver is active, draw nothing */
if (menu_screensaver_active)
/* If menu screensaver is active or notifications are hidden, draw nothing */
if (menu_screensaver_active || notifications_hidden)
return;
video_driver_set_viewport(video_width, video_height, true, false);

View File

@ -2693,6 +2693,9 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->widgets_active = p_dispwidget->active;
#else
video_info->widgets_active = false;
#endif
#ifdef HAVE_MENU
video_info->notifications_hidden = settings->bools.notification_show_when_menu_is_alive && !menu_st->alive;
#endif
video_info->refresh_rate = settings->floats.video_refresh_rate;
video_info->crt_switch_resolution = settings->uints.crt_switch_resolution;
@ -3918,7 +3921,7 @@ void video_driver_frame(const void *data, unsigned width,
video_st->active = video_st->current_video->frame(
video_st->data, data, width, height,
video_st->frame_count, (unsigned)pitch,
video_info.menu_screensaver_active ? "" : video_driver_msg,
video_info.menu_screensaver_active || video_info.notifications_hidden ? "" : video_driver_msg,
&video_info);
video_st->frame_count++;
@ -3930,6 +3933,7 @@ void video_driver_frame(const void *data, unsigned width,
|| video_info.core_status_msg_show
)
&& !video_info.menu_screensaver_active
&& !video_info.notifications_hidden
)
{
#if defined(HAVE_GFX_WIDGETS)

View File

@ -471,6 +471,7 @@ typedef struct video_frame_info
char stat_text[512];
bool widgets_active;
bool notifications_hidden;
bool menu_mouse_enable;
bool widgets_is_paused;
bool widgets_is_fast_forwarding;

View File

@ -4802,6 +4802,10 @@ MSG_HASH(
MENU_ENUM_LABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA,
"notification_show_netplay_extra"
)
MSG_HASH(
MENU_ENUM_LABEL_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE,
"notification_show_when_menu_is_alive"
)
MSG_HASH(
MENU_ENUM_LABEL_VIDEO_SHADERS_ENABLE,
"video_shader_enable"

View File

@ -4035,6 +4035,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA,
"Display non-essential netplay on-screen messages."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE,
"Menu-only Notifications"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE,
"Display notifications only when menu is open."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH,
"Notification Font"

View File

@ -453,6 +453,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_refresh_rate, MENU
#ifdef HAVE_NETWORKING
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_netplay_extra, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA)
#endif
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_when_menu_is_alive, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_width, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_height, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_auto_width_max, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_AUTO_WIDTH_MAX)
@ -3528,6 +3529,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_netplay_extra);
break;
#endif
case MENU_ENUM_LABEL_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_when_menu_is_alive);
break;
case MENU_ENUM_LABEL_RESTART_RETROARCH:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_restart_retroarch);
break;

View File

@ -8656,6 +8656,7 @@ unsigned menu_displaylist_build_list(
#ifdef HAVE_NETWORKING
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA, PARSE_ONLY_BOOL, false },
#endif
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE, PARSE_ONLY_BOOL, false },
};
for (i = 0; i < ARRAY_SIZE(build_list); i++)

View File

@ -14671,6 +14671,21 @@ static bool setting_append_list(
SD_FLAG_NONE);
#endif
CONFIG_BOOL(
list, list_info,
&settings->bools.notification_show_when_menu_is_alive,
MENU_ENUM_LABEL_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE,
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE,
DEFAULT_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
END_SUB_GROUP(list, list_info, parent_group);
END_GROUP(list, list_info, parent_group);
break;

View File

@ -2883,6 +2883,7 @@ enum msg_hash_enums
MENU_LABEL(NOTIFICATION_SHOW_REFRESH_RATE),
MENU_LABEL(NOTIFICATION_SHOW_NETPLAY_EXTRA),
MENU_LABEL(NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE),
MENU_LABEL(SELECT_FILE),
MENU_LABEL(SELECT_FROM_PLAYLIST),

View File

@ -596,6 +596,7 @@ QWidget *NotificationsPage::widget()
notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH);
notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_REFRESH_RATE);
notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA);
notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE);
layout->addWidget(notificationsGroup);