diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 662cc7b62a..31b42dc4c3 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -6479,6 +6479,11 @@ them. :system: No manual syncing, depend on the layer mechanic and the next drawable :feedback: Same as precise but uses the presentation feedback core mechanism +``--macos-menu-shortcuts=`` + Enables the default menu bar shortcuts (default: yes). The menu bar shortcuts always take + precedence over any other shortcuts, they are not propagated to the mpv core and they can't be + used in config files like ``input.conf`` or script bindings. + ``--android-surface-size=`` Set dimensions of the rendering surface used by the Android gpu context. Needs to be set by the embedding application if the dimensions change during diff --git a/osdep/mac/app_bridge.h b/osdep/mac/app_bridge.h index cc77c2f4dd..94ba745b3a 100644 --- a/osdep/mac/app_bridge.h +++ b/osdep/mac/app_bridge.h @@ -62,6 +62,7 @@ struct macos_opts { int macos_app_activation_policy; int macos_geometry_calculation; int macos_render_timer; + bool macos_menu_shortcuts; int cocoa_cb_sw_renderer; bool cocoa_cb_10bit_context; int cocoa_cb_output_csp; diff --git a/osdep/mac/app_bridge.m b/osdep/mac/app_bridge.m index c61ba3b6cb..bea1ecae3e 100644 --- a/osdep/mac/app_bridge.m +++ b/osdep/mac/app_bridge.m @@ -52,6 +52,7 @@ const struct m_sub_options macos_conf = { {"macos-render-timer", OPT_CHOICE(macos_render_timer, {"callback", RENDER_TIMER_CALLBACK}, {"precise", RENDER_TIMER_PRECISE}, {"system", RENDER_TIMER_SYSTEM}, {"feedback", RENDER_TIMER_PRESENTATION_FEEDBACK})}, + {"macos-menu-shortcuts", OPT_BOOL(macos_menu_shortcuts)}, {"cocoa-cb-sw-renderer", OPT_CHOICE(cocoa_cb_sw_renderer, {"auto", -1}, {"no", 0}, {"yes", 1})}, {"cocoa-cb-10bit-context", OPT_BOOL(cocoa_cb_10bit_context)}, @@ -78,6 +79,7 @@ const struct m_sub_options macos_conf = { .macos_title_bar_color = {0, 0, 0, 0}, .macos_fs_animation_duration = -1, .macos_render_timer = RENDER_TIMER_CALLBACK, + .macos_menu_shortcuts = true, .cocoa_cb_sw_renderer = -1, .cocoa_cb_10bit_context = true, .cocoa_cb_output_csp = MAC_CSP_AUTO, diff --git a/osdep/mac/app_hub.swift b/osdep/mac/app_hub.swift index 81390744dc..fd917bc80f 100644 --- a/osdep/mac/app_hub.swift +++ b/osdep/mac/app_hub.swift @@ -44,7 +44,6 @@ class AppHub: NSObject { input = InputHelper() log = LogHelper() super.init() - if isApplication { menu = MenuBar(self) } #if HAVE_MACOS_MEDIA_PLAYER remote = RemoteCommandCenter(self) #endif @@ -58,6 +57,7 @@ class AppHub: NSObject { log.log = mp_log_new(nil, mp_client_get_log(mpv), "app") option = OptionHelper(UnsafeMutablePointer(mpv), mp_client_get_global(mpv)) input.option = option + DispatchQueue.main.sync { menu = MenuBar(self) } } #if HAVE_MACOS_MEDIA_PLAYER diff --git a/osdep/mac/menu_bar.swift b/osdep/mac/menu_bar.swift index 4abbd912e1..a43f55f1ea 100644 --- a/osdep/mac/menu_bar.swift +++ b/osdep/mac/menu_bar.swift @@ -71,6 +71,7 @@ extension MenuBar { class MenuBar: NSObject { unowned let appHub: AppHub + var option: OptionHelper? { return appHub.option } let mainMenu = NSMenu(title: "Main") let servicesMenu = NSMenu(title: "Services") var menuConfigs: [Config] = [] @@ -272,7 +273,8 @@ class MenuBar: NSObject { } func createMenuItem(parentMenu: NSMenu, config: Config) -> MenuItem { - var item = MenuItem(title: config.name, action: config.action, keyEquivalent: config.key) + var item = MenuItem(title: config.name, action: config.action, + keyEquivalent: (option?.mac.macos_menu_shortcuts ?? true) ? config.key : "") item.config = config item.target = config.target item.keyEquivalentModifierMask = config.modifiers