From 3d7d1f3f264e55857c83b8a94aa24081ae45dd4d Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 9 Nov 2014 10:00:21 +0100 Subject: video/out: minor simplification to event query function The "clear" parameter is confusing and useless. --- player/playloop.c | 2 +- video/out/vo.c | 9 ++++----- video/out/vo.h | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/player/playloop.c b/player/playloop.c index 9e1cef957d..b525fd9d0c 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -673,7 +673,7 @@ static void handle_cursor_autohide(struct MPContext *mpctx) 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; + int events = vo ? vo_query_and_reset_events(vo, VO_EVENTS_USER) : 0; if (events & VO_EVENT_RESIZE) mp_notify(mpctx, MP_EVENT_WIN_RESIZE, NULL); if (events & VO_EVENT_WIN_STATE) diff --git a/video/out/vo.c b/video/out/vo.c index f697002f92..7e2bcfb83e 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -840,7 +840,7 @@ int64_t vo_get_vsync_interval(struct vo *vo) } // Set specific event flags, and wakeup the playback core if needed. -// vo_query_events() can retrieve the events again. +// vo_query_and_reset_events() can retrieve the events again. void vo_event(struct vo *vo, int event) { struct vo_internal *in = vo->in; @@ -852,14 +852,13 @@ void vo_event(struct vo *vo, int event) } // Check event flags set with vo_event(). Return the mask of events that was -// set and included in the events parameter. If clear==true, clear these events. -int vo_query_events(struct vo *vo, int events, bool clear) +// set and included in the events parameter. Clear the returned events. +int vo_query_and_reset_events(struct vo *vo, int events) { struct vo_internal *in = vo->in; pthread_mutex_lock(&in->lock); int r = in->queued_events & events; - if (clear) - in->queued_events &= ~(unsigned)r; + in->queued_events &= ~(unsigned)r; pthread_mutex_unlock(&in->lock); return r; } diff --git a/video/out/vo.h b/video/out/vo.h index 60e887444c..a083437397 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -316,7 +316,7 @@ void vo_set_paused(struct vo *vo, bool paused); int64_t vo_get_drop_count(struct vo *vo); int vo_query_format(struct vo *vo, int format); void vo_event(struct vo *vo, int event); -int vo_query_events(struct vo *vo, int events, bool clear); +int vo_query_and_reset_events(struct vo *vo, int events); void vo_set_flip_queue_offset(struct vo *vo, int64_t us); int64_t vo_get_vsync_interval(struct vo *vo); -- cgit v1.2.3