summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authormaniak1349 <maniak1349@gmail.com>2016-05-05 08:56:21 +0300
committerwm4 <wm4@nowhere>2016-05-08 17:05:20 +0200
commit7d9eab15f00e38a5b4c25d084a904e3a8439807b (patch)
tree17779d34af02d8f726d3c040a3e9d63989094b26 /player
parent2f8b4dd4808d796cff955354caf804df00e53ebb (diff)
downloadmpv-7d9eab15f00e38a5b4c25d084a904e3a8439807b.tar.bz2
mpv-7d9eab15f00e38a5b4c25d084a904e3a8439807b.tar.xz
win32: make taskbar progress indication optional
Add --taskbar-progress command line option and property which controls taskbar progress indication rendering in Windows 7+. This option is on by default and can be toggled during playback. This option does not affect the creation process of ITaskbarList3. When the option is turned off the progress bar is just hidden with TBPF_NOPROGRESS. Closes #2535
Diffstat (limited to 'player')
-rw-r--r--player/command.c19
-rw-r--r--player/misc.c16
2 files changed, 31 insertions, 4 deletions
diff --git a/player/command.c b/player/command.c
index 66d3b6fc42..8ff2914c66 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2409,6 +2409,23 @@ static int mp_property_fullscreen(void *ctx, struct m_property *prop,
return r;
}
+/// Show playback progress in Windows 7+ taskbar (RW)
+static int mp_property_taskbar_progress(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ if (action == M_PROPERTY_SET) {
+ int desired = !!*(int *) arg;
+ if (mpctx->opts->vo.taskbar_progress == desired)
+ return M_PROPERTY_OK;
+ mpctx->opts->vo.taskbar_progress = desired;
+ if (mpctx->video_out)
+ update_vo_playback_state( mpctx );
+ return M_PROPERTY_OK;
+ }
+ return mp_property_generic_option(mpctx, prop, action, arg);
+}
+
/// Window always on top (RW)
static int mp_property_ontop(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -3703,6 +3720,7 @@ static const struct m_property mp_properties[] = {
{"fullscreen", mp_property_fullscreen},
{"deinterlace", mp_property_deinterlace},
{"field-dominance", mp_property_generic_option},
+ {"taskbar-progress", mp_property_taskbar_progress},
{"ontop", mp_property_ontop},
{"border", mp_property_border},
{"on-all-workspaces", mp_property_all_workspaces},
@@ -4036,6 +4054,7 @@ static const struct property_osd_display {
{ "balance", "Balance", .osd_progbar = OSD_BALANCE },
// video
{ "panscan", "Panscan", .osd_progbar = OSD_PANSCAN },
+ { "taskbar-progress", "Progress in taskbar" },
{ "ontop", "Stay on top" },
{ "border", "Border" },
{ "framedrop", "Framedrop" },
diff --git a/player/misc.c b/player/misc.c
index f14f5a43e3..941c493cf2 100644
--- a/player/misc.c
+++ b/player/misc.c
@@ -116,16 +116,24 @@ void update_vo_playback_state(struct MPContext *mpctx)
if (mpctx->video_out) {
struct voctrl_playback_state oldstate = mpctx->vo_playback_state;
struct voctrl_playback_state newstate = {
+ .taskbar_progress = mpctx->opts->vo.taskbar_progress,
.playing = mpctx->playing,
.paused = mpctx->paused,
.percent_pos = get_percent_pos(mpctx),
};
- if (oldstate.playing != newstate.playing ||
+ if (oldstate.taskbar_progress != newstate.taskbar_progress ||
+ oldstate.playing != newstate.playing ||
oldstate.paused != newstate.paused ||
- oldstate.percent_pos != newstate.percent_pos) {
- vo_control(mpctx->video_out,
- VOCTRL_UPDATE_PLAYBACK_STATE, &newstate);
+ oldstate.percent_pos != newstate.percent_pos)
+ {
+ // Don't update progress bar if it was and still is hidden
+ if ((oldstate.playing && oldstate.taskbar_progress) ||
+ (newstate.playing && newstate.taskbar_progress))
+ {
+ vo_control(mpctx->video_out,
+ VOCTRL_UPDATE_PLAYBACK_STATE, &newstate);
+ }
mpctx->vo_playback_state = newstate;
}
} else {