diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 4498dd34dd..4fb9e40c1e 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -967,6 +967,8 @@ int vo_x11_check_events(struct vo *vo) break; } case MapNotify: + x11->window_hidden = false; + vo_x11_update_geometry(vo); x11->vo_hint.win_gravity = x11->old_gravity; XSetWMNormalHints(display, x11->window, &x11->vo_hint); x11->fs_flip = 0; @@ -1275,13 +1277,18 @@ static void vo_x11_create_window(struct vo *vo, XVisualInfo *vis, int x, int y, vo_x11_set_wm_icon(x11); vo_x11_update_window_title(vo); vo_x11_dnd_init_window(vo); + + // The real size is only known when the window is mapped, which + // unfortunately happens asynchronous to VO initialization. At least + // vdpau needs a _some_ window size, though. + x11->win_width = w; + x11->win_height = h; } static void vo_x11_map_window(struct vo *vo, int x, int y, int w, int h) { struct vo_x11_state *x11 = vo->x11; - x11->window_hidden = false; vo_x11_move_resize(vo, true, true, x, y, w, h); if (!vo->opts->border) vo_x11_decoration(vo, 0); @@ -1490,6 +1497,8 @@ static void vo_x11_update_geometry(struct vo *vo) int dummy_int; Window dummy_win; Window win = vo->opts->WinID > 0 ? vo->opts->WinID : x11->window; + if (x11->window_hidden) + return; XGetGeometry(x11->display, win, &dummy_win, &dummy_int, &dummy_int, &w, &h, &dummy_int, &dummy_uint); if (w <= INT_MAX && h <= INT_MAX) {