From 899d3e55b341874cce5145db3511fcaa166dc50b Mon Sep 17 00:00:00 2001 From: maniak1349 Date: Mon, 30 May 2016 11:09:43 +0300 Subject: 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. --- video/out/w32_common.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- cgit v1.2.3