Skip to content

Commit

Permalink
w32_common: update stored client area size on window resize
Browse files Browse the repository at this point in the history
Properly update stored client area size when the window is resized in
reinit_window_state due to window size exceeding the size of the screen.

This was causing wrong behavior with window-scale - when window size was
becoming too big the window was resized but the video was not.
  • Loading branch information
maniak1349 authored and wm4 committed May 22, 2016
1 parent 0352972 commit 981048e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions video/out/w32_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,15 +1100,25 @@ static void reinit_window_state(struct vo_w32_state *w32)
} else {
n_w = n_h * asp;
}
// Save new size
w32->dw = n_w;
w32->dh = n_h;
// Add window borders to the new window size
r = (RECT){.right = n_w, .bottom = n_h};
add_window_borders(w32->window, &r);
// Get top and left border size for client area position calculation
long b_top = -r.top;
long b_left = -r.left;
// Center the final window
n_w = r.right - r.left;
n_h = r.bottom - r.top;
r.left = w32->screenrc.x0 + screen_w / 2 - n_w / 2;
r.top = w32->screenrc.y0 + screen_h / 2 - n_h / 2;
r.right = r.left + n_w;
r.bottom = r.top + n_h;
// Save new client area position
w32->window_x = r.left + b_left;
w32->window_y = r.top + b_top;
}

MP_VERBOSE(w32, "reset window bounds: %d:%d:%d:%d\n",
Expand Down

0 comments on commit 981048e

Please sign in to comment.