summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-03-03 13:57:56 -0500
committerDudemanguy <random342@airmail.cc>2024-03-17 14:59:26 +0000
commit4370dc0cb6c4ec29e4ba0055458c2e2fc8d5da82 (patch)
treef2efd09f3d0125d471b02b8c2d0c9b97dc6b2939
parentf236e249a49d893b21a800a0f93618d3d1e13d6c (diff)
downloadmpv-4370dc0cb6c4ec29e4ba0055458c2e2fc8d5da82.tar.bz2
mpv-4370dc0cb6c4ec29e4ba0055458c2e2fc8d5da82.tar.xz
win32: support runtime geometry update
Similar to other platforms. Also make sure that the x/y positions are set on geometry update.
-rw-r--r--video/out/w32_common.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index eb9f18948a..35351cfeaa 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -1739,9 +1739,8 @@ static void run_message_loop(struct vo_w32_state *w32)
mp_dispatch_queue_process(w32->dispatch, 1000);
}
-static void gui_thread_reconfig(void *ptr)
+static void window_reconfig(struct vo_w32_state *w32, bool force)
{
- struct vo_w32_state *w32 = ptr;
struct vo *vo = w32->vo;
RECT r = get_working_area(w32);
@@ -1764,14 +1763,14 @@ static void gui_thread_reconfig(void *ptr)
vo_calc_window_geometry3(vo, &screen, &mon, w32->dpi_scale, &geo);
vo_apply_window_geometry(vo, &geo);
- bool reset_size = (w32->o_dwidth != vo->dwidth ||
+ bool reset_size = ((w32->o_dwidth != vo->dwidth ||
w32->o_dheight != vo->dheight) &&
- w32->opts->auto_window_resize;
+ w32->opts->auto_window_resize) || force;
w32->o_dwidth = vo->dwidth;
w32->o_dheight = vo->dheight;
- if (!w32->parent && !w32->window_bounds_initialized) {
+ if (!w32->parent && (!w32->window_bounds_initialized || force)) {
SetRect(&w32->windowrc, geo.win.x0, geo.win.y0,
geo.win.x0 + vo->dwidth, geo.win.y0 + vo->dheight);
w32->prev_windowrc = w32->windowrc;
@@ -1802,6 +1801,11 @@ finish:
reinit_window_state(w32);
}
+static void gui_thread_reconfig(void *ptr)
+{
+ window_reconfig(ptr, false);
+}
+
// Resize the window. On the first call, it's also made visible.
void vo_w32_config(struct vo *vo)
{
@@ -2077,6 +2081,10 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg)
update_maximized_state(w32);
} else if (changed_option == &vo_opts->window_corners) {
update_corners_pref(w32);
+ } else if (changed_option == &vo_opts->geometry || changed_option == &vo_opts->autofit ||
+ changed_option == &vo_opts->autofit_smaller || changed_option == &vo_opts->autofit_larger)
+ {
+ window_reconfig(w32, true);
}
}