[MPlayer-dev-eng] [PATCH] libvo/x11_common: resize window before mapping it.

wm4 nfxjfg at googlemail.com
Wed Feb 13 17:32:52 CET 2013

On Wed,  6 Feb 2013 17:17:00 +0100
Nicolas George <nicolas.george at normalesup.org> wrote:

> If the window is resized before being mapped, then the
> original size is visible for a fraction of a second.
> It happens with the temporary 320×200 window used by vo_gl
> to determine the display capabilities and causes bad window
> placement decisions from window-managers.

I think it's because it tries to read the window position
and size with XGetGeometry right after mapping, and then sets
window hints with XSetWMNormalHints() with PPosition using these

In addition to breaking VOFLAG_HIDDEN, this also causes a race
condition in the normal use case. Even with -vo vdpau (which
does not use VOFLAG_HIDDEN), sometimes the window is centered instead
of placed according to the window manager's rules. I tried with Fluxbox
and IceWM. Actually I'm not so sure if I can reproduce the problem with
MPlayer (I usually use/test various forks), but at least under Fluxbox
it is almost always centered, but sometimes correctly placed. Maybe
this misbehavior is generally a bit hard to spot, because the window is
centered when the bug happens - and centering the window is
actually perceived as better behavior than the WM's random placement.

Further, with VOFLAG_HIDDEN the window should be resized to the actual
video size before mapping (just an additional XMoveResizeWindow call).

I guess this problem is easily solvable, but reasoning with all the
corner cases and weird things (which are possibly workarounds for
broken window managers or X deficiencies) make it a bit harder.

More information about the MPlayer-dev-eng mailing list