summaryrefslogtreecommitdiffstats
path: root/video/out/x11_common.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-12 12:15:27 +0100
committerwm4 <wm4@nowhere>2015-01-12 12:15:27 +0100
commita8df0bbf22ab05eb5ebd92f6dbb30abd7428120e (patch)
treea8025d96e6d63aa90b34b69bb17e9fb4a2231922 /video/out/x11_common.c
parentfc95678d8d9bbd325c715c1660db918f35c164d2 (diff)
downloadmpv-a8df0bbf22ab05eb5ebd92f6dbb30abd7428120e.tar.bz2
mpv-a8df0bbf22ab05eb5ebd92f6dbb30abd7428120e.tar.xz
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.
Diffstat (limited to 'video/out/x11_common.c')
-rw-r--r--video/out/x11_common.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index af603b2ac8..f5a3f9e808 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -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);