rework bcresources static vframe initializers, add CIN_XSYNCH
[goodguy/history.git] / cinelerra-5.1 / guicast / bcwindowbase.C
index 8654bbe7238bb6ed66d66e201c3e3a10bb05d238..fae98cb186b9315572190fa6abd940e3d2f84a0b 100644 (file)
@@ -181,9 +181,10 @@ BC_WindowBase::~BC_WindowBase()
                for( int i=sizeof(xfont)/sizeof(xfont[0]); --i>=0; )
                        XFreeFont(display, this->*xfont[i]);
 
-// bug in X causes XRenderExtensionInfo to be damaged if this is done here
-//  left to be done in XCloseDisplay by Xlib.
-#if defined(HAVE_XFT) && 0
+// past bug in X caused XRenderExtensionInfo to be damaged
+// if this is done here. left to be done in XCloseDisplay by Xlib.
+// works in more modern systems, and needed for leak testing.
+#if defined(HAVE_XFT) && defined(VALGRIND)
                static void *BC_WindowBase::*xft_font[] = {
                         &BC_WindowBase::smallfont_xft,
                         &BC_WindowBase::mediumfont_xft,
@@ -683,6 +684,15 @@ Display* BC_WindowBase::init_display(const char *display_name)
                        }
                }
        }
+
+       static int xsynch = -1;
+       if( xsynch < 0 ) {
+               const char *cp = getenv("CIN_XSYNCH");
+               xsynch = !cp ? 0 : atoi(cp);
+       }
+       if( xsynch > 0 )
+               XSynchronize(display, True);
+
        return display;
 }
 
@@ -962,12 +972,15 @@ locking_message = event->xclient.message_type;
 //   event_names[event->type] : "Unknown");
 //}
 
-       if( active_grab && active_grab->grab_event(event) ) {
+       if( active_grab ) {
                unlock_window();
-               return 0;
+               active_grab->lock_window("BC_WindowBase::dispatch_event 3");
+               result = active_grab->grab_event(event);
+               active_grab->unlock_window();
+               if( result ) return result;
+               lock_window("BC_WindowBase::dispatch_event 4");
        }
 
-
        switch(event->type) {
        case ClientMessage:
 // Clear the resize buffer