From e09278cfb92d7e1cc5e4380c88e04d6502eec3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Wed, 9 Oct 2024 20:24:52 +0200 Subject: [PATCH] win32: set consoleAllocationPolicy to detached in the manifest This essentially obsoletes the console wrapper (mpv.com), which is no longer needed. The console is attached depending on the context in which mpv.exe is run. Add an option to control which subsystem is targeted. Keep the GUI application as the default to preserve compatibility with Windows versions prior to 24H2. For more information about the new console handling, see: https://github.com/microsoft/terminal/blob/4386bf07fd65f763693132ee5e4c43a2a571dc76/doc/specs/%237335%20-%20Console%20Allocation%20Policy.md --- meson.build | 4 ++-- meson_options.txt | 1 + osdep/mpv.exe.manifest | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 1b56eb4713..67b7b3d107 100644 --- a/meson.build +++ b/meson.build @@ -1797,9 +1797,9 @@ if get_option('cplayer') install_data('etc/mpv-symbolic.svg', install_dir: join_paths(hicolor_dir, 'symbolic', 'apps')) mpv = executable('mpv', main_fn_source, objects: libmpv.extract_all_objects(recursive: true), dependencies: dependencies, - win_subsystem: 'windows', install: true) + win_subsystem: get_option('win32-subsystem'), install: true) - if win32 + if win32 and get_option('win32-subsystem') != 'console' wrapper_sources= 'osdep/win32-console-wrapper.c' executable('mpv', wrapper_sources, c_args: '-municode', link_args: '-municode', name_suffix: 'com', install: true) diff --git a/meson_options.txt b/meson_options.txt index c6e6337d68..633d839f06 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -117,6 +117,7 @@ option('swift-flags', type: 'string', description: 'Optional Swift compiler flag # Windows features option('win32-smtc', type: 'feature', value: 'auto', description: 'Enable Media Control support') +option('win32-subsystem', type : 'string', value: 'windows', description : 'Windows subsystem to use for mpv.exe') # manpages option('html-build', type: 'feature', value: 'disabled', description: 'HTML manual generation') diff --git a/osdep/mpv.exe.manifest b/osdep/mpv.exe.manifest index 3cade40a38..6180f5fd80 100644 --- a/osdep/mpv.exe.manifest +++ b/osdep/mpv.exe.manifest @@ -9,6 +9,7 @@ mpv - The Movie Player + detached True/PM PerMonitorV2,PerMonitor UTF-8