From ed1d98d2a2b73ad5c107a44b330c255c46e0e5d0 Mon Sep 17 00:00:00 2001 From: Ryunam Date: Sun, 2 Jun 2019 23:48:01 +0200 Subject: [PATCH] Add toggle to show/hide mouse cursor with overlays --- config.def.h | 1 + configuration.c | 1 + configuration.h | 1 + input/input_overlay.c | 5 +++++ intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_us.h | 8 ++++++++ menu/cbs/menu_cbs_sublabel.c | 4 ++++ menu/menu_displaylist.c | 1 + menu/menu_setting.c | 16 ++++++++++++++++ msg_hash.h | 1 + 10 files changed, 40 insertions(+) diff --git a/config.def.h b/config.def.h index 116a1df95c1..a36b4271f25 100644 --- a/config.def.h +++ b/config.def.h @@ -263,6 +263,7 @@ static const unsigned int def_user_language = 0; #define DEFAULT_SHOW_HIDDEN_FILES false #define DEFAULT_OVERLAY_HIDE_IN_MENU true +#define DEFAULT_OVERLAY_SHOW_MOUSE_CURSOR true #define DEFAULT_DISPLAY_KEYBOARD_OVERLAY false diff --git a/configuration.c b/configuration.c index 28a57ba5bb3..6781198ee48 100644 --- a/configuration.c +++ b/configuration.c @@ -1569,6 +1569,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("input_overlay_enable_autopreferred", &settings->bools.input_overlay_enable_autopreferred, true, true, false); SETTING_BOOL("input_overlay_show_physical_inputs", &settings->bools.input_overlay_show_physical_inputs, true, false, false); SETTING_BOOL("input_overlay_hide_in_menu", &settings->bools.input_overlay_hide_in_menu, true, DEFAULT_OVERLAY_HIDE_IN_MENU, false); + SETTING_BOOL("input_overlay_show_mouse_cursor", &settings->bools.input_overlay_show_mouse_cursor, true, DEFAULT_OVERLAY_SHOW_MOUSE_CURSOR, false); #endif #ifdef HAVE_VIDEO_LAYOUT SETTING_BOOL("video_layout_enable", &settings->bools.video_layout_enable, true, true, false); diff --git a/configuration.h b/configuration.h index 56623441104..b4744e8fe10 100644 --- a/configuration.h +++ b/configuration.h @@ -129,6 +129,7 @@ typedef struct settings bool input_overlay_enable_autopreferred; bool input_overlay_hide_in_menu; bool input_overlay_show_physical_inputs; + bool input_overlay_show_mouse_cursor; bool input_descriptor_label_show; bool input_descriptor_hide_unbound; bool input_all_users_control_menu; diff --git a/input/input_overlay.c b/input/input_overlay.c index 6943ef23e2a..aa0f26e2827 100644 --- a/input/input_overlay.c +++ b/input/input_overlay.c @@ -602,6 +602,7 @@ void input_overlay_loaded(retro_task_t *task, overlay_task_data_t *data = (overlay_task_data_t*)task_data; input_overlay_t *ol = NULL; const video_overlay_interface_t *iface = NULL; + settings_t *settings = config_get_ptr(); if (err) return; @@ -642,6 +643,10 @@ void input_overlay_loaded(retro_task_t *task, overlay_ptr = ol; free(data); + + if (!settings->bools.input_overlay_show_mouse_cursor) + video_driver_hide_mouse(); + return; abort_load: diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index af243850266..cb0a32da8e3 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -571,6 +571,8 @@ MSG_HASH(MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, "overlay_show_physical_inputs") MSG_HASH(MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, "overlay_show_physical_inputs_port") +MSG_HASH(MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_MOUSE_CURSOR, + "overlay_show_mouse_cursor") MSG_HASH(MENU_ENUM_LABEL_INPUT_PLAYER_ANALOG_DPAD_MODE, "input_player%u_analog_dpad_mode") MSG_HASH(MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index a858fea710d..35c8dc5f192 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -1420,6 +1420,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, "Show Inputs On Overlay" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_MOUSE_CURSOR, + "Show Mouse Cursor With Overlay" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, "Show Inputs Listen Port" @@ -5516,6 +5520,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, "Select the port for the overlay to listen to if Show Inputs On Overlay is enabled." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_MOUSE_CURSOR, + "Show the mouse cursor when using an onscreen overlay." + ) MSG_HASH( MENU_ENUM_SUBLABEL_PLAYLISTS_TAB, "Scanned content matching the database will appear here." diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 925c5d2e6dd..9bdcb00a1bc 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -250,6 +250,7 @@ default_sublabel_macro(action_bind_sublabel_video_message_pos_x, MENU_ default_sublabel_macro(action_bind_sublabel_video_message_pos_y, MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y) default_sublabel_macro(action_bind_sublabel_video_font_size, MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE) default_sublabel_macro(action_bind_sublabel_input_overlay_hide_in_menu, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU) +default_sublabel_macro(action_bind_sublabel_input_overlay_show_mouse_cursor, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_MOUSE_CURSOR) default_sublabel_macro(action_bind_sublabel_content_collection_list, MENU_ENUM_SUBLABEL_PLAYLISTS_TAB) default_sublabel_macro(action_bind_sublabel_video_scale_integer, MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER) default_sublabel_macro(action_bind_sublabel_video_gpu_screenshot, MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT) @@ -2018,6 +2019,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_show_physical_inputs_port); break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_MOUSE_CURSOR: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_show_mouse_cursor); + break; case MENU_ENUM_LABEL_VIDEO_FONT_SIZE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_font_size); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index ba40aa41ccc..df572b48fce 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3889,6 +3889,7 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct {MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU, PARSE_ONLY_BOOL }, {MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, PARSE_ONLY_BOOL }, {MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT,PARSE_ONLY_BOOL }, + {MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_MOUSE_CURSOR, PARSE_ONLY_BOOL }, {MENU_ENUM_LABEL_OVERLAY_PRESET, PARSE_ONLY_PATH }, {MENU_ENUM_LABEL_OVERLAY_OPACITY, PARSE_ONLY_FLOAT }, {MENU_ENUM_LABEL_OVERLAY_SCALE, PARSE_ONLY_FLOAT }, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index c098bcaea02..0aed17c4e2b 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -10703,6 +10703,22 @@ static bool setting_append_list( (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 0, MAX_USERS - 1, 1, true, true); + CONFIG_BOOL( + list, list_info, + &settings->bools.input_overlay_show_mouse_cursor, + MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_MOUSE_CURSOR, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_MOUSE_CURSOR, + DEFAULT_OVERLAY_SHOW_MOUSE_CURSOR, + 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 + ); + CONFIG_PATH( list, list_info, settings->paths.path_overlay, diff --git a/msg_hash.h b/msg_hash.h index da0531855b6..e901ee58fd2 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -777,6 +777,7 @@ enum msg_hash_enums MENU_LABEL(INPUT_OVERLAY_HIDE_IN_MENU), MENU_LABEL(INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS), MENU_LABEL(INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT), + MENU_LABEL(INPUT_OVERLAY_SHOW_MOUSE_CURSOR), MENU_LABEL(INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE), MENU_LABEL(INPUT_SMALL_KEYBOARD_ENABLE), MENU_LABEL(INPUT_TOUCH_ENABLE),