summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-01-08 20:23:12 +0100
committerder richter <der.richter@gmx.de>2020-01-09 19:13:42 +0100
commit7bb3f53cf5720cb1ed8c88ff91eb82cde5eb6b95 (patch)
tree08eb3aa373e6b510817675cf6855344f42ecd615
parent57f9de7b53f7cb5a671d04e4204aaa3ad7f8875e (diff)
downloadmpv-7bb3f53cf5720cb1ed8c88ff91eb82cde5eb6b95.tar.bz2
mpv-7bb3f53cf5720cb1ed8c88ff91eb82cde5eb6b95.tar.xz
command, vo: add a mechanism for runtime DPI scale changes
Follow up to commit a58585d5e063. It turned out that the OSX backend needs this.
-rw-r--r--player/command.c5
-rw-r--r--player/command.h1
-rw-r--r--player/playloop.c2
-rw-r--r--video/out/vo.h6
4 files changed, 10 insertions, 4 deletions
diff --git a/player/command.c b/player/command.c
index e7a0ef6a4f..c12ad007d1 100644
--- a/player/command.c
+++ b/player/command.c
@@ -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)
diff --git a/player/command.h b/player/command.h
index e980f1715e..268a7ab0d4 100644
--- a/player/command.h
+++ b/player/command.h
@@ -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,
diff --git a/player/playloop.c b/player/playloop.c
index 86738e4ed0..8a287bfadf 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -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)
diff --git a/video/out/vo.h b/video/out/vo.h
index a05860cbc7..52e78dc502 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -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,
};