summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-21 13:41:19 +0200
committerwm4 <wm4@nowhere>2014-10-21 13:42:15 +0200
commitbc1893e0369388cbc0b2023cb06a98e4449783d7 (patch)
tree23231bc79ec5258d4e66dfcce4b6633f2851fb9c
parent0fa9e2bff0a40e077bc05dd3be70ce12ddaf6317 (diff)
downloadmpv-bc1893e0369388cbc0b2023cb06a98e4449783d7.tar.bz2
mpv-bc1893e0369388cbc0b2023cb06a98e4449783d7.tar.xz
command: add cursor-autohide property
Allows properly changing/updating the cursor state. Useful for client API window embedding, because the host application may not want the mpv window to grab mouse input, and this has to manually handle the cursor. Changing the cursor of foreign windows is usually not sane. It might make sense to allow changing the cursor icon, but that would be much more complicated, so I won't add it unless someone actually requests it.
-rw-r--r--DOCS/man/input.rst4
-rw-r--r--player/command.c14
2 files changed, 18 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index fdad8e29a2..b0a7ed2a2e 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1339,6 +1339,10 @@ Property list
situations like during ``on_load`` hook processing, when the user can
stop playback, but the script has to explicitly end processing.)
+``cursor-autohide`` (RW)
+ See ``--cursor-autohide``. Setting this to a new value will always update
+ the cursor, and reset the internal timer.
+
``osd-sym-cc``
Inserts the current OSD symbol as opaque OSD control code (cc). This makes
sense only with the ``show_text`` command or options which set OSD messages.
diff --git a/player/command.c b/player/command.c
index f811a8ea06..25e3aa1168 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2566,6 +2566,18 @@ static int mp_property_sub_pos(void *ctx, struct m_property *prop,
return property_osd_helper(mpctx, prop, action, arg);
}
+static int mp_property_cursor_autohide(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ struct MPOpts *opts = mpctx->opts;
+ int old_value = opts->cursor_autohide_delay;
+ int r = mp_property_generic_option(mpctx, prop, action, arg);
+ if (opts->cursor_autohide_delay != old_value)
+ mpctx->mouse_timer = 0;
+ return r;
+}
+
static int prop_stream_ctrl(struct MPContext *mpctx, int ctrl, void *arg)
{
if (!mpctx->demuxer)
@@ -3080,6 +3092,8 @@ static const struct m_property mp_properties[] = {
{"tv-channel", mp_property_tv_channel},
{"dvb-channel", mp_property_dvb_channel},
+ {"cursor-autohide", mp_property_cursor_autohide},
+
#define TRACK_FF(name, type) \
{name, property_switch_track_ff, (void *)(intptr_t)type}
TRACK_FF("ff-vid", STREAM_VIDEO),