summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaniak1349 <maniak1349@gmail.com>2016-05-30 11:09:43 +0300
committerwm4 <wm4@nowhere>2016-05-30 16:58:07 +0200
commit899d3e55b341874cce5145db3511fcaa166dc50b (patch)
tree5bca7104daab432ac864b72d9ad439b7fe237e8d
parent256d9d2b896be69e8a313e485dd4a643f9b2fc53 (diff)
downloadmpv-899d3e55b341874cce5145db3511fcaa166dc50b.tar.bz2
mpv-899d3e55b341874cce5145db3511fcaa166dc50b.tar.xz
w32_common: center window on original window center on video resize
Position the window around the original window center on video size change (when switching to the next file with different resolution, for example) instead of keeping the position of its top-left corner fixed.
-rw-r--r--video/out/w32_common.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index df67dc32b3..ea8ec8772e 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -1145,6 +1145,7 @@ static void gui_thread_reconfig(void *ptr)
vo_apply_window_geometry(vo, &geo);
bool reset_size = w32->o_dwidth != vo->dwidth || w32->o_dheight != vo->dheight;
+ bool pos_init = false;
w32->o_dwidth = vo->dwidth;
w32->o_dheight = vo->dheight;
@@ -1161,6 +1162,7 @@ static void gui_thread_reconfig(void *ptr)
} else {
w32->window_bounds_initialized = true;
reset_size = true;
+ pos_init = true;
w32->window_x = w32->prev_x = geo.win.x0;
w32->window_y = w32->prev_y = geo.win.y0;
}
@@ -1176,6 +1178,12 @@ static void gui_thread_reconfig(void *ptr)
vo->dheight = r.bottom;
}
+ // Recenter window around old position on new video size
+ // excluding the case when initial positon handled by win_state.
+ if (!pos_init) {
+ w32->window_x += w32->dw / 2 - vo->dwidth / 2;
+ w32->window_y += w32->dh / 2 - vo->dheight / 2;
+ }
w32->dw = vo->dwidth;
w32->dh = vo->dheight;