From 949247d6e63d3742fef7211bd3a43fa9b1f1d490 Mon Sep 17 00:00:00 2001 From: maniak1349 Date: Tue, 26 Apr 2016 04:47:14 +0300 Subject: w32_common: respect --fit-border on size check Fit whole window or just a client area in accord with value of --fit-border option. Fixes #2935. --- video/out/w32_common.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'video/out/w32_common.c') diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 0398b08fda..042e81b7fe 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -1067,15 +1067,31 @@ static void reinit_window_state(struct vo_w32_state *w32) RECT cr = r; add_window_borders(w32->window, &r); + // Check on client area size instead of window size on --fit-border=no + long o_w; + long o_h; + if( w32->opts->fit_border ) { + o_w = r.right - r.left; + o_h = r.bottom - r.top; + } else { + o_w = cr.right - cr.left; + o_h = cr.bottom - cr.top; + } - if (!w32->current_fs && - ((r.right - r.left) > screen_w || (r.bottom - r.top) > screen_h)) + if ( !w32->current_fs && ( o_w > screen_w || o_h > screen_h ) ) { MP_VERBOSE(w32, "requested window size larger than the screen\n"); // Use the aspect of the client area, not the full window size. // Basically, try to compute the maximum window size. - long n_w = screen_w - (r.right - cr.right) - (cr.left - r.left); - long n_h = screen_h - (r.bottom - cr.bottom) - (cr.top - r.top); + long n_w; + long n_h; + if( w32->opts->fit_border ) { + n_w = screen_w - (r.right - cr.right) - (cr.left - r.left); + n_h = screen_h - (r.bottom - cr.bottom) - (cr.top - r.top); + } else { + n_w = screen_w; + n_h = screen_h; + } // Letterbox double asp = (cr.right - cr.left) / (double)(cr.bottom - cr.top); double s_asp = n_w / (double)n_h; -- cgit v1.2.3