Skip to content

Commit

Permalink
clipboard: remove --clipboard-enable
Browse files Browse the repository at this point in the history
Clipboard can be now disabled with --clipboard-backends-clr so
--clipboard-enable is redundant.
  • Loading branch information
na-na-hi committed Feb 16, 2025
1 parent d18f219 commit cefa5f3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion DOCS/interface-changes/clipboard.txt
Original file line number Diff line number Diff line change
@@ -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
39 changes: 20 additions & 19 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7896,29 +7896,17 @@ Miscellaneous

Conversion is not applied to metadata that is updated at runtime.

``--clipboard-enable=<yes|no>``
(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=<yes|no>``
(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=<backend1,backend2,...[,]>``
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.

Expand All @@ -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=<yes|no>``
(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.
5 changes: 1 addition & 4 deletions player/clipboard/clipboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "player/core.h"

struct clipboard_opts {
bool enabled;
bool monitor;
struct m_obj_settings *backends;
};
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit cefa5f3

Please sign in to comment.