[vlc-devel] commit: Qt4: synchronize X display ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Aug 13 18:07:54 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug 13 19:04:04 2009 +0300| [1c201d4807e95194fa6964a6f7954d0042952a6b] | committer: Rémi Denis-Courmont 

Qt4: synchronize X display

This should fix spurious BadWindow errors from the video displays.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1c201d4807e95194fa6964a6f7954d0042952a6b
---

 modules/gui/qt4/components/interface_widgets.cpp |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index cf923d4..4deb3b6 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -45,6 +45,15 @@
 #ifdef Q_WS_X11
 # include <X11/Xlib.h>
 # include <qx11info_x11.h>
+static void videoSync( void )
+{
+    /* Make sure the X server has processed all requests.
+     * This protects other threads using distinct connections from getting
+     * the video widget window in an inconsistent states. */
+    XSync( QX11Info::display(), False );
+}
+#else
+# define videoSync() (void)0
 #endif
 
 #include <math.h>
@@ -133,8 +142,8 @@ WId VideoWidget::request( int *pi_x, int *pi_y,
 
     reparentable->setLayout( innerLayout );
     layout->addWidget( reparentable );
-    updateGeometry();
 
+    videoSync();
 #ifndef NDEBUG
     msg_Dbg( p_intf, "embedded video ready (handle %p)",
              (void *)stable->winId() );
@@ -152,6 +161,7 @@ void VideoWidget::SetSizing( unsigned int w, unsigned int h )
     videoSize.rheight() = h;
     if( !isVisible() ) show();
     updateGeometry(); // Needed for deinterlace
+    videoSync();
 }
 
 void VideoWidget::SetFullScreen( bool b_fs )
@@ -186,6 +196,7 @@ void VideoWidget::SetFullScreen( bool b_fs )
         layout->addWidget( reparentable );
         reparentable->setWindowState( newstate );
     }
+    videoSync();
 }
 
 void VideoWidget::release( void )




More information about the vlc-devel mailing list