Calculate border size in aspect keeping code by using AdjustWindowRect

instead of GetClientRect and GetWindowRect since GetClientRect returns
nonsensical values if Window is still minimized.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28713 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2009-02-23 21:40:02 +00:00
parent 30aa2383ca
commit 74efde9480
1 changed files with 6 additions and 5 deletions

View File

@ -109,11 +109,12 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
if (vo_keepaspect && !vo_fs) { if (vo_keepaspect && !vo_fs) {
WINDOWPOS *wpos = lParam; WINDOWPOS *wpos = lParam;
int xborder, yborder; int xborder, yborder;
RECT r2; r.left = r.top = 0;
GetClientRect(vo_window, &r); r.right = wpos->cx;
GetWindowRect(vo_window, &r2); r.bottom = wpos->cy;
xborder = (r2.right - r2.left) - (r.right - r.left); AdjustWindowRect(&r, GetWindowLong(vo_window, GWL_STYLE), 0);
yborder = (r2.bottom - r2.top) - (r.bottom - r.top); xborder = (r.right - r.left) - wpos->cx;
yborder = (r.bottom - r.top) - wpos->cy;
wpos->cx -= xborder; wpos->cy -= yborder; wpos->cx -= xborder; wpos->cy -= yborder;
aspect_fit(&wpos->cx, &wpos->cy, wpos->cx, wpos->cy); aspect_fit(&wpos->cx, &wpos->cy, wpos->cx, wpos->cy);
wpos->cx += xborder; wpos->cy += yborder; wpos->cx += xborder; wpos->cy += yborder;