diff options
author | wm4 <wm4@nowhere> | 2014-10-21 13:41:19 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-21 13:42:15 +0200 |
commit | bc1893e0369388cbc0b2023cb06a98e4449783d7 (patch) | |
tree | 23231bc79ec5258d4e66dfcce4b6633f2851fb9c /player/command.c | |
parent | 0fa9e2bff0a40e077bc05dd3be70ce12ddaf6317 (diff) | |
download | mpv-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.
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 14 |
1 files changed, 14 insertions, 0 deletions
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), |