x11: explicitly query map status when waiting for map event

For some reason, mpv sometimes does not get a MapNotify event with
GtkSocket embedding. This happens maybe 1 out of 10 times. I'm not sure
how this can happen - it certainly shouldn't. Since I was not able to
find the cause, and causes an apparent "deadlock", here's a lazy hack to
fix the misbehavior.
This commit is contained in:
wm4 2015-01-12 12:15:27 +01:00
parent fc95678d8d
commit a8df0bbf22
1 changed files with 6 additions and 0 deletions

View File

@ -1356,6 +1356,12 @@ static void wait_until_mapped(struct vo *vo)
if (!x11->pseudo_mapped)
x11_send_ewmh_msg(x11, "_NET_REQUEST_FRAME_EXTENTS", (long[5]){0});
while (!x11->pseudo_mapped && x11->window) {
XWindowAttributes att;
XGetWindowAttributes(x11->display, x11->window, &att);
if (att.map_state != IsUnmapped) {
x11->pseudo_mapped = true;
break;
}
XEvent unused;
XPeekEvent(x11->display, &unused);
vo_x11_check_events(vo);