select.lua: open context_menu.lua in d3d11 exclusive fullscreen

Load context_menu.lua when --d3d11-exclusive-fs is enabled and open it
instead of the native context menu. Native context menu cannot be
displayed over the exlusive window.

Fixes: #18181
This commit is contained in:
Kacper Michajłow
2026-10-15 18:31:28 +02:00
parent 867990d949
commit 2ddd0f027c
4 changed files with 19 additions and 5 deletions
+2 -1
View File
@@ -42,7 +42,8 @@ On platforms without integration with the native context menu,
``context_menu.lua`` can be disabled entirely using the
``--load-context-menu=no`` option. On platforms where the integration is
implemented, it is already disabled by default, and ``--load-context-menu=yes``
will make ``select.lua`` use it.
will make ``select.lua`` use it. It is also loaded when ``--d3d11-exclusive-fs``
is enabled, and ``select.lua`` uses it in exclusive fullscreen.
Script messages
---------------
+10 -2
View File
@@ -1423,6 +1423,14 @@ if options.populate_menu_data then
mp.observe_property("vo-configured", "native", parse_menu_conf)
end
-- The native menu can't be shown over a D3D11 exclusive fullscreen output.
local function use_context_menu_lua()
return mp.get_property_native("load-context-menu") or
(mp.get_property("current-gpu-context") == "d3d11" and
mp.get_property_native("fullscreen") and
mp.get_property_native("d3d11-exclusive-fs"))
end
mp.add_key_binding(nil, "context-menu", function (info)
if info.event == "repeat" then
return
@@ -1430,11 +1438,11 @@ mp.add_key_binding(nil, "context-menu", function (info)
if not info.is_mouse then
if info.event == "down" or info.event == "press" then
mp.command(mp.get_property_native("load-context-menu")
mp.command(use_context_menu_lua()
and "script-message-to context_menu open"
or "context-menu")
end
elseif mp.get_property_native("load-context-menu") then
elseif use_context_menu_lua() then
mp.commandv("script-message-to", "context_menu",
info.event == "down" and "open" or "select")
elseif info.event == (platform == "windows" and "up" or "down") then
+5 -1
View File
@@ -270,7 +270,11 @@ void mp_load_builtin_scripts(struct MPContext *mpctx)
load_builtin_script(mpctx, 5, mpctx->opts->lua_load_select, "@select.lua");
load_builtin_script(mpctx, 6, mpctx->opts->lua_load_positioning, "@positioning.lua");
load_builtin_script(mpctx, 7, mpctx->opts->lua_load_commands, "@commands.lua");
load_builtin_script(mpctx, 8, mpctx->opts->lua_load_context_menu, "@context_menu.lua");
// select.lua uses context_menu.lua in D3D11 exclusive fullscreen.
struct m_config_option *co = m_config_get_co(mpctx->mconfig, bstr0("d3d11-exclusive-fs"));
bool context_menu = mpctx->opts->lua_load_context_menu || (co && *(bool *)co->data);
load_builtin_script(mpctx, 8, context_menu, "@context_menu.lua");
}
bool mp_load_scripts(struct MPContext *mpctx)
+2 -1
View File
@@ -86,7 +86,8 @@ const struct m_sub_options d3d11_conf = {
{"bt.2020", DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020}),
.flags = UPDATE_VO,
},
{"d3d11-exclusive-fs", OPT_BOOL(exclusive_fs)},
{"d3d11-exclusive-fs", OPT_BOOL(exclusive_fs),
.flags = UPDATE_BUILTIN_SCRIPTS},
{"d3d11-output-mode", OPT_CHOICE(output_mode,
{"auto", -1},
{"window", 0},