diff --git a/DOCS/interface-changes/clipboard.txt b/DOCS/interface-changes/clipboard.txt index 98c7ec94fc075..9a1582d5ef5ee 100644 --- a/DOCS/interface-changes/clipboard.txt +++ b/DOCS/interface-changes/clipboard.txt @@ -1,4 +1,4 @@ -add `--clipboard-enable` and `--clipboard-monitor` options +add `--clipboard-monitor` option add `clipboard` property add `current-clipboard-backend` property add `--clipboard-backends` option diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 63a308389cffa..bb9bbccc3dfa8 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -7896,29 +7896,17 @@ Miscellaneous Conversion is not applied to metadata that is updated at runtime. -``--clipboard-enable=`` - (Windows, Wayland and macOS only) - - Enable native clipboard support (default: yes). This allows reading and - writing to the ``clipboard`` property to get and set clipboard contents. - -``--clipboard-monitor=`` - (Windows, Wayland and macOS only) - - Enable clipboard monitoring so that the ``clipboard`` property can be - observed for content changes (default: no). This only affects clipboard - implementations which use polling to monitor clipboard updates. - Other platforms currently ignore this option and always/never notify - changes. - - On Wayland, this option only has effect on the ``wayland`` backend, and - not for the ``vo`` backend. See ``current-clipboard-backend`` property for - more details. - ``--clipboard-backends=`` Specify a priority list of the clipboard backends to be used. You can also pass ``help`` to get a complete list of compiled in backends. + If the list is not empty, it enables native clipboard support for the + specified backends. This allows reading and writing to the ``clipboard`` + property to get and set clipboard contents. + + Native clipboard support is enabled by default. To disable this, remove + all backends in this list with ``--clipboard-backends-clr``. + Note that the default clipboard backends are subject to change, and must not be relied upon. @@ -7941,3 +7929,16 @@ Miscellaneous protocol, or if the ``wayland`` backend is disabled. This is an object settings list option. See `List Options`_ for details. + +``--clipboard-monitor=`` + (Windows, Wayland and macOS only) + + Enable clipboard monitoring so that the ``clipboard`` property can be + observed for content changes (default: no). This only affects clipboard + implementations which use polling to monitor clipboard updates. + Other platforms currently ignore this option and always/never notify + changes. + + On Wayland, this option only has effect on the ``wayland`` backend, and + not for the ``vo`` backend. See ``current-clipboard-backend`` property for + more details. diff --git a/player/clipboard/clipboard.c b/player/clipboard/clipboard.c index ccf57a8a01e4d..4c894870c3d8c 100644 --- a/player/clipboard/clipboard.c +++ b/player/clipboard/clipboard.c @@ -23,7 +23,6 @@ #include "player/core.h" struct clipboard_opts { - bool enabled; bool monitor; struct m_obj_settings *backends; }; @@ -70,14 +69,12 @@ static const struct m_obj_list backend_obj_list = { #define OPT_BASE_STRUCT struct clipboard_opts const struct m_sub_options clipboard_conf = { .opts = (const struct m_option[]) { - {"enable", OPT_BOOL(enabled), .flags = UPDATE_CLIPBOARD}, {"monitor", OPT_BOOL(monitor), .flags = UPDATE_CLIPBOARD}, {"backends", OPT_SETTINGSLIST(backends, &backend_obj_list), .flags = UPDATE_CLIPBOARD}, {0} }, .defaults = &(const struct clipboard_opts) { - .enabled = true, .backends = (struct m_obj_settings[]) { {.name = "win32", .enabled = true}, {.name = "mac", .enabled = true}, @@ -163,7 +160,7 @@ void reinit_clipboard(struct MPContext *mpctx) mpctx->clipboard = NULL; struct clipboard_opts *opts = mp_get_config_group(NULL, mpctx->global, &clipboard_conf); - if (opts->enabled) { + if (opts->backends && opts->backends[0].name) { struct clipboard_init_params params = { .mpctx = mpctx, .flags = opts->monitor ? CLIPBOARD_INIT_ENABLE_MONITORING : 0,