command, vo: add a mechanism for runtime DPI scale changes

Follow up to commit a58585d5e0. It turned out that the OSX backend
needs this.
This commit is contained in:
wm4 2020-01-08 20:23:12 +01:00 committed by der richter
parent 57f9de7b53
commit 7bb3f53cf5
4 changed files with 10 additions and 4 deletions

View File

@ -3524,7 +3524,8 @@ static const char *const *const mp_event_property_change[] = {
"demuxer-cache-state"),
E(MP_EVENT_WIN_RESIZE, "current-window-scale", "osd-width", "osd-height",
"osd-par", "osd-dimensions"),
E(MP_EVENT_WIN_STATE, "display-names", "display-fps", "display-hidpi-scale"),
E(MP_EVENT_WIN_STATE, "display-names", "display-fps"),
E(MP_EVENT_WIN_STATE2, "display-hidpi-scale"),
E(MP_EVENT_CHANGE_PLAYLIST, "playlist", "playlist-pos", "playlist-pos-1",
"playlist-count", "playlist/count"),
E(MP_EVENT_CORE_IDLE, "core-idle", "eof-reached"),
@ -6054,6 +6055,8 @@ static void command_event(struct MPContext *mpctx, int event, void *arg)
// Update chapters - does nothing if something else is visible.
set_osd_bar_chapters(mpctx, OSD_BAR_SEEK);
}
if (event == MP_EVENT_WIN_STATE2)
ctx->cached_window_scale = 0;
}
void handle_command_updates(struct MPContext *mpctx)

View File

@ -97,6 +97,7 @@ enum {
MP_EVENT_CACHE_UPDATE,
MP_EVENT_WIN_RESIZE,
MP_EVENT_WIN_STATE,
MP_EVENT_WIN_STATE2,
MP_EVENT_CHANGE_PLAYLIST,
MP_EVENT_CORE_IDLE,
MP_EVENT_DURATION_UPDATE,

View File

@ -847,6 +847,8 @@ static void handle_vo_events(struct MPContext *mpctx)
mp_notify(mpctx, MP_EVENT_WIN_RESIZE, NULL);
if (events & VO_EVENT_WIN_STATE)
mp_notify(mpctx, MP_EVENT_WIN_STATE, NULL);
if (events & VO_EVENT_DPI)
mp_notify(mpctx, MP_EVENT_WIN_STATE2, NULL);
}
static void handle_sstep(struct MPContext *mpctx)

View File

@ -43,14 +43,14 @@ enum {
VO_EVENT_AMBIENT_LIGHTING_CHANGED = 1 << 4,
// Special mechanism for making resizing with Cocoa react faster
VO_EVENT_LIVE_RESIZING = 1 << 5,
// Legacy. Use m_config_cache_write_opt() instead to update the fullscreen
// option.
// For VOCTRL_GET_HIDPI_SCALE changes.
VO_EVENT_DPI = 1 << 6,
// Special thing for encode mode (vo_driver.initially_blocked).
// Part of VO_EVENTS_USER to make vo_is_ready_for_frame() work properly.
VO_EVENT_INITIAL_UNBLOCK = 1 << 7,
// Set of events the player core may be interested in.
VO_EVENTS_USER = VO_EVENT_RESIZE | VO_EVENT_WIN_STATE |
VO_EVENTS_USER = VO_EVENT_RESIZE | VO_EVENT_WIN_STATE | VO_EVENT_DPI |
VO_EVENT_INITIAL_UNBLOCK,
};