From 22ed3f82719ebc2bca7a8b60c97b9ce7ae14e6a8 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Sat, 28 Jan 2023 10:18:46 +0800 Subject: [PATCH] fix window-scale implementation --- source/player.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/player.cpp b/source/player.cpp index 800150f..412b8e4 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -231,9 +231,9 @@ void Player::initMpv() { mpv->observeProperty("window-scale", MPV_FORMAT_DOUBLE, [this](void* data) { double scale = static_cast(*(double*)data); - int w, h; - glfwGetWindowSize(window, &w, &h); - glfwSetWindowSize(window, (int)(w * scale), (int)(h * scale)); + int w = (int)mpv->property("dwidth"); + int h = (int)mpv->property("dheight"); + if (w > 0 && h > 0) glfwSetWindowSize(window, (int)(w * scale), (int)(h * scale)); }); mpv->observeProperty("fullscreen", MPV_FORMAT_FLAG, [this](void* data) {