summaryrefslogtreecommitdiffstats
path: root/player/playloop.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-02 20:26:51 +0100
committerwm4 <wm4@nowhere>2014-11-02 20:53:56 +0100
commit4e2574f025b9f143140008cbed48f6ee9705f813 (patch)
tree0d3f18fa705a31cb278819324cb4e54533a704a6 /player/playloop.c
parent61b06f3756596d0e858db25f5293920eff29333c (diff)
downloadmpv-4e2574f025b9f143140008cbed48f6ee9705f813.tar.bz2
mpv-4e2574f025b9f143140008cbed48f6ee9705f813.tar.xz
command: make window-scale property observable
Add a generic mechanism to the VO to relay "extra" events from VO to player. Use it to notify the core of window resizes, which in turn will be used to mark all affected properties ("window-scale" in this case) as changed. (I refrained from hacking this as internal command into input_ctx, or to poll the state change, etc. - but in the end, maybe it would be best to actually pass the client API context directly to the places where events can happen.)
Diffstat (limited to 'player/playloop.c')
-rw-r--r--player/playloop.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/player/playloop.c b/player/playloop.c
index 22cc12f70d..85d962fffe 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -670,6 +670,14 @@ static void handle_cursor_autohide(struct MPContext *mpctx)
mpctx->mouse_cursor_visible = mouse_cursor_visible;
}
+static void handle_vo_events(struct MPContext *mpctx)
+{
+ struct vo *vo = mpctx->video_out;
+ int events = vo ? vo_query_events(vo, VO_EVENTS_USER, true) : 0;
+ if (events & VO_EVENT_RESIZE)
+ mp_notify(mpctx, MP_EVENT_WIN_RESIZE, NULL);
+}
+
void add_frame_pts(struct MPContext *mpctx, double pts)
{
if (pts == MP_NOPTS_VALUE || mpctx->hrseek_framedrop) {
@@ -884,6 +892,7 @@ void run_playloop(struct MPContext *mpctx)
}
handle_cursor_autohide(mpctx);
+ handle_vo_events(mpctx);
handle_heartbeat_cmd(mpctx);
fill_audio_out_buffers(mpctx, endpts);
@@ -995,6 +1004,7 @@ void mp_idle(struct MPContext *mpctx)
mpctx->sleeptime = 100.0;
mp_process_input(mpctx);
handle_cursor_autohide(mpctx);
+ handle_vo_events(mpctx);
update_osd_msg(mpctx);
handle_osd_redraw(mpctx);
}