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,
}
}
}
+
+ 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;
}
// 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
}
}
-int BC_WindowBase::get_single_text_width(int font, const wchar_t *text, int length)
-{
-#ifdef HAVE_XFT
- if(get_resources()->use_xft && get_xft_struct(font)) {
- XGlyphInfo extents;
-
- XftTextExtents32(top_level->display, get_xft_struct(font),
- (const FcChar32*)text, length, &extents);
- return extents.xOff;
- }
-#endif
- if(!get_font_struct(font)) return 0;
- XChar2b xtext[length], *xp = xtext;
- for( int i=0; i<length; ++i,++xp ) {
- xp->byte1 = (unsigned char) (text[i] >> 8);
- xp->byte2 = (unsigned char) (text[i] & 0xff);
- }
- return XTextWidth16(get_font_struct(font), xtext, length);
-}
-
int BC_WindowBase::get_text_width(int font, const char *text, int length)
{
int i, j, w = 0, line_w = 0;