From 8de7ba6dfd87b1c62b0d057f1ed547360aff3eb1 Mon Sep 17 00:00:00 2001 From: rr- Date: Thu, 23 Mar 2017 22:17:59 +0100 Subject: [PATCH] vo_x11: reduce flickering on playlist navigation The delay between call to .resize, which cleared the buffer, and actually rendering the first video frame, was significant, resulting in short flicker on navigation and resizing. This was especially visible when zooming and navigating between images. Now the clearing is scheduled to happen just before the rendering, which looks to be good enough even without double buffering. --- video/out/vo_x11.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c index 9540fd96b6..db967577a3 100644 --- a/video/out/vo_x11.c +++ b/video/out/vo_x11.c @@ -77,6 +77,7 @@ struct priv { XVisualInfo vinfo; int current_buf; + bool reset_view; #if HAVE_SHM && HAVE_XEXT int Shmem_Flag; @@ -268,8 +269,7 @@ static bool resize(struct vo *vo) if (mp_sws_reinit(p->sws) < 0) return false; - XFillRectangle(x11->display, x11->window, p->gc, 0, 0, vo->dwidth, vo->dheight); - + p->reset_view = true; vo->want_redraw = true; return true; } @@ -280,6 +280,11 @@ static void Display_Image(struct priv *p, XImage *myximage) XImage *x_image = p->myximage[p->current_buf]; + if (p->reset_view) { + XFillRectangle(vo->x11->display, vo->x11->window, p->gc, 0, 0, vo->dwidth, vo->dheight); + p->reset_view = false; + } + #if HAVE_SHM && HAVE_XEXT if (p->Shmem_Flag) { XShmPutImage(vo->x11->display, vo->x11->window, p->gc, x_image,