summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-02-26 18:19:16 -0500
committersfan5 <sfan5@live.de>2024-03-01 18:25:12 +0100
commit9d03b83a6c26341b2dd7c5e1ffc4592219c79730 (patch)
tree5e3d152d4b99d9aed926eaedc694db904e336287
parent4560d93bf0f2494f4f1344ac1840801911be7319 (diff)
downloadmpv-9d03b83a6c26341b2dd7c5e1ffc4592219c79730.tar.bz2
mpv-9d03b83a6c26341b2dd7c5e1ffc4592219c79730.tar.xz
command: add begin-vo-dragging command
This command initializes a vo dragging request for VOs that implement the new VOCTRL_BEGIN_DRAGGING voctrl. This allows scripts to begin vo dragging for any button press event.
-rw-r--r--DOCS/interface-changes.rst1
-rw-r--r--DOCS/man/input.rst7
-rw-r--r--player/command.c12
-rw-r--r--video/out/vo.h3
4 files changed, 23 insertions, 0 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index 61a60d516a..2abf99ed93 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -27,6 +27,7 @@ Interface changes
::
--- mpv 0.38.0 ---
+ - add `begin-vo-dragging` command
- add `--volume-gain`, `--volume-gain-min`, and `--volume-gain-max` options
- add `current-gpu-context` property
- add `--secondary-sub-ass-override` option
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 84f64cf5c7..f3e222d8c1 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1478,6 +1478,13 @@ Input Commands that are Possibly Subject to Change
This command has an even more uncertain future than ``ab-loop-dump-cache``
and might disappear without replacement if the author decides it's useless.
+``begin-vo-dragging``
+ Begin window dragging if supported by the current VO. This command should
+ only be called while a mouse button is being pressed, otherwise it will
+ be ignored. The exact effect of this command depends on the VO implementation
+ of window dragging. For example, on Windows only the left mouse button can
+ begin window dragging, while X11 and Wayland allow other mouse buttons.
+
Undocumented commands: ``ao-reload`` (experimental/internal).
List of events
diff --git a/player/command.c b/player/command.c
index 2690fd4a27..e1de32be25 100644
--- a/player/command.c
+++ b/player/command.c
@@ -6502,6 +6502,16 @@ static void cmd_dump_cache_ab(void *p)
cmd->args[0].v.s);
}
+static void cmd_begin_vo_dragging(void *p)
+{
+ struct mp_cmd_ctx *cmd = p;
+ struct MPContext *mpctx = cmd->mpctx;
+ struct vo *vo = mpctx->video_out;
+
+ if (vo)
+ vo_control(vo, VOCTRL_BEGIN_DRAGGING, NULL);
+}
+
/* This array defines all known commands.
* The first field the command name used in libmpv and input.conf.
* The second field is the handler function (see mp_cmd_def.handler and
@@ -6970,6 +6980,8 @@ const struct mp_cmd_def mp_cmds[] = {
{ "ab-loop-align-cache", cmd_align_cache_ab },
+ { "begin-vo-dragging", cmd_begin_vo_dragging },
+
{0}
};
diff --git a/video/out/vo.h b/video/out/vo.h
index 2ed971c146..3879d024e7 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -122,6 +122,9 @@ enum mp_voctrl {
/* private to vo_gpu and vo_gpu_next */
VOCTRL_EXTERNAL_RESIZE,
+
+ // Begin VO dragging.
+ VOCTRL_BEGIN_DRAGGING,
};
// Helper to expose what kind of content is currently playing to the VO.