diff options
Diffstat (limited to 'player')
-rw-r--r-- | player/client.c | 2 | ||||
-rw-r--r-- | player/command.c | 1 | ||||
-rw-r--r-- | player/command.h | 10 | ||||
-rw-r--r-- | player/playloop.c | 10 |
4 files changed, 19 insertions, 4 deletions
diff --git a/player/client.c b/player/client.c index 8e2bc4d1b7..6a8204615f 100644 --- a/player/client.c +++ b/player/client.c @@ -620,7 +620,7 @@ int mpv_request_event(mpv_handle *ctx, mpv_event_id event, int enable) { if (!mpv_event_name(event) || enable < 0 || enable > 1) return MPV_ERROR_INVALID_PARAMETER; - assert(event < INTERNAL_EVENT_BASE); // excluded above; they have no name + assert(event < (int)INTERNAL_EVENT_BASE); // excluded above; they have no name pthread_mutex_lock(&ctx->lock); uint64_t bit = 1ULL << event; ctx->event_mask = enable ? ctx->event_mask | bit : ctx->event_mask & ~bit; diff --git a/player/command.c b/player/command.c index aa44196925..391cc5b30a 100644 --- a/player/command.c +++ b/player/command.c @@ -3201,6 +3201,7 @@ static const char *const *const mp_event_property_change[] = { E(MPV_EVENT_CHAPTER_CHANGE, "chapter", "chapter-metadata"), E(MP_EVENT_CACHE_UPDATE, "cache", "cache-free", "cache-used", "cache-idle", "demuxer-cache-duration", "demuxer-cache-idle"), + E(MP_EVENT_WIN_RESIZE, "window-scale"), }; #undef E diff --git a/player/command.h b/player/command.h index 0307bd06b7..3469e32948 100644 --- a/player/command.h +++ b/player/command.h @@ -39,9 +39,13 @@ void mp_notify_property(struct MPContext *mpctx, const char *property); int mp_get_property_id(const char *name); uint64_t mp_get_property_event_mask(const char *name); -// Must start with the first unused positive value in enum mpv_event_id -#define INTERNAL_EVENT_BASE 24 -#define MP_EVENT_CACHE_UPDATE (INTERNAL_EVENT_BASE + 0) +enum { + // Must start with the first unused positive value in enum mpv_event_id + // MPV_EVENT_* and MP_EVENT_* must not overlap. + INTERNAL_EVENT_BASE = 24, + MP_EVENT_CACHE_UPDATE, + MP_EVENT_WIN_RESIZE, +}; bool mp_hook_test_completion(struct MPContext *mpctx, char *type); void mp_hook_run(struct MPContext *mpctx, char *client, char *type); 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); } |