+
+void DrawToolTipText( tooltip_t *tooltip )
+{
+ int direction, fontAscent, fontDescent;
+
+ Display *disp = tooltip->display;
+ Window win = tooltip->window;
+ Font font = tooltip->font;
+ GC gc = tooltip->gc;
+ string text = tooltip->text;
+ int curX = tooltip->curX;
+ int curY = tooltip->curY;
+
+ XLOCK;
+ XClearWindow( disp, win );
+ XCharStruct overall;
+ XQueryTextExtents( disp, font, text.c_str(), text.size(), &direction,
+ &fontAscent, &fontDescent, &overall );
+ int w = overall.rbearing - overall.lbearing;
+ int h = overall.ascent + overall.descent;
+ XMoveWindow( disp, win, curX - w/4, curY + 20 );
+ XResizeWindow( disp, win, w+8, h+8 );
+ XDrawString( disp, win, gc, 4, overall.ascent+4, text.c_str(),
+ text.size() );
+ XSync( disp, 0 );
+ XUNLOCK;
+}
+
+