From 954f6ac7bfd68ddfff7d89fe0ec6319710fa5940 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Sat, 17 Apr 2021 15:57:14 +0300 Subject: win32: fit_window_on_screen: centralize logic (no-op) fit_on_screen is called only from reinit_window_state. Move the yes/no logic unmodified from fit_on_screen to reinit_window_state, and remove the w32->parent condition because it's already checked earlier at reinit_window_state. --- video/out/w32_common.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 5a52006307..1a84e0de55 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -824,9 +824,6 @@ static bool fit_rect_size(RECT *rc, long n_w, long n_h) // Also, if the top edge is above the working area, move down to align. static void fit_window_on_screen(struct vo_w32_state *w32) { - if (w32->parent || w32->current_fs || IsMaximized(w32->window)) - return; - RECT screen = get_working_area(w32); if (w32->opts->border) subtract_window_borders(w32, w32->window, &screen); @@ -986,7 +983,9 @@ static void reinit_window_state(struct vo_w32_state *w32) // Assume that the window has already been fit on screen before switching fs if (!toggle_fs || w32->fit_on_screen) { - fit_window_on_screen(w32); + if (!w32->current_fs && !IsMaximized(w32->window)) + fit_window_on_screen(w32); + // The fullscreen state might still be active, so set the flag // to fit on screen next time the window leaves the fullscreen. w32->fit_on_screen = w32->current_fs; -- cgit v1.2.3