[MPlayer-dev-eng] [PATCH] Fix wrong aspect after window minimization (direct3d, gl, gl2)

Georgi Petrov gogothebee at gmail.com
Mon Feb 23 20:45:45 CET 2009


On Mon, Feb 23, 2009 at 9:37 PM, Georgi Petrov <gogothebee at gmail.com> wrote:
> Ok, here it goes. I didn't particularly like this testing, but just to
> be on the safe side:
>
> Changing the code to:
> GetClientRect(vo_window, &r);
> GetWindowRect(vo_window, &r2);
> mp_msg(MSGT_VO, MSGL_V, "GetClientRect: left: %hd, right: %hd, top:
> %hd, bottom: %hd\n", r.left, r.right, r.top, r.bottom);
> mp_msg(MSGT_VO, MSGL_V, "GetWindowRect: left: %hd, right: %hd, top:
> %hd, bottom: %hd\n", r2.left, r2.right, r2.top, r2.bottom);
>
> Yields:
>
> First video, the movie size is: 1280x534
>
> ********** After clicking minimize ***************************
> Aero ON:
> GetClientRect: left: 0, right: 1280, top: 0, bottom: 534
> GetWindowRect: left: -8, right: 1288, top: 213, bottom: 787
>
> Aero OFF:
> GetClientRect: left: 0, right: 1280, top: 0, bottom: 534
> GetWindowRect: left: -4, right: 1284, top: 222, bottom: 783
>
> XP (another computer):
> GetClientRect: left: 0, right: 1280, top: 0, bottom: 534
> GetWindowRect: left: -241, right: 1047, top: 88, bottom: 656
>
> ********** After the window is restored ***************************
> Aero ON:
> GetClientRect: left: 0, right: 0, top: 0, bottom: 0
> GetWindowRect: left: -32000, right: -31840, top: -32000, bottom: -31971
>
> Aero OFF:
> GetClientRect: left: 0, right: 0, top: 0, bottom: 0
> GetWindowRect: left: -32000, right: -31840, top: -32000, bottom: -31976
>
> XP (another computer):
> GetClientRect: left: 0, right: 0, top: 0, bottom: 0
> GetWindowRect: left: -32000, right: -31840, top: -32000, bottom: -31969
>
> ******** After clicking the window border (it fixes the wrong ratio)***
> Aero ON:
> GetClientRect: left: 0, right: 1280, top: 0, bottom: 463
> GetWindowRect: left: -8, right: 1288, top: 213, bottom: 716
>
> Aero OFF:
> GetClientRect: left: 0, right: 1280, top: 0, bottom: 467
> GetWindowRect: left: -4, right: 1284, top: 222, bottom: 716
>
> XP (another computer):
> GetClientRect: left: 0, right: 1280, top: 0, bottom: 534
> GetWindowRect: left: -241, right: 1047, top: 88, bottom: 656
>
>
> Second video, the movie size is: 720x576
>
> ********** After clicking minimize ***************************
> Aero ON:
> GetClientRect: left: 0, right: 1024, top: 0, bottom: 576
> GetWindowRect: left: 120, right: 1160, top: 192, bottom: 808
>
> Aero OFF:
> GetClientRect: left: 0, right: 1024, top: 0, bottom: 576
> GetWindowRect: left: 124, right: 1156, top: 201, bottom: 804
>
> XP (another computer):
> GetClientRect: left: 0, right: 1280, top: 0, bottom: 534
> GetWindowRect: left: -241, right: 1047, top: 88, bottom: 656
>
> ********** After the window is restored ***************************
> Aero ON:
> GetClientRect: left: 0, right: 0, top: 0, bottom: 0
> GetWindowRect: left: -32000, right: -31840, top: -32000, bottom: -31971
>
> Aero OFF:
> GetClientRect: left: 0, right: 0, top: 0, bottom: 0
> GetWindowRect: left: -32000, right: -31840, top: -32000, bottom: -31976
>
> XP (another computer):
> GetClientRect: left: 0, right: 0, top: 0, bottom: 0
> GetWindowRect: left: -32000, right: -31840, top: -32000, bottom: -31969
>
> ******** After clicking the window border (it fixes the wrong ratio)***
> Aero ON:
> GetClientRect: left: 0, right: 1188, top: 0, bottom: 576
> GetWindowRect: left: 120, right: 1324, top: 192, bottom: 808
>
> Aero OFF:
> GetClientRect: left: 0, right: 1182, top: 0, bottom: 576
> GetWindowRect: left: 124, right: 1314, top: 201, bottom: 804
>
>
> XP (another computer):
> GetClientRect: left: 0, right: 1280, top: 0, bottom: 534
> GetWindowRect: left: -241, right: 1047, top: 88, bottom: 656
>

After a little bit research I found that the Win32 API always returns
the position of minimized windows at top:-32000, bottom:-32000. You
can find many articles about it when you googlesearch: GetWindowRect
32000. So I assume that we can either count on GetClientRect returning
"0 0 0 0" or GetWindowRect returning "-32000 x -32000 x". This wasn't
observed when the code was written, so it deals Wrong with minimized
windows.



More information about the MPlayer-dev-eng mailing list